serhii.net

In the middle of the desert you can say anything you want

11 Apr 2024

Latex margin notes

Margin notes - Overleaf, Online-LaTeX-Editor:

\marginpar{text} is the vanilla option, but this works in all cases ever:

\usepackage{marginnote}
\marginnote{text}

EXCEPT I couldn’t find a way to add footnote markers to have numbered margin notes separate from the real footnotes.

But this solves everything, quoting directly1:

\newcounter{mgncount}
\renewcommand\themgncount{\arabic{mgncount} }
\newcommand\marginfootnote[1]{\refstepcounter{mgncount}\marginpar{{$^\themgncount$}#1}\footnotemark}

\begin{document}
Can we put a footnote with number in the margin and a number in the text?\marginfootnote{There's a number here!}

Another test\marginfootnote{Working!}

One more try\marginfootnote{Successful!}
\end{document}

EDIT: actually it doesn’t and uses the number from footnotes in the text itself. :(

Ah, the sidenotes package exists: https://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/sidenotes/sidenotes.pdf

But uses only 1…3-type numbers.

Yes this is it! CTAN: Paket sidenotesplus

%\usepackage{sidenotes}
\usepackage[mark=Alph]{sidenotesplus}
...

\sidenote{does basically what footnote does}

It has a lot of options and can do a lot of things, yes, this is it, it’s perfect. The example page has everything: https://ctan.math.illinois.edu/macros/latex/contrib/sidenotesplus/tests-sidenoteplus.pdf

See also CTAN: Marginal topic.

marginpar - Footnote and number in margin - TeX - LaTeX Stack Exchange


  1.  ↩︎
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus