mathjax / MathJax-node

MathJax for Node
Apache License 2.0
616 stars 97 forks source link

Mathjax- node:Latex Error converting latex to SVG with "\ \ [" #467

Closed lyxabymxlc closed 3 years ago

lyxabymxlc commented 3 years ago

Issue Summary

Latex: $$[1,2,3] \\ [4,5,6]$$ When the node service is called to convert SVG, The output error is as follows: TeX parse error: Bracket argument to \\ must be a dimension Through comparison, it is found that when the latex contains "\ \ [", it will lead to errors. I need your help. Thank you!

Technical details:

pkra commented 3 years ago

This is the expected result for $$[1,2,3] \\ [4,5,6]$$ and matches "real" TeX.

dpvc commented 3 years ago

Just to clarify, in LaTeX, \\ can be followed by an optional dimension that indicates extra space to add for that line break. E.g., \\[3px] would add three additional pixels of space for that line break. Since optional arguments are allowed to be preceded by spaces \\ [3px] would do the same. Your \\ [4,5,6] looks like an optional argument, and so the 4,5,6 is expected to be a dimension, but since it isn't, you get the error message. As Peter points out, this is correct behavior.

You could use something like $$[1,2,3] \\ {[4,5,6]}$$ or $$[1,2,3] \\{} [4,5,6]$$ to avoid the issue.

lyxabymxlc commented 3 years ago

@dpvc I see. I tried it just now. It really works. I'm going to modify latex. Thank you very much