Page LayoutDifferent Margins for every odd page

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
0Jam
Posts: 10
Joined: Tue Dec 08, 2020 4:23 pm

Different Margins for every odd page

Post by 0Jam »

Dear people of the internet,
I would like to have every second page of my rather large document have different margins, top and bottom.
I have tried editing the geometry package options, but no luck, I get different errors each time:

Code: Select all

\ifthenelse{\equal{\value{Hilf}}{0}}{\geometry{top=1.5cm}}{\ifthenelse{\isodd{\value{page}}}{\geometry{top=1.5cm}}{\geometry{top=.5cm}}}
I hope you can see what I've tried to do here, the value "Hilf" is merely unequal to 0 once the document starts.
\ifthenelse has helped me out a lot, but I've read the texdoc documentation on the geometry package and it doesn't seem like you can do anything other than arithmetics inside the arguments of the package.

Code: Select all

\usepackage[left=2.5cm,right=2.5cm]{geometry}
\geometry{
	top={\ifthenelse{\equal{\value{Hilf}}{0}}{1.5cm}{{\ifthenelse{\isodd{\value{page}}}{1.5cm}{.5cm}}}},
	bottom=1.5cm,
	footskip=1.4cm, nomarginpar
	%top={\ifthenelse{\isodd{\value{page}}}
	%{2cm}
	%{5cm}}
}
I don't want to have to use \newgeometry and \restoregeometry every second page, there has to be a better way :D

Thank you!
Last edited by cgnieder on Thu Mar 31, 2022 5:08 pm, edited 1 time in total.
Reason: repaired code markup

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
0Jam
Posts: 10
Joined: Tue Dec 08, 2020 4:23 pm

Different Margins for every odd page

Post by 0Jam »

Also there needs to be a command, I can not do this manually using \newgeometry and \restoregeometry as the ToC is just one big thing.

Code: Select all

\ifthenelse{\equal{\value{Hilf}}{0}}{}{{\ifthenelse{\isodd{\value{page}}}{\newgeometry{top=.5cm}}{\restoregeometry}}}
something like this gets me the error: "You can't use `\relax' after \the. \ifthenelse{\equal{\value{Hilf}}{0}}"
Last edited by cgnieder on Thu Mar 31, 2022 5:12 pm, edited 1 time in total.
Reason: added inline code markup
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Different Margins for every odd page

Post by cgnieder »

site moderator & package author
Post Reply