# MiKTeX “default papersize” setting

Now MiKTeX has the following setting:

I have it set to A4 (A4size) all the time. But I don't really understand what this setting is supposed to do. When I compile

\documentclass{book}
%\usepackage{fullpage}
\begin{document}
Hello World!
\end{document}


I get an A4 document, however uncommenting the fullpage package changes it to lettersize. The package documentation says that it needs the appropriate documentclass option, but I thought that is passed to the class by the MiKTeX default setting.

So what exactly does that setting do? Also, why are there two options for Letter, A4 and A6?

-

Generally when using LaTeX classes (article, book, report) you can explicitly specify the kind of paper size to use, a4paper or letterpaper, for example:

\documentclass[a4paper,11pt]{report}


However, when you convert a DVI file to PostScript there is again a choice of paper sizes. The conversion program (dvips) doesn't know the paper size specified in the original LaTeX file, but will assume its own default paper size unless told otherwise by a command such as:

    dvips -t a4 mydocdoc.dvi -o mydoc.ps


MikTeX settings will cater for the latter and set the paper size correctly to simplify the commands. It saves the setting in C:\MiKTeX\dvips\config\config.ps

Since you are using the MikTeX menus and pdfLaTeX to compile the document, this setting of the program does nothing i.e., you are not producing a postcript file, but a pdf directly. What is important in this case is that the class you are using sets \pdfpageheight and \pdfpagewidth.

-
Do you know what happens when I set dvips with -t unknown? Will it take the size specified in the LaTeX input file? –  kiss my armpit Jun 21 '13 at 22:51
dvips will never read the size from the LaTeX file, its input is the dvi i.e., the device independent file, which doesn't have any physical paper size info. –  Yiannis Lazarides Jun 21 '13 at 22:53
So the settings do not affect pdfTeX at all. Why are there two menu items for A4, A6 and Letter? –  marczellm Jun 22 '13 at 8:46

Traditional (La)TeX has no direct contact with printing on a physical paper.

 \documentclass[a4paper]{book}


and

 \documentclass{book}% US Letter


set up the width of the the text area and its offset from a notional reference pint 1in in from the top left corner of the page. But it would be the job of the .dvi driver to insert commands and perhaps further offset the text, for printing at a physical paper size.

pdfTeX combines the roles of TeX and the driver so has additional parameters \pdfpageheight and \pdfpagewidth that tell a .pdf reader what size to show the page boundaries. But by default LaTeX does not set these. (They are set by several packages including geometry and hyperref). So many tools in the TeX distribution will need a default page layout (almost always A4 or Letter) however for historical compatibility reasons the default behaviour for most people that have A4 printers is that the default physical paper size is A4 but the default text width and margins for latex are set for US Letter. LaTeX does not give a way to change that default, Documents not aimed at US Letter should use an explicit option so that they remain portable.

Apart from the screenshot of the menu, this applies to any TeX distribution not just MikTeX (in fact I personally use TeX Live but the issues are the same).

-
So if I understand correctly, the MiKTeX setting affects the papersize known to the driver, but not the papersize known to the documentclass and packages. This way if a package/class tries to 'detect' the papersize it will assume letterpaper. But why are there more than one options called A4, Letter and A6 in the menu? –  marczellm Feb 3 '13 at 21:10
sorry I don't use miktex so I'm not sure of the details of that menu, you might want to wait for a miktex user to answer:-) –  David Carlisle Feb 3 '13 at 21:36

First of all, what you say is not true. Using the fullpage package does not change \pdfpagewidth/height or \paperwidth/height. It does therefore not change the paper size from A4 to letter. In fact, it computes and sets the margins as well as \textwidth/height depending on the values of \paperwidth/height. By default, fullpage will set the left and right margin to 1in. So text should appear horizontally centered on the page.

Now the MiKTeX's setting for the default page size apparently controls the value of \pdfpagewidth/height in pdflatex. These control the page size that is written into the PDF. Maybe, it affects dvips too, but I did not test it. Also, MiKTeX does not change the default for \paperwidth/height, meaning that the documentclass or packages like fullpage.sty will configure your margins thinking that the page has letter format, while the PDF may actually have A4 pages. The result is that your document looks bad, really bad, as the text is not centered at all horizontally on the page.

Take a look at the PDF generated by the following code when MiKTeX 2.9 is set to A4 default page size:

\documentclass{book}
\usepackage{printlen}
\usepackage{blindtext}
\usepackage{fullpage}
\begin{document}
\noindent\blindtext

\uselengthunit{cm}
\noindent
\printlength{\paperwidth}\\
\printlength{\paperheight}\\
\printlength{\pdfpagewidth}\\
\printlength{\pdfpageheight}
\end{document}


Looking at the PDF, the visible margin on the left is visibly wider than the right margin. Also observe how inconsistent the values are.

I conclude that MiKTeX is broken and that the default page size setting should be set to letter size at all times, since the MiKTeX programmer didn't bother to patch the documentclasses and other packages such that \paperwidth/height would be set to A4 (or something else) either, and not just \pdfpagewidth/height.

The obvious workaround is to use the geometry package or koma-script's pagesize options to make the values of \pdfpagewidth/height and \paperwidth/height consistent.

-