[Tex/LaTex] How to create different margins for odd and even pages

double-sidedmargins

I'm trying to create a document that has different margins on even and odd pages. This is what I've tried:

\documentclass[a4paper,12pt]{article}
\usepackage[slovene]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsfonts,amsmath,amssymb,amsthm}
\usepackage[all,cmtip]{xy}
\usepackage{graphicx}
\usepackage{resizegather}

\hfuzz=2pt

\oddsidemargin=51pt
\evensidemargin=11pt

This would give me precisely the margins I want, but for some reason, \oddsidemargin and \evensidemargin are not independent. When I set one of them, the other is fixed. After reading some answers here, I tried setting changing the first line to

\documentclass[a4paper,12pt,twoside]{article}

but this completely messes with my layout and I get a bunch of "underfull \vbox"'s. (Although the left and right margins then behave as expected.) So, my question is as follows:

How do I make \oddsidemargin and \evensidemargin behave independently without introducing any other (undesired) behaviour?

Best Answer

LaTeX uses different margins on odd and even pages only if the twoside option is activated in the \documentclass line.

With the geometry package it's fairly easy to adjust the page setup parameters. For example

\documentclass[a4paper,twoside]{article}

\usepackage[
  inner=<XX>pt,
  textwidth=345pt,
]{geometry}

would set the usual "oneside" textwidth. Choose the value for <XX>pt to suit your needs. Check the manual of geometry for other options, in particular for setting the text height.

Spacing between paragraphs can be due to big indivisible objects near the end of a page. If there are many short subsections, this may happen, or if there are big math displays. Curing the appearance is a job to be done when the text is in final form.

A \raggedbottom command before \begin{document} will avoid this, at the expense of having non even page height.