[Tex/LaTex] Marginpar on a fixed side of two-column double-sided memoir document

double-sidedmarginparpositioningtwo-column

I have a two-column, double-sided document class based on memoir, where the wide margin is always on the left. I would like the \marginpar to always be in this left margin, irrespective of whether it is called from the left or the right column. Right now it is always in the margin closest to the column.

Here is a minimal example:

\documentclass[twoside,twocolumn,openright]{memoir}
\usepackage{kantlipsum}

\setmarginnotes{1cm}{4cm}{0mm}
\settypeblocksize{20cm}{14cm}{*}
\setlrmargins{6cm}{*}{*}

% Fix the margin to the left
\checkandfixthelayout
\setlength{\evensidemargin}{\oddsidemargin}

\begin{document}
A first line in the first column. 
\marginpar{I'd like this to be on the left, and it is.}
\kant[1-3]

Another line in the second column. 
\marginpar{I'd like this to be on the left as well, but it's not!}

\kant[4-7]
\end{document}

Using \marginparmargin does not change anything, and it shouldn't for two-column documents. The memoir documentation says the following:

\Xmargin{⟨placement⟩} for possible placements: left, right, outer, and inner

Two column document If the note is placed in the first column, to the left, otherwise to the right, irrespective the document being one- or two-side and of the users choices

Is there a workaround that would allow me to put all \marginpar on the left side?

I need to keep the twoside option for other elements of the template.

Best Answer

A necessary update is made since texlive version 2018

In memoir class and for a two columns document the \marginparmargin{placement} has no effect on notes created with \marginpar so we use the \marginnote command from the marginnotepackage .

\documentclass[twoside,twocolumn,openright]{memoir}
\usepackage{kantlipsum,xcolor}

\usepackage{marginnote} % <-------------

\setmarginnotes{1cm}{4cm}{0mm}
\settypeblocksize{20cm}{14cm}{*}
\setlrmargins{6cm}{*}{*}

% Fix the margin to the left
\checkandfixthelayout
\setlength{\evensidemargin}{\oddsidemargin}


\newcommand*{\redtext}{\textcolor{red}{margin note inserted here}}

\marginparmargin{left} % <--------------
\begin{document}
\redtext 
%
\marginnote{I'd like this to be on the left, and it is.}
\kant[1-3]

\redtext
\marginnote{I'd like this to be on the left as well, but it's not!}

\kant[4-5]

\redtext
\marginnote{I'd like this to be on the left, and it is.}
\kant[6]

\redtext
\marginnote{I'd like this to be on the left as well, but it's not!}
\kant[7]


\end{document}

The following is only relevant for texlive version up to 2017

However for a two columns two sided document if we use \marginparmargin{left} we get all the odd page margin notes positioned on the left side while all the even page margin notes are positioned on the right side regardless from which column the \marginnote is called and vice versa if we use \marginparmargin{right}.

So we have to use \marginparmargin{left} for odd pages and \marginparmargin{right} for even pages

Therfore the solution could be to define a

\newcommand*{\mymarginpar}[1]{
            \checkoddpage
            \ifoddpage
               \marginparmargin{left}
            \else
               \marginparmargin{right}
            \fi
            \marginnote{#1}}

The MWE for texlive version up to 2017

\documentclass[twoside,twocolumn,openright]{memoir}
\usepackage{kantlipsum,xcolor}

\usepackage{marginnote} % <-------------

\setmarginnotes{1cm}{4cm}{0mm}
\settypeblocksize{20cm}{14cm}{*}
\setlrmargins{6cm}{*}{*}

% Fix the margin to the left
\checkandfixthelayout
\setlength{\evensidemargin}{\oddsidemargin}

\newcommand*{\mymarginpar}[1]{ % <----------
\checkoddpage
\ifoddpage
   \marginparmargin{left}
\else
   \marginparmargin{right}
\fi
\marginnote{#1}
}
\newcommand*{\redtext}{\textcolor{red}{margin note inserted here}}

\begin{document}
\redtext 
%
\mymarginpar{I'd like this to be on the left, and it is.}
\kant[1-3]

\redtext
\mymarginpar{I'd like this to be on the left as well, but it's not!}

\kant[4-5]

\redtext
\mymarginpar{I'd like this to be on the left, and it is.}
\kant[6]

\redtext
\mymarginpar{I'd like this to be on the left as well, but it's not!}
\kant[7]


\end{document}

enter image description here odd page

enter image description here even page

Related Question