Footnotes, Margin Notes, and Code Formatting
Footnotes add supporting information without interrupting the body, margin notes provide brief reminders, and code should use inline monospace, verbatim text, or highlighted blocks according to its length. Use all three sparingly.
EasyLaTeX compiler setting: pdfLaTeX; margin notes use marginnote and code blocks use listings. The latter works well for the ASCII examples here but has limited Unicode support. For multilingual code, choose a suitable verbatim or highlighting setup with a Unicode-capable engine.
Adding Footnotes
Use \footnote{...} at the point that needs explanation:
This term uses the standard industry definition\footnote{The wording may vary slightly between standards.}.
LaTeX numbers footnotes and places them at the bottom of the page. Use them for sources, exceptions, or brief explanations rather than a new extended argument.
Separating the Marker and Text
Where an ordinary footnote does not work directly, such as some table or heading contexts, separate its marker and text:
Table Caption\footnotemark
...
\footnotetext{These data have been rounded.}
Keep them close together on the same page and pair them in order. For complex table footnotes, follow the template or use a table-specific solution.
Margin Notes
LaTeX provides \marginpar; \marginnote is useful for short annotations at the current position:
\usepackage{marginnote}
This conclusion needs verification.\marginnote{Source needed}
Margin notes consume margin space, and two-sided documents require attention to which side they occupy. Keep them short to avoid collisions with headers, footnotes, or other notes.
Inline Code
Use \texttt for short commands, filenames, and variables:
The main file is usually named \texttt{main.tex}.
Use \verb|...| for literal content that does not contain the chosen delimiter:
\verb|\section{Heading}|
\verb cannot be used in command arguments such as section headings, captions, or ordinary footnotes. Use escaped text with \texttt or an appropriate package command there.
Code Blocks
Use verbatim for a small amount of literal text:
\begin{verbatim}
main.tex
figures/result.pdf
\end{verbatim}
Use listings for numbering, line wrapping, or syntax highlighting:
\usepackage{listings}
\usepackage{xcolor}
\lstset{
basicstyle=\ttfamily\small,
frame=single,
breaklines=true
}
\begin{lstlisting}[language=Python]
total = sum(values)
print(total)
\end{lstlisting}
Preserve indentation and explain the block's inputs, outputs, or purpose rather than presenting an unexplained fragment.
Common Problems
Footnotes Move to the Next Page
This can result from insufficient space. Shorten the note, restructure the body, or move the related sentence to the next page. Avoid forcing the note back with large negative spaces.
Margin Notes Overlap
Shorten them, reduce their number per page, or use footnotes. Margin notes are unsuitable for dense annotation or essential body content.
Non-ASCII Text Is Garbled in listings
listings has limited Unicode support. Keep it for supported code, or use a Unicode-capable verbatim or highlighting setup already configured by the project template.
Complete Example
\documentclass[a4paper,12pt]{article}
\usepackage{marginnote}
\usepackage{listings}
\usepackage{xcolor}
\lstset{basicstyle=\ttfamily\small, frame=single, breaklines=true}
\begin{document}
Use \texttt{main.tex} as the main file\footnote{The project's single build entry point.}.
\marginnote{Check the engine before compiling}
\begin{lstlisting}[language=Python]
total = sum(values)
print(total)
\end{lstlisting}
\end{document}