Next: A segmentation example Up: Hypertext Extensions to LaTeX Previous: A Cross-referencing example

## Document Segmentation

One of the greatest appeals of the World Wide Web is its high connectivity through hyperlinks. As we have seen, the LaTeX author can provide these links either manually or symbolically. Manual links are more tedious because a URL must be provided by the author for every link, and updated every time the target documents change. Symbolic links are more convenient, because the translator keeps track of the URLs. Earlier releases of LaTeX2HTML required the entire document to be processed together if it was to be linked symbolically. However, it was easy for large documents to overwhelm the memory capacities of moderate sized computers. Furthermore, processing time could become prohibitively high, if even a small change required the entire document to be reprocessed.

For these reasons, program segmentation was developed. This feature enables the author to subdivide his document into multiple segments  . Each segment can be processed independently by LaTeX2HTML. Hypertext links between segments can be made symbolically, with references shared through auxiliary files. If a single segment changes, only that segment needs to be reprocessed (unless a label is changed that another segment requires). Furthermore, the entire document can be processed without modification by LaTeX to obtain the printed version. The top level segment that LaTeX reads is called the parent segment. The others are called child segments.

Program segmentation does require a little more work on the part of the author, who will now have to untertake some of bookkeeping formerly performed exclusively by LaTeX2HTML. The following four LaTeX extensions carry out segmentation:

\segment{file}{sec-type}{heading} This commands indicates the start of a new program segment. This segment resides in file.tex, represents the start of a new LaTeX sectional unit of type sec-type (e.g., section, chapter, etc.), and has a heading of heading. A variation of this command, \segment*, is provided for segments that are not to appear in the table of contents. These commands perform the following operations in LaTeX:
1. The specified sectioning command is executed.
2. LaTeX will write its section and equation counters into an auxiliary file, named file.ptr. It will also write an \htmlhead command to this file. This information will tell LaTeX2HTML how to initialize itself for the new document segment.
3. LaTeX will then proceed to input and process the file, file.tex.
The \segment and \segment* commands are ignored by LaTeX2HTML.
\internal[type]{prefix} This command directs LaTeX2HTML to load intersegment information of type type from the file <prefix><type>.pl. Each program segment must be associated with a unique filename prefix, specified either through a command line option, or through the installation variable \$AUTO_PREFIX. The information type must be one of the following:
internals
This is the default type, which need not be given. It specifies that the internal labels from the designated segment are to be input and made available to the current segment.
contents
sections
Sectioning information is to be read in. Note that the segment containing the table of contents requires both contents and sections information from all other program segments.
figure
Lists of figures from other segments are to be read.
table
Lists of tables from other segments are to be read.
index
Index information from other segments are to be read.

\startdocument Only the parent segment contains \begin{document} and \end{document} statements. The child segments, therefore, cannot be processed separately by LaTeX (without modification). They can be processed separately by LaTeX2HTML, provided it is told where the end of the end the LaTeX preamble is. This is the function of the \startdocument directive. It substitutes for \begin{document} in child segments, but is otherwise ignored by both LaTeX and LaTeX2HTML.
\htmlhead{sec-type}{heading} This command is not normally placed in the document at all. It is automatically passed from parent to child via file.ptr. It identifies to LaTeX2HTML that the current segment is a LaTeX sectional unit of type sec-type, with the specified heading. This command is ignored by LaTeX itself.

Next: A segmentation example Up: Hypertext Extensions to LaTeX Previous: A Cross-referencing example

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