# [texhax] \marginpar on both/changing margins

Uwe Lück uwe.lueck at web.de
Mon Jan 22 15:48:18 CET 2007

At 22:15 19.01.07, Alex Scorpan wrote:
>Is there a way to send some \marginpar's to the left margin and some
>to the right, on the same page?
>That is, explicitly instruct LaTeX to place a specified \marginpar to
>the left, and a specified other to the right?
>As in:  be able to implement a \marginparright and a \marginparleft,
>or some such.
>
>Note that \reversemarginpars and \normalmarginpars seem to only work
>per page.
>Also note that the cute \marginpar[left text]{right text} also does
>not address this:  it gobbles one of the two texts.

I agree. Maybe Markus Kohm (komascript at gmx.info) is willing
to extend his marginnote package for this purpose.

For doing it on your own, you might put the marginal text into
a \parbox and move it (in the arguments of \marginpar) it
\textwidth + 2\marginparsep + \marginparwidth to the left or right.
Whether to the left or to the right with [twoside] can be decided
by \label (using a counter for such marginals) and \pageref.
(For strange formats of pagenumbers, you can use Heiko
Oberdiek's refcount package.)
For moving, you could use the primitive TeX command \move.
For pure LaTeX only something like

\marginpar{%
\hspace*{\onesign<sum>}%
\parbox{\marginparwidth}{<text>}%
\hspace*{\othersign<sum>}}

might do, where \onesign and \othersign a macros expanding
to -' or to nothing depending on whether the page number is
odd or even.

If you want to have "facing" marginals (marginal texts
on both sides at about the same vertical position),
Markus' approach might be better.
It doesn't move down the second \marginpar coming from the
same text line. Or you could use \raisebox in some way
(maybe manually at certain occasions only, or in a tricky
way to get it automatically -- measure the height ...)

Cheers,

Uwe.

`