I am looking for a powerful and versatile tool for creating margin notes.

The way I intend to use margin notes is for clarifying mathematical notation and definitions that are not important enough to be clarified in the text. For instance, the symbol $\mathbb{N}$ sometimes refers to the non-negative whole numbers, and sometimes to the positive whole numbers. A margin note would clarify which is the correct interpretation. Or the non-standard use of the hash symbol # to denote the power of a set $x$, which is more usually denoted by a pair of vertical lines: $|x|$. A mathematics text contains many such minor details whose clarification should not, in my opinion, interrupt the flow of the main text. However, a clarifying margin note at the place of their first use would be helpful for the reader, and these notes can also be referenced in an index of symbols at the end of the work.

I find both the \marginpar command that is built into LaTeX (or into the article document class, I'm not sure which), as well as the marginnote package unsatisfactory.

The former is unsatisfactory because it often doesn't align the margin note with the main text line in which the corresponding \marginpar command occurs, even when there aren't any other margin notes in the vicinity, and the command provides no way of adjusting the margin note's vertical position.

The latter is unsatisfactory because when several margin notes occur in close range they overlap and require manual adjustment of their vertical position. Furthermore, this package is no longer maintained, as stated in the package's manual.

Another downside that applies to both options is that neither provides a way to indicate within the main text which margin note is relevant at the current point. Contrast this with footnotes.

A possible alternative that addresses this last issue is the todonotes package. However the underline a todonote draws across the entire corresponding main text line creates a visual clutter that is unappealing to me.

A todonote

Another possibility is using the wrapfig package to create floating margin notes, but this seems to require too much manual work for each and every margin note.

These considerations have led me to consider using a different document class than article, specifically memoir, or KOMAScript's scrartcl.

memoir seems to deal well with margin notes:

  1. Its \marginpar command aligns the margin notes with the line in which the command occurs.
  2. Closely occurring margin notes do not overlap.
  3. The \sidepar command enables manual adjustment of the margin note's vertical position. (However, I don't think they can be used together with \marginpar; it's a case of either-or.)
  4. The margin notes can be numbered and referenced from inside the main text by using the \footnotesinmargin command. (However, if I use this trick, I can no longer use footnotes, which is a problem.)
  5. The memoir class is actively maintained.

I don't know whether the scrartcl class provides similar functionality.

Another important consideration is that I will want to embed the margin notes in right-to-left Hebrew documents, using babel+lualatex as the language manager.

I welcome any input and suggestions concerning a powerful and versatile solution for margin notes.

A related post from over 12 years ago.

  • 1
    \marginpar usually aligns itself vertically with with the line you typed it. Note that you have to start the paragraph before you type the marginpar, thus if you want the \marginpar to be the first in the paragraph you need to write \leavevmode\marginpar{...}. Maybe that is the source of the problem? see tex.stackexchange.com/questions/16141/…
    – Udi Fogiel
    Dec 29, 2022 at 10:49
  • @UdiFogiel \marginpar also suffers from the problem that it cannot be embedded inside a math-mode formula, and when said formula is in display mode, the margin note cannot readily be made to align with the formula line to which it pertains.
    – Evan Aad
    Dec 29, 2022 at 11:33
  • Another related question: tex.stackexchange.com/questions/215322/… Note that marginfix uses this approach, only with better coding. Dec 29, 2022 at 15:27
  • you can suppress the line in todonotes with the noline option. And naturally one can redefine this line to do something different. But todonotes uses internally \marginpar so its behaviour is not really different to it. Dec 29, 2022 at 16:58
  • Related with point 4: tex.stackexchange.com/questions/68115/…
    – Fran
    Dec 31, 2022 at 8:07


You must log in to answer this question.

Browse other questions tagged .