I've run into a problem using the marginnote package; the vertical position changes if the note is wider than the margin. An MWE:



\marginnote{Not Overlong}%


The first note, wider than the margin, is set about half a line lower than the second. Using vanilla \marginpar instead sets both margin notes at the correct vertical position.

How can I get the vertical position to be set consistently using \marginnote? At this point, I'm using \parboxes, but then I lose the left/right justification.

  • 2
    If you have elements inside your \marginnote that is wider than \marginparwidth, then you can set them in boxes that shorter no wider. For example, using \rlap{\rule{1.1\marginparwidth}{2pt}} sets the rule in a zero-width box. I'm not exactly sure what the \marginnote contents is, so I don't know whether this works for you or not.
    – Werner
    Jun 5, 2013 at 2:12
  • It seems that \nolinebreak also works: \marginnote{\nolinebreak\rule{1.1\marginparwidth}{2pt}}.
    – g.kov
    Jun 5, 2013 at 10:04
  • You'd have the same problem in a normal paragraph, if you want to start it with a rule wider than the line width. Can you make a more realistic example?
    – egreg
    Jun 5, 2013 at 10:37
  • @g.kov: \nolinebreak didn't have any effect for me; the notes still go in different places.
    – gilgamec
    Jun 5, 2013 at 15:46
  • @egreg: I tried starting paragraphs with long and short rules, and the vertical alignments of the two are the same; am I misunderstanding you? Plus, like I said the question, there is no alignment problem using vanilla \marginpars.
    – gilgamec
    Jun 5, 2013 at 15:48

1 Answer 1


The difference is that \marginnote issues \hspace{0pt} before starting to typeset the text of the note, which inserts a legitimate break point; so TeX will use it and the oversized rule will go to the second line; if you try with \unskip before the oversized rule, it will go in the first line. With \marginpar the \hspace is not issued.

Without a realistic example it's difficult to say more; an oversized rule will necessarily produce an overfull box and seems to be a little unsensical.

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.