I am new to TeX4HT, I tried to write a .cfg for quote environment, i have used the below tex coding

Sample para 1

Sample para 2

and the cfg coding is

             {\ifvmode \IgnorePar\fi \EndP\HCode{<div class="disp-quote">}}
             {\ifvmode \IgnorePar\fi \EndP\HCode{</div>}}

I am getting the output like below

<div class="disp-quote">
     <div class="quote">
     <!--l. 4--><p class="noindent" >Sample para 1
     </p><!--l. 6--><p class="noindent" >Sample para 2</p></div>

In the output html file '<div>' tag is opened for two times

"<div class="disp-quote">" - this is I defined in the cfg file
"<div class="quote">"  - this one is coming from the html4.4ht

also i am getting <!--l. 4--> and <!--l. 6--> in the each and every para starting in the output html file

I compile the file with the following arguments

htlatex sample "sample.cfg,xhtml"

Please suggest How to suppress the repeating <div> tag and the comment Instructions <!--l. 4--> ?

1 Answer 1


The original configuration for quote environment is:

 \HCode{<div class="\getClass{quote}">}\afterGetClass{quote}}
 \Css{.quote  {margin-bottom:0.25em; margin-top:0.25em;
               margin-left:1em; margin-right:1em; text-align:justify;}}

quote environment is based on \list, so it is a little bit special. You can see that tags are inserted in fourth and fifth argument of \ConfigureEnv instead of the second and third. When you provide your own configuration, you leave these arguments empty, but in that case the original configuration is used, and this results in double tag insertion.

You can either change your configuration to replace the original insertions:

         {\ifvmode \IgnorePar\fi \EndP\HCode{<div class="disp-quote">}}
         {\ifvmode \IgnorePar\fi \EndP\HCode{</div>}}

or you can use the fact that quote has configurable class name, using \Configure{quoteClass}{quote class name}{code to be inserted aftertag}:


The line numbers are inserted by the paragraph configuration, you can get rid of it using this configuration:

 {\EndP\HCode{<p class="noindent">}}
 {\EndP\HCode{<p class="\ifdim\parindent=0pt no\fi indent">}}

We have different configurations for paragraphs with and without indent, the \ifdim\parindent=0pt no\fi part is for inserting noindent class if the paragraph is marked as indented, but \parindent is zero, because it is the situation inside the quote environment.

The meaning of some of the paragraph handling commands is following:

\IgnorePar     Asks to ignore the next paragraph
\ShowPar       Asks to take into account the following paragraphs

\IgnoreIndent  asks to ignore indentation in the next paragraph
\ShowIndent    asks to check indentation in the following paragraphs

\SaveEndP      Saves the content of \EndP, and sets it to empty content

This results in the following code:

 <div class="disp-quote">
 <p class="noindent">Sample para 1
 </p><p class="noindent">Sample para 2</p></div>
  • what is the use of \getClass, \afterGetClass, \ShowPar and \ShowIndent
    – pdy-ind
    Jan 6, 2017 at 8:47
  • @venkatesanRamachandiran I've added description of the paragraph commands to the answer. \getClass{name} and \afterGetClass{name} inserts information from \Configure{'name'Class}.
    – michal.h21
    Jan 6, 2017 at 9:24
  • closing </p> tag is not printing in the first para of the environment, how to arrest/get the closing tag of </p>?
    – pdy-ind
    Feb 7, 2017 at 5:30
  • @VenkatesanRamachandiran there is missing \EndP command in the configuration for \HtmlPar. Please see the updated answer.
    – michal.h21
    Feb 7, 2017 at 9:50

You must log in to answer this question.

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