jgm/texmath

`array` options, `\vlines` and `\hlines` and some bugs

Opened this issue · 2 comments

While

\begin{array}{lcr}
1 & 2 & 3 \\
4 & 5 & 6 \\
\end{array}

is parsed correctly,

\begin{array}{l cr}
1 & 2 & 3 \\\hline
   & 5 & 6 \\
\end{array}

is not. I tried all of them separately.

Note three types of issues

  • Array options should at least be normalized removing spaces. It crashes if it finds some space between lcr letters.
  • \hline is not ignored when the first item in the next row is empty and crashes as well.
  • \hlines seems to be ignored by default

Besides that, I want to do a simple Ruffini table for my students. I think these features could be added. I mean vlines, hlines, etc.

UPDATE: Could vertical and horizontal lines be added with rowlines and columnlines attributes?

<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
  <mrow>
    <mtable rowlines="none solid" columnlines="solid none">
      <mtr>
        <mtd columnalign="center" style="text-align: center" />
        <mtd columnalign="center" style="text-align: center">
          <mn>1</mn>
        </mtd>
        <mtd columnalign="center" style="text-align: center">
          <mn>2</mn>
        </mtd>
      </mtr>
      <mtr>
        <mtd columnalign="center" style="text-align: center">
          <mn>1</mn>
        </mtd>
        <mtd columnalign="center" style="text-align: center" />
        <mtd columnalign="center" style="text-align: center">
          <mn>1</mn>
        </mtd>
      </mtr>
      <mtr >
        <mtd columnalign="center" style="text-align: center" />
        <mtd columnalign="center" style="text-align: center">
          <mn>1</mn>
        </mtd>
        <mtd columnalign="center" style="text-align: center">
          <menclose notation="box">
            <mn>3</mn>
          </menclose>
        </mtd>
      </mtr>
    </mtable>
  </mrow>
</math>

this would render well in Firefox

jgm commented

See #127 for a PR that was never finished that would support columnlines.

jgm commented

I fixed the two bugs, thanks. The other issue is more complicated and would require changes in the basic types (so that lines in arrays can be represented) and changes to writers and readers for all formats.