1

I am trying to create a one environment in tex4ht, in the html file <p>... </p> tag is missing in the very first para of the environment

I am using the below tex coding

\documentclass{book}
\newenvironment{exe}{Exercise: }{}
\begin{document}
This version uses the powerful Uniscribe library in order to better handle Unicode and complex language processing.

\begin{exe}
This Theorem explain how it works in the example

This Theorem explain how it works in the example
\end{exe}
This version uses the powerful Uniscribe library in order to better handle Unicode and complex language processing (including support for bidirectional text).

\end{document} 

and I used the below coding in the cfg file

\ConfigureEnv{exe}
   {\ifvmode\IgnorePar\fi\EndP\HCode{<div class="Theorem">}}
   {\ifvmode\IgnorePar\fi\EndP\HCode{</div>}}
   {}
   {}

The output in the html file is:

<p class="noindent" >This version uses the powerful Uniscribe library in order</p>
<div class="Theorem">Exercise:  This Theorem explain how it works in the example
<p class="indent" >This Theorem explain how it works in the example</p>
</div>
<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>

I compile the file with the following arguments

htlatex sample "sample.cfg,xhtml"

Please suggest how to insert the para tag <p>...</p> in the opening para of the new environment?

3

You need to insert explicit paragraphs with \par command in this case:

\ConfigureEnv{exe}
   {\ifvmode\IgnorePar\fi\EndP\HCode{<div class="Theorem">}\par}
   {\ifvmode\IgnorePar\fi\EndP\HCode{</div>}\par}
   {}
   {}

The result:

  <div class="Theorem">
<p class="indent">   Exercise:  This Theorem explain how it works in the example
</p><p class="indent">   This Theorem explain how it works in the example
</p></div>
<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>
  • Its working now thank you for your timely help. I think Inserting paragraph tag is more tricky in TeX4HT – Venkatesan Ramachandiran Feb 7 '17 at 10:15
  • sorry another one doubt, why the closing para tag </p> coming with newline in the html file, how to run on the tag with the line. – Venkatesan Ramachandiran Feb 7 '17 at 10:17
  • @VenkatesanRamachandiran the newlines are inserted everywhere, where the line in broken in the DVI file, so every paragraph inserts new line. – michal.h21 Feb 7 '17 at 10:25
  • @VenkatesanRamachandiran but you can use something like HTML tidy to reformat the HTML file. – michal.h21 Feb 7 '17 at 10:35
  • I want to generate xml structures from TeX4ht!!! – Venkatesan Ramachandiran Feb 7 '17 at 10:41

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.