![]() | 1 | initial version |
Well...
sage: latex(GF(3).multiplication_table())
{\setlength{\arraycolsep}{2ex}
\begin{array}{r|*{3}{r}}
\multicolumn{1}{c|}{\ast}&a&b&c\\\hline
{}a&a&a&a\\
{}b&a&b&c\\
{}c&a&c&b\\
\end{array}}
In a console (or in emacs
's sage-shell-view
), view(GF(3).addition_table())
gets me this:
Sage's view
uses Mathjax by default, but reverts to LATEX when the latex string contains some "trigger" commands (this can be customized via latex.add_to_mathjax_avoid_list
).
But, indeed, in a Jupyter notebook, this fails (not only on \multicolumn
but also on {\setlength{\arraycolsep}{2ex}
), probably because the notebook can't use LATEX\, and mathjax isn't a complete implementation if it).
By the way, the mathjax
implementation of the present server has the same problem: A cut'n'paste of the LATEX string generating the (correct) representation of the multiplication table gives this:
\setlength\arraycolsep2ex\multicolumn1c|∗abchlineaaaa babc cacb
This can probably worked around by saving the latex text, compiling it with an external LaTeX installation, converting the output to, say, .png
and displaying it in the notebook. An utility function might be written for that.
One more reason to use LATEX an Sagetex (or pythontex (or org-mode))...
HTH,