jgm / texmath

A Haskell library for converting LaTeX math to MathML.
GNU General Public License v2.0
312 stars 65 forks source link

Handle < and > in array column specifiers #166

Open catap opened 3 years ago

catap commented 3 years ago

I just discovered the next issue when array's is used instead of case.

The test case:

\documentclass{scrartcl}

\usepackage{amsmath}
\usepackage{array}

\begin{document}

\setlength{\arraycolsep}{1pt}
\begin{equation}
  x =
  \left\{ \begin{array}{>{\arraybackslash$} p{3cm} <{$} l}
            y - 1, & \mbox{if } 1 \\
            y,       & \mbox{if } 2 \\
          \end{array} \right.
\end{equation}

\end{document}

Error:

[WARNING] Could not convert TeX math 'x =
    \left\{ \begin{array}{>{\arraybackslash$} p{3cm} <{$} l}
              y - 1, & \mbox{if } 1 \\
              y,       & \mbox{if } 2 \\
            \end{array} \right.', rendering as TeX:
  ft\{ \begin{array}{>{\arraybackslash$} p
                     ^
  unexpected ">"
  expecting white space, letter, "|" or "}"
jgm commented 3 years ago

What is the meaning of the column specifiers {>{\arraybackslash$} and <{$}? That's the part the parser doesn't seem to understand.

catap commented 3 years ago

>{XXX} and <{YYY} are used to put XXX in the entry of column and YYY right after entry of the column.

In my case it puts

catap commented 3 years ago

@jgm any news with this? :)