# \paperwidth too large

Recently a fellow student asked me how to make a table over the entire width of the page. I don't know why he wanted to do that but I thought it should be easy and wrote the following example:

\documentclass{article}
\usepackage{booktabs}
\usepackage{tabularx}

\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}

\noindent
\makebox[\linewidth][c]{%
\begin{tabularx}{\paperwidth}{XCR}
\toprule
x   & x   & x   \\
xx  & xx  & xx  \\
xxx & xxx & xxx \\
\bottomrule
\end{tabularx}%
}

\end{document}


However, the table was too wide (the grey part is the background of my pdf viewer):

I have printed the value of \paperwidth using a \convertto macro taken from another answer:

\makeatletter
\def\convertto#1#2{\strip@pt\dimexpr #2*65536/\number\dimexpr 1#1}
\makeatother
\convertto{mm}{\paperwidth}mm


It says the value of \paperwidth is 215.90114mm. But the size of the resulting pdf is according to my viewer A4, Portrait (210 × 297 mm) -- as it should be.

I am using pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2017.4.22) and Evince Document Viewer 3.14.1.

How can it be that \paperwidth and the width of the resulting document do not match?

• \paperwidth defaults to USletter size unless you use [a4paper] option – David Carlisle Dec 5 '17 at 10:21
• The default paper size for the standard classes (article, report, book) letter paper. Therefore, class option a4paper is needed. – Heiko Oberdiek Dec 5 '17 at 10:22
• @DavidCarlisle, @HeikoOberdiek yes, thank you. With the a4paper class option the table fits as expected. So \paperwidth is independent of the size of the output document? That seems counterintuitive... – jakun Dec 5 '17 at 11:18
• @jakun: No, the output document should comply to \paperwidth and friends, AFAIK. Maybe your viewer displays it as A4? – Martin Scharrer Dec 5 '17 at 11:39
• latex (unless you use graphics, or hyperref or geometry or similar driver specific packages) has no driver specific code so \papersize is used to set various tex lengths but it is not used to set the media box in the resulting pdf, that is your system default (a4 or us letter normally) If you add \usepackage{graphics} then the driver specials or pdftex primitives are used to force the pdf media box to match, then your document would have fitted on the page, but the page in your preview would have been us letter sized. – David Carlisle Dec 5 '17 at 12:07

You should use [a4paper] to tell LaTex that you are using A4 and/or you should add
\usepackage{graphicx}