MathJax-full \hline makes table black filled

83 views
Skip to first unread message

Sasa Dautovic

unread,
Apr 12, 2021, 2:58:20 AM4/12/21
to MathJax Users
Hello, 

I'm using mathjax-full npm module to convert latex expression into image. When I try to convert this latex epression:

\begin{array}{|c|c|}\hline\textcolor{primary}{x}&\textcolor{secondary}{y}\\\hline \textcolor{primary}{-2}&\textcolor{secondary}{1}\\\hline \textcolor{primary}{-1}&\textcolor{secondary}{\frac{1}{2}}\\\hline \textcolor{primary}{0}&\textcolor{secondary}{0}\\\hline \textcolor{primary}{1}&\textcolor{secondary}{-\frac{1}{2}}\\\hline \textcolor{primary}{2}&\textcolor{secondary}{-1}\\\hline\end{array}

whole exported table is filled with black. If I omit first \hline or last \hline image is created but I get missing line on top or at the end of the table. 

What I do is to create a document:

mathjax.document('', {
InputJax: new TeX({packages: AllPackages}),
OutputJax: new SVG({fontCache: 'none'}) 

Then I call convert upon that created document with given latex from above. 

After that I use liteAdaptor to generate innerHTML that creates SVG from the given latex expression. 

Did anyone had the same issue with using \hline directive on MathJax?

Also I am using MathJax-Fill npm module version 3.1.2

Thnx for the help, 
best regards 
Sasa

Davide Cervone

unread,
Apr 12, 2021, 8:14:08 AM4/12/21
to mathja...@googlegroups.com
MathJax's SVG output relies on CSS for some of its layout, and table lines are one place where that is the case.  If you are not including the CSS, then you are likely to get the output that you describe.  This was discussed at


and a solution was presented in


(though it discusses how to change the original posters code, so you will have to adapt that to your own).

Also, I've modified the examples in the node demos for the upcoming 3.1.3 release to include this idea, so another place to look would be


as an example.

Davide


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/5433d63e-1c3b-48e5-bee4-d76d66572125n%40googlegroups.com.

Sasa Dautovic

unread,
Apr 13, 2021, 2:44:58 AM4/13/21
to MathJax Users

Hello, 

I have looked at the example, but there is no <defs> tag generated after innerHtml is called.

Sasa Dautovic

unread,
Apr 13, 2021, 2:45:37 AM4/13/21
to MathJax Users

Hello, 

I have looked at the example, but there is no <defs> tag generated after innerHtml is called.
On Monday, April 12, 2021 at 2:14:08 PM UTC+2 Davide Cervone wrote:

Davide Cervone

unread,
Apr 13, 2021, 7:40:24 AM4/13/21
to mathja...@googlegroups.com
Sorry, I didn't see your fontCache: 'none' setting.  That prevents the <defs> from being used.  In that was, you will need to do something like

html.replace(/>/, `><defs><style>${CSS}</style><defs>`)

instead.  See if that works.

Davide


Reply all
Reply to author
Forward
0 new messages