Katex In PDF/CHM (Robohelp 2020, latest update)

Jan 11, 2021

Copy link to clipboard

Copied

I am creating online documentation using Katex to render maths formulas (similar to MathJax, only faster and smaller weight/less dependencies). The Frameless HTML5 export of the doc looks like this when using Katex:

Mark_Noc_1-1610375320929.png

 

However, I need to be able to create CHM and PDF as well, and when I generate those outputs that same page looks like this:

Mark_Noc_0-1610375295670.png

The CHM output also gives me a script error when loading the page. I'm assuming this is because of basic incompatibility between the formats, as I assume PDF would need to pre-render the JS elements before being created (which it can't/doesn't, obviously), and CHM just doesn't like JS stuff in general from my experience.

I know I can use images instead of generating the maths, but that makes it a lot more painful to maintain and update. So, any suggestions on how I can work around this or even resolve the situation? Or any better tools that would be cross platform compatible to create these maths formulas?

TOPICS
New UI, Scripting

Views

37

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Katex In PDF/CHM (Robohelp 2020, latest update)

Jan 11, 2021

Copy link to clipboard

Copied

I am creating online documentation using Katex to render maths formulas (similar to MathJax, only faster and smaller weight/less dependencies). The Frameless HTML5 export of the doc looks like this when using Katex:

Mark_Noc_1-1610375320929.png

 

However, I need to be able to create CHM and PDF as well, and when I generate those outputs that same page looks like this:

Mark_Noc_0-1610375295670.png

The CHM output also gives me a script error when loading the page. I'm assuming this is because of basic incompatibility between the formats, as I assume PDF would need to pre-render the JS elements before being created (which it can't/doesn't, obviously), and CHM just doesn't like JS stuff in general from my experience.

I know I can use images instead of generating the maths, but that makes it a lot more painful to maintain and update. So, any suggestions on how I can work around this or even resolve the situation? Or any better tools that would be cross platform compatible to create these maths formulas?

TOPICS
New UI, Scripting

Views

38

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 11, 2021 0
Jan 11, 2021

Copy link to clipboard

Copied

I think your logic is correct. I'm guessing the Katex output is HTML5 and CSS3 compliant and therefore RoboHelp can generate the frameless output.

 

CHMs require CSS2 so RoboHelp has to do a backwards conversion, hence that not working.

 

I can't offer any alternatives so hopefully someone else can.

 

Have you tried Katex forums or support to see if others have faced this issue and found a solution?

 

Please use the blue Reply button at the top to help me help you. The black Reply link nests replies and they sort out of order.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 11, 2021 0
Jan 11, 2021

Copy link to clipboard

Copied

CHM is actually a bit worse than Peter suggest. It uses IE7, which was not fully HTML 4.01 or CSS2 standards compliant.

 

Svg isn't supported either, so if you can get it to prerender, you'll need to specify an older image format for the CHM output (png or gif probably).

 

Katex only supports IE11, it looks like: https://katex.org/docs/browser.html

 

I noticed on the Extensions and Libraries page of the Katex doco it mentions Asciimath. Perhaps using the Asciimath library could work better, as, if I'm reading it right, you should at least get a plaintext rendering of the formula in the chm, rather than the katex code? (I'm assuming the scripting code for asciimath won't work in chm either) I haven't used anything like it before though, so my interpretation could be wrong. http://asciimath.org

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 11, 2021 0
Jan 11, 2021

Copy link to clipboard

Copied

Thank you Peter for your reply! I haven't checked the katex forums yet, as I thought that someone here might have had a similar issue before (I can't be the only one using aths forumlas in documentation!!!). I'll have look through them though...

 

Amebr, your suggestion to use Asciimath sems like a great idea! Quick investigation leads me to believe that it would indeed be more compatible... Thank you very much for the reply and I'll get testing ASAP and see how it goes. 🙂

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 11, 2021 0
Jan 12, 2021

Copy link to clipboard

Copied

The issue of maths formulas has come up from time to time and prior to HTML5 the only responses I recall seeing were to convert to images.

 

I can only guess that not having seen this in more recent times that solutions such as yours were sufficient and CHMs and PDFs were not required by those users.

________________________________________________________
See www.grainge.org for free Authoring and RoboHelp Information

Please use the blue Reply button at the top to help me help you. The black Reply link nests replies and they sort out of order.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 12, 2021 0