TransWikia.com

Converting tensorial expressions in xAcT to LaTeX

Mathematica Asked by Janstillerion on May 5, 2021

I’m trying to convert tensorial expressions from xAct to LaTeX format using the TeXForm command. This seems to work fine when using covariant derivatives (As in Copy xAct expression to LaTeX). However, this seems to change when employing curvature invariants such as $R_{a}^{ b}{}_c^{ d}R^{a}_{ b}{}^c_{ d}$. In this case, evaluating $$texttt{TeXForm@StandardForm@RiemannCD[-a, b, -c, d] RiemannCD[a, -c, b, -d]}$$
yields

enter image description here

Do you know how to avoid the array command and produce a similar output as in the previous link?

One Answer

xAct contains a full package dedicated to converting tensor expressions into LaTeX, called TexAct, and I'd recommend using that instead of the general TeXForm.

For example, in your case:

<< xAct`xTensor`
<< xAct`TexAct`

DefManifold[M, 4, {a, b, c, d}]
DefMetric[-1, g[-a, -b], CD]

expr = RiemannCD[-a, -b, -c, d] RiemannCD[a, c, b, -d];

In[]:= TexPrint[%]
Out[]= "R[nabla]_{abc}{}^{d} R[nabla]^{acb}{}_{d}"

If you want to change the name of the Riemann tensors use

PrintAs[RiemannCD] ^= "R";

In[]:= TexPrint[expr]
Out[]= "R_{abc}{}^{d} R^{acb}{}_{d}"

If your expressions are very large then look at the documentation of TexBreak on how to break the single-line TeX output into several lines. Note also the commands TexPort to send the result to a file and TexView to visualize the output.

Correct answer by jose on May 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP