[tex4ht] how to do selective splitting of large document at the unit level?

Nasser M. Abbasi nma at 12000.org
Sat Aug 10 12:13:57 CEST 2013

I have given up on this one. I looked at the documentation,
but too many options and too many configurations. Trying all
day with no success.

The goal is simple. Tell htlatex to split some chapter's
sections to separate HTML pages, but not for another chapter(s).

If I can figure how to do this, I can use it for sections and
other units.

Since it is possible to customized TOC per unit, I hope it is
possible to do the same for splitting as well.

Here is a diagram to explain what I'd like to get in the MWE

+-----------+    +-----> chapter 1 (SPLIT this)
| main TOC  |    |      +------------+
| chapter 1 |----+      | TOC        |        section 1
| chapter 2 |----+      | section 1  |------>+-----------+
+-----------+    |      | section 2  |---..  | section 1 |
                  |      +------------+       | ......    |
                  |                           +-----------+
                  |       chapter 2
                         | TOC        |
                         | section 1  |
                         | section 2  |
                         |section 1   |
                         | .....      |
                         |section 2   |
                         | ....       |
                          (DO NO SPLIT this chapter)

So, for chapter 1, which has sections in it, each section will be in
a separate page. But for chapter 2, which also has sections in it,
those remain in the same HTML page.

Is it possible to do the above? This must be done inside the Latex
file to be able to tell it which chapter or section to affect.

currently doing

    htlatex foo.tex "htm,3"

causes all chapters to split same way. I tried to use \CutAt{}
inside the latex document to control this splitting, but it is not working
at all (different strange results show up for different things
I tried).

Here is a MWE, and any suggestions how to do this will be great.

I have a large document, and there are places I want to split chapters
or sections to smaller units, and some other places where I do not
want to do this.

htlatex foo.tex "htm,3,notoc*"



\title{test cutat}

\ifx\HCode\undefined \else
\chapter{chapter 1}
\section{section 1 in chapter 1}
\subsection{subsection 1 in section 1 in chapter 1}
\subsection{subsection 2 in section 1 in chapter 1}
\subsubsection{subsubsection 1 subsection 2 in section 1 in chapter 1}

\ifx\HCode\undefined \else

\chapter{chapter 2}
\section{section 1 in chapter 2}
\subsection{subsection 1 in section 1 in chapter 2}
\subsection{subsection 2 in section 1 in chapter 2}


1. http://tug.org/applications/tex4ht/mn11.html#QQ1-11-51
2. http://www.cvr.cc/?p=504

thank you,

More information about the tex4ht mailing list