[tex4ht] Very strange problem with tex4ht using mathjax mode. Problem with \ followed by \] on new line. CR being stripped causing problem.

Nasser M. Abbasi nma at 12000.org
Thu Dec 20 08:56:55 CET 2018


Problem solved.

I use filezilla FTP software. Been using it for years with
Its default for AUTO for file type transfer.

I now changed the file type to be explicit BINARY
and now when I upload the HTML generated, the carriage return
is not stripped. It is there.

So mathjax is happy and now it looks the same as it does
locally.

This is first time I had issue with the setting for FTP,
may be because before I was using images for math and this
was never an issue.

The default was AUTO, but now will make sure to change to binary
next time I install fillezilla. Even though transfering text
files between different OS's using binary can be a problem due
to different end of line encoding, but I compile everything
on Linux on the local PC even though the deskstop itself is
windows, so using binary for transfer should be OK.

Case seems to be closed.
Thank you
--Nasser

On 12/20/2018 1:13 AM, Nasser M. Abbasi wrote:
> This is probably the weirdest problem I found using mathjax.
> 
> I am having hard time understanding how to work around this
> problem.
>    
> The same HTML generated using mathjax mode looks Ok on my computer
> but does not look OK after ftp'ed up to the the server then looking
> at it in the browser there.
> 
> Here is a MWE
> 
> -------------------------------------
> \documentclass[11pt]{article}%
> \usepackage{amsmath}
> \begin{document}
> Therefore
> \[
> A=0\
> \]
> Hence
> \end{document}
> ----------------------------------
> 
> Any one notice any problem with the above code? It is
> valid latex and compiles OK with all systems.
> 
> Compiled this using
> 
>         make4ht foo1.tex "htm,mathjax"
> 
> And there is _NO_ problem, when I view it on my computer, running
> windows 10, via localhost: URL using my local apache web server running
> on windows.
> 
> Here comes the issue. I ftp the above HTML file to my hosting server
> and then view it there, now it is no longer working.
> 
> The same exact HTML file and .css.
>     
> Here is screen shot side by side. Both views are using Chrom browser.
> One on local PC and one on the server.
> 
> https://www.12000.org/tmp/122018/screen_shot.png
> 
> When I view source of the page on screen, it looks the same as on my PC
> ===========================
> <!DOCTYPE html>
> <html lang="en-US" xml:lang="en-US" >
> <head><title></title>
> <meta  charset="iso-8859-1" />
> <meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)" />
> <meta name="viewport" content="width=device-width,initial-scale=1" />
> <link rel="stylesheet" type="text/css" href="foo1.css" />
> <meta name="src" content="foo1.tex" />
>    <script type="text/x-mathjax-config"> MathJax.Hub.Config({ 'fast-preview': {disabled: true}, TeX: { extensions: ["color.js","AMSmath.js"], equationNumbers: { autoNumber: "AMS" } }, extensions: ["tex2jax.js"], tex2jax: {  inlineMath: [ ["\\\(","\\\)"] ], displayMath: [ ['$$','$$'], ["\\[","\\]"] ], processEscapes: true, processEnvironments: true } }); </script>
>    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
> </head><body
>>
> <!--l. 6--><p class="noindent" >Therefore \[ A=0\\] Hence
> </p>
>       
> </body>
> </html>
> ====================================
> 
> The web hosting server runs Linux Apache. So it could be some encoding
> issue.
> 
> The problem goes away when changing
> 
> \[
> A=0\
> \]
> 
> to
> 
> \[
> A=0
> \]
> 
> Now you might ask, when I wrote A=0\ there instead of A=0? I did not.
> This is fragment of code generated by Scientific word. SW tends to add
> lots of \ for spacing everywhere.
> 
> Next, I went to this file DIFF free site, which does byte by byte difference.
> 
> I copied the HTML on my PC and the HTML on the server and compared them
> side by side.
> 
> It turned out that on the server the _carriage return_ after A\ was
> stripped out!, so the code on the server actually is A\\]  while on the PC
> the CR is still there, so it actually like this
> 
>        A=0\
>        \]
> 
> Here is screen shot side by side the file difference. Left
> screen shot is on the server, and right side is same HTML on the PC
> 
> https://www.12000.org/tmp/122018/diff.png
> 
> note that there is no issue with the code as is compiled in latex or SVG for
> math. Only issue is with mathjax and only when ftp'ing it to the Linux server.
> 
> Any suggestion what one should do to avoid this problem? Is problem this to
> be expected?
> 
> luckily this problem does not show in many places. For now, I can manually
> remove the \ after the A. But SW will put it back next time
> I edit the file. And this problem could be there in many
> other places also but I have not noticed it before.
> 
> I am using TL 2018
> 
>> make4ht --version
> make4ht version v0.2c
> 
> 



More information about the tex4ht mailing list