I need to modify enumeration list environment, but just in one place and not globally, for tex4ht.
I have reason where this one particular enumeration list, I need it not to wrap. i.e. each \item
should not wrap.
I figured how to do it, but globally. i.e. now all my enumeration lists are affected which is not what I want. Here is an example how to change it globally
\documentclass[12pt,notitlepage]{article}
\begin{document}
\ifdefined\HCode
\Css{body{
margin: 0 auto; /* center */
outline: 1px solid \#D3D3D3;
max-width:500px;
}}
\fi
\begin{enumerate}
\item some long text here, some long text here, some long text here, some long text here, some long text here, some long text here
\item some long text here
\end{enumerate}
\end{document}
Then created this my.cfg file
\Preamble{xhtml,p-width}
\ConfigureEnv{enumerate}
{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="nowaprEnumerate">}}
{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}}
{}
{}
\Css{.nowaprEnumerate {white-space: nowrap;}}
\begin{document}
\EndPreamble
And now I compile using
make4ht -ulm default -a debug -c my.cfg main.tex "mathjax,htm,nostyle"
It gives
Which is exactly what I want. But as I said, this affects now every enumeration list I have in my document. I do not know how to make it affect specific enumeration list and not another.
I thought I need to make new environment. So I changed the above code to the following
\documentclass[12pt,notitlepage]{article}
\begin{document}
\ifdefined\HCode
\Css{body{
margin: 0 auto; /* center */
outline: 1px solid \#D3D3D3;
max-width:500px;
}}
\fi
%I only want this enumeration to not wrap
\ifdefined\HCode
\begin{nowaprEnumerate}
\else
\begin{enumerate}
\fi
\item some long text here, some long text here, some long text here, some long text here, some long text here, some long text here
\item some long text here
\ifdefined\HCode
\end{nowaprEnumerate}
\else
\end{enumerate}
\end{document}
And changed .cfg to the following
\Preamble{xhtml,p-width}
\ConfigureEnv{nowaprEnumerate} %CHANGED THIS LINE
{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="nowaprEnumerate">}}
{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}}
{}
{}
\Css{.nowaprEnumerate {white-space: nowrap;}}
\begin{document}
\EndPreamble
When compiling again, tex4ht gives error
LaTeX Error: Environment nowaprEnumerate undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.60 \begin{nowaprEnumerate}
I understand the error. There is no nowaprEnumerate
.
But I have no idea what to do now. I think I need some other trick to modify enumeration environment as above, but at same time, give it a new name, and use this new name where in the document I need to modify the enumeration and not use when I want the normal enumeration.
But do not know how to do this.
Any suggestions how do the above? i.e. change enumeration list environment, just for tex4ht in specific places? clearly I need new environment for tex4ht to do this.
TL 2023