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

Bruno Voisin bvoisin at mac.com
Tue Nov 6 19:37:49 EST 2007

```Le 7 nov. 07 à 00:20, win at ucla.edu a écrit :

> [...] I still want/need to use plain TeX but in the context of
> TeXshop, possibly returning to the new OS X compatible Textures once
> the development bugs have been removed.  However,  whenever I
> typeset an existing TeX (i.e., Textures) document---and my
> installation of TeXshop may have inadvertently imposed A4 page
> standards, my margins are horribly messed up.  (They are messed up
> even in the context of using A4 paper.)  Is there a simple way to
> accomplish this?  As a workaround, I have found that the following 4
> lines introduced near the beginning (i.e., in the preamble region)
> of a TeX document will do the job (to the nearest millimeter or so):
>
> \hsize=6.5truein
> \vsize=9.0truein
> \hoffset=0.68truein
> \voffset=0.9truein
>
> (Note that I use "truein" in place of "in" as a dimension to
> accommodate the use of "\magnification=" statements.)  Is there a
> simpler or more elegant way to adjust the margins appropriately to
> conform with US letter paper?  I appreciate any advice that you
> might have to offer.

Two things:

- Regarding A4 vs US Letter, MacTeX tries to guess at install time
which default size you're using (as defined in System Prefs > Printers
& Fax) and adjusts its default settings accordingly. In case this
guess is wrong, you'll get a bit of handwork to perform (in Terminal).

> Some programs in TeX need to know whether you are using letter-size
> paper or A4-size paper. The installer tries to guess the answer from
> your printer's default paper setting. This will work in almost all
> cases. If you run into problems, open Apple's Terminal program in
> Applications/Utilities and type one of the following pairs of
>
>     sudo texconfig-sys paper letter
>     sudo texconfig-sys dvips paper letter
>
>     sudo texconfig-sys paper a4
>     sudo texconfig-sys dvips paper a4

- Regarding paper size and \magnification in plain TeX: TeXShop uses
pdfTeX by default, not traditional TeX like Textures. As a
consequence, there are two additional dimensions to consider,
\pdfpageheight and \pdfpagewidth. These define if I'm not mistaken the
media size, namely the size of the support TeX is shipping out to
(paper size for printed output, screen size for screen output). More
precisely:

* In Textures the media size corresponds I think to the paper size
specified in File > Page Setup.

* In standard TeX, namely for dvips, the media size corresponds to the
paper size coming first in the list of paper sizes in /Library/TeX/
Root/texmf-config/dvips/config/config.ps, and may be modified via the
papersize \special in any given document as specified in section 4.1
of /Library/TeX/Documentation/texmf-doc/dvips/dvips.pdf.

* In pdfTeX, the media size is defined via the above dimensions
\pdfpageheight and \pdfpagewidth in the file /Library/TeX/Root/texmf-
config/tex/generic/config/pdftexconfig.tex, and may be modified by
redefining these dimensions in any given document.

The config files config.ps and pdftexconfig.tex are the files set by
MacTeX at install time, and later by the user should texconfig-sys be
used.

But now, just to make things challenging, comes the effect of
\magnification: though with pdfTeX the parameters \pdfpageheight and
\pdfpagewidth are set in true units in pdftexconfig.tex, then owing to
some devious reasoning I never quite understood the true units there
are not really true and are affected by any subsequent \mag or
\magnification.

Thus, as a take-home message: four parameters \pdfpageweight,
\pdfpagewidth, \pdfhorigin and \pdfvorigin must be reset in true units
after any \mag or \magnification, in the same way as does Knuth by
resetting \hsize and \vsize after modifying \mag in the definition of
\magnification.

For example, a plain TeX document of mine, intended for A4 paper (210
mm x 297 mm) and typeset indifferently with pdfTeX or TeX + dvips +
distiller, contains:

\magnification=\magstep1
\input ifpdf
\ifpdf
\pdfpagewidth=210truemm \pdfhorigin=1truein
\pdfpageheight=297truemm \pdfvorigin=1truein
\else
\special{papersize=210mm,297mm}
\fi

Adaptation to US Letter should yield something like:

\magnification=\magstep1
\input ifpdf
\ifpdf
\pdfpagewidth=8.5truein \pdfhorigin=1truein
\pdfpageheight=11truein \pdfvorigin=1truein
\else
\special{papersize=8.5in,11in}
\fi

Hope this helps,

Bruno Voisin