Document ClassesProblem with the Memoir package

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
Ant_222
Posts: 6
Joined: Tue Mar 25, 2008 2:02 pm

Problem with the Memoir package

Post by Ant_222 »

Hello all,

When using the memoir document class, I don't know where I should place the commands for setting up the layout (settypeblocksize, setlrmargins...).

If I call them from the preamble, LaTeX swears about a missing \begin{document}, and if I move them into the document environment, they start working fine but... with a side effect: some garbage is generated on the resulting document's first page.

Here's an example code:

Code: Select all

\documentclass[a4paper, 12pt]{memoir}
\usepackage[english]{babel} 
%yields missing \begin{document}:
\setstocksize{210mm}{148.5mmm} 
\begin{document}
  % yields garbage on first page
  %\setstocksize{210mm}{148.5mmm} 
\end{document}
Thanks in advance for help,
Anton

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Problem with the Memoir package

Post by Juanjo »

Look at this line:

Code: Select all

\setstocksize{210mm}{148.5mmm} 
You have written an extra "m" here: 148.5mmm. Just remove it.
Ant_222
Posts: 6
Joined: Tue Mar 25, 2008 2:02 pm

Problem with the Memoir package

Post by Ant_222 »

Oh, LOL! Thanks...

But, unfortunately, the bug(?) seems more serious...

Here's the code where I'm setting all the layout options except trimmedsize, and which compiles without prolems:

Code: Select all

\documentclass[twoside, a5paper, 11pt, openany, russian]{memoir}
\usepackage[T2A]{fontenc}
\usepackage[cp1251]{inputenc}
\usepackage[russian]{babel}
\setlrmargins{20mm}{*}{*}
\setulmargins{20mm}{*}{*}
\setheadfoot{0pt}{8mm}
%\settrimmedsize{210mm}{148.5mm}
\settrims{0pt}{0pt}
\setstocksize{210mm}{148.5mm}
\settypeblocksize{153mm}{94mm}
\checkandfixthelayout
\begin{document}
Hello
\end{document}
But as soon as I uncomment this command, LaTeX reports this error:

Code: Select all

! LaTeX /b/c9/cError:/b/c0/c Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.9 \settrims{0
               pt}{0pt}
which is very strange because the only change is that I uncommented that command! In the result LaTeX thinks a line break has been inserted in the middle of the following line. If I, for example, locate the settrimmedsize command just before I start the document, the error is this:

Code: Select all

l.13 \begin{d
             ocument}
— again, an unneeded line break...

Anton
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Problem with the Memoir package

Post by Juanjo »

The \settrimmedsize command has a third mandatory argument. You are missing it. This works:

Code: Select all

\settrimmedsize{210mm}{148.5mm}{*}
Check first the syntax of every command if you run again into problems.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Problem with the Memoir package

Post by gmedina »

You are missing one mandatory argument in the \settrimmedsize command. (Page 53 in the memoir class documentation)

Edit: Juanjo has already given the same answer. I could not delete my message so I apologize.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Ant_222
Posts: 6
Joined: Tue Mar 25, 2008 2:02 pm

Re: Problem with the Memoir package

Post by Ant_222 »

Thanks again and sorry for bothering!

I'll have to get customed to it's not always reporting the real error...

Anton
Ant_222
Posts: 6
Joined: Tue Mar 25, 2008 2:02 pm

Problem with the Memoir package

Post by Ant_222 »

I have one more question. As I understand, the paperwidth consists of spinemargin, textwidth and foremargin. So, I can thus distribute it among the three components:

148.5 = 100 + 15 + 33.5

So, why don't the following settings work?

Code: Select all

\setlrmargins{15mm}{*}{*}
\setulmargins{20mm}{*}{*}
\setheadfoot{0mm}{8mm}
\settrims{0pt}{0pt}
\setstocksize{210mm}{148.5mm}
\settrimmedsize{210mm}{148.5mm}{*}
\settypeblocksize{162mm}{100mm}{*}
Here's the error:

Code: Select all

! Class memoir /b/c9/cError:/b/c0/c \spinemargin and//or \textwidth and//or \foremargin are too
 large for \paperwidth by 7.10492pt.
Anton

EDIT: Hmmmm, although the manual says:
You can plan and specify your layout in any order that is convenient to you. Each
of the page layout commands are independent;
calling settypeblocksize before setlrmargins solves the problem...
Post Reply