# Specific stocksize{14cm}{21cm} in memoir and shorter margins

I have instructions to use the specific size of book 14x21cm so I included the \setstocksize{21cm}{14cm} coommand....
The margins also have the specific size of 0,5inches in every direction so the text is placed right in the center of the page...But how do I apply that?

I am using

\setulmarginsandblock{0,5in}{0,5in}{*} %Define margem vertical maior
\checkandfixthelayout %Define margem vertical maior

\setlrmarginsandblock{0,5in}{0,5in}{*} %Define margem horizontal maior
\checkandfixthelayout %Define margem horizontal maior


But there's an error right after the \checkandfixthelayout:

Class memoir Error: \paperwidth (421.10078pt) and/or \trimedge (0.0pt) are too large for \stockwidth (398.33858pt) by 22.7622pt.

Is there any other way to do it?

This is my MWE:

\documentclass[12pt,twoside,openany,showtrims,a5paper]{memoir} %Classe estilo memoir
\usepackage[brazilian]{babel} %Traduz doc para português do Brasil
\usepackage[utf8]{inputenc} %Reconhece acentuação
\usepackage{ebgaramond} % Define a fonte garamond
\usepackage{titlesec} %Centralizar Cap e cabeçalho

\setstocksize{21cm}{14cm}

\setulmarginsandblock{0,5in}{0,5in}{*} %Define margem vertical maior
\checkandfixthelayout %Define margem vertical maior

\setlrmarginsandblock{0,5in}{0,5in}{*} %Define margem horizontal maior
\checkandfixthelayout %Define margem horizontal maior

\copypagestyle{chapter}{plain}
\makeevenfoot{chapter}{}{\thepage}{}
\makeoddfoot{chapter}{}{\thepage}{}

\renewcommand{\chapnumfont}{\bfseries\huge} %Formata Nº título de Cap
\renewcommand{\chapnamefont}{\small} %Formata "Capítulo X"
\renewcommand{\chaptitlefont}{\normalfont\Huge} %Formata Título de Cap
\chapterstyle{thatcher}

\begin{document}

\chapter*{Dedicatória}
\input{1dedicatoria}
\newpage

\tableofcontents*

\chapter*{Síntese}
\input{3sintese}

\chapter*{Apresentação}
\input{4apresentacao}

\chapter{Preparação}
\input{5preparacao}
...

\chapter*{Conclusão}
\input{26conclusao}

\end{document}

• Not at a pc so cannot test, but you only need one checkandfixthelayout the last one, you might also want to look up in the manual about the various algorithms behind it – daleif Apr 14 '16 at 19:13
• Do you mean 0.5 inches rather than 0,5 ? – cfr Apr 14 '16 at 23:16
• Tried putting some extras \checkandfixthelayout.... did not work. Commas or final stop are indifferent. I have added some extra code to the MWE, maybe there is something there causing the error. – Adriano Apr 15 '16 at 17:50
• As I said, perhaps start by removing the first checkandfixthelayout, only one is needed. And remove the titlesec package, you're not using it. – daleif Apr 15 '16 at 18:04
• Alright.It still shows error. – Adriano Apr 16 '16 at 20:47

First of read what I say, you should only have ONE \checkandfixthelayout! this is the macro that checks the values.

Sendcondly, plesae always post something we can use, we do not have all the files you include (the kantlipsum package can be used for filler text)

Third, why are you changing the stock size from a5paper (210mm by 148mm) to 210mm by 140mm, that seems a bit strange. If you need it, you'll also need to run \settrimmedsize in order to translate it into page size (it sets \paperwidth/height, if the paper size is the same as the stock, then you can just use \settrimmedsize{\stockheight}{\stockwidth}{*}

This works fine (I've removed everything irrelevant to your question)

\documentclass[12pt,twoside,openany,showtrims,a5paper]{memoir} %Classe estilo memoir
\usepackage[brazilian]{babel} %Traduz doc para português do Brasil
\usepackage[utf8]{inputenc} %Reconhece acentuação

\setstocksize{21cm}{14cm}
\settrimmedsize{\stockheight}{\stockwidth}{*}
\setulmarginsandblock{0.5in}{0.5in}{*} %Define margem vertical maior
\setlrmarginsandblock{0.5in}{0.5in}{*} %Define margem horizontal maior
\checkandfixthelayout %Define margem horizontal maior

\usepackage{kantlipsum}

\begin{document}

\kant

\end{document}
`
• daleif, thanks for the help, it worked. I had tried to include only one \checkandfixlayout but it did not work.... I will make sure to add lipsum to substitute the chapters, texts, etc..next time. The specific stock size is an instruction I received to format the book this way. I am new to LaTex and to tex.stackexchange...thanks for the help. I really appreciate this website organization. – Adriano Apr 18 '16 at 14:30