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>

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">

How can I obtain that?

Thanks in advance.


You can use \Configure{maketitle}:

\Configure{maketitle}{\ifvmode\IgnorePar\fi\EndP\HCode{<section class="titlepage">}\NoFonts}%
{\HCode{<h2 class="titleHead">}}{\HCode{</h2>}}

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>

  • 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

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.