Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with rules in mathjax array #47

Open
punkdit opened this issue Mar 30, 2017 · 2 comments
Open

problem with rules in mathjax array #47

punkdit opened this issue Mar 30, 2017 · 2 comments

Comments

@punkdit
Copy link

punkdit commented Mar 30, 2017

I have this bit of latex, but neither the hline nor the
vertical rule are being shown in the array.
Instead of the horizontal rule, i see the text "hline".
Any ideas what is going wrong? I am using instiki 0.20.1.

$$
\begin{array}{r|rrrr}
* & A & B & C & D \\
\hline
A & A & B & C & D \\
B & B & 2B & D & 2D \\
C & C & D & C+D & 3D \\
D & D & 2D & 3D & 6D \\
\end{array}
$$
@distler
Copy link
Collaborator

distler commented Mar 30, 2017

This isn't really a MathJax issue, it's an itex issue.

In MathML, the functionality you want is controlled by the columnlines and rowlines attributes on the mtable element. Thus the following MathML output produces the table you want:

<math class='maruku-mathml' display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
<mtable columnalign='right right right right right' columnlines='solid none none none' rowlines='solid none none none' displaystyle='false' rowspacing='0.5ex'>
 <mtr><mtd>*</mtd> <mtd><mi>A</mi></mtd> <mtd><mi>B</mi></mtd> <mtd><mi>C</mi></mtd> <mtd><mi>D</mi></mtd></mtr>
 <mtr><mtd><mi>A</mi></mtd> <mtd><mi>A</mi></mtd> <mtd><mi>B</mi></mtd> <mtd><mi>C</mi></mtd> <mtd><mi>D</mi></mtd></mtr>
 <mtr><mtd><mi>B</mi></mtd> <mtd><mi>B</mi></mtd> <mtd><mn>2</mn><mi>B</mi></mtd> <mtd><mi>D</mi></mtd> <mtd><mn>2</mn><mi>D</mi></mtd></mtr>
 <mtr><mtd><mi>C</mi></mtd> <mtd><mi>C</mi></mtd> <mtd><mi>D</mi></mtd> <mtd><mi>C</mi><mo>+</mo><mi>D</mi></mtd> <mtd><mn>3</mn><mi>D</mi></mtd></mtr>
 <mtr><mtd><mi>D</mi></mtd> <mtd><mi>D</mi></mtd> <mtd><mn>2</mn><mi>D</mi></mtd> <mtd><mn>3</mn><mi>D</mi></mtd> <mtd><mn>6</mn><mi>D</mi></mtd></mtr>
</mtable>
</math>

Unfortunately, itex doesn't currently support the columnlines and rowlines attributes (neither using the "standard" LaTeX syntax you were using, nor via some alternative syntax).

This is an unfortunate omission, which I hope to rectify in the next version of itex2MML.

@distler
Copy link
Collaborator

distler commented May 17, 2017

So I've been thinking some more about this, but I am a bit stymied. The semantics of columnlines, rowlines (and, as I'll explain, frame) are completely different from what's allowed in the LaTeX array environment.

  • columnlines and rowlines control the lines between rows/columns. LaTeX allows you to put a vertical line before the first column or after the last one, merely by inserting a "|" (and similarly for an "hline" before the first row or after the last row). In MathML, the only option (controlled by the frame attribute) is whether to put a box around the entire array.
  • In LaTeX, you can insert a double (or triple or whatever) line with a "||" (or "\hline\hline"). In MathML, the only options are "none", "solid" or "dashed".

Setting aside the intricacies of how to implement something like this, these incompatibilities are going to create serious headaches ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants