Jump to content

LaTeX/Footnotes and Margin Notes

From Wikibooks, open books for an open world

LaTeX

Getting Started
  1. Introduction
  2. Installation
  3. Installing Extra Packages
  4. Basics
  5. How to get help

Common Elements

  1. Document Structure
  2. Text Formatting
  3. Paragraph Formatting
  4. Colors
  5. Fonts
  6. List Structures
  7. Special Characters
  8. Internationalization
  9. Rotations
  10. Tables
  11. Title creation
  12. Page Layout
  13. Customizing Page Headers and Footers‎
  14. Importing Graphics
  15. Floats, Figures and Captions
  16. Footnotes and Margin Notes
  17. Hyperlinks
  18. Labels and Cross-referencing
  19. Initials

Mechanics

  1. Errors and Warnings
  2. Lengths
  3. Counters
  4. Boxes
  5. Rules and Struts

Technical Text

  1. Mathematics
  2. Advanced Mathematics
  3. Theorems
  4. Chemical Graphics
  5. Algorithms
  6. Source Code Listings
  7. Linguistics

Special Pages

  1. Indexing
  2. Glossary
  3. Bibliography Management
  4. More Bibliographies

Special Documents

  1. Scientific Reports (Bachelor Report, Master Thesis, Dissertation)
  2. Letters
  3. Presentations
  4. Teacher's Corner
  5. Curriculum Vitae
  6. Academic Journals (MLA, APA, etc.)

Creating Graphics

  1. Introducing Procedural Graphics
  2. MetaPost
  3. Picture
  4. PGF/TikZ
  5. PSTricks
  6. Xy-pic
  7. Creating 3D graphics

Programming

  1. Macros
  2. Plain TeX
  3. Creating Packages
  4. Creating Package Documentation
  5. Themes

Miscellaneous

  1. Modular Documents
  2. Collaborative Writing of LaTeX Documents
  3. Export To Other Formats

Help and Recommendations

  1. FAQ
  2. Tips and Tricks

Appendices

  1. Authors
  2. Links
  3. Package Reference
  4. Sample LaTeX documents
  5. Index
  6. Command Glossary

edit this boxedit the TOC


Footnotes

[edit | edit source]

Footnotes are a very useful way of providing extra information to the reader. Usually, it is non-essential information which can be placed at the bottom of the page. This keeps the main body of text concise.

The footnote facility is easy to use. The command you need is: \footnote{text}. Do not leave a space between the command and the word where you wish the footnote marker to appear, otherwise LaTeX will process that space and will leave the output not looking as intended.

Creating a footnote is easy.\footnote{An example footnote.}

LaTeX will obviously take care of typesetting the footnote at the bottom of the page. Each footnote is numbered sequentially - a process that, as you should have guessed by now, is automatically done for you.

If you want your footnote to be at the bottom of the page (instead of the default position of `glued` under the text), consider using:

\usepackage[bottom]{footmisc}

You can also choose to place the footnote text manually. In this case we use the \footnotemark-\footnotetext duo:

\footnotemark
% ...
Somewhere else\footnotetext{This is my footnote!}

The footnote number can also be explicitly specified.

\footnotemark[17]
% ...
Somewhere else\footnotetext[17]{This is my footnote!}

Customization

[edit | edit source]
  • Enumeration/counter style

It is possible to customize the footnote marking. By default, they are numbered sequentially (Arabic). However, without going too much into the mechanics of LaTeX at this point, it is possible to change this using the following command (which needs to be placed at the beginning of the document, or at least before the first footnote command is issued).

\renewcommand{\thefootnote}{\arabic{footnote}} Arabic numerals, e.g., 1, 2, 3...
\renewcommand{\thefootnote}{\roman{footnote}} Roman numerals (lowercase), e.g., i, ii, iii...
\renewcommand{\thefootnote}{\Roman{footnote}} Roman numerals (uppercase), e.g., I, II, III...
\renewcommand{\thefootnote}{\alph{footnote}} Alphabetic (lowercase), e.g., a, b, c...
\renewcommand{\thefootnote}{\Alph{footnote}} Alphabetic (uppercase), e.g., A, B, C...
\renewcommand{\thefootnote}{\fnsymbol{footnote}} A sequence of nine symbols, try it and see!

To make a footnote without number mark use this declaration:

\let\thefootnote\relax\footnote{There is no number in this footnote}

In this way, the numbering is switched off globally. To have only one footnote without number mark, the above command has to be placed inside { }. Nevertheless, in that case, the current footnote counter is still incremented, so for instance you'd get footnote 1, unnumbered, and 3. A better solution[1] consists in defining the following macro in the preamble, and to use it:

\makeatletter
\def\blfootnote{\xdef\@thefnmark{}\@footnotetext}
\makeatother

The package footmisc offers many possibilities for customizing the appearance of footnotes. It can be used, for example, to use a different font within footnotes.

Reset counter

[edit | edit source]
  • every section
\makeatletter
\@addtoreset{footnote}{section}
\makeatother
  • every page

(This may require running LaTeX twice)

\usepackage{perpage} %the perpage package
\MakePerPage{footnote} %the perpage package command

Referencing a footnote

[edit | edit source]

Can be done by placing a \label{labelName} in the end of the footnote and use \ref{labelName} to refer to the footnote.

Common problems and workarounds

