-
Notifications
You must be signed in to change notification settings - Fork 154
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
Symbolic arrays with underscore names have broken latex representation #1288
Comments
A similiar problem happens when displaying an element of a part of a symbolic array: using Symbolics
julia> @variables z[1:3]
1-element Vector{Symbolics.Arr{Num, 1}}:
z[1:3]
julia> using Latexify
julia> latexify(z[1:2][1])
L"\begin{equation}
z_{\left[
\begin{array}{c}
1 \\
2 \\
\end{array}
\right]}_{1}
\end{equation}
" Here is the latex-error for the above output: http://www.texrendr.com/?eqn=%5Cbegin%7Bequation%7D%0Az_%7B%5Cleft%5B%0A%5Cbegin%7Barray%7D%7Bc%7D%0A1%20%5C%5C%0A2%20%5C%5C%0A%5Cend%7Barray%7D%0A%5Cright%5D%7D_%7B1%7D%0A%5Cend%7Bequation%7D When there are two subscripts one needs to clarify by curly braces which is the subscript of which. |
Thanks for the reports. I don't know if I'll get to this soon, but just dropping it that our recipes just tell Latexify to use subscript https://github.com/JuliaSymbolics/Symbolics.jl/blob/master/src/latexify_recipes.jl#L88 so my guess is that this can be MWE'd to be a Latexify recipe issue with repeated subscripts. I haven't gotten as far as building an example though, but that would be the next step to get an error onto Latexify which should be the root cause. |
Thanks for the hint! I constructed a MWE and created an issue with Latexify.jl. |
PR #1303 didn't fix my use case, but with korsbo/Latexify.jl#316 it now compiles and looks ok: julia> latexify(z[1:2][1])
L"\begin{equation}
\left( z_{\left[
\begin{array}{c}
1 \\
2 \\
\end{array}
\right]} \right)_{1}
\end{equation}
" Renders as |
Okay, that's a reasonable representation. |
On Symbolics 6.13, a variable array with an underscore, like
@variables A_out[1:10]
has broken HTML when accessing its elements,A_out[1]
Presumably the whole subscript ought to be enclosed in
{}
The text was updated successfully, but these errors were encountered: