4

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?

  • Why don't you use the package marginnote, which provides marginnotes, which are not floats? – Keks Dose Jul 14 '13 at 18:13
  • For no particular reason: I'd like to know in which way that command could be tweaked, as I can't figure it out on my own. I find it a neat solution. – uldi Jul 14 '13 at 18:19
  • \reversemarginpar could be your friend. – Count Zero Jul 14 '13 at 18:41
  • That command doesn't seem to have any effect on my code. – uldi Jul 14 '13 at 18:49
  • Does this answer solve your problem? – Fran Jul 14 '13 at 18:51
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.

  • Very helpful and clear answer – uldi Jul 14 '13 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.