2

I would like to be able to use marginnote in a two-sided book, but have all notes appear on the left margin. There is an older solution to this problem here, and there's a parallel older answer that puts all notes on the right margin here. Neither of those solutions work any longer, however, because of updates to marginnote.

There is a working solution for putting all notes on the right margin here, but I'm unfortunately not capable of adapting it to the left margin by myself.

Small example

\documentclass[twoside]{book}
\usepackage{marginnote}
\usepackage{lipsum}

\begin{document}

\lipsum[1]\marginnote{test test test test test}
\lipsum[1-2]\marginnote{test test test test test}
\lipsum[1-2]\marginnote{test test test test test}
\lipsum[1-2]\marginnote{test test test test test}
\lipsum[1-2]\marginnote{test test test test test}
\lipsum[1-2]

\end{document}
  • Make a minimal example that can be used for tests. – Ulrike Fischer Jan 31 at 14:26
  • @UlrikeFischer Done. – Telemachus Jan 31 at 14:54
  • Sorry! but may be I haven't well understood the question – Hafid Boukhoulda Jan 31 at 15:05
  • So you want all the notes on the left margin? – Hafid Boukhoulda Jan 31 at 15:07
  • @HafidBoukhoulda Yes. That's precisely what I want. – Telemachus Jan 31 at 15:08
1

Per this answer, there is an analogous cludge to the marginnote package to put everything on the left, obtained by preserving the other case from the code defining \@mn@@@marginnote. This is given below.

\documentclass[twoside]{book}
\usepackage{marginnote}
\usepackage{lipsum}
%
%
\makeatletter
\long\def\@mn@@@marginnote[#1]#2[#3]{%
  \begingroup
    \ifmmode\mn@strut\let\@tempa\mn@vadjust\else
      \if@inlabel\leavevmode\fi
      \ifhmode\mn@strut\let\@tempa\mn@vadjust\else\let\@tempa\mn@vlap\fi
    \fi
    \@tempa{%
      \vbox to\z@{%
        \vss
        \@mn@margintest
        \if@reversemargin\if@tempswa
            \@tempswafalse
          \else
            \@tempswatrue
        \fi\fi

          \llap{%
            \vbox to\z@{\kern\marginnotevadjust\kern #3
              \vbox to\z@{%
                \hsize\marginparwidth
                \linewidth\hsize
                \kern-\parskip
                %\mn@parboxrestore
                \marginfont\raggedleftmarginnote\strut\hspace{\z@}%
                \ignorespaces#1\endgraf
                \vss
              }%
              \vss
            }%
            \if@mn@verbose
              \PackageInfo{marginnote}{xpos seems to be \@mn@currxpos}%
            \fi
            \begingroup
              \ifx\@mn@currxpos\relax\else\ifx\@mn@currpos\@empty\else
                  \kern\@mn@currxpos
              \fi\fi
              \ifx\@mn@currpage\relax
                \let\@mn@currpage\@ne
              \fi
              \if@twoside\ifodd\@mn@currpage\relax
                  \kern-\oddsidemargin
                \else
                  \kern-\evensidemargin
                \fi
              \else
                \kern-\oddsidemargin
              \fi
              \kern-1in
            \endgroup
            \kern\marginparsep
          }%
      }%
    }%
  \endgroup
}
\makeatother
%
\begin{document}

\lipsum[1]\marginnote{test test test test test}
\lipsum[1-2]\marginnote{test test test test test}
\lipsum[1-2]\marginnote{test test test test test}
\lipsum[1-2]\marginnote{test test test test test}
\lipsum[1-2]\marginnote{test test test test test}
\lipsum[1-2]

\end{document}

Note that there is a line %\mn@parboxrestore which I have commented out (because it didn't work on my system with it not commented out). This is almost surely because the version of marginnote in my system is not the most recent, but this snippet of code is taken from marginnote.sty, which can be found (for example) at this URL. It would be worth trying this on your system with this line uncommented.

  • This works perfectly for me with the line commented out. Thank you for taking the time to rewrite your answer for the opposite situation. – Telemachus Feb 1 at 18:35
2

As there are tests for twoside everywhere in the code (and it affects spacing and other things), it is imho the best to locally set twoside to false:

\documentclass[twoside]{book}
\usepackage[centering,marginparwidth=2.5cm,paperheight=10cm]{geometry}
\usepackage{marginnote}
\usepackage{lipsum}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\@mn@@@marginnote}{\begingroup}{\begingroup\@twosidefalse}{}{\fail}
\reversemarginpar
\makeatother

\begin{document}

\lipsum[1]\marginnote{test test test test test}
\lipsum[1-2]\marginnote{test test test test test}
\lipsum[1-2]\marginnote{test test test test test}
\lipsum[1-2]\marginnote{test test test test test}
\lipsum[1-2]\marginnote{test test test test test}
\lipsum[1-2]

\end{document}
  • That would affect the overall layout of that section of the book in many other ways, no? (The example document is one thing, but the actual code needs to run in part of one chapter of a long book.) – Telemachus Jan 31 at 15:10
  • I don't think that it affects the layout - the change is locally in the marginnote, and unless you need a twoside test there, it it will not be seen by the rest of the document. – Ulrike Fischer Jan 31 at 15:13
  • Ah, I see. I'll try that out and see if it has any other side effects. Thanks. – Telemachus Jan 31 at 15:14
  • It does have an odd side effect: even-numbered pages end up with an extra indentation after the margin note. (I.e., the rest of the content starts oddly far to the right.) – Telemachus Jan 31 at 15:19
  • 1
    Sorry I have no idea what you mean. I see nothing curious in the output. – Ulrike Fischer Jan 31 at 15:27

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.