|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
|
Packit Service |
76cb02 |
<section id="sec-section-num">
|
|
Packit Service |
76cb02 |
<title>Chapter and Section numbering</title>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<section>
|
|
Packit Service |
76cb02 |
<title>Depth of Section numbering and Table Of Content</title>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para><command>Dblatex</command> relies on latex to automatically compute the
|
|
Packit Service |
76cb02 |
chapter and section numbers. It also relies on latex to produce the headings
|
|
Packit Service |
76cb02 |
with these numbers, and to produce the Table Of Content containing these
|
|
Packit Service |
76cb02 |
entries.</para>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para>Some specific sections like <sgmltag>preface</sgmltag>,
|
|
Packit Service |
76cb02 |
<sgmltag>colophon</sgmltag>, or <sgmltag>dedication</sgmltag> are not numbered
|
|
Packit Service |
76cb02 |
because they are displayed in front and back matters, but they can be listed in
|
|
Packit Service |
76cb02 |
the TOC if the related parameters are set
|
|
Packit Service |
76cb02 |
(<parameter>dedication.tocdepth</parameter>, <parameter>preface.tocdepth</parameter>, <parameter>colophon.tocdepth</parameter>).</para>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para>More generally you can configure the depth of the chapter and section
|
|
Packit Service |
76cb02 |
numbering with the parameter <parameter>doc.section.depth</parameter>, and the
|
|
Packit Service |
76cb02 |
depth of the entries in the TOC with the parameter
|
|
Packit Service |
76cb02 |
<parameter>toc.section.depth</parameter></para>.
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para>Note however that an unumbered section
|
|
Packit Service |
76cb02 |
becomes an informal component, and therefore you can only link to such a section
|
|
Packit Service |
76cb02 |
by using a specific xrefstyle because their label built with the
|
|
Packit Service |
76cb02 |
automatic number does not exist anymore. The other drawback is that
|
|
Packit Service |
76cb02 |
all the sections included in an unnumbered section or chapter are
|
|
Packit Service |
76cb02 |
unnumbered.</para>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</section>
|
|
Packit Service |
76cb02 |
<section>
|
|
Packit Service |
76cb02 |
<title>Using the latex style for section numbering</title>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para>A well customized latex style can be a powerfull yet versatile
|
|
Packit Service |
76cb02 |
alternative to the use of section and/or TOC depth parameter. With some latex
|
|
Packit Service |
76cb02 |
packages you can easily format the headings to remove the numbers, or transform them. See <xref linkend="sec-custom-latex"/> to know how to use your own latex
|
|
Packit Service |
76cb02 |
style with <command>dblatex</command>.</para>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para>The benefit of this method is that you can fully control how the titles
|
|
Packit Service |
76cb02 |
must be displayed, you do not have to play with latex counters to have the right
|
|
Packit Service |
76cb02 |
depth, and the sections do not lost their formal number label.</para>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para>The following example shows how you can customize the chapter title by
|
|
Packit Service |
76cb02 |
using the latex package titlesec, and shows how to remove the chapter label in
|
|
Packit Service |
76cb02 |
the Table Of Content with the package titletoc. Look in particular in the
|
|
Packit Service |
76cb02 |
listing where text is emphasized.</para>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para><programlisting language="tex">
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
%% Example 1: Redefines the heading to remove the chapter label
|
|
Packit Service |
76cb02 |
%% The 2nd parameter only contains \filcenter without any label
|
|
Packit Service |
76cb02 |
\titleformat{\chapter}[block]
|
|
Packit Service |
76cb02 |
{\filcenter\huge}{]]><emphasis role="bold"></emphasis>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
%% Example 2: Put the chapter number in word
|
|
Packit Service |
76cb02 |
%% The title of the first chapter is then displayed like this:
|
|
Packit Service |
76cb02 |
%% "Chapter One <chapter title>"
|
|
Packit Service |
76cb02 |
\newcommand\makeletterof[1]{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{1}}{ONE}{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{2}}{TWO}{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{3}}{THREE}{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{4}}{FOUR}{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{5}}{FIVE}{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{6}}{SIX}{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{7}}{SEVEN}{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{8}}{EIGHT}{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{9}}{NINE}{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{10}}{TEN}{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{11}}{ELEVEN}{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{12}}{TWELVE}{%
|
|
Packit Service |
76cb02 |
#1}}}}}}}}}}}}}
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
\titleformat{\chapter}[block]
|
|
Packit Service |
76cb02 |
{\filcenter\ttfamily\huge}%
|
|
Packit Service |
76cb02 |
{]]><emphasis role="bold"></emphasis>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
%% Make TOC entries for chapters without label
|
|
Packit Service |
76cb02 |
\usepackage{titletoc}
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
\titlecontents{chapter} %
|
|
Packit Service |
76cb02 |
[1.5em] %
|
|
Packit Service |
76cb02 |
{\addvspace{1em plus 0pt}\bfseries} %
|
|
Packit Service |
76cb02 |
{]]><emphasis role="bold"></emphasis>
|
|
Packit Service |
76cb02 |
{\hspace{-1.3em}} %
|
|
Packit Service |
76cb02 |
{\hfill \contentspage} %
|
|
Packit Service |
76cb02 |
[\addvspace {0pt}]
|
|
Packit Service |
76cb02 |
]]></programlisting></para>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</section>
|
|
Packit Service |
76cb02 |
<section>
|
|
Packit Service |
76cb02 |
<title>Using the <sgmltag>label</sgmltag> attribute</title>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para>If you need to mix numbered and not numbered chapters, the numbering depth
|
|
Packit Service |
76cb02 |
parameters will not help. The latex style will not easily detect that for
|
|
Packit Service |
76cb02 |
some chapters the number should be displayed and for others it should not.
|
|
Packit Service |
76cb02 |
</para>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para>To mix numbered and unnumbered chapters you can use a label with an
|
|
Packit Service |
76cb02 |
empty string for the chapters that must not be numbered, as shown by the example
|
|
Packit Service |
76cb02 |
below.</para>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para><programlisting language="XML">
|
|
Packit Service |
76cb02 |
<emphasis role="bold">label=""</emphasis><title>Introduction</title>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</chapter>
|
|
Packit Service |
76cb02 |
<chapter id="before" ]]><emphasis role="bold">label=""</emphasis><title>Pre-requisite</title>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</chapter>
|
|
Packit Service |
76cb02 |
<chapter id="chap1"><title>First chapter</title>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</chapter>
|
|
Packit Service |
76cb02 |
...
|
|
Packit Service |
76cb02 |
<chapter id="after" ]]><emphasis role="bold">label=""</emphasis><title>Conclusion</title>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</chapter>
|
|
Packit Service |
76cb02 |
...
|
|
Packit Service |
76cb02 |
]]></programlisting></para>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para>You can also set a label to a specific integer to force a section
|
|
Packit Service |
76cb02 |
counter. In this case there is no more automatic numbering. The automatic
|
|
Packit Service |
76cb02 |
numbering then applies to the following sections that increment the counter
|
|
Packit Service |
76cb02 |
set for this section if there is no label.</para>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<para><programlisting language="XML">
|
|
Packit Service |
76cb02 |
<emphasis role="bold">label="2"</emphasis><title>Introduction</title>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<section id="s1" ]]>
|
|
Packit Service |
76cb02 |
role="bold">label="3"</emphasis><title>Section 2.3</title>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<section id="s11" ]]>
|
|
Packit Service |
76cb02 |
role="bold">label="4"</emphasis><title>Section 2.3.4</title>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</section>
|
|
Packit Service |
76cb02 |
</section>
|
|
Packit Service |
76cb02 |
</chapter>
|
|
Packit Service |
76cb02 |
]]></programlisting></para>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</section>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</section>
|