# Margin notes on both left and right?

I've been trying to put margin notes in both the left and the right margins at the same time. My attempts have gone something like:

Lorem{\reversemarginpar\marginpar{Left}} ipsum {\normalmarginpar\marginpar{Right}} dolor sit amet, consectetuer adipiscing elit.


But here both notes appear in the right margin. I would be very grateful for ideas on how to solve this.

-
Welcome to TeX.sx! –  Peter Jansson Mar 8 '13 at 22:08
Which class are you using? The memoir class has a \sidepar command that allows side notes, i.e. notes on the other side of the page than where the margin notes are. See this example. –  Jubobs Mar 8 '13 at 23:11
Thanks very much for the hint. I'll have a look at the memoir class, but basically I am looking for a solution for the article class. I am using the article class with some (simple) modifications of my own and I am reluctant to give this up. –  user27080 Mar 9 '13 at 9:14
Thanks again. I've looked at memoir and \sidebar and the result seems to be exactly what I am looking for. However, I'm not keen on all the overhead that comes with memoir, nor on redoing my adjustments to the article class. The manual talks about a lot of work going into implementing \sidebar - this isn't available as a package that can be loaded into article? –  user27080 Mar 9 '13 at 9:40

You cannot change the margin for side notes within the same paragraph.

Therefore you can wait until the next paragraph to do that, or use \marginnote (found in the marginnote package) instead of \marginpar. In this way, even the same note can write different texts depending on which margin appear:

\documentclass{article}
\usepackage{xcolor}
\usepackage{marginnote}
\begin{document}

\newcommand\Right{\textcolor{red}{(Right) Lorem ipsum  dolor sit amet}}
\newcommand\Left{\textcolor{cyan}{(Left) Lorem ipsum  dolor sit amet}}

\section*{Two \texttt{marginpar} in the same paragraph}

Lorem \reversemarginpar\marginpar{\Left}
ipsum  dolor sit amet, consectetuer adipiscing elit.\normalmarginpar\marginpar{\Right} Ut purus elit\ldots
\vspace{2cm}

\subsection*{Two \texttt{marginpar} in separate paragraphs}

Lorem \reversemarginpar\marginpar{\Left}
ipsum  dolor sit amet, consectetuer adipiscing elit.\par\normalmarginpar\marginpar{\Right} Ut purus elit\ldots
\vspace{1cm}

\subsection*{Two \texttt{marginnotes} in the same paragraph}

\renewcommand*{\raggedleftmarginnote}{\flushleft}

Lorem \reversemarginpar\marginnote{\Left} ipsum  dolor sit amet, consectetuer adipiscing elit.\normalmarginpar\marginnote{\Right}
Ut purus elit\ldots
\vspace{1cm}

\subsection*{One \texttt{marginnote} with and without \texttt{reversemarginpar}}

Lorem \reversemarginpar\marginnote[\Left]{\Rigth} ipsum  dolor sit amet, consectetuer adipiscing elit.\normalmarginpar\marginnote[\Left]{\Right}
Ut purus elit\ldots

\end{document}

-

There is one limited time when you can get marginpars on both sides. If you are at the end of a paragraph in which you already placed a marginpar, you can \par\vspace{-\parskip}, reverse the marginpar direction and do a marginpar on the other side.

With this particular implementation, I also allow some vertical shifting to the note, with my routine

\mnote[vertical shift]{l/r}{text}


Here is the example, where you see the note on both sides of the paragraph.

\documentclass{article}
\usepackage{xcolor}
\usepackage{stackengine}
\usepackage{lipsum}
\usepackage{MNsymbol}
\usepackage{graphicx}

\newcommand*\mnote[3][0pt]{%
\if l#2\reversemarginpar\def\pointer{\filledmedtriangleright}%
\def\stackalignment{r}\fi%
\if r#2\normalmarginpar\def\pointer{\filledmedtriangleleft}%
\def\stackalignment{l}\fi%
\marginpar{%
\topinset{%
\scalebox{1.5}{\textcolor{blue}{$\pointer$}}}{%
\belowbaseline[-1.5\baselineskip-#1]{%
\stackengine%
{-5pt}%
{\fcolorbox{blue}{white}{\parbox{1.8cm}%
{\vspace{3pt}\raggedright#3}}}%
{~\colorbox{white}{\sffamily Note}}%
{O}%
{l}%
{F}%
{F}%
{S}%
}%
}{%
3ex+#1}{%
-2ex}%
}%
}

\begin{document}
\lipsum[1-2]
this is a\mnote[2ex]{l}{some text for the mnote box} test%
\par\vspace{-\parskip}\mnote[1ex]{r}{both right and left}

\lipsum[3]
This is another test\mnote{r}{another mnote box test testing the
right side}

\lipsum[4]

\end{document}


-