Closed briochemc closed 2 years ago
Hi @briochemc!
Yes, sorry about that. This new behavior is a breaking change of v2. We needed to escape all LaTeX characters otherwise the output can break depending on what the user is inputing. To circumvent this, we created the type LatexCell
. If you wrap a value using this structure, PrettyTables will not escape the output. However, you must ensure that it is a valid LaTeX sequence that can be used inside a table cell.
julia> c1 = LatexCell.([latexify("α"), latexify("β")]);
julia> c2 = [0.0, 1.0];
julia> pretty_table([c1 c2], backend = Val(:latex))
\begin{tabular}{rr}
\hline
\textbf{Col. 1} & \textbf{Col. 2} \\\hline
$\alpha$ & 0.0 \\
$\beta$ & 1.0 \\\hline
\end{tabular}
Oh I see, great! What about adding this as an example in the docs about LaTeX?
Yes! Documentation is something we need to improve in this package. Can you submit a PR please?
MWE:
where I have turned the
"α"
and"β"
intoLaTeXString
s so under the hood their backslashes are automatically escaped.However this interferes with
pretty_table
, which replaces those escaped backslashes with\textbackslash{}
, see output below:Not sure what the fix is. Maybe this is just a matter of specializing something on
LaTeXString
s for which"\\"
should be left untouched?