General ⇒ Memoir, Page Sizes & Margins
-
- Posts: 1
- Joined: Wed Sep 29, 2010 2:31 pm
Memoir, Page Sizes & Margins
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.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Memoir, Page Sizes & Margins
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
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10