Closed retsyo closed 2 years ago
\begin{vmatrix} 1 & 2& 3 \\ 4 & 5& 6\\ \end{vmatrix}
is bad too
\begin{Bmatrix} 1 & 2\\ 3 & 4\\ 5 & 5\\ \end{Bmatrix}
\begin{Vmatrix} 1 & 2 & 3\\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{Vmatrix}
\left\{\begin{matrix} 1 & 2\\ 4 & 5\\ 6 & 7\\ \end{matrix}\right.
\left.\begin{matrix} 1 & 2\\ 3 & 4\\ 5 & 6\\ \end{matrix}\right|
all have short symbol
and \begin{cases} x & \text{ if } x=1 \\ x+1 & \text{ if } x=2 \\ x+2 & \text{ if } x=3 \end{cases}
It looks like all the rendering issue here like short brackets and spaces on accents are a problem with MS Word because all the outputs are working properly with Mathjax which is always my source of truth. I always try to compare the one generated by latex2mathml.
@retsyo can you also verify? I am both using Mathjax and Katex as reference for correct output. MS Word probably does not support these.
then could you please give some suggestion on writing kinds of matrix in DOCX?
since I and some other users(like stated on https://github.com/python-openxml/python-docx/issues/320) use latex2mathml to write equation in DOCX.
@retsyo
Would it be an option to add SVG or PNG to docx files instead of raw MathML? There is a library that uses latex2mathml
output and convert them to SVG/PNG called ziamath.
I would also try to take a look and find more options.
EDIT: Reference - https://ziamath.readthedocs.io/en/latest/usage.html#drawing-equations
Thanks, to insert a pic is valid for DOCX, this is what I did if there is only few equation before. Then I found the metioned https://github.com/python-openxml/python-docx/issues/320 which try to convert latex equation string and insert as Ms Word equation
I tested https://ziamath.readthedocs.io/en/latest/, and found that
https://ziamath.readthedocs.io/en/latest/ does not support some features missing in latex2mathml too, for example, \xleftarrow[abc]{hello}
, \overbrace{1+2+\cdots+n}^{there are n} \qquad \underbrace{a+b+\cdots+z}_{26}
, \left.\begin{matrix} 1 & 2\\ 3 & 4\\ 5 & 6\\ \end{matrix}\right|
on my windows 10 64 bits, I can't make cairosvg runs on python 3.8, but it runs on python 3.6; however, https://ziamath.readthedocs.io/en/latest/ runs on python 3.8, but does not runs on python 3.6. So I use 2 versions of python to convert latex string to equation image
btw, to use a real equation could be still a better solution which has been requested many times on https://github.com/python-openxml/python-docx
@retsyo
Then I found the metioned https://github.com/python-openxml/python-docx/issues/320 which try to convert latex equation string and insert as Ms Word equation
Did you try the stylesheet used in the link? That will probably solve some of the rendering issues that you encountered.
Did you try the stylesheet used in the link?
It looks like you did in https://github.com/roniemartinez/latex2mathml/issues/287#issuecomment-1085438838. I am not really sure of other solution other than using ziamath.
As for cairosvg, they have Python 3.6+
stated on their README. Maybe you can open a ticket in their project repo: https://github.com/Kozea/CairoSVG
Closing this issue. Please read my comment in https://github.com/roniemartinez/latex2mathml/issues/287#issuecomment-1093470723
but it should be