# How to set margins in memoir class?

I'm having a hard time with the memoir margins. Honestly, I don't get how it works. In principle it should be fairly easy to get what I want: 3.5cm left, 2.5cm right, 2.5cm top, 2.5cm bottom. Two-sided layout.

I tried this (it's just a simplified version of my actual document, hope that works)

\documentclass[a4paper,12pt]{memoir}

\usepackage[a4paper]{geometry}
\geometry{
left=3.5cm,
right=2.5cm,
top=2.5cm, bottom=2.5cm,
footskip=7mm
}

\usepackage{fancyhdr}
\fancyhf{}
\fancyfoot[C]{\thepage}
\pagestyle{fancy}

\usepackage{color}

\usepackage{lipsum}

\begin{document}

\tableofcontents

\section{Introduction}
\lipsum[2-4]

\subsection{Material}
\lipsum[2-8]

\end{document}


Well, that did not work. The margins are just not set correctly. Looking into the memoir documentation I found these two commands:

\setulmargins{4cm}{*}{*}
\setlrmargins{1.25in}{*}{*}
\checkandfixthelayout


I guess I should get rid of the geometry block and use this instead. However, I'm doing something wrong.

Here are two images showing the kind of layout I want. Any help is appreciated.

• There are two margins command types in memoir, the ones you are using expects that you have already set the text block size, which you have not. Use \setlrmarginsandblock{left}{right}{ratio} and \setulmarginsandblock{top}{bottom}{ratio} instead. In this case exactly one of the three args for each macro has to be *. So the args would be {3.5cm}{2.5cm}{*} and for example {2.5cm}{*}{1} for the other. Note that memoir rounds the height of the text block to an even number of lines to avoid stretching, thus the bottom margin may be larger than what you requested. Jul 4 '17 at 14:33
• Thanks for the quick reply! I tested your solution .. \setlrmarginsandblock{3.5cm}{2.5cm}{*} \setulmarginsandblock{2.5cm}{*}{1} \checkandfixthelayout but the margins are still incorrect. I always get 2.cm top, 2.7cm bottom, 4.2cm left, 3.2cm right. It's fine if the bottom margin may be at bit larger than what I requested, but the side margins are completely off :( I also tried to use the \settrimmedsize and \settypeblocksize commands, but without any success. Jul 4 '17 at 15:27
• Exactly how do you measure this? BTW note that headers and footers are not included in the margins. If you are measuring on printed copies, remember to explicitly switch off scaling in the programme you use to print the pdf. That issue have hit me a lot of times. Jul 4 '17 at 16:01
• Oh my gosh, that's it. Thank you so much and my apologies for such a silly mistake. BTW I just checked the hardcopy of my master's thesis.. same issue . Well, nobody noticed lol. Anyway, thanks again! Jul 4 '17 at 16:27
• I'll write an answer Jul 4 '17 at 16:28

The main issue here is that memoir has two ways of setting margins. One where iøyou set the margins and let that dictate the text block. And one where you specify the text block and then place that on the paper. Sadly you got the latter one, should have used the first one, thus use
\setlrmarginsandblock{3.5cm}{2.5cm}{*}