Writing Sample #20
This writing sample explains how to create footnotes in a DITA topic.
How to create footnotes in DITA
Use the <fn>
element to create footnotes in a DITA topic.1
You can create footnotes in paragraphs and in tables.
You can specify letters, numbers, or symbols by including the
@callout
attribute.You can repeat footnotes when necessary.
Create a footnote
Use the DITA <fn>
element to create a footnote.
This is an example of a paragraph that uses the DITA footnote element. When you publish your document, DITA typically places the footnote at the bottom of the page.2
Sample <fn> code:
<p>
This is an example of a paragraph that uses the DITA footnote element.
When you publish your document, the footnote is typically placed
at the bottom of the page.<fn>You can control the placement of footnotes
using CSS or other output processing techniques.</fn>.
</p>
Note: Use the @deliveryTarget
attribute to specify a document type (html
, pdf
, epub
).
For example:
<fn deliveryTarget="html">You can control the placement of footnotes using CSS
or other output processing techniques.</fn>
Repeat a footnote
Add an @id
attribute to the <fn>
element to repeat a footnote and use the <xref>
element for each repeating instance of the footnote. Here is an example:
I like pets. At my house, I have a dog,3
a cat,3
and a llama.3
Sample code to repeat a footnote:
<p>
I like pets. <fn id="reuse-fn">This is the name of an animal.</fn>
At my house, I have
a dog<xref href="testtopic.dita#testtopic/reuse-fn" type="fn"/>,
a cat<xref href="testtopic.dita#testtopic/reuse-fn" type="fn"/>,
and a llama<xref href="testtopic.dita#testtopic/reuse-fn" type="fn"/>.
</p>
The <xref>
element uses the @href
attribute as a relative path to the topic that holds the original <fn>
element, even if it is the footnote’s source topic.
Create a Footnote in a table
Here is an example of a table that uses the DITA <fn>
element along with the @callout
attribute:
The text in this table column needs a footnote.a
This table text also needs a footnote.b
Using the @callout attribute in a footnote:
<p>
<strow>
<stentry>
The text in this table column needs
a footnote.<fn callout="a">Footnote for first column.</fn>
</stentry>
<stentry>
This table text also needs
a footnote.<fn callout="b">Footnote for second table column.</fn>
</stentry>
</strow>
</p>
Footnote Placement
When you publish your document, DITA typically places footnotes at the bottom of the page. To distinguish between paragraph and table footnotes, you can use numbered callouts for footnotes in paragraphs (1,2,3) and alphabetical callouts for footnotes in tables (a,b,c).
Creating manual footnotes for specific placement
As an alternative to using the <fn>
element, you can use the <sup>
element to manually create and build a superscript callout. You can then place the footnotes at any location. For example, instead of a table’s associated footnotes appearing at the bottom of the page, you can place them immediately after the table:
Sample table using manual footnotes:
This is a table entry.c
This is another table entry.d
c. Manual footnote for the first row. d. Manual footnote for the second row.
1 Source: Oasis 3.2.2.16 <fn>
2 You can control the placement of footnotes using CSS or other output processing techniques.
3 This is the name of an animal.
a Footnote for the first column.
b Footnote for the second table column.
Last updated