Cadabra
a field-theory motivated approach to computer algebra

LaTeXForm

Changes the way in which expressions are displayed.
Changes the way in which expressions are displayed in the graphical interface. Example:
\del{#}::LaTeXForm("\partial"). ex:=\del_{m}(A);
\(\displaystyle{}\partial_{m}\left(A\right)\)
\del_{m}(A)
This prints $\partial_{m}(A);$ in the notebook, despite the fact that \del is not a LaTeX{} command. If you use this property to make a symbol printable, make sure to declare it before any other properties are declared, otherwise the notebook will not know how to display the symbol and produce an error message. Note that the property is attached to a pattern (\del{#} in this case) which matches the expression in which the replacement has to be made. If the pattern matches, the replacement will be done on the head symbol (\del in this case). A pattern \del without the argument wildcard # would only replace when \del occurs without any arguments (as in e.g. \del + A).
If you want more control over the way in which elements of your original expression are printed, you can use patterns like in the example below:
\ket{A??}{q??}::LaTeXForm("|", A??, "\rangle_{", q??, "}").
ex:=\ket{n+1}{a};
\(\displaystyle{}|n+1\rangle_{a}\)
\ket(n + 1 , a)
The comma-separated list of arguments to LaTeXForm will be concatenated into a single LaTeX output string, with patterns replaced by their normal output form.
Copyright © 2001-2024 Kasper Peeters
Questions? info@cadabra.science