Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote

Hi experts.

In a Jupyter notebook with Cadabra2 kernel:

Is there any way to display "hand made" Latex, such as

s = Latex(
    '\\begin{array}{l} \n'
    ' 0 &  0 &  0 \\   \n'
    ' 0 &  0 &  1 \\   \n'
    ' 0 & -1 &  0      \n'
    '\\end{array}      \n'
)._repr_latex_()

Trying to display the above with

s;

prints it out as a string not as a properly formated array.

I am working in

  • Jupyter notebook
  • Cadabra2 kernel
  • ipynb file
  • Cadabra 2.4.5
  • Ubuntu 22.04

Thank you

GPN

in General questions by (2.0k points)

1 Answer

+2 votes
 
Best answer

Timely question ;-) I have just pushed a change to github which allows you to do

s = LaTeXString(
    r'\begin{array}{lll}'
    r' 0 &  0 &  0 \\'
    r' 0 &  0 &  1 \\'
    r' 0 & -1 &  0'
    r'\end{array}'
)
s;

which will then show (in cadabra2-gtk and the jupyter frontend) the typeset result.

In other words, this is like a normal string, but with information that the content can be processed as LaTeX.

by (82.6k points)
selected by

Oh wow. Thanks! Very cool.

Any chance this release's binary for Ubuntu 22.04 will be available on the download page?

Thank you

GPN

The packages are slowly being generated; the one for Ubuntu 22.04 has just appeared.

Thank you! I've now tested and it works nicely :-)

...