[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#225833: 225833: letter vs A4 in TeX



Hi all!

On Die, 30 Jan 2007, Atsuhito Kohda wrote:
>       documentclass[a5paper] \usepackage{geometry} \usepackage[dvips]{geometry}
> dvips      bad                     bad                  ok
> xdvi       bad                     bad                  ok
> pdflatex   bad                     ok                   ok
> dvipdfmx   bad                     bad                  ok

I guess I am missing something, but isn't all this a simple question of
RTFM? ...

Here is some explanation I wrote on the train ...

---
I think you miss a point here: There are two things in this, setting
the paper size in latex to get the right layout, and transfering this
information to the driver.

First: dvi format *does*not*support* the paper size, you have to specify
the paper size to the driver:
	dvips -t a5
	dvipdfm -p a5
In both cases you can check with either gv or pdfinfo that after this the 
paper size is set correct in the PostScript file and in the pdf file.

Now, there are *some* tricks to overcome this, ie by specifying the driver
option for geometry. This is clearly documented in the geometry manual:

Drivers:

dvips
    writes the paper size in dvi output with the \special macro. If you 
    use dvips as a dvips DVI-to-PS driver, for example, to print a 
    document with \geometry{a3paper,landscape} on A3 paper in landscape 
    orientation, you don't need options "-t a3 -t landscape" to dvips. 
    In version 3, this option sets an addtional correction for landscape 
    documents so that PostScript outputs shouldn't be displayed upside down 
    by PostScript viewers, e.g., Ghostscript. If you use VTEX environment 
    or pdflatex command, this option is automatically deselected and changed 
    to the corresponding driver option. This option works with xdvi and 
    dviout (though you may get some warnings).
...

So this explains why Kohda-san did arrive at the table where the dvips option
gives the best results: It works (as specified above) for dvips, xdvi.
For pdflatex the option pdftex is automatically selected. And I assume that
dvipdfm(x) also just check the same special as dvips, so that's the reason
why dvipdfmx with dvips-option worked.

In case you use pdflatex you have the same problems, without setting
anything special, the latex core will not specify the papersize, and the
pdf output will contain what ever is default.
	\documentclass[a5paper]{article}
OTOH, if you add the geometry package it selects automatically the pdftex
driver and the a5paper option from the documentclass is executed, so:
	\documentclass[a5paper]{article}
	\usepackage{geometry}
and pdfinfo gave me A5 paper as intended. As it should be.

So actually I don't see any problem. The only problem is as mention in the
bug report, that we should document how to set the paper option for the
different drivers. I would say something like this would suffice:

Setting the paper size of your document
=======================================
Setting the paper size of your document consists of two steps:
1) Telling LaTeX which layout it should use
2) Telling the output driver (dvips, dvipdfm(x), pdflatex, xdvi) the
   intended paper size
Note that these two things are not automatically connected.

1) is done by specifying the paper size in the documentclass options, like
	\documentclass[a5paper]{article}

2) Here it depends on your driver, ie whether you use latex+dvips or
   latex+dvipdfm(x), or pdflatex.

   Variant a) Tell the driver on the command line
   	latex file.tex
	dvips -t a5 file.dvi
	dvipdfm -p a5 file.dvi

	Disadvantage: You might forget it, thus the better solution is
	to use the geometry package with the correct driver option:

   Variant b) Use geometry.sty and the correct driver option
   	For this you specify the paper size as usual in the documentclass
	options:
		\documentclass[a5paper]{article}
	and furthermore use geometry.sty with the correct driver option:
		\usepackage[driver=dvips]{geometry}
	After this a simple
		latex file.tex
		dvips file.tex
	produces a ps file that suses A5 paper. Note that xdvi evaluates 
	the same information in the dvi file as dvips, so using
	the driver=dvips option works also for xdvi.

	For dvipdfm(x) it is best to use driver=dvipdfm, but incidentally
	the dvipdfm(x) also evaluates the same special as dvips so that
	driver=dvips also works for dvipdfm(x).

	Finally, for pdflatex, use the option driver=pdftex. Again 
	geometry is intelligent and recognizes that it is running with
	pdflatex and resets the driver option automatically to pdftex.
	
	To some it up, using geometry it is currently possible to use
		\usepackage[driver=dvips]{geometry}
	and have the correct paper sizes with all the common drivers.
	Note that this may change later on and that you have to specify
	the correct driver explicitely to get the desired results.

	Finally, you can adjust the default settings for geometry.sty
	by putting a copy of 
	/usr/share/texmf-{tetex,texlive}/tex/latex/geometry/geometry.cfg
	into
	/etc/texmf/tex/latex/geometry/
	and editing this file as described in the file.


Additions and comments welcome!

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@logic.at>                    Università di Siena
Debian Developer <preining@debian.org>                         Debian TeX Group
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
TROSSACHS (pl.n.) The useless epaulettes on an expensive raincoat.
			--- Douglas Adams, The Meaning of Liff



Reply to: