Footnotes

Footnote Numbering Scope
End Notes

Footnote Numbering Scope

The foonotes are well handled by latex. Dblatex just takes care about special cases like footnotes in headings or in tables. Therefore the default latex behaviour is applied for footnote numbering.

By default the footnote numbers are reset for each new chapter. If you want to change the numbering scope, you can use the latex package chngcntr either in a customized latex style (see Chapter 4, Customization) or in the parameter latex.begindocument. The following example makes the footnote numbers document wide.

  <xsl:param name="latex.begindocument">
    <xsl:text>
% Want document wide footnotes
\usepackage{chngcntr}
\counterwithout{footnote}{chapter}
\begin{document}
    </xsl:text>
  </xsl:param>

End Notes

You can configure dblatex to manage the footnotes as endnotes. In this case the notes are expected to be displayed in a dedicated section. The following sections tell how to do this.

Writing a document with endnotes

To have footnotes behaving as endnotes, you just need to set the footnote.as.endnote to 1, and to put in your document an empty index element with the attribute type set to 'endnotes'. This index is supposed to be included in a section dedicated to contain the notes, and therefore it does not display any heading by itself. The section containing the endnotes index can also contain any other materials.

Example 3.15. Writing a document with endnotes

The following document contains some footnotes and a section for the End Notes:

<book>
  <chapter><title>A Chapter</title>
  <para>Bla bla<footnote id="fn1">First note</footnote> bla 
  bla<footnote id="fn2">Second note</footnote> ...</para>
  </chapter>

  <chapter><title>Another Chapter</title>
  <para>Bla bla<footnote id="fn3">Third note</footnote> bla 
  bla<footnote id="fn4">Fourth note</footnote> ...</para>
  </chapter>

  <chapter><title>End Notes</title>
  <para>This chapter contains all the notes of the book.</para>

  <index type="endnotes"/>
  </chapter>
</book>

dblatex is called with:

$ dblatex -P footnote.as.endnote=1 file.xml

Setup Properties

Currently the endnotes are handled by the latex package endnotes. You can customize its use with the endnotes.properties attribute set. This attribute set is filled by default with the values given by the internal attribute set endnotes.properties.default, and you can override the following attributes:

package
Recall the latex package in charge to handle the endnotes. Attribute provided for provision since currently there is no real alternative with well established packages.
heading
Macros to render the heading of the endnotes to display.
font-size
Macro specifying the font size to apply for each endnote. The package default is \footnotesize. The dblatex default is \normalsize.
note-format
Macros specifying how the render a end note. The package default is the same formatting that footnotes. The dblatex default is to print out endnotes like a numbered list.

The default setup:

<xsl:attribute-set name="endnotes.properties.default">
  <xsl:attribute name="package">endnotes</xsl:attribute>

  <!-- No header: endnotes are embedded in another section -->
  <xsl:attribute name="heading">\mbox{}\par</xsl:attribute>

  <!-- Show end notes as a numbered list -->
  <xsl:attribute name="font-size">\normalsize</xsl:attribute>
  <xsl:attribute name="note-format">%
  \leftskip=1.8em\noindent
  \makebox[0pt][r]{\theenmark.~~\rule{0pt}{\baselineskip}}\ignorespaces
  </xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="endnotes.properties"
                   use-attribute-sets="endnotes.properties.default"/>

Endnotes Setup from scratch

If you want to fully control the endnotes setup, add some other macros, you can directly override the template endnotes.setup, as shown by the example below. If the endnote setup is already defined in your latex style you can override the template to make it empty in order to avoid some conflict between the latex style definition and the default one done by dblatex.

<!-- Use the default endnotes package setup and change the heading -->
<xsl:template name="endnotes.setup">
  <xsl:text>\usepackage{endnotes}&#10;</xsl:text>
  <xsl:text>\def\enoteheading{\paragraph*{List Of Notes}%
  \mbox{}\par\vskip-\baselineskip}&#10;</xsl:text>
</xsl:template>

Grouping Endnotes

By default the endnotes are displayed for the whole document as a global list. You can configure dblatex to show the endnotes grouped per part or per chapter. A heading is put before each group of notes to recall the component (part, chapter, or another section) that contains these notes. The purpose is to make the research of the notes at the end of the document easier for the reader.

To group the endnotes according to the granularity you wish, you just need to set the endnotes.heading.groups with the expected section types separated by a space. For example, the following setup displays notes per part and per chapter:

  <xsl:param name="footnote.as.endnote" select="1"/>
  <xsl:param name="endnotes.heading.groups" select="'part chapter'"/>
Adding new Groups

By default dblatex can group the notes per chapter and/or per part, provided that the section type is declared in endnotes.heading.groups as explained previously. If you want to add another section type you need to override the template called in mode endnotes, and to add this type to the declared groups. Usually the endnotes mode template only calls the endnotes.add.header template. The example below makes a new group for preface.

  <xsl:param name="endnotes.heading.groups" select="'part chapter preface'"/>

  <xsl:template match="preface" mode="endnotes">
    <xsl:call-template name="endnotes.add.header">
      <xsl:with-param name="reset-counter" select="1"/>
    </xsl:call-template>
  </xsl:template>
Formatting the Headings text

You can use the parameter endnotes.heading.style to format the headings of the groups with the same syntax than xrefstyle does. The example below gives a template where the title and the page of the chapter containing the notes are displayed.

  <xsl:param name="endnotes.heading.style">
    <xsl:text>template:Notes of the chapter "%t", page %p</xsl:text>
  </xsl:param>
LaTeX Command to make the Headings

By default dblatex creates the headings of the groups with a section command whose level is just below the level of the endnotes section. For example, if the endnotes section is a chapter, the headings are created by using a \section* latex command. If the endnotes section is a section, the headings are done by using \subsection*, and so on.

If this behaviour does not fit your needs you can specify the command to use with the parameter endnotes.heading.command. It can be usefull if you want to format these heading in a specific way. The heading markup produced following the endnotes.heading.style template is passed as an argument of the specified command. The example below uses the command \enoteheader* to create the headings. It assumes that this macro is defined somewhere else (e.g. in a user latex style).

  <xsl:param name="endnotes.heading.command" select="'\enoteheader*'"/>
Endnotes Counter Scope

By default the endnotes counter restarts from one in each chapter or part when they are grouped. You can change this behaviour by overriding the endnotes.counter.resetby parameter that lists the section types where the counter is reset. If you want a global counter running for the whole document, just set the parameter empty.