GeneralMemoir, Page Sizes & Margins

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
psilonline
Posts: 1
Joined: Wed Sep 29, 2010 2:31 pm

Memoir, Page Sizes & Margins

Post by psilonline »

Hi,

I'm using the memoir class for my book, but since I need it in several formats (ebook, b5 and a4) I would like to know if it's possible to have custom margins automatically selected with an if-then-else construction. Say,

if papersize=ebook then
% do ebook-margins
else if papersize=b5paper then
% do b5paper-margins
else if papersize=a4paper then
% do a4paper-margins
end if

Here, "papersize" is some 'variable' (I don't know if LaTeX has variables) that goes to the options of memoir.

Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Memoir, Page Sizes & Margins

Post by meho_r »

Hi,

This is not exactly what you asked for, but an alternative way. Simply define custom commands containing geometry setups with different page sizes and margins, then, when you need a specific format, just uncomment the matching line. E.g.:

Code: Select all

\documentclass{memoir}

\usepackage{blindtext}
\usepackage[english]{babel}

\usepackage{geometry}

\newcommand{\myebook}{%
\geometry{paperwidth=6in,paperheight=9in,%
hmargin={1in,1in},vmargin={1in,1in}}%
}

\newcommand{\myaivpaper}{%
\geometry{paperwidth=21cm,paperheight=29.7cm,%
hmargin={4cm,2cm},vmargin={2cm,4cm}}%
}

\newcommand{\mybvpaper}{%
\geometry{paperwidth=17.6cm,paperheight=25cm,%
hmargin={3cm,1.5cm},vmargin={1.5cm,3cm}}%
}

% Different paper sizes:
\myebook
%\myaivpaper
%\mybvpaper

\begin{document}

\Blinddocument

\end{document}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Memoir, Page Sizes & Margins

Post by localghost »

I think it's better not to use an additional package but set up the individual page layouts with the structures provided by the memoir class. See Chapter 2 of the class manual.


Best regards and welcome to the board
Thorsten
Post Reply