NanoMichael / MicroTeX

A dynamic, cross-platform, and embeddable LaTeX rendering library
MIT License
399 stars 66 forks source link

Infinite recursion when defining a new columntype that uses the new columntype internaly #167

Open sp1ritCS opened 9 months ago

sp1ritCS commented 9 months ago

Because \newcolumntype just stores the second argument as string in a map and parses it when needed again and again, you can use the newly defined coumntype inside of itself, creating infinite recursion. Example:

\begin{array}{s}
\newcolumntype{s}{>\begin{array}{s}}

a hacky workarround would be to just parse the second argument in the newcolumntype macro using Formula(tp, args[2]);, but a better method might be storing the now parsed formula in the map instead of the args[2] and reusing this wherever necessary.