2

Is there a way to add annotations to the margins beside items of an enumeration?

Consider for example the following pseudo-code:

\documentclass{article}

\usepackage{enumerate}
\begin{document}
\begin{enumerate}[a)}
\specialitem[First annotation] First item %% "First annotation" should appear on the margin beside the first item
\specialitem[second annotation] Second item %% %% "First annotation" should appear on the margin beside the first item
\end{document}

If so, how can I adjust it, such that the annotations are aligned to the top, center or bottom of the item and appear on the left or on the right margin beside the item?

Note that I want for each item an individual (small) text on the margin, not something auto-generated. The automatic enumeration "[a)]" in my case should not be affected by this, the note on the margin should be additional to the automatic enumeration!

1

2 Answers 2

2

I'm not entirely sure how to manage that manually, but perhaps it will suffice to use another documentclass: Tufte-LaTeX (Link 1, Link 2) offers this feature and works quite well. Looks nice too, as you can see below.

Hope that helps.

enter image description here

2
  • 1
    Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. In particular, your answer does not fit our format - we prefer them to stand alone, and answers that only link to other sites should be comments. Welcome! :)
    – cmhughes
    Jun 5, 2014 at 21:19
  • Like @cmhughes said, this answer should really be self-contained and not just a 'link-only' answer.
    – Adam Liter
    Jun 5, 2014 at 21:58
1

You could grab the optional argument of \specialitem, and set it as a regular \item with a \marginnote:

enter image description here

\documentclass{article}
\usepackage{enumerate,marginnote}

\newcommand{\specialitem}[1][]{%
  \if$#1$
    \item% Empty optional argument
  \else
    \item\marginnote{\small #1}% Non-empty optional argument
  \fi}

%\reversemarginpar% To change display on eleft/right of page

\begin{document}
\begin{enumerate}[a)]
  \specialitem[First annotation] First item % "First annotation" should appear on the margin beside the first item
  \specialitem Second item 
  \item Third item
  \specialitem[Fourth annotation] Fourth item % "Fourth annotation" should appear on the margin beside the fourth item
\end{enumerate}
\end{document}

Also see Different command definitions with and without optional argument on how to test for the contents of an optional argument.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .