# Problem setting margins in memoir

I'm trying to setup the layout of my thesis and margins seems to be a little off what I'm expecting, I'm using `memoir` and I'm trying to setup all the variables of page layout so nothing wont go wrong...

The specs are simple: 2.54cm margin all around the page except for the printing side which should be 3.54cm. the page is A4 29.7x21cm.... here is my code:

``````\pagestyle{plain}
\setlength{\trimtop}{0cm}
\setlength{\trimedge}{0cm}
\setlength{\oddsidemargin}{1cm}
\setlength{\evensidemargin}{0.0cm}
\setlength{\parindent}{18pt}
\setlength{\parskip}{6pt}
\setlength{\uppermargin}{2.54cm}
\setlength{\footskip}{0.80cm}
\setlength{\spinemargin}{2.54cm}
\setlength{\marginparwidth}{0cm}
\setlength{\marginsep}{0cm}
\setlength{\paperheight}{29.7cm}
\setlength{\paperwidth}{21.0cm}
\setlength{\stockheight}{\paperheight}
\setlength{\stockwidth}{\paperwidth}
\setlength{\textheight}{24.6cm}
\setlength{\textwidth}{14.9cm}
``````

the problem with the above code is that the top margin is always stuck at 3.54cm leaving only 1.54cm to the bottom margin no matter how I change it, even if I change the `\trimtop` to -1cm!

When I add the following line to the code, it fixes the top/bottom margins but the left/right margin in odd pages only is messed-up and stuck at 4.54cm / 1.54cm to left/righ margins respectively...

``````\checkandfixthelayout
``````

-
Read the discussion on page layouts in the memoir documentation carefully. Page layout is not random. –  vonbrand Feb 10 '13 at 0:32
Related Correct way to set margins –  Ipsen Apr 4 '13 at 12:56

Solved ....

I moved the 2 lines for setting the odd and even side margins:

``````\setlength{\oddsidemargin}{1cm}
\setlength{\evensidemargin}{0.0cm}
``````

to after the check and fix layout line:

``````\checkandfixthelayout
``````

source: section 2.7 Side Margins in memoir reference

-