Fixes #135.
When using "special" commands (like \newcommand), it's possible to define only one part of an environment (like a singular \begin{equation}), which caused errors when parsing. This commit implements a "special" mode, which is entered every time a "special" command is encountered (for now, \newcommand, \renewcommand, and \providecommand), which disables the matching of \begin{...} with an associated \end{...} until the command considered is fully processed, after which it goes back to normal (non-math) mode. Note that this has the disadvantage that any whole environment defined inside of the special command will not be parsed as an environment, but rather as a series of TeX commands (I think it should be possible to reconstruct a complete env by parsing the content of the \newcommand, but I haven't tried it).
Fixes #135. When using "special" commands (like
\newcommand
), it's possible to define only one part of an environment (like a singular\begin{equation}
), which caused errors when parsing. This commit implements a "special" mode, which is entered every time a "special" command is encountered (for now,\newcommand
,\renewcommand
, and\providecommand
), which disables the matching of\begin{...}
with an associated\end{...}
until the command considered is fully processed, after which it goes back to normal (non-math) mode. Note that this has the disadvantage that any whole environment defined inside of the special command will not be parsed as an environment, but rather as a series of TeX commands (I think it should be possible to reconstruct a complete env by parsing the content of the\newcommand
, but I haven't tried it).