[tex4ht] Environments interlaced with paragraphs

Denis Bitouzé dbitouze at wanadoo.fr
Wed Oct 31 11:45:34 CET 2012


Hello,

consider the following test.tex file:

%%%%%%%%%%%%%%%%%%% test.tex %%%%%%%%%%%%%%%%%%%
\documentclass{article}
\newenvironment{warning}{%
  \HCode{<div class="warning">}%
}{%
  \HCode{</div>}%
}
\begin{document}
\begin{warning}
  foo
\end{warning}

\begin{warning}
  bar\par
  baz
\end{warning}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

and test.cfg file:

%%%%%%%%%%%%%%%%%%% test.cfg %%%%%%%%%%%%%%%%%%%
\Preamble{xhtml}
\begin{document}
\EndPreamble
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

When compiled with htlatex, the resulting test.html file contains
(formatted for more readability) the following which is OK (no
interlacing):

  <p class="noindent" >
    <div class="warning">
      foo
    </div>
  </p>

but also the following which is not OK (interlacing):

  <p class="noindent" >
    <div class="warning">
      bar
    </p>
  <p class="indent" >
    baz
  </div>
  </p>

The same problem occurs with, in test.tex:

\newenvironment{warning}{%
}{%
}

and, in test.cfg:

\ConfigureEnv{warning}
{\HCode{<div class="warning">}}
{\HCode{</div>}}
{}
{}

Do you know how to avoid this problem?

Thanks in anticipation.
-- 
Denis


More information about the tex4ht mailing list