Closed yalguzaq closed 1 year ago
This issue is quite complicated to solve, because you can quite easily run into XML tag mismatch with switch commands such as \color
. It is better to use \textcolor
, which has limited scope. Anyway, you can try this configuration file:
\Preamble{xhtml}
\makeatletter
\catcode`\:=11
\let\current:tag\relax
\def\color:tag{\ifmmode mstyle\else span\fi}
\def\:color:after{\HCode{</\color:tag>}\let\current:tag\relax}
\def\:tmp#1{\get:xcolorcss{#1}\:tmpcolor\def\current:tag{\HCode{<\color:tag}\HCode{ style="color:\:tmpcolor" >}}\current:tag\aftergroup\:color:after\o:color:{#1}}
\HLet\color\:tmp
%\Configure{HtmlPar}{\ifx\current:tag\relax\else\color:after\fi\EndP\HCode{<p>}\current:tag}{\EndP\HCode{<p>}}{\HCode{</p>}}{\HCode{</p>}}
\catcode`\:=12
\makeatother
\begin{document}
\EndPreamble
It fails with more complicated examples, where you use \color
outside groups, but it seems to work for your test file.
Thank you. The conclusion is that \textcolor
should be used instead.
Consider the following TeX:
I have two issues here:
make4ht markup.tex
colors centered equations ($$) but not inline ones ($)make4ht markup.tex 'mathml,mathjax'
does not color anything.