diff --git a/src/latexify_recipes.jl b/src/latexify_recipes.jl index 65b881411..0e895e0be 100644 --- a/src/latexify_recipes.jl +++ b/src/latexify_recipes.jl @@ -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 diff --git a/test/latexify_refs/integral1.txt b/test/latexify_refs/integral1.txt index 3f8fa1ea0..d03e515c2 100644 --- a/test/latexify_refs/integral1.txt +++ b/test/latexify_refs/integral1.txt @@ -1,3 +1,3 @@ \begin{equation} -\int_{0}^{1)} dx x +\int_{0}^{1)} \texttt{dx} x \end{equation} diff --git a/test/latexify_refs/integral2.txt b/test/latexify_refs/integral2.txt index 427aeff95..3e8ba3144 100644 --- a/test/latexify_refs/integral2.txt +++ b/test/latexify_refs/integral2.txt @@ -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} diff --git a/test/latexify_refs/integral3.txt b/test/latexify_refs/integral3.txt index ee9d552c6..2857cd437 100644 --- a/test/latexify_refs/integral3.txt +++ b/test/latexify_refs/integral3.txt @@ -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}