In the tex4ht configuration file, I have these 2 lines:
\Configure{$}{\PicMath}{\EndPicMath}{}
\Configure{PicMath}{}{}{}{class="math";align="absmiddle"}
These have been the .cfg for 5 years or more. No problem. These are used to tell tex4ht to convert inline math to images, else it will not. So these 2 lines are very basic and must be there all the time.
I just found out now, for some reason, when I use adjustbox
, that the output is all corrupted on the HTML page. It turned out that removing the above 2 lines from the .cfg file, then the output becomes OK.
I have no idea why these 2 lines affect adjustbox
or cause tex4ht to do this.
Here is MWE
\documentclass[12pt]{book}%
\usepackage{listings}
\usepackage{adjustbox}
\begin{document}
\begin{adjustbox}{max width=0.8\textwidth,fbox=0.1pt,margin=2pt}
\begin{lstlisting}[basicstyle=\ttfamily,columns=fullflexible,keepspaces=true]
This is just some text
which is verbatim using listing
\end{lstlisting}
\end{adjustbox}
\end{document}
Here is MWE nma.cfg
file which should be in the same folder as the .tex file
\Preamble{ext=htm,charset="utf-8",p-width,pic-align}
\Configure{DOCTYPE}{\HCode{<!DOCTYPE html>\Hnewline}}
\Configure{HTML}{\HCode{<html>\Hnewline}}{\HCode{\Hnewline</html>}}
\Configure{@HEAD}{}
\Configure{@HEAD}{\HCode{<meta charset="utf-8"/>\Hnewline}}
\Configure{@HEAD}{\HCode{<link rel="stylesheet" type="text/css"
href="\expandafter\csname aa:CssFile\endcsname" />\Hnewline}}
\begin{document}
\Configure{$}{\PicMath}{\EndPicMath}{}
\Configure{PicMath}{}{}{}{class="math";align="absmiddle"}
\EndPreamble
Compile with htlatex foo7_1.tex "nma.cfg,htm"
The HTML page is
When removing the .cfg file, and compiling using htlatex foo7_1.tex "htm"
the output is
For somereason, tex4ht thought adjustbox
content was math and tried to make it an image? Removing adjustbox
and keeping the .cfg also solves the problem:
\documentclass[12pt]{book}%
\usepackage{listings}
\begin{document}
\begin{lstlisting}[basicstyle=\ttfamily,columns=fullflexible,keepspaces=true]
This is just some text
which is verbatim using listing
\end{lstlisting}
\end{document}
Compiling using htlatex foo7_1.tex "nma.cfg,htm"
gives
So the question is: Can one use keep the .cfg as is, and using adjustbox
with tex4ht?
This problem happens on TL 2015 and TL 2016.