next up previous contents index
Next: Hypertext Links in Bibliographic Up: Document Segmentation Previous: Document Segmentation

A segmentation example

The best way to illustrate document segmentation is through a simple example. Suppose that a document is to be segmented into one parent and two child segments. Let the parent segment be report.tex, and the the two child segments be sec1.tex, and sec2.tex. The latter are translated with filename prefixes of s1 and s2, respectively. This example is included with the version 96.1 distribution of LaTeX2HTML, with more prolific comments than are shown here.

The text of report.tex is given below:

\documentclass{article}          % Must use LaTeX 2e

\internal[figure]{s1}            % Include internal information
\internal[figure]{s2}            % from children

\begin{document}                 % The start of the document
\title{A Segmentation Example}

% Process the child segments:

\segment{sec1}{section}{Section 1 title}
\segment{sec2}{section}{Section 2 title}

This file obtains the information necessary to build an index, a table of contents and a list of figures from the child segments. It then proceeds and typesets these.

The first child segment, sec1.tex is shown below:

Here is some text.
\subsection{First subsection}
Here is subsection 1 \label{first}.
\colorbox{red}{Some red text\index{Color text}}
\caption[List of figure caption]{Figure 1 caption}
Reference\index{Reference} to \ref{second}.

The first thing this child segment does is establish the LaTeX packages it requires, then loads the counter information that was written by the \segment command that invoked it. Since this segment contains a symbolic reference (second) to the second segment, it must load the internal labels from that segment.

The final segment sec2.tex is shown below:

Here's is another section \label{second}.
Plus another\index{Reference, another} reference \ref{first}.
\fbox{The figure}
\caption{The caption}

This segment needs to load internal labels from the first one, because of the reference to first. These circular dependencies (two segments referencing each other) are either not allowed or handled incorrectly by the Unix utility make, without resorting to time stamps and some trickery. A time stamp is a zero-length file whose only purpose is to record its creation time. Besides evaluating segment interdependence, another function of make is to provide intersegment navigation information.

A sample makefile is included in the distribution which correctly generates the fully linked document. The first time it is invoked, it runs:

Proper operation of make depends on the fact that LaTeX2HTML updates its own internal label file only if something in its current program segment causes the labels to change from the previous run. This ensures that LaTeX2HTML is not run unnecessarily. It is also important that the information page be supressed by specifying -into "" on all but the last program segment.


next up previous contents index

Tim Love
Thu Mar 14 11:15:46 GMT 1996