Page MenuHomePhabricator

Can't parse array elements
Closed, ResolvedPublic


It seems Mathoid (texvcinfo) can't parse the array element. Reported for (which has other alignment problems as well)

math-Stöchiometrische_Matrix.png (500×772 px, 64 KB)

Event Timeline

mobrovac added a subscriber: Physikerwelt. uses bmatrix which works. Also, array works in PNG mode, so it's definitely a regression caused by T131177: Enable MathML by default

Its the option [h] parameter in


remove that and things work fine


From T131177#2344157 it is likely connected to the optional [h] parameter, not \array itself.

The root cause for this problem is in texvc

vagrant/srv/texvcjs/bin (master)
$ ./texvcjs '\begin{array}[h]{crcl}
R_1 := & \text{A} & \rightarrow & \text{B},\\
R_2 := & 4 \text{C} + 2 \text{B} & \rightarrow & 5 \text{C} + \text{B},\\
R_3 := & \text{C} & \rightarrow & \text{D},\\
R_4 := & \text{D} & \rightarrow & \text{A},
(node) util.print is deprecated. Use console.log instead.

Is there documentation of the optional parameter of the array envirnoment in standard TeX/LaTeX?
That would be really helpful.

I can only find documentation on the tcb but not h. Thus I have no clue what the expected behaviour is?

I don't use that much TeX/LaTeX, but you could try testing it in PNG mode which I believe we know to work and see what it does in different situations. I don't know if you can look at the code, but you could try that too although that would be more difficult you would get a definite answer. There must be something about it somewhere though as why would people use it if they have never heard of it or did not know what it did. It is possible it was written in a non-English language which might make searching more difficult.

Is there documentation of the optional parameter of the array envirnoment in standard TeX/LaTeX?

There is no such option. TeX ignores it

Pardon my hurry earlier. The value h will simply ignored in TeX (and in MathJax).

If there is no option and it is ignored then why is it causing problems now but not with PNG only mode? What happens if one that page with the problems you remove it?

There is a slight difference in the list of whitelisted commands.
The new rendering mode allows for tcb only.
The old png seems to allow h as well

Would it be possible to remove all usages of h?

I will put out an RFC on en-Wikipedia, but it is not possible to add some rule that translates the "h"'s to "tcb" before parsing them? It might be less elegant, but it could work.

I did a scan of my 2014 dump of the english wikipedia and found no instances of the [h] parameter, but there was one instance of \begin{array}[l] in
which I've fixed.

I think the option derives from the tabular environment in
page 31 we have

pos Specifies the vertical position; default is alignment on the centre of the environment.
  t align on top row 
  b align on bottom row

@Hungryce, I think it would be good to get rid of all the invalid alternatives. Allowing h would not be a problem, but it would take about two weeks until the change gets online.

+1 for removing [h]. Creating per-case work-arounds and ignore lists is not feasible in the long run, IMHO.

The way these appear in standard latex is shown below

latex array.png (440×329 px, 37 KB)

Source latex is

Standard  $\begin{array}{rl} a & b \\ c & d  \\ e & f \end{array}$ bar.

Center aligned [c]  $foo \begin{array}[c]{rl} a & b \\ c & d \\ e & f \end{array}$ bar.

Top aligned [t]  $foo \begin{array}[t]{rl} a & b \\ c & d \\ e & f \end{array}$ bar.

bottom aligned [b]  $foo \begin{array}[b]{rl} a & b \\ c & d \\ e & f \end{array}$ bar.

Mysterious [h]  $foo \begin{array}[h]{rl} a & b \\ c & d \\ e & f \end{array}$ bar.

Mysterious [l]  $foo \begin{array}[l]{rl} a & b \\ c & d \\ e & f \end{array}$ bar.

On wikipedia they all appear as the no option version. Client-side mathjax has same behavior as latex.

@SalixAlba how did you test the ClientSide mathjax rendering?

Just a standard webpage with normal mathjax

  <script type="text/javascript"
   <script type="text/javascript">
	  jax: ["input/TeX","output/HTML-CSS"],
	  extensions: ["tex2jax.js"],
	  "HTML-CSS": {    scale: 100  },
	  tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
  <p>  Top aligned [t]  $foo \begin{array}[t]{rl} a & b \\ c & d \\ e & f \end{array}$ bar.
  </body >

@Physikerwelt I have made an RFC at (I did this because I can't make a bot/AWB script myself) to get rid of [h]'s. I am not sure there are any on en-wiki, but I wish to make sure.

Physikerwelt claimed this task.

the example
\begin{array}[t]{rl} a & b \\ c & d \\ e & f \end{array}