TexSoup
TexSoup copied to clipboard
Problem with \right) and }
I found out that if I have file.tex with this content:
\begin{equation}
\frac{\left(a+b\right)}{a}
\end{equation}
\begin{itemize}
\item Lalala.
\end{itemize}
and I run
import TexSoup
with open('file.tex', 'r') as ifile:
latex_soup = TexSoup.TexSoup(ifile.read())
print(latex_soup)
I get AssertionError: Command \item invalid in math mode.. I have noted that if I change \frac{\left(a+b\right)}{a} to \frac{\left(a+b\right) }{a} this works as expected. I suppose this is not the expected behavior so I am reporting this issue here.
I just encountered a related error. If I run
TexSoup(r'What is \[\left(2\right)\]')
I get
EOFError: [Line: 0, Offset: 21] "displaymath" env expecting \].
Inserting a space after \right leads to correct behaviour:
TexSoup(r'What is \[\left(2\right) \]')
I expect this is related to #115, see @equaeghe's comment.
I get simular problem, but what is intersting:
$f_I(z)=V_0 \left\{1-\beta + \beta\frac{z^2}{z_0^2}\right\} $parsing correctly, while$f_I(z)=V_0 \left\{1-\beta + \beta\frac{z^2}{z_0^2}\right\}$is not. So, as long as the problem not fixed, maybe you'll try to get a space after the \right) command?
I think this issue was actually fixed in https://github.com/alvinwan/TexSoup/commit/71d4c0624141bce6686f45c755465278d0ead0e3 (committed on Oct 19, 2020).
A new release on PyPI would be useful :slightly_smiling_face: