Fixes data-latex content for Table Rows#1528
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1528 +/- ##
==========================================
Coverage 86.47% 86.47%
==========================================
Files 340 340
Lines 86178 86224 +46
Branches 4856 3218 -1638
==========================================
+ Hits 74520 74566 +46
Misses 11658 11658 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dpvc
left a comment
There was a problem hiding this comment.
This is a big improvement, but there still seem to be some issues. Those are probably actually problems with the attributes of the child nodes in many cases. Perhaps they can be improved? (I haven't looked into the problem, but it may be due to modifying the parser.string value for substitutions.)
| "<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\begin{numcases}{f(x)=} 1 & if $x > 0$ \\\\ 0 & otherwise \\end{numcases}" display="block"> | ||
| <mtable columnalign="right left left left" columnspacing="0em 1em" rowspacing=".2em" data-break-align="top top top" data-latex="\\begin{numcases}{f(x)=} 1 & if $x > 0$ \\\\ 0 & otherwise \\end{numcases}"> | ||
| <mlabeledtr data-latex="{f(x)=}"> | ||
| <mlabeledtr data-latex="1&&"> |
There was a problem hiding this comment.
The result here is a bit strange. The second column is blank (probably because numcases is handling the text-mode material internally), but the second & is wrong. Is this due to the mlabeledtr having an extra child for the tag?
The same is true for all the other tests as well.
| <mtable columnalign="right left left left" columnspacing="0em 1em" rowspacing=".2em" data-break-align="top top top" data-latex="\\begin{numcases}{f(x)=} 1 & if $x > 0$ \\\\ 0 & otherwise \\end{numcases}"> | ||
| <mlabeledtr data-latex="{f(x)=}"> | ||
| <mlabeledtr data-latex="1&&"> | ||
| <mtd id="mjx-eqn:1"> |
There was a problem hiding this comment.
Should this mtd have a data-latex attribute for the tag?
| "<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\begin{array}{cc} a & \\cellcolor{red} b \\\\ \\cellcolor{yellow} c & d \\end{array}" display="block"> | ||
| <mtable columnspacing="1em" rowspacing="4pt" columnalign="center center" data-frame-styles="" framespacing=".5em .125em" data-latex="\\begin{array}{cc} a & \\cellcolor{red} b \\\\ \\cellcolor{yellow} c & d \\end{array}"> | ||
| <mtr data-latex="{cc}"> | ||
| <mtr data-latex="a&b"> |
There was a problem hiding this comment.
This is missing the \cellcolor{red} before the b. Can that be captured as well?
| </mtd> | ||
| </mtr> | ||
| <mtr data-latex="{cc}"> | ||
| <mtr data-latex="c&d"> |
There was a problem hiding this comment.
Similarly, \cellcolor{yellow} is missing before c.
| "<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\begin{array}{cc} a & b \\cellcolor{red} \\end{array}" display="block"> | ||
| <mtable columnspacing="1em" rowspacing="4pt" columnalign="center center" data-frame-styles="" framespacing=".5em .125em" data-latex="\\begin{array}{cc} a & b \\cellcolor{red} \\end{array}"> | ||
| <mtr data-latex="{cc}"> | ||
| <mtr data-latex="a&\\cellcolor{red}"> |
There was a problem hiding this comment.
Here you capture \cellcolor{red} but missing the preceding b. Of course, that is probably due to the b being missing from the data-latex attribute of the mi at line 73 below.
| "<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\newenvironment{boxed}{\\begin{array}{|c|c|}\\hline}{\\\\\\hline\\end{array}}\\begin{boxed}\\begin{boxed}a&b\\\\c&d\\end{boxed} & X \\end{boxed}" display="block"> | ||
| <mtable columnspacing="1em" rowspacing="4pt" columnalign="center center" columnlines="solid" framespacing=".5em .125em" frame="solid" data-latex="{array}"> | ||
| <mtr data-latex="{|c|c|}"> | ||
| <mtr data-latex="{array}&X"> |
There was a problem hiding this comment.
The {array} doesn't seem right, here.
| "<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\begin{align}a=b\\label{A}\\\\ c&=d \\label{B}\\end{align}" display="block"> | ||
| <mtable displaystyle="true" columnalign="right left" columnspacing="0em" rowspacing="3pt" data-break-align="bottom top" data-latex="\\begin{align}a=b\\label{A}\\\\ c&=d \\label{B}\\end{align}"> | ||
| <mlabeledtr> | ||
| <mlabeledtr data-latex="a=\\label{A}"> |
There was a problem hiding this comment.
The b is missing before the \label, here. Similarly in the tests below.
| "<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\begin{CD}A @>a>> B\\\\@VVbV @VVcV\\\\C @>d>> D\\end{CD}" display="block"> | ||
| <mtable columnspacing="5pt" rowspacing="5pt" displaystyle="true" data-latex="\\begin{CD}A @>a>> B\\\\@VVbV @VVcV\\\\C @>d>> D\\end{CD}"> | ||
| <mtr> | ||
| <mtr data-latex="A&&B"> |
There was a problem hiding this comment.
I'm wondering if the blank column can capture the arrows somehow. These are constructed as raw MathML, so that may be hard to get.
Rows in Tables did not get a meaningful
data-latexattribute. E.g., for\begin{array}{c}a\end{array}we gotdata-latex="{c}".This PR fixes this by explicitly collecting the LaTeX elements and then adding them to the final node, combined with
&.