In this question, I described a problem I have with marginpars appearing on the wrong side of the page when they occur near a page break. I ran into a different, but perhaps related problem described below. I have a non-LaTeX related solution (also described below) that I include as a workaround in case others may find it useful, but I would like very much to have a pure LaTeX solution.

I want to print my course notes as a book, with double-sided paper. [I am using the memoir class.] I also want to have text or figures in the "outer" (i.e. wide) margin - and that margin should change side depending if the page is odd or even.

I also want to be able to change from single column (with a wide margin) to double column (with narrow margins) to include either worked out examples and/or problems at the end of each chapter. The problem I encountered is that the margin adjustment done (correctly) at the beginning of the double-column environment is totally wrong on the subsequent page if the environment crosses a page boundary.

Here is a MWE - actually, three MWE in one. Depending on which options get commented out, one can have the normal two-sided memoir output, or a one-sided output with the wide margin either on the left-hand side or the right hand side. Note that there are two places where commented out options occur: right at the beginning and also in the page layout "section" of the preamble.

%%%%% two-sided option with wide margin alternating sides
%   \documentclass[openany,twoside]{memoir}
%       \newenvironment{widematter}{\begin{adjustwidth*}{0in}{-2in}\small}{\end{adjustwidth*}}

%%%%  one sided - wide margin (for marginpar) on the right
%   \documentclass[openany,oneside]{memoir}
%       \newenvironment{widematter}{\begin{adjustwidth}{0in}{-2in}\small}{\end{adjustwidth}}

    %%% one sided - wide margin (for marginpar) on the left

%%% page layout dimensions for memoir
%%% marginpar on right OR twosided
% \setlrmargins{0.75in}{*}{*}
%%% marginpar on left


\newcommand{\sampletext}{This is a short sample text
    longer than one line but shorter than a typical paragraph
    from the lipsum package.}

\chapter{First Chapter}
\section{First section}
\section{Second section}

\chapter{Second Chapter}
\section{First section}


The non-LaTex solution I have found is to have two one-sided "base documents" (for lack of a better term), one that has the preamble for the wide margin on the left, the other for the wide margin on the right, and keeping most of the content in separate files that get inputted. I then process both the "left" document and the "right" document, and combine them with this Python script:

from pyPdf import PdfFileWriter, PdfFileReader

output = PdfFileWriter()
left = PdfFileReader(file("left-test.pdf", "rb"))
right = PdfFileReader(file("right-test.pdf", "rb"))

total_nb_pages = left.getNumPages()
assert left.getNumPages() == right.getNumPages()

for page in range(0, total_nb_pages, 2):
    if page + 1 < total_nb_pages:
        output.addPage(right.getPage(page + 1))

outputStream = open("combined-test.pdf", "wb")

So far, based on limited tests, it does work ... but a pure LaTeX solution would be much appreciated.

1 Answer 1


AFAICS, the only problem with the two-sided version is that the adjustwidth* environment doesn't work over page breaks.

In fact, the implementation of adjustwidth* is not intended to accomodate page breaks, so you need something different.

Fortunately, there is a package for this purpose: Loading


I could define


(widematter is no longer needed).

This seems to give an acceptable result (using the twoside version):

enter image description here

  • Sorry. Changed wording. Commented Apr 3, 2012 at 6:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .