# parametric page size

The Greek Ministry of Education allows two different sizes for our textbooks, namely the small size (17 cm X 21 cm) and the large size (namely 21 cm X 25 cm) .. I define both sizes using the geometry package - for example to get the large size I call the package as

\usepackage[a4paper,
inner=1.55cm,
outer=1.55cm,
left=1.55cm,
right=1.55cm,
top=1.58cm,
bottom=1.58cm,


and a similar call is used for the small size .. I wonder if it is possible to parametrize the process in the way we do in in programming languages, namely, to define a variable bookSize and two constants SMALL and LARGE and write a code in the form

if bookSize=SMALL call geometry package with values for 'small' size
if bookSize=LARGE call geometry package with values for 'large' size


If LaTeX allows such a coding, where can I find all the relevant documentation to study this stuff? thanks a lot .... Athanasios

\documentclass{book}

% giving value to a variable
\def\bookSize{SMALL}%

% using some conditionals
\makeatletter
\def\ATH@SMALL{SMALL}%
\def\ATH@LARGE{LARGE}%

\ifx\bookSize\ATH@LARGE
\usepackage[a4paper,
inner=1.55cm,
outer=1.55cm,
left=1.55cm,
right=1.55cm,
top=1.58cm,
bottom=1.58cm,
\fi
\ifx\bookSize\ATH@SMALL
\usepackage[a5paper,% or what ever
inner=1cm,
outer=1cm,
left=1cm,
right=1cm,
top=1cm,
bottom=1cm,
\fi
\makeatother

\begin{document}
Hello world
\end{document}


• texdoc topic should open a pdf viewer with the TeX by Topic pdf. – user4686 Oct 1 '17 at 9:43
• the % in my answers are not really needed: they are there to comment out the rest of the line, which means avoiding a space token from the end-of-line processing by TeX. But such a space token would cause no harm in those locations anyhow. – user4686 Oct 1 '17 at 9:56
• remark: there is an \else in TeX but there is no \elif. Which is a pity because it would have simplified a great many things related to expansion (but a priori one would have one needed \elifx, \elifnum, \elifdim, .., a bunch of them -- I did not think it over at all -- and this multiplication could have been deterrent to their introduction; possibly e-TeX could have done so) – user4686 Oct 1 '17 at 9:57
• TeX by Topic (and of course TeXBook) give excellent ressources for learning TeX. It is a macro expansion language. It handles spaces in a very special manner, because they have both typesetting significance and syntactic significance. With LaTeX, you can use packages etoolbox, xstring, ... but it is very good to be well-versed in core material from TeXBook/ TeX by Topic. And it is indispensable to become acquainted with the e-TeX extensions which however have no general public documentation although incoporated since 2004 by default in pdftex (from TeXLive). texdoc etex. – user4686 Oct 1 '17 at 12:05