[OS X TeX] Just went to Leopard and ...

Richard Koch koch at math.uoregon.edu
Fri Nov 9 12:31:11 EST 2007


On Nov 9, 2007, at 6:00 AM, Bruno Voisin wrote:

> By the way, I regret Dick Koch hasn't posted his explanation about  
> the why and how of the 4 new pdfTeX parameters \pdfpagewidth,  
> \pdfpageheight, \pdfhorigin and \pdfvorigin to the whole OS X TeX  
> list. It's very clear, very comprehensive, and very well-written (as  
> far as I can judge as a non-native English speaker); it could have  
> been helpful there.

OK, I'll bite. My explanation may have historical flaws, but I guess  
I'll learn something when other list members correct me.


I conjecture that your TeX documents use a "magnification" command. In  
that case, the problem you ran into is a common problem, easily  
explained. The standard solution was given earlier in this mailing  
list: if you typeset a plain TeX document with pdftex, then you must  
add the following commands just after the "magnification" command:

	\pdfpageheight=11.0 truein
	\pdfpagewidth=8.5 truein

Bruno Voisin suggested an even nicer solution, which produces a source  
file which will typeset in both pdftex and ordinary TeX:

	\input ifpdf.sty
	\pdfpagewidth=8.5truein \pdfhorigin=1truein
	\pdfpageheight=11truein \pdfvorigin=1truein

The main reason I'm writing is to explain this problem, since  
otherwise it may seem that we don't know what we are doing!


When TeX typesets, it outputs type to imaginary paper which starts at  
the origin and extends infinitely far down and to the right. Usually  
the characters are placed on this page right up to the margin, i.e.,  
right up to the origin. When this page is actually printed, the  
imaginary paper is placed on the printed page exactly one inch from  
the top and from the left. The result is a margin on the top and left.  
It is then up to TeX to make sure the typeset stuff doesn't extend too  
far right or too far down, and TeX does this using the variables  
\hsize and \vsize, which control the horizontal and vertical sizes of  
the printed text. Note that these variables only control the size of  
the actual printed area; TeX knows nothing about the size of the paper.

The technique used by TeX to magnify is primitive but effective. In  
TeX there is a primitive variable named \mag. The default value of  
this variable is 1000. At the very end of typesetting a page, just  
before shipping the page to the printer, the typeset image is  
magnified by \mag divided by 1000.

Users don't set \mag directly. Instead they use the \magnification  
command in plain TeX. You can find the definition of this command in  
an appendix to Knuth's TeX book: it justs sets \mag appropriately and  
then redefines \hsize and \vsize so that after the image is magnified,  
it will correctly cover the paper. Thus when you use magnification,  
the document is actually typeset in regular font size, but crunched up  
to the top and left; then it is magnified, and the result is that the  
image fills the page but the type is larger than usual.

The problem is that pdftex is smarter than TeX: it does know the paper  
size (or more precisely, the image size). That is because PDF files  
contain variables giving the size of the image. This extra information  
is important ---- for example, it makes it possible to output PDF  
slides for a presentation which are displayed from a computer and  
aren't intended to be printed. The extra variables which define the  
image size are called \pdfpagewidth and \pdfpageheight.

The default values for these variables are the width and height of  
ordinary paper. BUT!! The variables are magnified along with  
everything else by \mag. And unfortunately, they aren't reset by the  
\magnification command to compensate for the extra \mag at the end  
because Plain TeX was written long before pdftex existed.

Consequently, the extra commands being recommended just modify these  
variables appropriately after \mag is reset to compensate for the fact  
that \magnification doesn't do it.

The pdftex folks also extended TeX to allow output to go right up to  
the upper left corner, rather than always starting output one inch  
from the top and left. To do this, they added variables \pdfhorigin  
and \pdfvorigin. That's why these also must be reset after \mag is  

Dick Koch
koch at math.uoregon.edu

PS: Now experts: get out your guns and fire away!

------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/

More information about the MacOSX-TeX mailing list