While struggling a bit with layout, I have encountered a few useful packages, namely geometry
, changepage
and vmargin
but I'm wondering a bit about the difference between them.
An important one that I have already figured out: the changepage
package doesn't force some default layout settings that differ from the ones of my document class (in my case report
), which is extremely nice when you just want to locally change the layout (in my case for the title page).
Are there other differences?
Best Answer
The
changepage
package is useful for temporarily change the page parameters, based on the current values, so it's compatible with several other packages; particularly useful is itsadjustwidth
environment.On the other hand,
geometry
andvmargin
are useful to set the overall shape of the page without doing complicated computations involving\topmargin
,\evensidemargin
and\oddsidemargin
and several other parameters.The approach of the two packages is different;
vmargin
has two different eight argument commands for setting the main parameters, whilegeometry
offers a much more flexible key-value interface. Moreovergeometry
also handles page imposition (a page layout built on a smaller page than the one the document is printed on, with crop marks) and the\newgeometry
feature that allows to change the page parameters as many times as we need (but requires a page break, due to how TeX handles pages).Also
changepage
provides for changing the page height and width, but with an interface I consider difficult to manage, while\newgeometry
uses the same key-value interface as\geometry
(or the options to\usepackage[...]{geometry}
).Which one to prefer? The answer is easy:
vmargin
makes a bad error when doing its computations for the page parameters, because it usually sets\hoffset
and\voffset
to -1in (see section 3.3 in the documentation), which breaks other packages (notablyatbegshi
on whicheso-pic
andpdfpages
are based) that, coherently with the recommendations insource2e
(the commented source code of LaTeX), assume\hoffset
and\voffset
are zero.There is another package that's worth mentioning, that is,
typearea
, part of the KOMA-script suite. Its approach in setting the page parameters is completely different fromgeometry
's because it's based on page divisions: divide the height and width of the page by the same integer, create an imaginary subdivision into rectangles and take some of them as the type block (more details in the guide to KOMA-script). It doesn't support page imposition, but works well withcrop
. It doesn't conflict withatbegshi
.Note also that the
memoir
class and the AMS classes have their own methods for setting the page parameters, but usinggeometry
with them is possible.Of course one should never forget the
\enlargethispage
feature, which is in the LaTeX kernel, that may help in easily solving pagination problems without having to change the overall shape of the type block.