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.
General ⇒ Memoir, Page Sizes & Margins
NEW: TikZ book now 40% off at Amazon.com for a short time.

Memoir, Page Sizes & Margins
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.:
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}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Memoir, Page Sizes & Margins
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
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10