# Converting tensorial expressions in xAcT to LaTeX

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

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

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.

<< xActxTensor
<< xActTexAct

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.

• Thanks a lot Jose. I was not aware of the existence of TexAct and it is useful for all my purposes. Dec 10, 2020 at 10:37