arnog / mathlive

A web component for easy math input
https://cortexjs.io/mathlive
MIT License
1.54k stars 271 forks source link

& in array env generates new row, not new column #67

Closed NSoiffer closed 6 years ago

NSoiffer commented 6 years ago

Description

In an array environment, & should mark a new column and \\ a new row. \\ does the right thing, but & creates a new row also, not a new column.

Steps to Reproduce

In mathlive.io, paste \begin{array}{r}-13 & +13 \end{array}. The display is image

It should be image

arnog commented 6 years ago

This is actually the correct behavior. At least it matches what TeX does. Try it with http://quicklatex.com/

The reason it behaves this way is that with the array environment, if you have specified that it should have a single column with {r}, any extra columns will be wrapped on the following line. If you want more than one column, specify it using {rr} for example.

NSoiffer commented 6 years ago

FYI: I checked a TeX expert. He said the input is an error and any behavior from rejection to what I thought should happen to what you implemented is okay. LaTeX auto corrects after issuing an error. This allows it to keep on going to report more errors. It's correction converts & to \, so what you did agrees with the implementation, but it is not something one should count on. In other cases, he said the auto correct does things that are not useful, but in this case, it is reasonable.