2

I am trying to change the \Configure{section} for the customized tag <div> and <title>

I am using the below tex coding

\documentclass{book}
\usepackage{amsmath}
%\usepackage{macros}

\newenvironment{exe}{Exercise: }{}

    \begin{document}
    \section{sample}
    This version uses the powerful Uniscribe library in order to better handle Unicode and complex language processing (including support for bidirectional text).

    This version uses the powerful Uniscribe library in order to better handle Unicode and complex language processing (including support for bidirectional text).
    \end{document}

In the cfg file i have modified like below

\Configure{section}
    {\ifvmode \IgnorePar\fi \EndP\IgnorePar%
    \HCode{<section class="section\thesection"\a:LRdir>}\TitleMark}
    {\EndP\HCode{</section>}}
    {\HCode{<title>}}
    {\HCode{</title>}\HtmlParOn\ShowPar \IgnoreIndent \par}

when the tex file having only one section I am getting the correct output like below

<section class="section0.1"><label>0.1</label><title><a id="x1-10000.1"></a>sample</title>
<p class="noindent">This version uses the powerful Uniscribe library in order to better handle Unicode and complex language processing (including support for bidirectional text).</p>
<p class="indent">This version uses the powerful Uniscribe library in order to better handle Unicode and complex language processing (including support for bidirectional text).</p>
</section>

when we add another section in the .tex file the extra <p> is coming before the section like below

<section class="section0.1"><label>0.1</label><title><a id="x1-10000.1"></a>sample</title>
<p class="noindent" >This version uses.</p>
<p class="indent" >   This version uses the text).</p>
<p class="noindent" ></p>
<p class="indent" > 
</section>
</p>
<section class="section0.2"><label>0.2</label><title><a id="x1-20000.2"></a>sample</title>
<p class="noindent" >This version uses.</p>
<p class="indent" >   This version uses the text).</p>
</section>

How to suppress the extra <p> ... </p> tag in the HTML?

1

Most of wrong paragraph instances can be fixed using \ifvmode\IgnorePar\fi\EndP before the problematic tag:

\Configure{section}
{\ifvmode \IgnorePar\fi \EndP\IgnorePar%
\HCode{<section class="section\thesection"\a:LRdir>}\TitleMark}
{\ifvmode\IgnorePar\fi\EndP\HCode{</section>}}
{\HCode{<title>}}
{\HCode{</title>}\HtmlParOn\ShowPar \IgnoreIndent \par}

It produces the following result:

 <section class="section0.1"><span class="titlemark">0.1   </span><title><a 
 id="x1-10000.1"></a>sample</title>
<p class="noindent">This version uses the powerful Uniscribe library in order to better handle
Unicode and complex language processing (including support for bidirectional
text).
</p><p class="indent">   This version uses the powerful Uniscribe library in order to better handle
Unicode and complex language processing (including support for bidirectional
text).
</p>
   </section> 
<section class="section0.2"><span class="titlemark">0.2   </span><title><a 
 id="x1-20000.2"></a>another section</title>
<p class="noindent">some text </p></section> 
  • I have tried with your answer, but i am getting dummy para tag before the second Head<p class="noindent" ></p>, due to the blank line is present bfore the \section in the tex file, if i closed with the previous para the empty `<p>' tag is removed in the html file. How to handle with this situation? – vctu Feb 7 '17 at 12:14
  • @VenkatesanRamachandiran could you update your question with some concrete example? – michal.h21 Feb 7 '17 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.