Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1508 +/- ##
========================================
Coverage 86.47% 86.48%
========================================
Files 340 340
Lines 86125 86162 +37
Branches 3206 3210 +4
========================================
+ Hits 74476 74513 +37
Misses 11649 11649 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The current fix does indeed solve the issue, but it seems to be very generous, as it allows any combination of well-braced expressions in the preamble, including empty ones, arbitrarily nested ones etc. After some experimentation, here are the rules I believe LaTeX follows:
Having said that, I am not sure if it makes sense to expend time on implementing these rules, since we do not know
|
|
OK, I looked into the details of the code for the actual LaTeX array package, and it looks like the preamble is tokenized into either single characters or braced groups, and then those are processed as column specifiers (where some can take the following token as a parameter, as in I have pushed a commit that better matches this behavior, though not the strange messages (it will always be "Illegal param-token"). I also remove one set of braces from the entire expression, if there is such a pair. I think this matches LaTeX pretty well, and if there are other edge cases, we can deal with them later. |
|
While looking through the documentation for I also forgot to mention that in the previous commit I added support for newlines in the preamble, and I added a test for that. |
|
Here's one example I found that works in LaTeX, but not in MathJax: \left(\begin{array}{{r}c{l}}a&bb& ccc\\ ddd& e & ff\end{array}\right) |
|
Right, thanks. The removal of outer braces was too simplistic. I had convinced myself that that would work, but of course I should have known better. I've made a new commit to fix the issue, and add a new test for your example. |
This PR adds rules to the array preamble column parser to ignore braces within the preamble (when they aren't used to enclose an argument to one of the column specifications). This isn't exactly in line with LaTeX, which does seem to process the braces in some way, but I can't figure out what it is, and don't see any documentation for it. It looks like it might be to allow multi-character column specifiers, but then it also seem to allow multiple copies of a single column specifier, but not mixed ones. So I'm not sure what it actually does. In any case, ignoring them seems to handle the situation given in the original issue tracker.
I also added test for this situation.
Resolves issue mathjax/MathJax#3565.