unknown symbols brought by 'lvert' in latex formula expression

Having trouble installing Oxygen? Got a bug to report? Post it all here.
galanohan
Posts: 115
Joined: Mon Jul 10, 2023 11:49 am

unknown symbols brought by 'lvert' in latex formula expression

Post by galanohan »

Hi,

When converting latex formulas of which the expressions contain "lvert", the webhelp transformation reports the following:

Code: Select all

...
Caused by: org.scilab.forge.jlatexmath.ParseException: Problem with command genfrac at position 1:152
 [pipeline] Unknown symbol or command or predefined TeXFormula: 'lvert'
...
For example, in the formula for Elastic Net Regression Algorithm:

Code: Select all

<foreign outputclass="embed-latex"> \dfrac{1}{2*n\_samples}* \Bigl\lVert{y - Xw} \Bigr\rVert_2^2 +
                alpha * l1Ratio\Bigl\lVert{w}\Bigr\rVert_1 +
                \dfrac{alpha*(1-l1Ratio)}{2}\Bigl\lVert{w}\Bigr\rVert_2^2 </foreign>
It seems jlatexmath 1.0.7 cannot parse certain symbols converted from characters such as 'lvert' or 'rvert'. As it said the symbol expressed by 'lvert' is unknown (to its library).

I believe the latex plugin works well because there are many other latex formulas in the documents, none of them caused errors except for the ones containing 'lvert'.

Then I had a google search finding that eight years ago, someone encountered similar problem with 'lvert' and 'rvert': https://tex.stackexchange.com/questions ... -math-font

As the discussion went in that thread from stackexchange.com, it seems the problem was caused by the font-family, or in other words, the symbols converted from either 'lvert' or 'rvert' cannot be found in the library of specific font-family, then the jlatexmath parser detects it as unknown.

Since I was using the Inter font-family which was specified and imported in the css I used for webhelp, I had another test with default Webhelp Responsive transformation bundled with oxygen, the result was the same.

So, if it's caused by the compatibility issue of font-family, does it mean that I have only two workarounds for such issues?
1. Simple but straightforward, replace formula expression with image (screenshot of those formulas)
2. Use certain font-family to support latex formula, such as "Computer Modern", or "Latin Modern Math" and "TeX Gyre Math"?

Did I understand it correctly?
image.png
image.png (9.5 KiB) Viewed 656 times
I checked the font-support page of mathJax: https://docs.mathjax.org/en/latest/output/fonts.html
MathJax version 3 currently supports only one font, the MathJax TeX font. Version 2 provides the following fonts:

MathJax TeX (default)
STIX General
Asana Math
Neo Euler
Gyre Pagella
Gyre Termes
Latin Modern
Really?
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: unknown symbols brought by 'lvert' in latex formula expression

Post by Radu »

Hi,
Our Latex to SVG conversion in the open source DITA OT plugin calls code from the jlatexmath library:
https://github.com/oxygenxml/dita-latex ... ToSVG.java
It seems we are already using the latest version of the jlatexmath library.
I do not know much Latex and I am not familiar with how the jlatexmath library works but I suspect this problem is not related to the used font family. Our Java code does not set any specific font to be used by the jlatexmath library so what you are doing outside, in the WebHelp CSS does not influence in any way the latex image conversion.
How about if you add an issue on the JLatexmath plugin project? Maybe they can give us more feedback about if this works or how it could be made to work...
https://github.com/opencollab/jlatexmath
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
galanohan
Posts: 115
Joined: Mon Jul 10, 2023 11:49 am

Re: unknown symbols brought by 'lvert' in latex formula expression

Post by galanohan »

Hi Radu,

Sure. I've created an issue at https://github.com/opencollab/jlatexmath/issues/101. Thank you!

Regards,
Galano
galanohan
Posts: 115
Joined: Mon Jul 10, 2023 11:49 am

Re: unknown symbols brought by 'lvert' in latex formula expression

Post by galanohan »

Hi @Radu,
I got a reply from jlatexmath's issues list:
JLaTeXMath v2 - try with this branch https://github.com/opencollab/jlatexmat ... perimental
So, if I take a test to replace the current jlatexmath used in dita-latex component in DITA-OT/plugins, do I need to replace only the lib file itself, or maybe I should replace the other files with the ones in jLatexMath-v2 as well?

Regards,
Galano
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: unknown symbols brought by 'lvert' in latex formula expression

Post by Radu »

Hi,
Right, so you should replace the jlatexmath-1.0.7.jar jar library, update the reference to it here:
https://github.com/oxygenxml/dita-latex ... plugin.xml
then run again the DITA OT integrator and hope they did not change the APIs we are using in our custom Java code.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
galanohan
Posts: 115
Joined: Mon Jul 10, 2023 11:49 am

Re: unknown symbols brought by 'lvert' in latex formula expression

Post by galanohan »

ok, thanks Radu! I'll give it a try.
Post Reply