1

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,
headheight=\baselineskip,
headsep=7mm,
footskip=7mm
}

\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[LO,RE]{\sffamily\itshape \leftmark}
\fancyfoot[C]{\thepage}
\pagestyle{fancy}

\usepackage{color}
\renewcommand{\headrulewidth}{2pt}
\renewcommand{\headrule}{\hbox to\headwidth{%
\color{black}\leaders\hrule height \headrulewidth\hfill}}

\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. enter image description here enter image description here Any help is appreciated.

  • 1
    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. – daleif 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. – Alfred 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. – daleif 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! – Alfred Jul 4 '17 at 16:27
  • I'll write an answer – daleif Jul 4 '17 at 16:28
7

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}{*}
\setulmarginsandblock{2.5cm}{*}{1}
\checkandfixthelayout 

Note that memoir adjusts the bottom margin such that the text height matches a whole number of lines (algorithm is adjustable)

Secondly, it is a very common mistake that pdf viewers include scaling when printing, thus in many cases, if you measure the printed margins, they are wrong. Which off the scaling in the print setting and try again.

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.