41

I currently have an article document class and I previously changed it to include printing on A4 paper:

\documentclass[12pt, a4paper]{article}

However, I had to change my margins to meet my university requirements and the answer I received used A4 in the geometry package too.

\geometry{a4paper,margin=15mm,bindingoffset=25mm,heightrounded,}

Partially practical and partially theoretical, is there any difference to using either declaration and/or is there an effect by using both?

doncherry
  • 54,637
  • 3
    It's irrelevant: options to the class are automatically passed to all loaded packages. – egreg Jul 05 '12 at 15:51
  • @egreg: If you specify the paper size via \documentclass and don't use geometry, the paper will be of the correct size, so something changes. The question is, could these changes interfere with geometry in any way? (It doesn't seem like it.) – doncherry Jul 05 '12 at 16:30
  • @doncherry The class understands a4paper and sets the text block dimensions accordingly. If you also load geometry the dimensions are changed again according to geometry default for A4 paper, unless you use the pass option. – egreg Jul 05 '12 at 16:36

3 Answers3

29

a4paper specified in document class will be passed to geometry. So there is no difference in your case if you specify the option in \documentclass{article} or \usepackage{geometry}.

However if other packages need to know document format, you need to specify a4paper in the document class.

Paradox
  • 105
  • Looking at the source for the article class, how is the paper size being passed to geometry? I only see that paperheight and paperwidth are being directly set. – Tyler Crompton Oct 08 '15 at 03:18
  • @kissmyarmpit ! LaTeX Error: Filea4paper.sty' not found.` – alhelal Jan 10 '18 at 03:32
  • 1
    Passing the option to \documentclass gives any package a chance to react to the option; on the other hand, passing it to \usepackage{geometry} doesn't, thus I wouldn't say there is no difference. It depends on what other packages do with the paper size. Nothing in most cases, but who knows... – frougon Dec 22 '18 at 10:22
  • 2
    There is a difference if you call a4paper as class option or only geometry option. Please see my answer https://tex.stackexchange.com/a/472270/16550 – Mensch Jun 23 '19 at 23:16
5

I'm not sure about the changes, but I think the standard way is the following:

\documentclass[12pt]{article}
\usepackage[a4paper]{geometry}
...

You can specify the margins further. The simplest way is writing

\usepackage[a4paper, margin=2cm]{geometry}
Alenanno
  • 37,338
  • no, add a4paper to the class options, it only passed on to geometry then any later package that might also react to a4paper would never see it. – daleif Jul 05 '12 at 16:08
  • @daleif I don't understand your comment sorry... – Alenanno Jul 05 '12 at 21:42
  • 2
    type \documentclass[12pt,a4paper]{...} not just \usepackage[a4paper]{geometry} – daleif Jul 07 '12 at 10:02
  • @daleif I just realized but if that's true, how is this different from the accepted answer? – Alenanno Apr 23 '15 at 15:48
  • @daleif No answer? :P – Alenanno May 04 '17 at 10:18
  • The accepted answer is wrong in there is a difference. If package A and B can both react to option O, then passing O to A does not tricker option O in B. Passing O to the class instead, then even if the class does nothing with O, it is automatically passed on to both A and B. – daleif May 04 '17 at 10:57
  • Here is a very simple package for you, make an A and B version and test for yourself: \ProvidesPackage{A} \DeclareOption{a4paper}{ \typeout{A: a4paper tricker} } \ProcessOptions\relax Having a4paper added to the class trickers both A and B, giving it only to A (and not the class) does not tricker B. – daleif May 04 '17 at 11:01
  • The prime example, now I think about it, is the draft option. Sometimes you want this for all packages (graphicx and listings reacts to it), other times only local to the one package – daleif May 04 '17 at 11:10
4

There might be a difference if you load some other packages that could use ...paper options. It is naturally global option of your manuscript so I think it is better declared global, similarly to the language options discussed here: https://tex.stackexchange.com/a/60298/11002

So I think that ...paper should be put as a global option of \documentclass.

yo'
  • 51,322