Go to the first, previous, next, last section, table of contents.
Calling @pack is fairly simple:
a2ps Options... Files...
@pack uses GNU getopt
, hence:
-
the order between options and files does not matter: `a2ps -4m
main.c' and `a2ps main.c -4m' are identical.
-
options may be grouped together: `a2ps -4mg main.c - Pprinter'
-
when there are no ambiguities, long options can be abbreviated, e.g.,
`--re' will be understood as `--report',
-
`--' ends the options. Anything behind `--' is considered to
be a file: `a2ps -- -2' prints the file `-2'.
Here after bool stands for boolean. It is considered as true
(i.e. setting the option on), if bool is `yes', or `1';
as false if it equals `no' or `0'; and raise an error
otherwise. The corresponding short option takes no arguments, but
corresponds to a positive answer.
- `-q'
-
- `--quiet'
-
- `--silent'
-
be really quiet
- `-v'
-
- `--verbose'
-
tell what we are doing
- `-V'
-
- `--version'
-
print version and exit successfully
- `-=shortcut'
-
- `--user-option=shortcut'
-
use the shortcut defined by the user. See section Configuration files,
item `UserOption:'.
- `--report[=language]'
-
generate PreScript report on all/language style. This file
must be later processed by @pack using the PreScript style.
- `--guess'
-
@pack won't print anything, but will act as
file
does: it
returns for each file the language in which @pack believes the
file is written. This can be very useful on broken systems to
understand why a file is written with a bad style sheet
(see section Automatic style).
- `-h'
-
- `--help'
-
print a short help, and exit successfully.
- `--list-options'
-
Give a extensive report on @pack configuration and installation.
- `--list-features'
-
Known medias, encodings, languages, prologues, printers and user option
shortcuts are reported.
- `-M'
-
- `--media=media'
-
use output media media. Currently media may be `A3',
`A4', `A5', `B4', `B5', `Letter', `Legal',
`Tabloid', `Ledger', `Statement', `Executive',
`Folio', `Quarto', `10x14'. `A4dj', `Letterdj'
are also defined for Desk Jet owners, since that printer needs bigger
margins.
- `-r'
-
- `--landscape'
-
print in landscape mode
- `-R'
-
- `--portrait'
-
print in portrait mode
- `--columns=num'
-
specify the number of columns of virtual pages per physical page.
- `--rows=num'
-
specify the number of rows of virtual pages per physical page.
- `--major=direction'
-
specify whether the virtual pages should be first filled in rows
(direction = `rows') or in columns (direction =
`columns').
- `-1'
-
Predefined layout: 1 x 1 portrait, 80 chars/line, major rows (i.e. alias for `--columns=1 --rows=1 --portrait --chars-per-line=80 --major=rows').
- `-2'
-
1 x 1 landscape, 80 chars/line, major rows.
- `-3'
-
3 x 1 landscape, major rows.
- `-4'
-
2 x 2 portrait, 80 chars/line, major rows.
- `-5'
-
5 x 1 landscape, major rows.
- `-6'
-
3 x 2 landscape, 80 chars/line, major rows.
- `-7'
-
7 x 1 landscape, major rows.
- `-8'
-
4 x 2 landscape, 80 chars/line, major rows.
- `-9'
-
3 x 3 portrait, 80 chars/line, major rows.
- `-j'
-
- `--borders=bool'
-
print borders around virtual pages.
- `-A'
-
- `--compact=bool'
-
Compact mode for a sequence of files. This option allows the printing
of more than one file in the same physical page. This option makes
sense only when the number of virtual pages is greater than 1.
Otherwise, the beginning of each file will be printed in a new sheet.
- `--margin[=num]'
-
Specify the size of the margin (num PostScript points, or 12
points without arguments) to leave in the inside (i.e. left for the
front side page, and right for the back side). This is intended to ease
the binding.
- `--line-numbers=number'
-
precede each number line with its line number.
- `-C'
-
Alias for `--line-numbers=5'.
- `-f'
-
- `--fontsize=size'
-
scale font to size for body text. size is a float number.
To change the base font, change the current prolog (see section Designing prologues.
- `-lnum'
-
- `--chars-per-line=num'
-
Set the number of columns per page. num is the real number of
columns devoted to the body of the text, i.e., no matter whether lines
are numbered or not.
- `-Lnum'
-
- `--lines-per-page=num'
-
Set the lines per virtual page for printing. The font size is
automatically scaled up to fill in the whole page. This is useful for
printing preformatted documents which have a fixed number of lines per
page. The scaling of the font size will be suppressed if this option is
used with option `--font'. The minimum number of lines per page is
set at 40 and maximum is at 160. If a number less than 40 is supplied,
scaling will be turned off and a warning message is printed on the
terminal.
- `-m'
-
- `--catman'
-
Understand UNIX manual output ie: 66 lines per page and possible bolding
and underlining sequences. The understanding of bolding and underlining
is there by default even if `--catman' is not specified.
- `-Tnum'
-
- `--tabsize=num'
-
set tabulator size to num. This option is ignored if
--interpret=no
is given.
- `--non-printable-format=format'
-
specify how non-printable chars are printed. format can be
`caret' (`^A', `M-^B' etc.), or `space' (a space is
written instead of the non-printable character).
These are the options through which you may define the information you
want to see all around the pages.
All these options support text as an argument, which is composed
of plain strings and meta sequences. See section Meta sequences for details.
- `-b[text]'
-
- `--header[=text]'
-
set the page header
- `-B'
-
- `--no-header'
-
no page headers at all.
- `--center-title[=text]'
-
- `--left-title[=text]'
-
- `--right-title[=text]'
-
Set virtual page center, left and right titles to text.
- `-u[text]'
-
- `--underlay[=text]'
-
use text as under lay (or water mark), i.e., in a
light gray, and under every page.
- `--left-footer[=text]'
-
- `--footer[=text]'
-
- `--right-footer[=text]'
-
Set sheet footers to text.
- `-c'
-
- `--truncate-lines=bool'
-
Cut lines too large to be printed inside the borders. The maximum line
size depends on format and font size used and whether line numbering is
enabled.
- `-i'
-
- `--interpret=bool'
-
interpret tab, bs and ff chars
- `-Xname'
-
- `--encoding=name'
-
use input encoding name. Currently @pack supports:
- `ascii'
-
Regular ASCII code.
- `latin1'
-
Which real ISO name is ISO8859-1.
- `latin2 (ISO8859-2)'
-
- `latin3 (ISO8859-3)'
-
- `latin4 (ISO8859-4)'
-
- `latin5 (ISO8859-9)'
-
- `latin6 (ISO8859-10)'
-
The support for these encodings is provided thanks to Ogonkify
(see section `Overview' in Ogonkify manual). Ogonkify is a tool
that lets you extend the font support for most encodings, i.e., for most
non-western-Europe alphabets. If you think the support is not good
enough, you may help the extension of Ogonkify: See section `Adding new characters' in Ogonkify manual, for
details.
- `hp8'
-
The 8 bits Roman encoding for HP.
- `mac'
-
For the Macintosh encoding. The support is not sufficient, and a lot of
character may be missing at the end of the job. This is planed to be
fixed.
- `ibmpc'
-
For the regular PC encoding. Not all the characters will be printed.
- `pcg'
-
For the PC Graphic encoding.
- `cp1250'
-
MicroSoft's CP-1250 encoding (aka CeP).
- `-t filename'
-
- `--title=filename'
-
Give the name filename to the files read trough the standard
input.
- `--prologue=prologue'
-
Use prologue as the PostScript prologue for @pack{}.
prologue must be in a file named `prologue.pro', which
be in a directory of your library path (see section Library files).
Currently the available prologues are:
- `bw'
-
(black and white) the regular presentation
- `gray'
-
same presentation, but with gray shades for comments etc.
- `gray2'
-
same as gray, but light declaration (such as function calls etc.) are
mapped on the same shape as the strong declarations (such as function
declaration etc.).
- `color'
-
still the same idea, but with colors.
- `--print-anyway=bool'
-
force binary printing. By default, a whole print job is stopped as soon
as a binary file is detected. To detect such a file we make use of a
very simple heuristic: if the first sheet of the file contains more than
40% of non-printing characters, it's a binary file.
- `-ofile'
-
- `--output=file'
-
leave output to file file. If file is `-', leave
output to the standard output.
- `-nnum'
-
- `--copies=num'
-
print num copies of each page
- `-D'
-
- `--setpagedevice[=key:value]'
-
Pass a page device definition to the generated PostScript output. If no
value is given, key is removed from the definitions.
For example, command
a2ps -DDuplex:true report.pre
prints file `report.pre' in duplex (two side) mode.
Page device operators are implementation dependent but they are
standardized. See section Page device options for details.
- `-S'
-
- `--statusdict=key[:value]'
-
- `--statusdict=key[::value]'
-
Pass a statusdict definition to the generated PostScript output.
statusdict
operators and variables are implementation dependent;
see printer's documentation for details. See section Statusdict options for
details.
If no value is given, key is removed from the definitions.
With a single colon, pass a call to an operator, for instance:
a2ps -Ssetpapertray:1 quicksort.c
prints file `quicksort.c' by using paper from the paper tray 1
(assuming that printer supports paper tray selection).
With two colons, define variable key to equal value. For
instance:
a2ps -Spapertray::1 quicksort.c
produces
/papertray 1 def
in the PostScript.
- `-k'
-
- `--page-prefeed'
-
enable page prefeeding. It consists in positioning the sheet in the
printing area while the PostScript is interpreted (instead of waiting
the end of the interpretation of the page before pushing the sheet). It
can lead to an significant speed up of the printing.
@pack quotes the access to that feature, so that non supporting
printers won't fail.
- `-K'
-
- `--no-page-prefeed'
-
disable page prefeeding. See item `DefaultPrinter:' in
section Configuration files and results of option `--list-options' to
see the bindings between printer names and commands.
- `-P name'
-
- `--printer=name'
-
send output to printer name. See item `Printer:' and
`Unknown printer:' in section Your printers and results of option
`--list-options' to see the bindings between printer names and
commands.
- `-d'
-
send output to the default printer. See item `DefaultPrinter:' in
section Your printers.
- `-snum'
-
- `--side=num'
-
number of sheet sides. num is of course 1 or 2.
- `-g'
-
- `--graphic-symbols=bool'
-
set symbols graphical conversion
- `-Elanguage'
-
- `--pretty-print=language'
-
use the language pretty print style sheet. See section Known languages, for the available style sheets.
- `-K'
-
- `--automatic-style=bool'
-
@pack will try to guess in what language is written your files,
and use the corresponding style sheet.
- `--strip-level=num'
-
Depending on the value of num:
-
everything is printed;
-
regular comments are not printed
-
strong coments are not printed
-
every comment is canceled.
This option is valuable for instance in java
in which case strong
comments are the so called documentation comments, or in SDL
for
which some graphical editors pollutes the specification with internal
data as comments.
Note that the current implementation is not satisfactory: some undesired
blank lines remain. This is planed to be fixed.
Headers, footers, titles and the water mark are strings in which some
meta sequences are later replaced by their actual values. In general
`%' are related to general information, while `$' meta
sequences are related to the current file.
On a new sheet @pack first draws the water mark, then the content of the
first page, then the frame of the first page, (ditto with the others),
and finally the sheet header and footers. This order must be taken into
account for some meta sequences (e.g., `$L', `$l').
Currently @pack support the following meta sequences:
- `%%'
-
character `%'
- `$$'
-
character `$'
- `%?#cond#if_true#if_false#'
-
this may be used for conditional assignment. The separator (presented
here as `#') may be any character. if_true and
if_false may be defined exactly the same way as regular headers,
included meta sequences and the `$?' construct.
cond may be:
- `l'
-
true if printing in landscape mode,
- `v'
-
true if printing on the back side of the sheet (verso).
- `1'
-
- `2'
-
- `3'
-
true if tag 1, 2 or 3 is not empty. See item `$t1' for
explanation.
- `$(var)'
-
value of the environment variable var
- `%a'
-
the localized equivalent for `Printed by User Name'
- `%A'
-
the localized equivalent for `Printed by User Name from
Host Name'
- `%a{username}'
-
the localized equivalent for `Printed by username'
- `%A{username@hostname}'
-
the localized equivalent for `Printed by username from
hostname'.
These two are provided in the case @pack would be used by the
print service: since neither of the user name nor the host name can be
known at the time the files reach @pack{}, these options should be
used.
- `%c'
-
trailing component of the current working directory
- `%C'
-
current time in `hh:mm:ss' format
- `$C'
-
file modification time in `hh:mm:ss' format
- `%d'
-
current working directory
- `%D'
-
current date in `yy-mm-dd' format
- `$D'
-
file modification date in `yy-mm-dd' format
- `%D{string}'
-
format current date according to string with the
strftime(3)
function.
- `$D{string}'
-
format file's last modification date according to string with the
strftime(3)
function.
- `%e'
-
current date in localized short format (e.g., `Jul 4, 76' in
English, or `14 Juil 89' in French).
- `$e'
-
file modification date in localized short format.
- `%E'
-
current date in localized long format (e.g., `July 4, 76' in
English, or `Samedi 14 Juillet 89' in French).
- `$E'
-
file modification date in localized long format.
- `%F'
-
current date in `dd.mm.yyyy' format.
- `$F'
-
file modification date in `dd.mm.yyyy' format.
- `%l'
-
top most line number of the current page
- `$l'
-
current line number. To print the page number and the line interval in
the right title, use `--right-title="$q:%l-$l"'.
- `$L'
-
number of lines in the current file.
- `%m'
-
the host name up to the first `.' character
- `%M'
-
the full host name
- `%n'
-
the user login name
- `$n'
-
input file name without the directory part
- `%N'
-
the user's pw_gecos field up to the first `,' character
- `$N'
-
the full input file name
- `%p'
-
current page number
- `$p'
-
page number for this file
- `%P'
-
total number of pages printed
- `$P'
-
number of pages of the current file
- `%q'
-
localized equivalent for `Page %p'
- `$q'
-
localized equivalent for `Page $p'
- `%Q'
-
localized equivalent for `Page %p/%P'
- `$Q'
-
localized equivalent for `Page $p/$P'
- `%s'
-
current sheet number
- `$s'
-
sheet number for the current file
- `%S'
-
total number of sheets
- `$S'
-
number of sheet of the current file
- `%t'
-
current time in 12-hour am/pm format
- `$t'
-
file modification time in 12-hour am/pm format
- `$t1'
-
- `$t2'
-
- `$t3'
-
Content of tag 1, 2 and 3. Tags are pieces of text @pack fetches in the
files, according to the style. For instance, in
mail-folder
style, tag 1 is the title of the mail, and tag 2 its author.
- `%T'
-
current time in 24-hour format `hh:mm'
- `$T'
-
file modification time in 24-hour format `hh:mm'
- `%*'
-
current time in 24-hour format with seconds `hh:mm:ss'
- `$*'
-
file modification time in 24-hour format with seconds `hh:mm:ss'
- `$v'
-
the sequence number of the current input file
- `$V'
-
the total number of files
- `%W'
-
current date in `mm/dd/yy' format
- `$W'
-
file modification date in `mm/dd/yy' format
All format directives can also be given in format
escape width directive
where width specifies the width of the column to which the escape
is printed. For example, escape `$5%' will expand to something
like ` 12'. If the width is negative, the value will be
printed left-justified.
Page device is a PostScript level 2 feature that offers an uniform
interface to control printer's output device. a2ps protects
all page device options inside an if block so they have no effect in
level 1 interpreters. Although all level 2 interpreters support page
device, they do not have to support all page device options. For
example some printers can print in duplex mode and some can not. Refer
to the documentation of your printer for supported options.
Here are some usable page device options which can be selected with the
`-D' option (`--setpagedevice'). For a complete listing, see
PostScript Language Reference Manual: section 4.11 Device Setup.
Collate boolean
-
how output is organized when printing multiple copies
Duplex boolean
-
duplex (two side) printing
ManualFeed boolean
-
manual feed paper tray
OutputFaceUp boolean
-
print output `face up' or `face down'
Tumble boolean
-
how opposite sides are positioned in duplex printing
The statusdict
is a special storage entity in PostScript (called
a dictionnary), in which some variables and operators determine
the behavior of the printer. As for page device, those variables are
device dependent: refer to the documentation of your printer for
supported options.
Here are some statusdict definitions in which you might be interested:
manualfeed boolean
-
Variable which determine that the manual fed paper tray will be used.
@pack uses several files: its PostScript prologue, encoding
related files, and such. @pack looks for these files in the
following path:
$HOME/.a2ps:/usr/local/share/a2ps
You may change this default path with the environment variable
A2PS_LIBRARY
.
If you plan to define yourself some header files for @pack (option
`--prologue'), they should be in one of those directory, with a
`.pro' suffix.
The following exit values are returned:
- `0'
-
@pack terminated normally.
- `1'
-
an error occured.
- `2'
-
bad argument was given.
- `3'
-
unknown language was given.
Go to the first, previous, next, last section, table of contents.