# How to put the <p>…</p> tag very first para in the environment like theorem

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?

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