Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fixed width text for compound variable names #1305

Merged
merged 7 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/latexify_recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,14 @@ function _toexpr(O)
end
if issym(O)
sym = string(nameof(O))
return Symbol(replace(sym, NAMESPACE_SEPARATOR => "."))
sym = replace(sym, NAMESPACE_SEPARATOR => ".")
if length(sym) > 1
sym = Latexify.unicode2latex(sym)
sym = replace(sym, "_"=>"\\_")
return LaTeXString(string("\\texttt", "{", sym, "}"))
else
return Symbol(sym)
end
end
!iscall(O) && return O

Expand Down
2 changes: 1 addition & 1 deletion test/latexify_refs/integral1.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
\begin{equation}
\int_{0}^{1)} dx x
\int_{0}^{1)} \texttt{dx} x
\end{equation}
2 changes: 1 addition & 1 deletion test/latexify_refs/integral2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
\begin{equation}
\int_{-\infty}^{\infty)} dx \left( u\left( x \right) \right)^{2}
\int_{-\infty}^{\infty)} \texttt{dx} \left( u\left( x \right) \right)^{2}
\end{equation}
2 changes: 1 addition & 1 deletion test/latexify_refs/integral3.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
\begin{equation}
\int_{ - z}^{u\left( x \right))} dx x^{2}
\int_{ - z}^{u\left( x \right))} \texttt{dx} x^{2}
\end{equation}
Loading