# How to interpret the page layout in LaTeX using layout package?

I have used package layout to generate the page layout figure for both article and amsart class. It's quite curious that although different in values, the patterns for those two layouts are quite the same. One thing I don't understand is the vertical and horizontal dotted line which is \hoffset and \voffset far away from the page boarder. I have two questions concerning this:

1. What do these two dotted lines stand for?
2. How is it related to the text area?
3. Is it redundant with another parameter controlling the width of the body area \textwidth?

Example

\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{layout}
\begin{document}

\layout

\end{document}


Below is the layout for article class.

The intersection of the two lines is the origin for TeX's coordinate system when it starts a new document. The x axis goes to the right and the y-axis to the bottom. For PostScript it is in the lower left of the page. \hoffset and \voffset make only sense if you have a problem with a printer which shifts the printed pages in fact of a hardware problem to the left/right or top/bottom.

With the packages geometry or typearea you can define the text area and the package will do the rest ...

• results aren't necessarily predictable if geometry is used with the ams document classes. i haven't tested typearea, but would be suspicious, since the ams document classes don't follow the same conventions as aarticle, book, etc. – barbara beeton Jul 2 '15 at 16:44

The two dotted lines represent the fixed offset that is hardwired in TeX: one inch from the left and one inch from the top.

The position can be modified by changing either \hoffset or \voffset (defaulting to zero). Measurements for positioning the left and top margins of the text block must take this fixed offset into account, so for an odd page (or any page in oneside style), the text block is positioned at

1in + \hoffset + \oddsidemargin


from the left border of the page. On even pages \evensidemargin is used instead. Similarly, the top of the text block sits at

1in + \voffset + \topmargin + \headheight + \headsep


and the first baseline will be at

1in + \voffset + \topmargin + \headheight + \headsep + \topskip


from the top border of the page.

Note that changing \hoffset and \voffset for positioning the text block is not recommended: the two parameters should only be used for fine tuning when the printer driver badly interprets instructions (it shouldn't happen very often nowadays).

The parameters \textwidth and \textheight determine the area of the text block. There's no way to specify directly the distance from the right or bottom border of the text block to the corresponding page border.

\hoffset and \voffset go back to the days of plain TeX. Knuth mentions them only briefly in the TeXbook:

p.251 "If you want your output to be positioned differently when it is ultimately printed, you can offset it by giving it nonzero values to \hoffset and \voffset. For example

\hoffset=.5in   \voffset=1.5in


will move the output half an inch to the right of its normal position, and 1.5 inches down.

p.274 A <dimen parameter> is one of the following:

...

\hoffset (horizontal offset in \shipout)

\voffset (vertical offset in \shipout)

p.342 Here are examples of how you might want to give new values to the most important parameters other than \hsize and \vsize:

...

\hoffset=1.5in (All output will be shifted right by one and a half inches.)

Getting back to the layout, I am guessing that the dotted lines are offset 1inch from the page border, because those were the default margins in the original TeX.

• I would strongly recommend leaving \hoffset and \voffset alone. Some packages assume they are the standard 1in and things can go wrong if they are not. – Joseph Wright Jul 2 '15 at 15:06

Others have told about \hoffset and \voffset. There is also the layouts package (warning, written by me) that can produce a correctly dimensioned diagram of the current document's layout and listing the values. For example:

\documentclass{book}
\usepackage{layouts}
\begin{document}
\begin{figure}
\currentpage % grab the current layout values
\oddpagelayouttrue % show odd page layout
\pagedesign % print the diagram
\caption{The book odd page layout}
\end{figure}
\end{document}


You can use the package for experimenting with page layout designs. It can also display the layouts for paragraphs, floats, lists, sectional headings, footnotes, and the ToC & friends.

• Is it possible to move the margin from the left side to the right side, i did it with oddpagelayoutfalse, but how do i do it in memoir ? – Ibn Saeed Dec 28 '15 at 4:28