## B.4 Sectioning

- Sectioning Commands
- The Appendix
- Table of Contents
- Use HACHA

### B.4.1 Sectioning Commands

Sectioning commands from `\part` down to `\subparagraph` are defined in base style files. They accept an optional argument and have starred versions.

The non-starred sectioning commands from `\part` down to `\subsubsection` show section numbers in sectional unit headings, provided their level is greater than or equal to the current value of the `secnumdepth` counter. Sectional unit levels and the default value of the `secnumdepth` counter are the same as in LATEX. Furthermore, given a sectional unit secname, the counter secname exists and the appearance of sectional units numbers can be changed by redefining `\the` secname. For instance, the following redefinition turn the numbering of chapters into alphabetic (uppercase) style:

    \renewcommand{\thechapter}{\Alph{chapter}}

When jumping to anchors, browsers put the targeted line on top of display. As a consequence, in the following code:

    \section{A section}
    \label{section:section}
     ...
    See Section~\ref{section:section}

Clicking on the link produced by `\ref{section:section}` will result in not displaying the targeted section title. A fix is writing:

    \section{\label{section:section}A section}
     ...
    See Section~\ref{section:section}

Starting with version 2.04, HEVEA and HACHA will use the label name (`section:section` above) for the table of contents they generate. For instance, the source code for the next sectioning command just below is:

    \subsection{The \label{appendix}Appendix}

As a consequence, the link to the next section on top of this page should read as:

    <a href="sectioning.html#appendix">The Appendix</a>

That is, HEVEA used the label name given in source as an anchor. Notice that this behaviour applies to the `\label` command that occurs first in the sectioning command argument.

### B.4.2 The Appendix

The `\appendix` command exists and should work as in LATEX.

### B.4.3 Table of Contents

HEVEA now generates a table of contents, using a procedure similar to the one of LATEX(a .htoc file is involved). One inserts this table of contents in the main document by issuing the command `\tableofcontents`. Table of contents is controlled by the counter `tocdepth`. By default, the table of contents shows sectioning units down to the subsubsection level in article style and down to the subsection level in book (or report) style. To include more or less sectioning units in the table of contents, one should increase or decrease the `tocdepth` counter. It is important to notice that HEVEA produces such a table of contents, only when it has total control over cross-references. More precisely, HEVEA cannot produce the table of contents when it reads LATEX-produced .aux files. Instead, it should read its own .haux files. This will naturally occur if no .aux files are present, otherwise these .aux files should be deleted, or HEVEA should be instructed not to read them with the command-line option -fix (see Sections B.11.1 and C.1.1.4).

One can also add extra entries in the table of contents by using the command `\addcontentslines`, in a way similar to LATEX homonymous command. However, hyperlinks need to be introduced explicitly, as in the following example, where an anchor is defined in the section title and referred to in the argument to `\addcontentsline`:

    \subsection*{\aname{no:number}{Use \hacha{}}}
    \addcontentsline{toc}{subsection}{\ahrefloc{no:number}{Use \hacha{}}}

(See Section 8.1.1 for details on commands related to hyperlinks.)

There is no list of figures nor list of tables.

### Use HACHA

However, HEVEA has a more sophisticated way of producing a kind of map w.r.t. the sectioning of the document. A later run of HACHA on HEVEA output file splits it in smaller files organized in a tree whose nodes are tables of links. By contrast with LATEX, starred sectioning commands generate entries in these tables of contents. Table of contents entries hold the optional argument to sectioning commands or their argument when there is no optional argument. Section 7 explains how to control HACHA.