18

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.

  • 1
    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. – jub0bs 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
19

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:

MEW

\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}
11

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}

enter image description here

  • I've 'edited' this answer only to some suggested edit that was fixing a typo from you, but introduced some other rubbish markup. Please revert at will ;-) – user31729 Mar 28 '16 at 10:17
  • @ChristianHupfer Thanks for the heads up. Looks OK and compiles, so I am happy. – Steven B. Segletes Mar 28 '16 at 11:13
  • Is there any way to create a horizontal shift? – Nadine Sep 26 at 4:40
  • @Nadine \setlength\marginparsep{1cm} will change the gap between text and note to 1cm. – Steven B. Segletes Sep 26 at 9:39
  • Thank you so much for your help! – Nadine Sep 29 at 15:30

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.