[Tex/LaTex] How to force Sections to be Heading2 H2 in Plastex

latex2htmltex4ht

Plastex is open source (Python) translator from LaTeX to HTML.

https://github.com/tiarno/plastex

It does a really good job, producing very clean HTML.
For those of use that use LateX for writing from a letter to a 450 page book, it turns out that, through Plastex, LaTeX can be used to easily produce Websites without any knowledge of HTML, etc.

However, when translating a Book \documentclass{book} into HTML, Plastex labels Chapter titles and Sections titles, both as H1. Subsetions get to be H2.

How can I change the behavior of Plastex to make Chapters H1, Sections H2, and Subsections H3?

Best Answer

As suggested by Mike, @mike-renfro , I modified Sectioning.zpts to change the headinglevel of sections, etc. down one from h1 to h2. While I was at it, I added "bibliography" together with section at level h2 (I need chapter by chapter bibliography),

name: part chapter
<h1 tal:attributes="id self/id" tal:content="self/fullTitle">Morbi metus pede, imperdiet vitae</h1>
<p tal:replace="self"></p>

name: section bibliography
<h2 tal:attributes="id self/id" tal:content="self/fullTitle">Cras dignissim</h2>
<p tal:replace="self"></p>

name: subsection
<h3 tal:attributes="id self/id" tal:content="self/fullTitle">Velit id pharetra</h3>
<p tal:replace="self"></p>

name: subsubsection
<h4 tal:attributes="id self/id" tal:content="self/fullTitle">Donec elementum mauris vel urna</h4>
<p tal:replace="self"></p>

name: paragraph
<h5 tal:attributes="id self/id" tal:content="self/fullTitle">Duis orci</h5>
<p tal:replace="self"></p>

name: subparagraph subsubparagraph
<h6 tal:attributes="id self/id" tal:content="self/fullTitle">Mauris fringilla, metus</h6>
<p tal:replace="self"></p>

and thus I had to modify Bibliography.zpts to get h2 on the bibliography heading, as follows:

# <h1 tal:content="self/title">Bibliography</h1>
<h2 tal:content="self/title">Bibliography</h2>
Related Question