Go to the first, previous, next, last section, table of contents.

Configuration file paper size command

The `@' command in a configuration file sets the paper size defaults and options. The first `@' command defines the default paper size. It has three possible parameters:

@ [name [hsize vsize]]

If `@' is specified on a line by itself, with no parameters, it instructs Dvips to discard all previous paper size information (possibly from another configuration file).

If three parameters are given, with the first parameter being a name and the second and third being a dimension (as in `8.5in' or `3.2cc', just like in the `papersize' special), then the option is interpreted as starting a new paper size description, where name is the name and hsize and vsize define the horizontal and vertical size of the sheet of paper, respectively. For example:

@ letterSize 8.5in 11in

If both hsize and vsize are zero (you must still specify units!) then any page size will match. If the `@' character is immediately followed by a `+' sign, then the remainder of the line (after skipping any leading blanks) is treated as PostScript code to send to the printer, presumably to select that particular paper size:

@ letter 8.5in 11in
@+ %%BeginPaperSize: Letter
@+ letter
@+ %%EndPaperSize

After all that, if the first character of the line is an exclamation point, then the line is put in the initial comments section of the final output file; else, it is put in the setup section of the output file. For example:

@ legal 8.5in 14in
@+ ! %%DocumentPaperSizes: Legal
@+ %%BeginPaperSize: Legal
@+ legal
@+ %%EndPaperSize

When Dvips has a paper format name given on the command line, it looks for a match by the name; when it has a `papersize' special, it looks for a match by dimensions. The first match found (in the order the paper size information is found in the configuration file) is used. If nothing matches, a warning is printed and the first paper size is used. The dimensions must match within a quarter of an inch. Landscape mode for all paper sizes is automatically supported.

If your printer has a command to set a special paper size, then give dimensions of `0in 0in'; the PostScript code that sets the paper size can refer to the dimensions the user requested as `hsize' and `vsize'; these will be macros defined in the PostScript that return the requested size in default PostScript units. Virtually all of the PostScript commands you use here are device-dependent and degrade the portability of the file; that is why the default first paper size entry should not send any PostScript commands down (although a structured comment or two would be okay). Also, some printers want `BeginPaperSize' comments and paper size setting commands; others (such as the NeXT) want `PaperSize' comments and they will handle setting the paper size. There is no solution I could find that works for both (except maybe specifying both).

The Perl 5 script `contrib/mkdvipspapers' in the distribution directory may help in determining appropriate paper size definitions.

If your printers are configured to use A4 paper by default, the configuration file (probably the global `config.ps' in this case) should include this as the first `@' command:

@ A4size 210mm 297mm
@+ %%PaperSize: A4

so that A4size is used as the default, and not A4 itself; thus, no PostScript a4 command is added to the output file, unless the user explicitly says to use paper size `a4'. That is, by default, no paper size PostScript command should be put in the output, but Dvips will still know that the paper size is A4 because `A4size' is the first (and therefore default) size in the configuration file.

Executing the `letter' or `a4' or other PostScript operators cause the document to be nonconforming and can cause it not to print on certain printers, so the default paper size should not execute such an operator if at all possible.


Go to the first, previous, next, last section, table of contents.