Home General LaTeX tips and tricks → Custom margins [Previous Page] [Question index] [Next Page]

16. How can you specify custom margins and paper sizes?


Answer

Use the geometry package by Hideo Umeki.

This is a very, very powerful package, which solves a great many problems that previously could only be tackled imperfectly through ill-programmed hacks. If you ever want to do anything involving changing the margins or paper size of your document, look no further than this package.

My best advice is to print out and study the package's documentation — you really do need to read the manual to get the most out of it.


Example usage

In the preamble:


%% For defining all text/page measurements. 170x240mm is the
%% standard thesis page size Ponsen & Looijen require. 124x185mm is
%% simply a text body size that resulted in margins that pleased me.
%% The dvips option will be superseded if pdflatex is used, but is
%% necessary in order to generate a correct PostScript bounding box
%% under standard LaTeX.

\usepackage[vcentering,dvips]{geometry}
\geometry{papersize={170mm,240mm},total={124mm,185mm}}


Result, before

'Before' screenshot

Result, after

'After' screenshot

These are perhaps not very impressive before/after screenshots, but the size of the printed page is significantly different in the ‘after’ shot (check the line breaks!), and of course the more different your custom page size is from A4, the greater the effect will be.

Of course, there is now also the problem that the custom-sized page will not print nicely centred on A4 paper anymore. For a solution, read the A4 printing tip.


[Previous page] [Question index] [Next page]

Leo Breebaart (leo@lspace.org)
Last updated: 27 June 2016