The marginnote package
Places notes in the page margin with \marginnote, also in places where \marginpar fails: inside figures, footnotes and boxes.
Loading the package
\usepackage{marginnote}\marginpar creates a float. Inside a figure, a footnote or a minipage it stops with Not in outer par mode or Float(s) lost. \marginnote is not a float and works in all of these places.
The price: LaTeX moves a \marginpar down when it would overlap the previous one, and \marginnote stays where it is. Two notes close together can overlap; shift one with the optional offset argument.
Main commands
\marginnote{text} | Note in the margin, level with the current line. |
\marginnote{text}[1cm] | The same note moved down by 1cm; a negative value moves it up. |
\marginnote[left text]{right text} | Different text for a note that lands in the left margin. |
\renewcommand{\marginfont}{\footnotesize\itshape} | Font of all margin notes. |
\reversemarginpar | Puts the notes in the opposite margin; \normalmarginpar switches back. |
Complete example
\documentclass{article}
\usepackage{marginnote}
\renewcommand{\marginfont}{\footnotesize\itshape}
\begin{document}
The result differs from the earlier study.\marginnote{Check the source.}
A second sentence fills the line.
\begin{figure}[h]
\centering
\fbox{A figure}\marginnote{Note next to a figure}
\caption{A figure with a margin note}
\end{figure}
\end{document}Compiled with pdfLaTeX from TeX Live 2023. Tools run in this order: pdflatex → pdflatex.
Pitfalls
- In a two-sided document the package reads the page of each note from the
.auxfile to choose the outer margin. After a change, the notes are on the correct side from the second run on. - The margin must be wide enough for the note; its width is
\marginparwidth, whichgeometrysets with the optionmarginparwidth.
Related pages
- Error Not in outer par mode
- Error Float(s) lost
- Error Marginpar on page 1 moved
- Package
todonotes