# How do I use a style file to force a4paper without calling the geometry package?

I'm writing a style file for my colleagues to typeset their exam papers. The paper size needs to be A4, but some of my colleagues always forget to invoke the a4paper option in the documentclass. Can I force A4 size via the style file, without doing \RequirePackage[a4paper]{geometry} (as I can't assume my colleagues have the geometry package)?

I suppose the answer is to emulate what the geometry package does, but I wonder whether there's a simpler way.

• why not make your file a class rather than a package, then the problem goes away as you can simply remove the option of changing paper size. – David Carlisle Mar 4 '16 at 10:42
• I'm all for finding the most widely-applicable solution, but also for reducing the amount of code you have to maintain. What are the odds in 2016 that a colleague won't have geometry? If so, what are the odds that they'll also have a very limited TeX install that will cause other problems later? – Mike Renfro Mar 4 '16 at 12:46
• why not use KOMA-class? a4paper is invoked by default. – naphaneal Apr 3 '16 at 17:04

## 1 Answer

Use the following two lines in your style file.

``````\setlength\paperheight {297mm}
\setlength\paperwidth  {210mm}
``````
• this won't actually affect the formatting in any way in most classes.You need \textwidth and \textheight to change to a size appropriate for A4. – David Carlisle Mar 4 '16 at 10:45
• @DavidCarlisle Then I will have to ask you to answer the question. That much knowledge is deep water for me. – Masroor Mar 4 '16 at 11:38