5

I've found on the net a useful trick that does exactly what the title says. This is the code:

\newcommand{\mymarginpar}[1]{%
\vadjust{\smash{\llap{\parbox[t]{\marginparwidth}{#1}\kern\marginparsep}}}}

It works fine, the only problem is that the note is created in the left margin. Is it possible to put it in the right margin instead?

uldi
  • 125

1 Answers1

4

An equivalent definition for right-side margin paragraphs would be:

\newcommand{\lmarginpar}[1]{%
  \vadjust{\smash{\llap{\parbox[t]{\marginparwidth}{\strut#1}\kern\marginparsep}}}}
\newcommand{\rmarginpar}[1]{%
  \vadjust{\smash{\rlap{\hspace*{\dimexpr\linewidth+\marginparsep}\parbox[t]{\marginparwidth}{\strut#1}}}}}

\lmarginpar sets a left-overlap of a paragraph of width \marginparwidth plus a right-hand gap of \marginparsep. \rmarginpar sets a left-hand gap of \linewidth+\marginparsep followed by a paragraph of width \marginparwidth.

Werner
  • 603,163