[Tex/LaTex] Customizing Page Size in Memoir

memoirpaper-size

How do I customize the size of the output pages in the memoir class?

For example, how could I change the page size to 6x9 (while preserving the margin proportions and headers/footers I use) in the following MWE?

\documentclass[11pt,a4paper]{memoir}

% customize
\setstocksize{297mm}{210mm}
\settrimmedsize{\stockheight}{195mm}{*}
\settypeblocksize{671.6pt}{335.8pt}{*}
\setlrmargins{*}{*}{4}
\setulmargins{*}{*}{2}
\setmarginnotes{5mm}{45.23mm}{\onelineskip}
\setlength{\footskip}{3.0\baselineskip}
\checkandfixthelayout

% headers and footers
\nouppercaseheads
\makepagestyle{mystyle} 
\setlength{\headwidth}{\dimexpr\textwidth+\marginparsep+\marginparwidth\relax}
\makerunningwidth{mystyle}{\headwidth}
\makeevenhead{mystyle}{\itshape\leftmark}{}{}
\makeoddhead{mystyle}{}{}{\itshape\leftmark}
\makeevenfoot{mystyle}{\thepage}{}{}
\makeoddfoot{mystyle}{}{}{\thepage}
\makepsmarks{mystyle}{\createmark{chapter}{left}{}{}{}}
\makeatletter
\makepsmarks{mystyle}{\createmark{chapter}{left}{shownumber}{\@chapapp\ }{:\ }}
\makeatother
\makepagestyle{plain}
\makerunningwidth{plain}{\headwidth}
\makeevenfoot{plain}{\thepage}{}{}
\makeoddfoot{plain}{}{}{\thepage}
\pagestyle{mystyle}

\begin{document}
Here is some text.
\end{document}

P.S. Currently, my document has \documentclass[11pt,a4paper]{memoir} at the top–does this control the page size?

Best Answer

Since memoir provides its own set of page layout macros, it's best to use them rather than resort to something like geometry. Also, using a4paper followed \setstocksize{297mm}{210mm} is superfluous, since a4paper has those dimensions exactly. In fact, if you choose the document class option a4paper with memoir, it executes \stockaiv, which is defined as

\newcommand*{\stockaiv} {\stockheight=297mm \stockwidth=210mm}

So, either use a4paper or \setstocksize{297mm}{210mm}, but not both.

In order to reduce the page size from 297mm x 210mm to 9in x 6in "while preserving the margin proportions and headers/footers", I would figure out the ratios between the two sizes knowing that

1mm ~  2.84526pt
1in ~ 72.26999pt

As such, the following settings are used:

\documentclass[11pt,showtrims]{memoir}

% Original setup
% \setstocksize{297mm}{210mm}
% \settrimmedsize{\stockheight}{195mm}{*}
% \settypeblocksize{671.6pt}{335.8pt}{*}

% New setup
\setstocksize{9in}{6in}
\settrimmedsize{\stockheight}{\dimexpr 6in-15mm}{*}
\settypeblocksize{516.9312pt}{243.6962pt}{*}

It kept the same proportions between the page size and the text block, but kept the trimming margins the same (15mm less than \stockwidth). The original is shown on the left, while the new is shown on the right at the same resolution (for comparison purposes):

enter image description here

Related Question