[edit | edit source]
  • Footnotes don't work with tables, as it is considered a bad practice. You can overcome this limitation with several techniques: you can use \footnotemark[123] in the table, and \footnotetext[123]{HelloWorld!} somewhere on the page. The same with references: use \footnote{HelloWorld!\label{fnote}} somewhere on the page and \textsuperscript{\ref{fnote}} in the table. Or, you can add \usepackage{footnotehyper} and \makesavenoteenv{tabular} to the preamble, and put your table environment in a \begin{savenotes} environment. The latter does not work with the packages color or colortbl. See this FAQ page for other approaches (such as the use of tablenotes with threeparttable).
  • Footnotes also don't work inside minipage environment. (In fact, several environments break footnote support. The \makesavenoteenv{environmentname} command of the footnote package might fix most.) The minipage includes its own footnotes, independent of the document's. The package mpfnmark allows greater flexibility in managing these two sets of footnotes.
  • If the text within the footnote is a URL (using \url or \href commands) with special characters, it will not compile. You must either escape the characters with a leading backslash, or use another command.
  • If the text within the footnote is very long, LaTeX may split the footnote over several pages. You can prevent LaTeX from doing so by increasing the penalty for such an operation. To do this, insert the following line into the preamble of your document:
\interfootnotelinepenalty=10000

or setting \samepage after footnote command:

\footnote{ \samepage text of the footnote follows }

  • To make multiple references to the same footnote, you can use the following syntax:
Text that has a footnote\footnote{This is the footnote} looks like this. Later text referring to the same footnote\footnotemark[\value{footnote}] uses the other command.

If you need hyperref support, use instead:

Text that has a footnote\footnote{This is the footnote}\addtocounter{footnote}{-1}\addtocounter{Hfootnote}{-1} looks like this. Later text referring to the same footnote\footnotemark uses the other command.

These approaches will not work if there are other footnotes between the first reference and the subsequent "duplicate" references. For more general solutions, see here and here.

  • If the footnote is intended to be added to the title of a chapter, a section, or similar, two methods can be used:
  1. Write \section[title] {title\footnote{I'm a footnote referred to the section} } where title is the title of the section.
  2. Use the footmisc package, with package option stable, and simply add the footnote to the section title.

Margin Notes

[edit | edit source]
A margin note.

Margin Notes are useful during the editorial process, to exchange comments among authors. To insert a margin note use \marginpar{margin text}. For one-sided layout (simplex), the text will be placed in the right margin, starting from the line where it is defined. For two-sided layout (duplex), it will be placed in the outside margin and for two-column layout it will be placed in the nearest margin.

To swap the default side, use \reversemarginpar and margin notes will then be placed on the opposite side, which would be the inside margin for two-sided layout.

If the text of your marginpar depends on which margin it is put in (say it includes an arrow pointing at the text or refers to a direction as in "as seen to the left..."), you can use \marginpar[left text]{right text} to specify the variants.

To insert a margin note in an area that \marginpar can't handle, such as footnotes or equation environments, use the package marginnote.

Another option for adding colored margin notes in a fancy way provides the package todonotes by using \todo{todo note}. It makes use of the package pgf used for designing and drawing with a huge tool database.

The packages mparhack and marginnote can be used if the native \marginpar command does not meet your needs.

Margin geometry (bottom margin H not shown).

The marginnote and geometry package can set the widths of the margins and marginnotes as follows.

In the preamble, insert

\usepackage{marginnote}

and use the geometry package with custom sizes:

\usepackage[top=Bcm, bottom=Hcm, outer=Ccm, inner=Acm, heightrounded, marginparwidth=Ecm, marginparsep=Dcm]{geometry}

where A, B, C, D, E, F, G, H are all numbers in cm (of course other units than cm can be used).

In the main text, employ the marginnote package according to:

\marginnote{typeset text here...}[Fcm]

Specifically,

  • marginparwidth (E) is the width of the margin note,
  • marginparsep (D) is the separation between the paragraph and the margin note,
  • F is the downwards vertical offset from the first line the margin note was written (negative values of F shift the margin note upwards), and
  • the value G = C − (D + E) is the separation between the edge of the margin note and the edge.

The example on the right was typeset by the following:

\documentclass[a4paper,twoside,english]{article}
\usepackage{lmodern}
\renewcommand{\sfdefault}{lmss}
\usepackage[T1]{fontenc}

\makeatletter
\special{papersize=\the\paperwidth,\the\paperheight}

\usepackage{lipsum}
\usepackage{marginnote}
\usepackage[top=1.5cm, bottom=1.5cm, outer=5cm, inner=2cm, heightrounded, marginparwidth=2.5cm, marginparsep=2cm]{geometry}

\makeatother

\usepackage{babel}
\begin{document}

\section{Margin notes}

\marginnote{This is a margin note using the geometry package, set at 0cm vertical offset to the first line it is typeset.}[0cm]
\marginnote{This is a margin note using the geometry package, set at 5cm vertical offset to the first line it is typeset.}[5cm]
\lipsum[1-10]
\end{document}

Additionally, the minimum vertical gap between margin notes can be adjusted with \marginparpush, such as with \setlength{\marginparpush}{0pt}.

Notes and References

[edit | edit source]
  1. "LaTeX footnotes". Retrieved 2016-01-14.

This page uses material from Andy Roberts' Getting to grips with LaTeX with permission from the author.


Previous: Floats, Figures and Captions Index Next: Hyperlinks