35

I want to explicitly specify sizes of my document. For this purposes I use geometry package. I do the following (I found the solution here):

\documentclass{article}
\usepackage[paperwidth=2394pt, paperheight=6840pt]{geometry}
\begin{document}
    ...     % document's content
\end{document}

But after this I have offsets for my document's content! I think that happens because some margins are set with this directive:

\usepackage[paperwidth=2394pt, paperheight=6840pt]{geometry}

I wonder what are the default page margins for geometry package?

Michael Z
  • 1,005
  • 3
    geometry has a very good documention. Read section 6.4. Defaults and 5.7. Other options. – Ulrike Fischer Feb 17 '12 at 08:34
  • 1
    Is there a reason for specifying the paperwidth and paperheight in printer's points? It's perfectly alright to use inches and/or centimeters. – Mico Feb 17 '12 at 11:11

2 Answers2

31

The default is that the text width and the text height are 0.7 of the paper width and height. This means that

textwidth = 0.7 paperwidth = 1675.8pt
textheight = 0.7 paperheight = 4788pt

The left and right margins are, for one sided document, equal to each other; this gives

leftmargin = rightmargin = .15 paperwidth = 359.1pt

The vertical spaces are divided in a 2:3 proportion. So

topmargin = (2/5)(.3 paperheight) = 820.8pt
bottommargin = (3/5)(.3 paperheight) = 1231.2pt

See p. 13 of the manual (section 6.4).

The actual results are shown in the log file:

* driver: pdftex
* paper: custom
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes: 
* h-part:(L,W,R)=(359.10365pt, 1675.7927pt, 359.10365pt)
* v-part:(T,H,B)=(820.80835pt, 4787.97913pt, 1231.21252pt)
* \paperwidth=2394.0pt
* \paperheight=6840.0pt
* \textwidth=1675.7927pt
* \textheight=4787.97913pt
* \oddsidemargin=286.83366pt
* \evensidemargin=286.83366pt
* \topmargin=711.53836pt
* \headheight=12.0pt
* \headsep=25.0pt
* \topskip=10.0pt
* \footskip=30.0pt
* \marginparwidth=65.0pt
* \marginparsep=11.0pt
* \columnsep=10.0pt
* \skip\footins=9.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidefalse
* \@mparswitchfalse
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)

The small differences from the "exact" values are due to the way TeX performs computation (in integer arithmetic).

egreg
  • 1,121,712
  • Nice answer!! :D Do you know by any chance also the algorithm for the default values for the page layout from LaTeX itself? (I.e. when the geometry package has not been loaded.) – C-star-W-star Dec 06 '17 at 09:42
  • @AlexanderFrei I think it's a long section in the LaTeX companion. – egreg Dec 06 '17 at 14:37
  • Perhaps I am doing some conversion terribly wrong but some of the measurements here seem inconsistent. How can the side margins be 360pt which according to the conversion you include ( 1cm=28.453pt) is about 12.5 cm. Since A4 paper is about 21cm that would mean the margins are bigger than the whole document. What am I doing wrong here? – Marten Dec 11 '20 at 11:02
16

geometry's default page margins can be retrieved using \Gm@restore (see Problem with the geometry package reset option), which yields:

\paperwidth=2394.0pt
\paperheight=6840.0pt
\textwidth=1675.7927pt
\textheight=4787.97913pt
\evensidemargin=286.83366pt
\oddsidemargin=286.83366pt
\topmargin=711.53836pt
\headheight=12.0pt
\headsep=25.0pt
\topskip=10.0pt
\footskip=30.0pt
\baselineskip=12.0pt
\marginparwidth=65.0pt
\marginparsep=11.0pt
\columnsep=10.0pt
\hoffset=0.0pt
\voffset=0.0pt

Alternatively, you can also use the layouts package to visually display the page setup:

enter image description here

\documentclass{article}
\usepackage{layouts}% http://ctan.org/pkg/layouts
\usepackage[paperwidth=2394pt, paperheight=6840pt]{geometry}% http://ctan.org/pkg/geometry
\begin{document}
\currentpage
\pagedesign
\end{document}

\currentpage sets the dimensions for the current page, while \pagedesign prints the layout and dimensions.

Werner
  • 603,163