Setting page size and margins

There’s quite a bit of interest in the .tex code behind the Grid Computing Cluster report, but I think posting the raw code in its entirety would be a bit too overwhelming to quickly glean useful tips from it. (Also to avoid getting into any issues with my university… etc…)

So instead, I’ll be doing a series of short posts on how I achieved certain effects and book design, starting with this one. It’s probably faster for people to “zero-in” on what they need. 😉 Posts in this series will be tagged “book design”. But before you implement your next major book project with LaTeX, do check with your printing company about the printing process used. If you’ll be using on-demand laser printing, everything should go fine since the RGB colour model of your PDF should be adequate. However, if you’re going with offset printing, your printing company will most likely prefer CMYK colour model to be used instead, and I haven’t quite figured out how to tweak that perfectly with (pdf)LaTeX. In our case, only the book cover was printed with offset printing, and the effect was acceptable — so that ended well…

IMPORTANT DISCLAIMER: I am NOT a graphics designer, so my choice of colours/illustrations/etc probably sucks. Don’t shoot me. :-)

Now there are multiple ways to achieve the same effect in LaTeX (that’s FOSS for you). For this report, I’ve decided to use the memoir document class, which incorporates the functionalities of many other packages. (Do take some time to browse or search through the excellent manual with texdoc or mthelp.)

The flowfram package looks like a very interesting solution for designing dynamic layout, but I didn’t find out about it until too late into my own project. Do find some time to look at it yourself. If you want to go with the standard document classes (report, book) or the koma-script classes, I’ll indicate what extra packages you’ll need where relevant.

In this first post we’ll just look at how (custom) page sizes and margins can be specified. Basically my page design is:

  • Stock paper size is 303mm x 216mm. The stock paper is the raw original paper that a commercial printer will print the page on, which will be trimmed down to the page size
  • Page size is A4 i.e. 297mm x 210mm.
  • The printer advised us to leave a good 10mm from the page edges around any printed text.
  • I decided the main typeblock will be 20mm from the top, bottom and spine (inner) edge of the page, and 15mm from the outer edge.
  • Also, the running header should occupy the height of a line of text, 7mm from the top edge of the typeblock. Whereas the baseline of the running footer is 7mm from the bottom edge of the typeblock.

These are not necessarily good measurements for an aesthetically-pleasing book design, but more because I was trying to strike a balance between aesthetics and to fit everything in (Lesson: Get in touch with the printing company early to check with their printing specifications per minimum page margins, etc!)

These can be implemented using commands from the memoir class. (The notion of ‘stock’, although a common concept in publishing and printing industries, is only available in memoir, not in the standard document classes.)


%% The stock paper size

%% The ‘real’ page size

%% The stock paper will be trimmed 3mm from the
%% top edge and 3mm from the left edge


%% Spine and trim page margins from main typeblock

%% Top and bottom page margins from main typeblock

%% Header occupies height of a single line;
%% Bottom edge of footer is 7mm from bottom edge
%% of typeblock


%% Bottom edge of header is 7mm from top edge of
%% typeblock


%% Apply and enforce layout

In my case, due to some later issues with colouring the 3mm bleeding edges too (as per our printing company’s request), I decided to make the trimmed page size the same as my stock size and increased the page margins instead:


%% Custom stock paper and page size

%% Adjust margins accordingly to achieve
%% same previous layout




If you just need to print on exactly A4-sized paper, you can forget about setting the stock and trimmed size explicitly and just do




One last thing: if you’re not using the memoir class, you can still change the page margins via a high-level interface with the geometry package:

   paperwidth=216mm, paperheight=303mm,
   left=23mm,  %% or inner=23mm
   right=18mm, %% or outer=18mm
   top=23mm, bottom=23mm,

Again, if you’re just going to print on A4 (or letter) paper, you can just do

   left=20mm,  %% or inner=20mm
   right=15mm, %% or outer=15mm
   top=20mm, bottom=20mm,

i.e. just pass the a4paper option to the geometry package; there’s then no need to set the paper height and width explicitly.

8 thoughts on “Setting page size and margins

  1. I have the following question:
    I would like to resize the dimensions of my page, keeping all proportions fixed (i.e. size of fonts compared to width of raws, number of raws per page, etc.). Any idea how do I do that for documentclass{book}?

  2. Hi ofer,

    If I understand correctly, do you mean you'd like to re-scale your page? Similar to photocopying your original page but at 75% of the original size? (Since you mention the font size) AFAIK there's no easy way to achieve that esp. for ratio of font size to text width.

    If you just need to resize your paper *size* but the main typeblock (area occupied by main text block) remains the same size, then you can just adjust the left, right, top, bottom margins accordingly with the geometry package.

    If you're looking for a solution to rescale your page (like photocopying to 75% of original page) a quick fix would be to use the pdfpages package. It lets you include specific pages from a PDF file with scaling options.

  3. Sufi, try something similar to this (using the pdfpages package):



    … Some text …

    %% where HelloWorld.pdf is the
    %% external file you want to include

    … some other text…

  4. Excellent article. How did you manage to print something in the trimmed area? I would like to use it to give a clear view of which chapter you are at when looking from the side of the book by adding colored boxes there but I have no idea how to add something in that margin.

  5. I hacked about a bit with some TikZ nodes with page anchors (extending _past_ the page margins and therefore into the trim areas), conveniently parked within the code for the running headers and footers: see for the blog post and sample code download.

    You might also be interested in this link:

Leave a Reply