# Specific margin size in memoir

I am writing my thesis nowadays, and one of the few things the instructions have specific recommendations about is page size and margins.

The page should be A4, and the margins should be: (I revised the description, hopefully in a clearer way)

• On the margin which will get binded the overall distance from the edge of the page to the text should be about 4cm;
• the rest of the sides should have about 1.5cm from the edge of the paper to the text.

These spacing instructions include the margin which is part of the page, as well the additional space for binding.

I am using the memoir document class, and I just couldn't get the hang of the spine, the fore-edge, etc. etc.

I tried using the geometry package but it completely broke the compilation and I'm quite lost at the moment. I tried using \setlrmarginsandblock and that too broke the compilation.

Both with several different error messages, amongst them:

You can't use the character 1' after \the.\headheight ->15pt

which, I suppose, means that some values are being overwritten at some point.

I should also point out that I have added \checkandfixthelayout and that I am loading fancyhdr after that, which may (or may not) be a source of troubles.

How can I solve this issue and have the margins the way I want them?

Thanks!

I just measured a recent printout (before trying to do any changes) and the spacings are 4cm on top and bottom; 3cm on the side of the binding; 5cm on the other side.

-
Judging from some other comments, I wonder if you don't want a 1.5 cm 'margin' from the top and bottom of the page to the header and footer (rather than to the textblock). Otherwise, if you measure the specified margins in @Brent.Longborough's answer, you'll see that they are correct given the earlier specifications. –  jon Aug 2 '12 at 19:13
@jon: Yes, to header footer seems what I am looking for. As I wrote in the last comment, I am not used to messing with margin sizes and I'm not sure what are the exact terms to use to describe the problem, and names and values I need to assign. –  WD40 Aug 2 '12 at 19:17

I assume from the strange way they've specified your layout, and the fact that it's a thesis, that it's one-sided.

Try this (the lipsum bits are just to give us some blind text):

\documentclass[a4paper,12pt,oneside]{memoir}
\setulmarginsandblock{1.5cm}{1.5cm}{*}
\setlrmarginsandblock{4cm}{1.5cm}{*}
\checkandfixthelayout
\usepackage{lipsum}
\begin{document}
\lipsum[1-4]
\end{document}


This solution assumes the margins are "conventional" -- from the page edges to the text block.

I don't know for sure (I've never used it), but fancyhdr does things that memoir has its own facilities for doing, so there may be a conflict there.

If you want to alter stock and trim, you can, but that really only makes sense if you're actually going to physically trim the printed sheets.

-
Actually the recommendation is two-sided, just that about half the theses in the faculty are written in Hebrew (not mine, though). –  WD40 Aug 2 '12 at 19:05
Is it normal that the .pdf seems extremely stretched, there are absolutely no margins between the header and footer; the left/right margins themselves don't look like 4cm or 1.5cm either. –  WD40 Aug 2 '12 at 19:08
@WD40 -- You have a two-sided document where every page has a 'left' (!?) margin of 4cm? That seems rather contradictory. (Of course, I have cannot and have not read any Hebrew documents, so maybe it would work there..?) –  jon Aug 2 '12 at 19:08
@WD40 -- regarding the layout of the page, try using the showframe package to see what's going on. –  jon Aug 2 '12 at 19:09
I suppose that the intention was that the text would take the better part of the page, and since the binding may take some space (the university binds it on their own) I suppose they required this for this reason. –  WD40 Aug 2 '12 at 19:25

A slightly more elaborate version. (Perhaps I should put this as a second answer in Brent.Longborough's ..?)

\documentclass[a4paper,12pt,oneside]{memoir}
% \setstocksize{297mm}{210mm} % these are a4 sizes
% \settrimmedsize{297mm}{210mm}{*}
\settypeblocksize{245mm}{155mm}{*}
\setulmargins{2.5cm}{*}{*}

\setlrmarginsandblock{4cm}{1.5cm}{*}
\checkandfixthelayout

\makepagestyle{test}
\makeoddhead{test}{PAGE \thepage}{PAGE \thepage}{PAGE \thepage}
\makeoddfoot{test}{PAGE \thepage}{PAGE \thepage}{PAGE \thepage}
\pagestyle{test}
\usepackage{lipsum}
\begin{document}
\footnote{\lipsum[1]}
\lipsum[1-5]
\end{document}


This answer sets the margins at 1.5 cm to the header and footer rather than to the textblock.

Addendum: As @daleif noted, \checkandfixthelayout can take one of several different optional arguments: [fixed] , [classic], [lines], [nearest]. These will (likely) subtly alter layout of the page, especially if you have things like \flushbottom in effect (which is the default for two-sided documents, I believe). You should see the manual (texdoc memman) for details on how everything is calculated.

-
This seem to push everything towards one side of the page, the margin itself is pushed off the limits of the page. –  WD40 Aug 2 '12 at 19:53
@WD40 -- Really? Are you testing this document or these settings in another document? The 'left' and 'right' settings are unchanged from the other answer? All that I changed are the 'top' and 'bottom' settings. –  jon Aug 2 '12 at 20:20
I put this straight into my thesis. I think I'll give it up and go to the faculty administration when the week starts, I'll ask them on this particular instruction. –  WD40 Aug 2 '12 at 20:22
@WD40 -- Well obviously you are doing 'extra' things in your thesis! Is there a thesis .sty file you are adding; are you also using geometry (or loading a package that implicitly loads it); etc., etc.? If you test the document, you'll see that the margins do what you asked. If you need something more specific, you need to provide a minimal, but complete and compilable document for others to use and 'fix'. –  jon Aug 2 '12 at 20:26
Might be an idea to look into the options that one can give to \checkandfixthelayout, memoir` does a rounding textheight to integral number of lines calculation which may confuse some. But then again I find it strange that there is a requirement for the bottom margin. Seems someone in the administration does not know what they are doing. –  daleif Aug 3 '12 at 8:26