# Quoting environment and tex4ht

I'm trying to convert some latex which includes the quoting environment, to html using htlatex. Here's a little example which gets typeset without any problems:

\documentclass{scrbook}
\usepackage{quoting}

\begin{document}
\chapter{Chapter one}
Here is a para

Here is a second para

\begin{quoting}
one para inside a small block.

another para inside the block.
\end{quoting}

Now for a para after the quote.

And another para after the quote.

What has happened? In the HTML version there are no para breaks!

\chapter{Chapter two}
Let's try after a chapter break.

That's good -- para breaks work now.

But what happened after the quoting environment in the previous chapter?
\end{document}


When I tried to run htlatex on this file it didn't know about the quoting environment, so I created this tex4ht config file configexample.cfg:

\Preamble{html}

\begin{document}
\ConfigureEnv{quoting}
{\HCode{<blockquote>}}
{\HCode{</blockquote>}}{}{}

\EndPreamble


Running this as htlatex example.tex "configexample.cfg" appears to work, and it creates example.html, and even gets the blockquote tags in there. But after the end of the quoting environment, I don't get the p tags I expected. Not, that is, until after a chapter break.

I don't know whether this is a tex4ht issue, or an issue with the quoting package. I could go back to using the quote environment, but I'd like to make this work first, if I can. Any ideas?

(Running under MiKTeX)

• I think this is the same issue tex.stackexchange.com/q/66131/2891 Oct 27, 2013 at 19:39
• I'd seen that issue and it's not the same. In this case there are simply no <p> tags after the quoting environment, until something gets reset by a chapter break. Oct 28, 2013 at 21:04

Ok, it seems that quoting pretty aggressively redefines \everypar token register, which is used by tex4ht to insert <p> tags. So we must create file quoting.4ht which will be loaded automatically with quoting.sty:

\newtoks\quoting@parht
\NewConfigure{quoting}{2}
\Configure{quoting}
{\ifvmode \IgnorePar\fi \EndP\HCode{<blockquote>}\HtmlParOn}
{\ifvmode \IgnorePar\fi \EndP\HCode{</blockquote>}\HtmlParOn\par}

\ConfigureEnv{quoting}
{\quoting@parht=\everypar%
\a:quoting\par\ShowPar}
{\par%
\b:quoting%
\everypar=\quoting@parht\par\ShowPar}
{}{}

\ConfigureList{quoting}{}{}
{%
\everypar=\quoting@parht\par\ShowPar%
}{}


First, we define new token register quoting@parht, where value of \everypar is saved, then new configuration quoting is created, so we can configure only tags to be inserted.

Then with \ConfigureEnv we save value of \everypar, then insert start and end tag, and restore value of everypar, so html paragraphs are printed. We must also use \ConfigureList, so paragraphs work correctly also inside the environment. The result:

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->
<html xmlns="http://www.w3.org/1999/xhtml"
>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<!-- xhtml,html -->
<meta name="src" content="quot.tex" />
<meta name="date" content="2013-10-29 15:45:00" />
>

id="x1-10001"></a>Chapter one</h2>
<!--l. 6--><p class="noindent" >Here is a para
</p><!--l. 8--><p class="indent" >  Here is a second para
</p>
<blockquote>
<!--l. 11--><p class="indent" >
one para inside a small block.
</p><!--l. 13--><p class="indent" >  another para inside the block.
</p><!--l. 15--><p class="indent" >  and another para
</p>
</blockquote>
<!--l. 18--><p class="indent" >  Now for a para after the quote.
</p><!--l. 20--><p class="indent" >  And another para after the quote.
</p><!--l. 22--><p class="indent" >  What has happened? In the HTML version there are no para breaks!

</p>