1

I have the following 'MWE.tex' file where I defined underscore with \catcode'_=12:

\documentclass{article}
\catcode`_=12

\begin{document} Text containing underscore between parenthesis (_) \end{document}

When I tried to convert this 'MWE.tex' file into html using Make4ht with the following command:

make4ht MWE.tex

I obtain this results in HTML (the underscore is not well converted):

Text containing underscore between parenthesis (˙)

My web navigator displays this: enter image description here

I there a way to obtain a good conversion of the underscore in this case?

zetyty
  • 779

1 Answers1

2

Your sample is typesetted diferently by pdflatex and by lualatex. pdflatex shows: Text containing underscore between parenthesis (˙), and lualatex shows: Text containing underscore between parenthesis (_). You get similar result with make4ht depending on the engine you chose for the conversion. When you use lualatex, it will display underscore:

make4ht -l MWE.tex

This is the result:

enter image description here

Alternatively, as you use an older system, you can try this configuration file for TeX4ht:

\Preamble{xhtml}
\begin{document}
\catcode`_=13
\def_{\textunderscore}
\EndPreamble

It makes underscore active and defines it to produce \textunderscore command. I hope that this should work even on TeX Live 2019.

Compile using:

make4ht -c config.cfg MWE.tex
michal.h21
  • 50,697
  • Thanks a lot for this clear answer. Unfortunately, I obtain the same bad result with -l... My setup could be wrong. I have the v0.3d version of make4ht and working on Linux Unbuntu 20.04 LTS (stricly speacking on a Windows Subsystem Linux). – zetyty Feb 18 '22 at 12:20
  • @SylvainRigal ah, I think that this can be the problem, your system is quite old. I can try to make a workaround that would work for you, but the preferred solution is to update your distribution. – michal.h21 Feb 18 '22 at 12:51
  • Please don't spend time for this. I will update my distribution. What exactly is too old? Make4ht ? – zetyty Feb 18 '22 at 12:56
  • @SylvainRigal I think the whole TeX distribution is too old. LaTeX itself was updated substantially in the last year, then TeX4ht and make4ht too. – michal.h21 Feb 18 '22 at 13:09
  • @michal.21 Is it the Latex3 update? My install it's a fresh install (yesterday) with apt install texlive-full and apt update before. When I do tex --version I get TeX 3.14159265 (TeX Live 2019/Debian) kpathsea version 6.3.1 I will try to upgrade something anyway. – zetyty Feb 18 '22 at 13:16
  • @SylvainRigal yes, among others. Current TeX Live is 2021, and there will be TeX Live 2022 soon. The package on your system hasn't been updated for two years. But I will post a workaround that should work even on the older system. – michal.h21 Feb 18 '22 at 13:24
  • Perfect ! Thanks a lot. Could you explain the meaning of the config.cfg file? Especially why \catcodeˋ_=13 and not =12? – zetyty Feb 18 '22 at 18:21