# tex4ht: wrapping title with a custom tag

The \maketitle command in my LaTeX source is rendered in HTML by tex4ht as

<div class="maketitle">
<h2 class="titleHead">My Title</h2>
<div class="author" >My Author</div><br />
<div class="date" >2016</div>
</div>


which is almost fine (apart from a lot of useless spaces and newlines I polished it from), I only would like to see it wrapped in tag (additional or replacing the external div tag) like

<section class="titlepage">
...
</section>


How can I obtain that?

Thanks in advance.

## 1 Answer

You can use \Configure{maketitle}:

\Preamble{xhtml}
\begin{document}
\Configure{maketitle}{\ifvmode\IgnorePar\fi\EndP\HCode{<section class="titlepage">}\NoFonts}%
{\EndNoFonts\HCode{</section>}}%
{\HCode{<h2 class="titleHead">}}{\HCode{</h2>}}
\EndPreamble


see also some documentation details on \maketitle configuration. What is interesting is use of \NoFonts ... \EndNoFonts, which suppress insertion of <span> elements with font information. Resulting elements:

 <section class="titlepage">

<h2 class="titleHead">My title</h2>
<div class="author" >My Author</div><br />
<div class="date" >2016</div>

</section>

• I assume your code should be used as a custom configuration file specified at compilation time, isn't it? I inserted the \Configure instruction after \begin{document} in my custom configuration file and it works. – mmj Sep 8 '16 at 17:50
• @mmj sure, I always post custom configuration files, I didn't mention it this time :) – michal.h21 Sep 8 '16 at 18:00