waterstrider123 · 2022-04-16 14:46
I have a org roam note that presents matrix multiplication and it looks fine in org mode as shown below.
https://preview.redd.it/nqazc9rjlwt81.png?width=310&format=png&auto=webp&s=8a559a18802177d7fa7ca96f8532fd3f8186cefd
However, when I run org-roam-ui, the browser does not show the matrix multiplication in the correct format. It just gives me the latex syntax as shown below. It works fine when I am just presenting equations, but it does not seem to work properly for matrix multiplications.
https://preview.redd.it/jdsvwvjukwt81.png?width=636&format=png&auto=webp&s=c2d0d03ed61e5abce7f83f778fc20dc77593b14c
When I hover over the red text, I get the following info and I am wondering why this works on org mode but not with org-roam-ui.
https://preview.redd.it/gre7e6uzlwt81.png?width=634&format=png&auto=webp&s=a94a90a90e517b344a7bd9a500b24664f8cd963c
lebensterben · 2022-04-16 14:55
you should report this to org-roam
Tommerd · 2022-04-17 08:03
Hey! Org-roam-ui guy here.
The reason this happens is because KaTeX, the web-based latex processing thingy, only parses a subset of all latex commands.
\begin{document} is for entire latex documents, while KaTeX only does math. Similar environments such as mini page etc also don't work.
I think simply removing the document env should work here! You already have the \[ \] delineators so you really don't need it, unless it's a standalone latex documents you're trying to render, in which case: don't do that lol.
If you really want environments you can use \begin{equation}
waterstrider123 · 2022-04-20 22:26
I replaced \\begin{document} with \\begin{equation}, but I still get the same issue even though it renders properly in the org file and not in the ui:
\begin{equation}
\[
h_{\theta}(x) =
\left[
\begin{array}{ccccc}
\theta_{0} & \theta_{1} & \theta_{2} & \hdots & \theta_{n}\\
\end{array}
\right]
\begin{bmatrix}
x_{1} \\
x_{2} \\
\vdots \\
x_{m}
\end{bmatrix}
= \theta^{T}x
\]
\end{equation}
Tommerd · 2022-04-21 08:31
No you need to either have \begin{equation}...\end{equation} or \[...\], not both.
waterstrider123 · 2022-04-21 23:16
Thanks, it works now.
Tommerd · 2022-04-22 08:09
Great! :D