Closed ea42gh closed 4 years ago
Could you elaborate?
I could write a function taking a string of valid tex:
write it to a file,
run latex a suitable number of times,
convert the result to an SVG
read and display the SVG file.
I don't know how best to incorporate such a facility. With itikz in jupyter, I can write
%%itikz --temp-dir --implicit-standalone --tex-packages=nicematrix,tikz --nexec=4
\NiceMatrixOptions{code-for-last-row = \color{red}, code-for-first-row = \color{red}}
$\begin{pNiceArray}{cccc|c}[left-margin = 4pt, first-col, last-row,
code-before =
{
\tikz \draw[red] (row-1-|col-1) -- (row-2-|col-1) -- (row-2-|col-3) -- (row-3-|col-3) -- (row-3-|col-6);
}
]
& \color{red}{1} & 2 & 1 & 1 & \; 5 \\
& 0 & 0 & \color{red}{2} & 1 & \; -1 \\
& 0 & 0 & 0 & 0 & 0 \\
\color{blue}{\begin{matrix} \text{basic variables} \\ \text{free variables} \end{matrix}} & \begin{matrix}\ x_1 \\ \\ \end{matrix} & \begin{matrix}\\ \ x_2=\alpha \\ \end{matrix} & \begin{matrix}\ x_3\\ \\ \end{matrix} & \begin{matrix} \\ \ x_4=\beta \\ \end{matrix} & \\
\end{pNiceArray}$
and get a display of a matrix with some annotations (using a latex package and tikz), i.e., I am not limited by the capabilities of markdown
It might be nice to support a latex to SVG capability, something along the lines https://github.com/jbn/itikz for jupyter
If there is support for tikzcd also (not just tikz) this would be amazing to embed directly commutative diagrams in SVG format instead of doing it externally with LaTeX and after putting the SVG in the notebook using some link.
This sounds like something that an external package should do, right?
Julia macros can support the syntax that you are looking for, run latex, etc, and Pluto can display SVGs.
You could ask in the Julia slack about packages that wrap TeX.
I succeeded doing this using PyCall and a modified version of itikz Look at my cloned itikz repository at GitHub and the two test_* jupyter notebooks.
added a commutative diagram example from tikzcd :) note there is a function that returns the SVG text, rather than the SVG image. I imagine it could be used to incorporate the output in a more elaborate layout
Cool! Can we close this then?
If you choose too, sure. I think Lluto.jl might profit from having such a capability built in from the outset.
Now while I am wishing for the stars, if I could also get the pyviz tool stack going! :)
It might be nice to support a latex to SVG capability, something along the lines https://github.com/jbn/itikz for jupyter