16

I'm using the marginpar to put side notes, but instead of having them facing the line where they are called, I would like the whole marginpar to be pushed up. How can I achieve that?

I tried adding a negative \vspace in my call to marginpar, but it messes up everything...

2
  • how do you this kind of document? Can I use \marginnote, \marginpar or maybe use \multicolumn package? edumate.files.wordpress.com/2011/07/ejem.jpg Thanks for your help.
    – user6986
    Jul 30, 2011 at 14:40
  • 1
    @carlosmath: Welcome to TeX.sx! Your question won't be seen by many people here so it would be best to repost it as a fresh question. Follow-up questions like this are more than welcome! Please use the "Ask Question" link for your new question; there you can link to this question to provide the background.
    – lockstep
    Jul 30, 2011 at 15:18

2 Answers 2

12

Consider the following minimal example:

\documentclass[12pt]{article}
\usepackage{lipsum}
\begin{document}
\lipsum[1]\par
\marginpar{\vspace{-4em}Lorem ipsum dolor sit amet, consectetur adipiscing elit.}\lipsum[2]
\end{document}

It produces a movable \marginpar that is vertically offset above its former position:

Vertical movement of a marginpar

This works well for individual \marginpars. The reason for this is because LaTeX handles a \marginpar in a very similar way to handling floats, allowing it to move along the side of the page (or possible flow to a following page). The advantage with this is that it also allows for these "margin floats" to float with one another - like figures/tables; thereby not typesetting over top of one another. When you add a negative space to a single \marginpar, it affects all those that formerly "touched" it. Consequently, you cannot merely duplicate the negative vertical space between two "touching" \marginpars. You have to set each \marginpar's vertical offset individually.

Consider, by virtue of an example, the following document (cropped left image below):

\documentclass[12pt]{article}
\begin{document}
\leavevmode\marginpar{Lorem ipsum dolor sit amet.}Donec congue dolor ut orci 
cursus adipiscing. Suspendisse porttitor nisi sed risus varius nec lacinia enim 
bibendum. Fusce ut odio in enim dapibus condimentum. \marginpar{Lorem ipsum dolor 
sit amet.}Pellentesque ultrices scelerisque urna, nec volutpat est vehicula vel. 
Nulla facilisi. Ut egestas porta placerat. Duis in velit a tellus condimentum luctus. 
Fusce ac turpis diam. In quis libero in diam varius sodales. Phasellus sed odio ac 
felis elementum volutpat. In tempor dolor vel velit scelerisque vel consequat quam 
interdum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per 
inceptos himenaeos. Vivamus id quam erat, eget posuere eros. Quisque non nisl dolor. 
Pellentesque eros justo, sagittis ut sollicitudin vitae, condimentum quis lacus. 
Vivamus facilisis scelerisque dui non laoreet.
\end{document}

If only the first \marginpar is changed to

\marginpar{\vspace{-4em}...}

in order to offset it vertically higher on the page, both \marginpars move (cropped right image below):

Movement of marginpar due to vertical alignment

3
  • It works for one note in the margin, but if you have more, they overlap.
    – raphink
    Jul 30, 2011 at 7:21
  • I've updated my answer to comment on your request for multiple \marginpars.
    – Werner
    Jul 30, 2011 at 8:10
  • Ah great! Is there a way I could push from the bottom up then, so all of them get pushed up? With the current solution, it just introduces spaces but doesn't fix the bottom ones, unless I push them all manually...
    – raphink
    Jul 30, 2011 at 8:44
4

use package marginnote, it has an optional argument for the vertical shift

\documentclass[12pt]{article}
\usepackage{marginnote}
\usepackage{lipsum}
\begin{document}
foo bar baz\marginnote{Lorem ipsum}[-1cm]

\lipsum[1]
\end{document}

enter image description here

3
  • I checked to see whether \marginnote does a better job when dealing with more than one note. However, it also causes an overlap. Using either \marginpar or \marginnote, I think the OP is left to individually tweak vertical adjustment for those close together.
    – Werner
    Jul 30, 2011 at 8:20
  • 3
    \marginnote is a _non floating` margin par, the reason why you have to controll overlapping by yourself. However, it does a better job than \marginpar
    – user2478
    Jul 30, 2011 at 8:41
  • 4
    See also the marginfix package
    – cmhughes
    Jul 30, 2011 at 16:26

You must log in to answer this question.

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