We used the following code fragment using the changepage package:


to provide a \raggedouter command, inspired by the tufte-latex class. Please see the following image to demonstrate the effect in a two-side book.

enter image description here

It is not uncommon and is done by Bringhurst's The Elements of Typographic Style or even in the German Der LaTeX-Begleiter by Mittelbach and Goosens. I would suspect the function in a package such as ragged2e. Does the upper code-fragment cover all possible cases? If there is a good solution, would it be an appropriate feature request for ragged2e?

  • 1
    Looks very good and yes could it makes a good feature request or patch the package yourself.
    – yannisl
    Oct 20, 2011 at 19:30
  • 1
    I want to add the following example to emphasize, that it is not limited to \marginpar per se: I use e.g. \DeclareCaptionJustification{raggedouter}{\raggedouter} \captionsetup{width=\marginparwidth, justification=raggedouter, font=footnotesize, skip = 0pt} with the caption package.
    – Andy
    Oct 21, 2011 at 5:41
  • Note: I had to use \strictpagecheck as well to get this working. Perhaps that's obvious for a non-newbie(?), but may be worth mentioning.
    – Keelan
    Apr 2, 2015 at 14:58
  • Thank you for pointing at the use with captions, it was very helpful, see tex.stackexchange.com/questions/236026/…
    – michael
    Apr 13, 2015 at 8:03

2 Answers 2


The command \marginpar already does the check for odd pages or even pages, so it's simpler to say


and to use \mymarginpar to insert marginal notes. Of course you can change \raggedright and \raggedleft with the similar commands provided by ragged2e, if you think they are better for you.

You may want to load also mparhack, probably.

  • This was useful for me for a simple way to get "foot"notes to print in the margins with "correct raggedness" depending on recto/verso. The method above can be made to work seamlessly with footmisc if we redefine \marginpar itself (since \footmisc[side] uses that internally). In glorious compressed code: \usepackage[side,flushmargin]{footmisc} \let\oldmarginpar\marginpar \renewcommand{\marginpar}[1]{\oldmarginpar[\raggedleft#1]{\raggedright#1}} (useful to substitute for the ragged2e versions RaggedLeft and RaggedRight). Jun 19, 2014 at 10:09

Have you looked at the raggedrightboxes option of the ragged2e package? It almost achieves what you're looking for. :-) Unfortunately, there's no raggedboxes option, but that's easily fixed, as the remainder of this example explains.

Create a copy of the ragged2e.sty (which should be located under TEXHOME/texmf-dist/tex/latex/ms/) and name the new file (say) newragged2e.sty. The relevant lines of the package file are 84 to 115 (at least in my copy of the package). First, copy and paste this range of lines verbatim to immediately after this range. Next, change the first line,




and change the last line,




Third, replace the instruction


located towards the end of the \@arrayparboxrestore command with


where \raggedouter is defined in your code example. (Note for readers other than the OP: the command \checkoddpage that is used in the definition of the raggedouter command is provided by the changepage package.) Run texhash (if needed) to make your TeX system aware of the new package myragged2e. Finally, load the myragged2e package with the raggedboxes option set, and you should be in business. :-)

  • And while your doing this, contact the author of ragged2e (me :) and pitch your idea. Oct 20, 2011 at 21:00
  • @MartinSchröder: Let me hereby pitch the idea of adding a "raggedboxes" option to the ragged2e package. :-) A different concern: While it may be worthwhile implementing an option to have all marginpar boxes be set RaggedRight/RaggedLeft, depending on whether they appear on recto/verso pages, providing an option that makes all boxes (incl. minipages, etc.) adhere to this style may be overkill. How providing an option "RaggedMarginpars" which affects only marginpar boxes and implements the OP's RaggedOuter idea, with RaggedRight in effect unless it's a two-sided document? Thanks.
    – Mico
    Oct 20, 2011 at 21:31
  • And why is that better than the answer by egreg (\marginpar/mparhack) above? Oct 20, 2011 at 21:42
  • @MartinSchröder: I'm puzzled by your question -- where or when did I state that this suggestion was better than egreg's? I thought you were asking me a real question about my suggested solution, so I tried to provide further information what I was thinking about. If this was not the purpose of your question, I apologize sincerely for misunderstanding it. OK?
    – Mico
    Oct 20, 2011 at 21:48
  • 2
    The \raggedouter macro in ragged2e would give people more options. It is also defined in the tufte-latex package, that defines its own floats and does not use marginpar. Also, it is not a good reason, but marginfix has a bug that prevents me from using /marginpar[\raggedleft]{\raggedright} solution.
    – Andy
    Oct 21, 2011 at 5:05

You must log in to answer this question.

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