3

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)

2
  • I think this is the same issue tex.stackexchange.com/q/66131/2891
    – michal.h21
    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.
    – user39026
    Oct 28, 2013 at 21:04

1 Answer 1

3

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"  
> 
<head><title></title> 
<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" /> 
<link rel="stylesheet" type="text/css" href="quot.css" /> 
</head><body 
>


  <h2 class="chapterHead"><span class="titlemark">1</span>&#x00A0;&#x00A0;<a 
 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>
  <h2 class="chapterHead"><span class="titlemark">2</span>&#x00A0;&#x00A0;<a 
 id="x1-20002"></a>Chapter two</h2>
<!--l. 25--><p class="noindent" >Let&apos;s try after a chapter break.
</p><!--l. 27--><p class="indent" >  That&apos;s good &#8211; para breaks work now.
</p><!--l. 29--><p class="indent" >  But what happened after the quoting environment in the previous chapter? </p> 
</body></html> 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .