[Top] | [Contents] | [Index] | [ ? ] |
GNU a2ps with pretty-printing features, strong support for many alphabets, and customizable layout.
This is Edition 4.13 of the a2ps 2 September 2004.
1. Introduction Foreword 2. User's Guide Beginner should start here 3. Invoking a2ps The command line options 4. Configuration Files Tuning your a2ps 5. Library Files Dynamic extension of a2ps 6. Encodings Supporting various charsets 7. Pretty Printing Support for source files 8. PostScript PostScript specific informations 9. Contributions Tools around a2ps 10. Frequently asked questions Frequently Answered Questions A. Glossary Small Dictionary B. Genesis History of a2ps C. Copying Your rights and ours Concept Index Most words used in here
Introduction
1.1 Description What a2ps is 1.2 Reporting Bugs What to do when you face problems 1.3 a2ps Getting news about a2ps 1.4 Helping the Development How to contribute
User's Guide
2.1 Purpose What a2ps is made for 2.2 How to print The basis 2.3 Important parameters What needs to be set 2.4 Localizing How to have a2ps speaking your language 2.5 Interfacing with Other Programs Using a2ps from common programs
How to print
2.2.1 Basics for Printing Printing text files 2.2.2 Special Printers Some useful fake printers 2.2.3 Using Delegations Printing special files (PS, DVI etc.) 2.2.4 Printing Duplex Doing Fancy Things 2.2.5 Checking the Defaults Is it set the way you want?
Interfacing with Other Programs
2.5.1 Interfacing With a Mailer Printing Mails or News 2.5.2 Netscape Interfacing with Netscape
Invoking a2ps
3.1 Command line options 3.2 Escapes Strings ready to use in the headers
Command line options
3.1.1 Tasks Options Exclusive options 3.1.2 Global Options Settings involving the whole process 3.1.3 Sheet Options Specify the layout on the sheet 3.1.4 Page Options Specify the virtual pages 3.1.5 Headings Options Specify the headers you want 3.1.6 Input Options How to process the input files 3.1.7 Pretty Printing Options Source files support 3.1.8 Output Options What should be done of the output 3.1.9 PostScript Options PostScript specific options
Escapes
3.2.1 Use of Escapes Where they are used 3.2.2 General Structure of the Escapes Their syntax 3.2.3 Available Escapes Detailed list
Configuration Files
4.1 Including Configuration Files Isolating site specific values 4.2 Your Library Path Setting the files search path 4.3 Your Default Options Default state of a2ps 4.4 Your Media Sheets dimensions 4.5 Your Printers How to access the printers 4.6 Your Shortcuts Your very own command line options 4.7 Your PostScript magic number Handling very old printers 4.8 Your Page Labels Page names as in Ghostview
4.9 Your Variables Short cut for long sequences 4.10 Your Delegations Delegating some files to other filters 4.11 Your Internal Details Details you might want to tune
Your Variables
4.9.1 Defining Variables Syntax and conventions 4.9.2 Predefined Variables Builtin variables
Your Delegations
4.10.1 Defining a Delegation Syntax of the definitions of the delegations 4.10.2 Guide Line for Delegations What should be respected 4.10.3 Predefined Delegations Making the best use of these delegations
Library Files
5.1 Documentation Format Special tags to write a documentation 5.2 Map Files Their general shape and rationale 5.3 Font Files Using other fonts 5.4 Style Sheet Files Defining pretty printing rules
Font Files
5.3.1 Fonts Map File Mapping a font name to a file name 5.3.2 Fonts Description Files Needed files to use a Font 5.3.3 Adding More Font Support Using even more Fonts
Encodings
6.1 What is an Encoding The concept of encoding explained 6.2 Encoding Files How a2ps handles the encodings
Encoding Files
6.2.1 Encoding Map File Mapping an encoding name to a file name 6.2.2 Encoding Description Files Specifying an encoding 6.2.3 Some Encodings Classical or standard encodings
Pretty Printing
7.1 Syntactic limits What can't be done 7.2 Known Style Sheets Some supported languages 7.3 Type Setting Style Sheets a2ps as a tiny word processor 7.4 Faces Encoding the look of pieces of text 7.5 Style Sheets Semantics What is to be defined 7.6 Style Sheets Implementation How they should be defined 7.7 A Tutorial on Style Sheets Step by step example
Type Setting Style Sheets
7.3.1 Symbol Access to the glyphs of the Symbol font 7.3.2 PreScript Typesetting in an a2ps like syntax 7.3.3 PreTeX Typesetting in a LaTeX like syntax 7.3.4 TeXScript Typesetting in a mixture of both
PreScript
7.3.2.1 Syntax Lexical specifications 7.3.2.2 PreScript Commands 7.3.2.3 Examples
PreTeX
7.3.3.1 Special characters 7.3.3.2 PreTeX Commands 7.3.3.3 Differences with LaTeX
Style Sheets Semantics
7.5.1 Name and key Both names of a style sheet 7.5.2 Comments Author name, version etc. 7.5.3 Alphabets What words are legal 7.5.4 Case sensitivity Is BEGIN different of begin 7.5.5 P-Rules Pretty Printing Rules 7.5.6 Sequences Strings, comments etc. 7.5.7 Optional entries Second level of pretty printing
Style Sheets Implementation
7.6.1 A Bit of Syntax Lexical rules of the ssh language 7.6.2 Style Sheet Header Declaration of a style 7.6.3 Syntax of the Words Classes of the Characters 7.6.4 Inheriting from Other Style Sheets Extending existing style sheets 7.6.5 Syntax for the P-Rules Atomic Pretty Printing rules 7.6.6 Declaring the keywords and the operators Special Classes of Identifiers 7.6.7 Declaring the sequences Bordered Lexical Entities 7.6.8 Checking a Style Sheet Ask a2ps to Check the Sheet
A Tutorial on Style Sheets
7.7.1 Example and syntax ChangeLog files 7.7.2 Implementation Implementation of chlog.ssh 7.7.3 The Entry in `sheets.map' Getting automatic style selection 7.7.4 More Sophisticated Rules Complex regular expressions 7.7.5 Guide Line for Distributed Style Sheets Additional Constraints
PostScript
8.1 Foreword: Good and Bad PostScript How to lose, how to win 8.2 Page Device Options Accessing some printers' features 8.3 Statusdict Options Some other features 8.4 Colors in PostScript Specifying a color or a gray 8.5 a2ps Convention for PostScript library files 8.6 Designing PostScript Prologues Make it look like what you want
Designing PostScript Prologues
8.6.1 Definition of the faces What goes in a characters style 8.6.2 Prologue File Format Including documentation 8.6.3 A step by step example
Contributions
9.1 card
Printing Reference Cards 9.2 fixps
Fixing Some Ill Designed PostScript Files 9.3 fixnt
Fixing Microsoft NT PostScript Files 9.4 pdiff
Produce Pretty Comparison of Files 9.5 psmandup
Printing Duplex on Simplex Printers 9.6 psset
Inserting calls to setpagedevice
card
9.1.1 Invoking card
Command Line Interface 9.1.2 Caution when Using card
card runs commands
fixps
9.2.1 Invoking fixps
Command Line Interface
fixnt
9.3.1 Invoking fixnt
Command Line Interface
pdiff
9.4.1 Invoking pdiff
Command Line Interface
psmandup
9.5.1 Invoking psmandup
Command Line Interface
psset
9.6.1 Invoking psset
Command Line Interface
Frequently asked questions
10.1 Why Does...? Questions on Error 10.2 How Can I ...? a2ps' How-To 10.3 Please tell me... Existential Questions on a2ps
Why Does...?
10.1.1 Why Does it Print Nothing? The printer issues nothing 10.1.2 Why Does it Print in Simplex? While I asked for Duplex 10.1.3 Why Does it Print in Duplex? While I asked for Simplex 10.1.4 Why Does it Not Fit on the Paper? Some parts are missing 10.1.5 Why Does it Print Junk? Random characters 10.1.6 Why Does it Say my File is Binary? And refuses to print it 10.1.7 Why Does it Refuse to Change the Font Size
How Can I ...?
10.2.1 How Can I Leave Room for Binding? Specifying Margins 10.2.2 How Can I Print stdin
?Using a2ps in a pipe chain 10.2.3 How Can I Change the Fonts? Tired of Courier? 10.2.4 How Can I Simulate the Old Option `-b'? Printing in Bold 10.2.5 How Can I Pass Options to `lpr' Disable the banner 10.2.6 How Can I Print on Non PostScript Printers? Using GhostScript 10.2.7 How Can I Print Man Pages with Underlines Now it Prints With Italics
Please tell me...
10.3.1 Is a2ps Printing dates in short format 10.3.2 Why Have the Options Changed? Respect The Users 10.3.3 Why not having used yacc
and suchWhy Using Style Sheets
Genesis
B.1 History Where does it come from B.2 Thanks People who really helped B.3 Translators People who brought support of your tongue
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1.1 Description What a2ps is 1.2 Reporting Bugs What to do when you face problems 1.3 a2ps Getting news about a2ps 1.4 Helping the Development How to contribute
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The format used is nice and compact: normally two pages on each physical page, borders surrounding pages, headers with useful information (page number, printing date, file name or supplied header), line numbering, pretty-printing, symbol substitution etc. This is very useful for making archive listings of programs or just to check your code in the bus. Actually a2ps printed with a2ps
While at the origin its names was derived from "ASCII to PostScript", today we like to think of it as "Any to PostScript". Indeed, a2ps supports delegations, i.e., you can safely use a2ps PostScript, LaTeX, JPEG etc., even compressed.
A short list of features of a2ps
Ogonkify
(see section `Overview' in Ogonkify manual),
written by Juliusz Chroboczek.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You may encounter some of these problems yourself. In any case, please never abandon without giving us a chance. We need information from everybody so that mistakes get fixed as fast as possible.
So, if you have a problem (configuration error, compilation error, runtime error, documentation error or unclear), first check in the FAQ (see section 10. Frequently asked questions), then on the page but it appears that the version of a2ps consider upgrading.
If the problem persists. But symbolic arguments can be abbreviated when there are no ambiguity, so here, you can just use `-Av'.
The option `-P lw' means to print on the printer named `lw', and finally, the long option `--prologue' requires the use one of the alternative printing styles. There are other prologues (See section 3.1.6 Input Options, option `--prologue'), and you can even design yours (see section 8.6 Designing PostScript Prologues).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The first one, void
, sends the output to the trash.
Its main use is to see how many pages would have been used.
gargantua ~ $ a2ps -P void parsessh.c [parsessh.c (C): 33 pages on 17 sheets] [Total: 33 pages on 17 sheets] sent to the printer `void' |
The second, display
sends the output to Ghostview
, so that
you can check the output without printing. Of course if you don't have
Ghostview
, it won't work... And it is up to you to configure
another displaying application (see section 4.5 Your Printers).
The last, file
saves the output into a file named after the
file you printed (e.g., saves into `foo.ps' when you print
`foo.c').
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
a2ps In that case it delegates the task to other programs. What you should retain from this, is, forget that there are delegations. Indeed, the interface with the delegations has been designed so that you don't need to be aware that they exist to use them. Do as usual.
As an example, if you need to print a PostScript file, just hit:
gargantua ~ $ a2ps article.ps -d [article.ps (ps, delegated to PsNup): 7 pages on 4 sheets] [Total: 8 pages on 4 sheets] sent to the default printer |
While honoring your defaults settings, a2ps
two virtual pages per physical page to psnup
, a powerful filter
part of the famous psutils
by Angus Duggan.
Suppose now that you want to display a Texinfo file. Then, provided you have all the programs a2ps
gargantua ~ $ a2ps a2ps.texi -P display [a2ps.texi (texinfo, delegated to texi2dvi): 75 pages on 38 sheets] [Total: 76 pages on 38 sheets] sent to the printer `display' |
Once the read documentation, you know you want to print just pages 10 to 20, plus the cover. Just hit:
gargantua ~ $ a2ps a2ps.texi --pages=1,10-20 -d [a2ps.texi (texinfo, delegated to texi2dvi): 13 pages on 7 sheets] [Total: 14 pages on 7 sheets] sent to the default printer |
A final word: compressed files can be treated in the very same way:
gargantua ~ $ a2ps a2ps.texi.gz -a1,10-20 -d [a2ps.texi (compressed, delegated to Gzip-a2ps): 13 pages on 7 sheets] [Total: 14 pages on 7 sheets] sent to the default printer |
You should be aware that:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If you still want to save more paper, and you are amongst the set of happy users of Duplex printers, a2ps (See section A. Glossary, for definitions). The option to specify Duplex printing is `--sides=mode' (see section 3.1.9 PostScript Options).
Here is how to print the documentation in Duplex and send it to the Duplex printer `margot':
quasimodo ~ a2ps/doc $ a2ps -s2 -Pmargot a2ps.texi [a2ps.texi (texinfo, delegated to texi2dvi): 109 pages on 28 sheets] [Total: 110 pages on 28 sheets] sent to the printer `margot' |
Actually, you can do something even more tricky: print a small book!
This is much more complicated than printing Duplex, because the pages
needs to be completely reorganized another way. This is precisely the
job of psbook
, yet another PsUtil from Angus Duggan. But there
is a user option which encapsulates the magic sequence of options:
`book'. Therefore, just run
quasimodo a2ps/doc $ a2ps -=book -Pmargot a2ps.texi [a2ps.texi (texinfo, delegated to texi2dvi): 109 pages on 109 sheets] [Total: 109 pages on 109 sheets] sent to the printer `margot' |
and voila` !, a booklet printed on margot!
We strongly discourage you to try with several files at once, because the tools then easily get lost. And, after all, the result will be exactly the same once you collated all the booklets together.
Another limitation is that this does not work if it is not sent to a printer. This kind of weird limitations will be solved in the future.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If a2ps the default settings given by your system administrator. Checking those default values is easy:
~ % a2ps --list=defaults Configuration status of a2ps 4.12a ================================== Sheets: ------- medium = A4, portrait page layout = 1 x 1, rows first borders = yes file alignment = page interior margin = 0 More stuff deleted here Internals: ---------- verbosity level = 2 file command = /usr/bin/file -L temporary directory = /tmp library path = /home/akim/.a2ps /usr/share/a2ps/sheets /usr/share/a2ps/ps /usr/share/a2ps/encoding /usr/share/a2ps/afm /usr/share/ogonkify/afm /usr/share/a2ps/ppd /usr/share/a2ps/fonts /usr/share/ogonkify/fonts /usr/share/a2ps |
Remember that the on-line help is always available. Moreover, if your
screen is small, you may pipe it into more
. Just trust
this:
a2ps --help | more |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Both values may be checked with `a2ps --list=defaults'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To enable these features, properly set your environment variable
LANG
(see the documentation of your system, for instance
`man locale', `man environ' etc.).
The problem with this approach is that a lot more than just messages and
time information is affected: especially the way numbers are written
changes, what may cause problems with awk
and such.
So if you just want messages and time format to be localized, then define:
set LC_MESSAGES=fr ; export LC_MESSAGES set LC_TIME=fr ; export LC_TIME |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.5.1 Interfacing With a Mailer Printing Mails or News 2.5.2 Netscape Interfacing with Netscape
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When you print from a mailer (or a news reader), your mailer calls a tool, say a2ps a2ps better results, make sure to tell a2ps option `mail' (or `longmail' for longer inputs) encapsulates most typical tuning users want to print mails (for instance, don't print all the headers).
Most specifically, if your mailer is:
elm
pine
# Your printer selection printer=a2ps -=mail -d # Special print command personal-print-command=a2ps -=mail -d |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This is actually valid for any program that generates PostScript that you want to post-process with a2ps@c. Use the following command:
a2ps |
Not too hard, isn't it?
Nevertheless, this setting suppose your world is OK, your file(1)
detects correctly PostScript files, and your a2ps
delegate. In case one one these conditions is not met, use:
a2ps -ZEps |
Do not forget to tell Netscape whether your printer supports colors, and the type of paper it uses.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Calling a2ps
a2ps Options... Files... |
If no Files... are given, a2ps `-' appears in the Files..., it designates the standard input too.
3.1 Command line options 3.2 Escapes Strings ready to use in the headers
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To read the options and arguments that you give, a2ps
getopt
, hence:
Here after a boolean is considered as true (i.e. setting the option on), if boolean 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.
When an argument is presented between square brackets, it means that it is optional. Optional arguments to short option must never be separated from the option.
3.1.1 Tasks Options Exclusive options 3.1.2 Global Options Settings involving the whole process 3.1.3 Sheet Options Specify the layout on the sheet 3.1.4 Page Options Specify the virtual pages 3.1.5 Headings Options Specify the headers you want 3.1.6 Input Options How to process the input files 3.1.7 Pretty Printing Options Source files support 3.1.8 Output Options What should be done of the output 3.1.9 PostScript Options PostScript specific options
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Task options specify the task a2ps it executes the task and exits successfully.
file
does: display the (key of the) type of the
Files.
For instance, on a C
file, you expect it to answer `c', and
upon a PostScript file, `ps'.
This can be very useful on broken systems to understand why a file is printed with a bad style sheet (see section 5.4 Style Sheet Files).
~ % a2ps --which bw.pro gray.pro /usr/local/share/a2ps/ps/bw.pro /usr/local/share/a2ps/ps/gray.pro |
If there are several library files matching the name, only the first one is reported: this allows to check which occurrence of a file is used by a2ps@c.
~ % a2ps --glob 'g*.pro' /usr/local/share/a2ps/ps/gray.pro /usr/local/share/a2ps/ps/gray2.pro |
There are also options meant for the maintainers only, presented for sake of completeness.
sheet
verbosity is set, report version numbers, requirements and
ancestors.
HTML
format.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These options are related to the interface between you and a2ps@c.
When a2ps
A2PS_VERBOSITY
. If it is set, this defines the verbosity level
for the whole session (options `--verbose', and `-q' etc.
have then no influence). The valid values for A2PS_VERBOSITY
are
exactly the valid arguments of the option `--verbose'. This helps
tracking down configuration problems that occur before a2ps
even a chance to read the command line.
There are a few predefined user-options:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This options specify the general layout, how the sheet should be used.
`A4dj', `Letterdj' are also defined for Desk Jet owners, since that printer needs bigger margins.
The special medium `libpaper' means that you want a2ps
ask the library libpaper
for the medium to use. This choice is
valid only if libpaper
was available when a2ps
See the man page of paperconf
for more information.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This options are related to the content of the virtual pages.
Please note that the options `-f', `-L', `-l', `-m', and `-1' .. `-9' all have an influence on the font size. Only the last one will win (i.e., `a2ps -L66 -l80' is the same as `a2ps -l80').
To change the fonts used, change the current prologue (see section 8.6 Designing PostScript Prologues.
If your file is actually a UNIX manual input, i.e., a roff file, then depending whether you left a2ps readable version of the text described, or a pretty-printed version of the describing file (see section 4.10 Your Delegations).
--interpret=no
is given.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
All these options support text as an argument, which is composed of plain strings and escapes. See section 3.2 Escapes, for details.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The pages referred to are the input pages, not the output pages, that is, in `-2', printing with `-a1' will print the first virtual page, i.e., you will get half the page filled.
Note that page selection does work with the delegations (see section 4.10 Your Delegations).
n
unix
r
mac
nr
pc
rn
any
auto
This is used for instance in the name given to the document from within
the PostScript code (so that Ghostview
and others can display a
file with its real title, instead of just the PostScript file name).
It is not the name of the output. It is just a logical title.
-b
of a2ps 4.3.
It is a copy of the black and white prologue, but in which all the fonts
are in Bold.
udiff
, wdiff
style sheets, to underline the differences. New things are in bold
on a diff background, while removed sequences are in italic.
There are no means to use a fixed size Symbol font, therefore you should not use the heavy highlighting style.
file(1)
what it thinks of the type of the file. If file(1)
answers `data', the file will also be considered as binary, hence
not printed.
Typically most people don't want to pretty-print a PostScript source file, but want to print what describes that file. Then set the delegations on.
See 4.10 Your Delegations for information on delegating, and option `--list=delegations' for the applications your a2ps
#{toc}
). If the given format is empty
(i.e., you wrote `--toc='), don't issue the table of contents.
Note that it is most useful to define a variable (see section 4.9 Your Variables), for instance, in a configuration file:
Variable: toc.mine \ \\Keyword{Table of Content}\n\ #-1!f\ |$2# \\keyword{$-.20n} sheets $3s< to $3s> ($2s#) \ pages $3p<-$3p> $4l# lines\n||\ \\Keyword{End of toc}\n |
and to give that variable as argument to `--toc': `a2ps *.c --toc=#{toc.mine}'.
Note too that you can generate only the table of content using `--pages':
a2ps *.c --toc -atoc |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These options are related to the pretty printing features of a2ps@c.
If language is `key.ssh', then don't look in the library path, but use the file `key.ssh'. This is to ease debugging non installed style sheets.
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.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The type of backups made can be set with the VERSION_CONTROL
environment variable, which can be overridden by this option. If
VERSION_CONTROL
is not set and this option is not given, the
default backup type is `existing'. The value of the
VERSION_CONTROL
environment variable and the argument to this
option are like the GNU Emacs
`version-control' variable;
they also recognize synonyms that are more descriptive. The valid
values are (unique abbreviations are accepted):
SIMPLE_BACKUP_SUFFIX
environment variable, which can be
overridden by this option. If neither of those is given, the default is
`~', as it is in Emacs
.
It is possible to pass additional options to lpr
or lp
via
the variable `lp.options', for more information see 10.2.5 How Can I Pass Options to `lpr'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For example, command
ubu $ a2ps -SDuplex:true -STumble:true NEWS [NEWS (plain): 15 pages on 8 sheets] [Total: 15 pages on 8 sheets] sent to the default printer |
prints file `report.pre' in duplex (two sides) tumble (suitable for landscape documents). This is also valid for delegated files:
a2ps -SDuplex:true -STumble:true a2ps.texi |
Page device operators are implementation dependent but they are standardized. See section 8.2 Page Device Options, for details.
statusdict
operators and variables are implementation dependent;
see the documentation of your printer for details. See section 8.3 Statusdict Options, for details. Several `--statusdict' can be accumulated.
If no value is given, key is removed from the definitions.
With a single colon, pass a call to an operator, for instance:
a2ps --statusdict=setpapertray: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 --statusdict=papertray::1 quicksort.c |
produces
/papertray 1 def |
in the PostScript.
a2ps printers won't fail.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
3.2.1 Use of Escapes Where they are used 3.2.2 General Structure of the Escapes Their syntax 3.2.3 Available Escapes Detailed list
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
escape width directive
where
If no padding is given, ` ' (white space) is used.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Supported escapes are:
The available tests are:
The enumerations may be:
For instance, the escapes `The files printed were: #!f|$n|, |.' evaluated with input `a2ps NEWS main.c -o foo.ps', gives `The files printed were: NEWS, main.c.'.
As an exception, `#!' escapes use the width as the maximum number of objects to enumerate if it is positive, e.g., `#10!f|$n|, |' lists only the ten first file names. If width is negative, then it does not enumerate the -width last objects (e.g., `#-1!f|$n|, |' lists all the files but the last).
strftime(3)
function.
strftime(3)
function.
form feed
).
new line
).
mail-folder
style, tag 1 is the title of the mail, and tag 2 its author.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
a2ps order, they are:
Because a2ps
local lpr
command) and architecture independent information (such
as the type of your printers), users have found useful that
`a2ps.cfg' be dedicated to architecture dependent information. A
sub configuration file, `a2ps-site.cfg' (see section 4.1 Including Configuration Files) is included from `a2ps.cfg'.
The file `a2ps.cfg' is updated when you update a2ps@c, while `a2ps-site.cfg' is not, to preserve local definitions.
In the configuration files, empty lines and lines starting with `#' are comments.
The other lines have all the following form:
Topic: Arguments |
where Topic: is a keyword related to what you are customizing, and Arguments the customization. Arguments may be spread on several lines, provided that the last character of a line to continue is a `\'.
In the following sections, each Topic: is detailed.
4.1 Including Configuration Files Isolating site specific values 4.2 Your Library Path Setting the files search path 4.3 Your Default Options Default state of a2ps 4.4 Your Media Sheets dimensions 4.5 Your Printers How to access the printers 4.6 Your Shortcuts Your very own command line options 4.7 Your PostScript magic number Handling very old printers 4.8 Your Page Labels Page names as in Ghostview
4.9 Your Variables Short cut for long sequences 4.10 Your Delegations Delegating some files to other filters 4.11 Your Internal Details Details you might want to tune
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This is especially useful for the site specific configuration file `etc/a2ps.cfg': you may tune your printers etc. in a separate file for easy upgrade of a2ps
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To define the default library path, you can use:
Note that for users configuration files, it is better not to set the library path, because the system's configuration has certainly been built to cope with your system's peculiarities. Use `AppendLibraryPath:' and `PrependLibraryPath:'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is the correct way to define the default behavior you expect from
a2ps@c. If for instance you want to use Letter
as medium, then
use:
Options: --medium=Letter |
It is exactly the same as always giving a2ps `--medium=Letter' at run time.
The quoting mechanism is the same as that of a shell. For instance
Options: --right-title="Page $p" --center-title="Hello World!" Options: --title="arg 'Jack said \\\"hi\\\"' has double quotes" |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are two formats supported:
# A4 for Desk Jets # name w h llx lly urx ury Medium: A4dj 595 842 24 50 571 818 |
where wxh are the dimension of the sheet, and the four other stand for lower left x and y, upper right x and y.
# A4 # name w h Medium: A4 595 842 |
is the same as
# A4 # name w h Medium: A4 595 842 24 24 571 818 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A general scheme is used, so that whatever the way you should address the printers on your system, the interface is still the same. Actually, the interface is so flexible, that you should understand `named destination' when we write `printer'.
The destination must be of one of the following forms:
Escapes expansion is performed on destination (see section 3.2 Escapes). Recall that `#o' is evaluated to the destination name, i.e., the argument given to `-P'.
For instance
# My Default Printer is called dominique DefaultPrinter: | lp -d dominique # `a2ps foo.c -P bar' will pipe into `lp -d bar' UnknownPrinter: | lp -d #o # `a2ps -P foo' saves into the file `foo' Printer: foo > foo.ps Printer: wc | wc Printer: lw | lp -d printer-with-a-rather-big-name # E.g. `a2ps foo.c bar.h -P file' will save into `foo.c.ps' Printer: file > $n.#. # E.g. `a2ps foo.c bar.h -P home' will save into `foo.ps' # in user's home Printer: home > ${HOME}/$N.#. # Here we address a printer which is not PostScript Printer: deskj | gs -q -sDEVICE=ljet3d -sOutputFile=- - \ | lpr -P laserwriter -h -l |
MS-DOS users, and non-PostScript printer owners should take advantage in getting good configuration of these entries.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You can define some kind of `Macro Options' which stand for a set of options.
Examples are
# This emulates a line printer: no features at all # call a2ps -=lp to use it UserOption: lp -1m --pretty-print=plain -B --borders=no # When printing mail, I want to use the right style sheet with strong # highlight level, and stripping `useless' headers. UserOption: mail -Email -g --strip=1 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
a2ps Adobe said
Thou shalt start your PostScript DSC conformant files with
%!PS-Adobe-3.0
The bad news is that some printers will reject this header. Then you may change this header without any worry since the PostScript produced by a2ps are no PostScript printers that don't understand these files.}.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In the PostScript file is dropped information on where sheets begin and
end, so that post processing tools know where is the physical page 1, 2 etc.
With this information can be also stored a label, i.e., a human readable text
(typically the logical page numbers), which
is for instance what Ghostview
shows as the list of page numbers.
a2ps
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are many places in a2ps of extending things. It once became clear that variables where needed in a2ps@c.
4.9.1 Defining Variables Syntax and conventions 4.9.2 Predefined Variables Builtin variables
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
As as example, here is a variable for psnup
, which encloses all
the option passing one would like. Delegations are then easier to
write:
Variable: psnup psnup -#v -q #?j|-d|| #?r||-c| -w#w -h#h |
It is strongly suggested to follow a `.' (dot) separated hierarchy, starting with:
ps.page_label
), the header etc.
This naming convention has not fully stabilized. We apologize for the inconvenience this might cause to users.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are a few predefined variables. The fact that a2ps
at startup changes nothing to their status: they can be modified like
any other variable using --define
(see section 3.1.2 Global Options).
In what follows, there are numbers (i) like this, or (ii) this. It
means that a2ps
(non empty value), this is the value given to the variable. Otherwise
it tries solution (ii), etc. The rationale behind the order is usually
from user modifiable values (e.g. environment variables) through
system's hard coded values (e.g., calls to getpwuid
) and finally
arbitrary values.
pw_gecos
after the first `,'), (ii) not defined.
HOME
, (ii) the system's database (using getpwuid
), (iii)
the empty string.
gethostname
or uname
), (ii) the empty string.
LOGNAME
, (ii) the environment variable USERNAME
,
(iii) the system's database (using getpwuid
), (iv) the translated
string `user'.
pw_gecos
up to the first `,'), (ii)
capitalized value of the variable `user.login' unless it was the
translated string `user', (iii) the translated string `Unknown
User'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
roff
files,
etc.). You can let a2ps
applications. The behavior at run time depends upon the option
`--delegate' (see section 3.1.6 Input Options).
4.10.1 Defining a Delegation Syntax of the definitions of the delegations 4.10.2 Guide Line for Delegations What should be respected 4.10.3 Predefined Delegations Making the best use of these delegations
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
command should produce the file on its standard output. Of course escapes substitution is performed on command (see section 3.2 Escapes). In particular, command should use the input file `$f'.
# In general, people don't want to pretty-print PostScript files. # Pass the PostScript files to psnup Delegation: PsNup ps:ps \ psselect #?V||-q| -p#?p|#p|-| $f | \ psnup -#v -q #?j|-d|| #?r||-c| -w#w -h#h |
Advantage should be taken from the variables, to encapsulate the peculiarities of the various programs.
# Passes the options to psnup. # The files (in and out) are to be given Variable: psnup psnup -#v #?V||-q| #?j|-d|| #?r||-c| -w#w -h#h # Passes to psselect for PS page selection Variable: psselect psselect #?V||-q| -p#?p|#p|-| # In general, people don't want to pretty-print PostScript files. # Pass the PostScript files to psnup Delegation: PsNup ps:ps #{psselect} $f | #{psnup} |
Temporary file names (`#f0' to `#f9') are available for complex commands.
# Pass DVI files to dvips. # A problem with dvips is that even on failure it dumps its prologue, # hence it looks like a success (output is produced). # To avoid that, we use an auxiliary file and a conditional call to # psnup instead of piping. Delegation: dvips dvi:ps #{dvips} $f -o #f0 && #{psnup} #f0 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
First of all, select carefully the applications you will use for the delegations. If a filter is known to cause problems, try to avoid it in delegations(3). As a thumb rule, you should check that the PostScript generating applications produce files that start by:
%!PS-Adobe-3.0 |
a2ps
in order to output correctly the page device definitions. It can happen
that your filters don't output this section. In that case, you should
insert a call to fixps
right after the PostScript generation:
########## ROFF files # Pass the roff files to groff. Ask grog how groff should be called. # Use fixps to ensure there is a %%BeginSetup/%%EndSetup section. Delegation: Groff roff:ps \ eval `grog -Tps '$f'` | fixps #?V!!-q! | #{d.psselect} | #{d.psnup} |
There are some services expected from the delegations. The delegations you may write should honor:
groff
).
If ever you need several commands, do not use `;' to separate them, since it may prevent detection of failure. Use `&&' instead.
The slogan "the sooner, the better" should be applied here: in
the processing chain, it is better to ask a service to the first
application that supports it. An example will make it clear: when
processing a DVI
file, dvips
knows better the page numbers
than psselect
would. So a DVI
to PostScript delegation
should ask the page selection (`#p') to dvips
, instead of
using psselect
later in the chain. An other obvious reason here
is plain efficiency (globally, less data is processed).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The purpose of this section is not to document all the predefined delegations, for this you should read the comments in the system configuration file `a2ps.cfg'. We just want to explain some choices, and give hints on how to make the best use of these delegations.
strings(1)
:
Delegation: dvips dvi:ps\ if strings $f | sed 3q | fgrep landscape > /dev/null 2>&1; then \ #{d.dvips} -T#hpt,#wpt $f -o #f0 && #?o|cat|#{d.psnup} -r| #f0;\ else \ #{d.dvips} $f -o #f0 && #{d.psnup} #f0; \ fi |
In order to have that rule work correctly, it is expected from the TeX, or LaTeX file to include something like:
\renewcommand{\printlandscape}{\special{landscape}} \printlandscape |
in the preamble.
We don't use a pipe because dvips always outputs data (its prologue) even if it fails, what prevents error detection.
texi2dvi
, from the
package Texinfo
, which runs makeindex
, bibtex
and
latex
as many times as needed. You should be aware that if the
file includes files from other directories, it may miss some
compilation steps. Other cases (most typical) are well handled.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are settings that only meant for a2ps yourself.
file(1)
on a file. If possible, make
it follow the symbolic links.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To be general and to allow as much customization as possible, a2ps avoids to hard code its knowledge (encodings, PostScript routines, etc.), and tries to split it in various files. Hence it needs a path, i.e., a list of directories, in which it may find the files it needs.
The exact value of this library path is available by `a2ps --list=defaults'. Typically its value is:
gargantua ~ $ a2ps --list=defaults Configuration status of a2ps 4.13 More stuff deleted here Internals: verbosity level = 2 file command = /usr/ucb/file -L temporary directory = library path = /inf/soft/infthes/demaille/.a2ps /usr/local/share/a2ps/sheets /usr/local/share/a2ps/ps /usr/local/share/a2ps/encoding /usr/local/share/a2ps/afm /usr/local/share/a2ps/printers /usr/local/share/a2ps |
You may change this default path through the configuration files (see section 4.2 Your Library Path).
If you plan to define yourself some files for a2ps@c, they should be in one of those directories.
5.1 Documentation Format Special tags to write a documentation 5.2 Map Files Their general shape and rationale 5.3 Font Files Using other fonts 5.4 Style Sheet Files Defining pretty printing rules
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These tags are:
bold
prologue mentions the bw
prologue:
Documentation This style is meant to replace the old option code(-b)code of a2ps 4.3. It is a copy of the black and white prologue, but in which all the fonts are in Bold. EndDocumentation |
gnuc
style sheet:
documentation is "Declaration of functions are highlighted" "emph(only)emph if you start the function name" "in the first column, and it is followed by an" "opening parenthesis. In other words, if you" "write" "@example" "int main (void)" "@end example" "it won't work. Write:" "@example" "int" "main (void)" "@end example" end documentation |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The syntax of these files is:
|
requests that the file designated by path be included at this point.
key value |
meaning that when looking for key (e.g., name of a font, an encoding etc.), a2ps encoding description file name etc.).
The map files used in a2ps
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Even when a PostScript printer knows the fonts you want to use, using these fonts requires some description files.
5.3.1 Fonts Map File Mapping a font name to a file name 5.3.2 Fonts Description Files Needed files to use a Font 5.3.3 Adding More Font Support Using even more Fonts
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
See section 5.2 Map Files, for a description of the map files. This file associates the font-key to a font name. For instance:
Courier pcrr Courier-Bold pcrb Courier-BoldOblique pcrbo Courier-Oblique pcrro |
associates to font named Courier
, the key pcrr
. To be
recognized, the font name must be exact: courier
and
COURIER
are not admitted.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
a2ps
name of the files in which are stored the fonts (see section 5.3.1 Fonts Map File). To this end, a very primitive but still useful shell script is
provided: make_fonts_map.sh
.
First, you need to find the directories which store the fonts you want to use, and extend the library path so that a2ps directories. For instance, add:
AppendLibraryPath: /usr/local/share/ghostscript/fonts |
Then run make_fonts_map.sh
. It should be located in the
`afm/' directory of the system's a2ps
`/usr/local/share/a2ps/afm/make_fonts_map.sh'.
This script asks a2ps
collecting AFM
files, and digging information in them.
Once the script has finished, a file `fonts.map.new' was created. Check its integrity, and if it's correct, either replace the old `fonts.map' with it, or rename `fonts.map.new' as `fonts.map' and place it higher in the the library path (for instance in your `~/.a2ps/' directory).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The style sheets are defined in various files. See see section 7. Pretty Printing for the structure of these files. As for most other features, there is main file, a road map, which defines in which condition a style sheet should be used (see section 5.2 Map Files). This file is `sheets.map'.
Its format is simple:
style-key: patterns |
or
include(file) |
The patterns need not be on separate lines. There are two kinds of patterns:
file(1)
matches pattern, then
select style style-key.
Currently flags can only be `i', standing for an insentive match. Please note that the matching is not truly case insensitive: rather, a lower case version of the string is compared to the pattern as is, i.e., the pattern should itself be lower case.
The special style-key `binary' tells a2ps the file should not be printed, and will be ignored, unless option `--print-anyway' is given.
If a style name can't be found, the plain style is used.
The map file is read bottom up, so that the "last" match is honored.
Two things are to retain from this:
stdin
, then a2ps
file(1)
. However, unless you specify a fake file name with
`--stdin', pattern matching upon the name is turn off. In general
you can expect correct delegations, but almost never pretty printing.
file
is wrong on some files, a2ps
In this case, do try option `--guess', compare it with the output
of file
, and if the culprit is file
, go and complain to
your system administrator :-), or fix it by defining your own filename
pattern matching rules.
Consider the case of Texinfo files as an example (the language in which
this documentation is written). Files are usually named
`foo.texi', `bar.txi', or even `baz.texinfo'.
file(1)
is able to recognize Texinfo files:
doc % file a2ps.texi a2ps.texi: Texinfo source text |
Therefore the sheets.map would look like:
# Texinfo files texinfo: /*.txi/ /*.texi/ /*.texinfo/ <Texinfo source*> |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
a2ps use. This chapter presents what an encoding is, how the encodings support is handled within a2ps@c, and some encodings it supports.
6.1 What is an Encoding The concept of encoding explained 6.2 Encoding Files How a2ps handles the encodings
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section is actually taken from the web pages of Alis Technologies inc.
Document encoding is the most important but also the most sensitive and explosive topic in Internet internationalization. It is an essential factor since most of the information distributed over the Internet is in text format. But the history of the Internet is such that the predominant - and in some cases the only possible - encoding is the very limited ASCII, which can represent only a handful of languages, only three of which are used to any great extent: English, Indonesian and Swahili.
All the other languages, spoken by more than 90% of the world's population, must fall back on other character sets. And there is a plethora of them, created over the years to satisfy writing constraints and constantly changing technological limitations. The ISO international character set registry contains only a small fraction; IBM's character registry is over three centimeters thick; Microsoft and Apple each have a bunch of their own, as do other software manufacturers and editors.
The problem is not that there are too few but rather too many choices, at least whenever Internet standards allow them. And the surplus is a real problem; if every Arabic user made his own choice among the three dozen or so codes available for this language, there is little likelihood that his "neighbor" would do the same and that they would thus be able to understand each other. This example is rather extreme, but it does illustrate the importance of standards in the area of internationalization. For a group of users sharing the same language to be able to communicate,
Certain character sets stand out either because of their status as an official national or international standard, or simply because of their widespread use.
First off, there is the ISO 8859 standards series that standardize a dozen character sets that are useful for a large number of languages using the Latin, Cyrillic, Arabic, Greek and Hebrew alphabets. These standards have a limited range of application (8 bits per character, a maximum of 190 characters, no combining) but where they suffice (as they do for 10 of the 20 most widely used languages), they should be used on the Internet in preference to other codes. For all other languages, national standards should preferably be chosen or, if none are available, a well-known and widely-used code should be the second choice.
Even when we limit ourselves to the most widely used standards, the overabundance remains considerable, and this significantly complicates life for truly international software developers and users of several languages, especially when such languages can only be represented by a single code. It was to resolve this problem that both Unicode and the ISO 10646 International standard were created. Two standards? Oh no! Their designers soon realized the problem and were able to cooperate to the extent of making the character set repertoires and coding identical.
ISO 10646 (and Unicode) contain over 30,000 characters capable of representing most of the living languages within a single code. All of these characters, except for the Han (Chinese characters also used in Japanese and Korean), have a name. And there is still room to encode the missing languages as soon as enough of the necessary research is done. Unicode can be used to represent several languages, using different alphabets, within the same electronic document.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.2.1 Encoding Map File Mapping an encoding name to a file name 6.2.2 Encoding Description Files Specifying an encoding 6.2.3 Some Encodings Classical or standard encodings
The support of the encodings in a2ps to say, adding, removing or changing anything in its support for an encoding does not require programming, nor even being a programmer.
See section 6.1 What is an Encoding, if you want to know more about this.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
See section 5.2 Map Files, for a description of the map files.
The meaningful lines of the `encoding.map' file have the form:
alias key iso-8859-1 latin1 latin1 latin1 l1 latin1 |
where
mail
style sheet (support for
MIME).
When encoding is asked, the lower case version of encoding must be equal to alias.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The encoding description file describing the encoding key is named `key.edf'. It is subject to the same rules as any other a2ps
The entries are
Name: ISO-8859-1 |
Documentation Also known as ISO Latin 1, or Latin 1. It is a superset of ASCII, and covers most West-European languages. EndDocumentation |
Courier
, Times-Roman
...) do not support many encodings
(for instance it does not support Latin 2). To avoid that Latin 2 users
have to replace everywhere calls to Courier
, a2ps
specify that whenever a font is called in an encoding, then another font
should be used.
For instance in `iso2.edf' one can read:
# Fonts from Ogonkify offer full support of ISO Latin 2 Substitute: Courier Courier-Ogonki Substitute: Courier-Bold Courier-Bold-Ogonki Substitute: Courier-BoldOblique Courier-BoldOblique-Ogonki Substitute: Courier-Oblique Courier-Oblique-Ogonki |
Courier
equivalent is the best choice.
Default: Courier-Ogonki |
^G
) should not be named). The special name `.notdef' is to
be used when the character is not printable.
Warning. Make sure to use real, official, PostScript names. Using names such as `c123' may be the sign you use unusual names. On the other hand PostScript names such as `afii8879' are common.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Most of the following information is a courtesy of Alis Technologies inc. and of Roman Czyborra's page about The ISO 8859 Alphabet Soup. See section 6.1 What is an Encoding, is an instructive presentation of the encodings.
The lack of the new C=-resembling Euro currency symbol U+20AC has opened the discussion of a new Latin0.
Support is provided thanks to Ogonkify.
Support is provided thanks to Ogonkify.
Support is provided thanks to Ogonkify.
The Cyrillic alphabet was created by St. Cyril in the 9th century from the upper case letters of the Greek alphabet. The more ancient Glagolithic (from the ancient Slav glagol, which means "word"), was created for certain dialects from the lower case Greek letters. These characters are still used by Dalmatian Catholics in their liturgical books. The kings of France were sworn in at Reims using a Gospel in Glagolithic characters attributed to St. Jerome.
Note that Russians seem to prefer the KOI8-R character set to the ISO set for computer purposes. KOI8-R is composed using the lower half (the first 128 characters) of the corresponding American ASCII character set.
Support is provided thanks to Ogonkify.
Support is provided thanks to Ogonkify.
Support is provided thanks to Ogonkify.
Very few fonts yet offer the possibility to print the Euro sign.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Note that the difference is up to the author of the style sheet.
7.1 Syntactic limits What can't be done 7.2 Known Style Sheets Some supported languages 7.3 Type Setting Style Sheets a2ps as a tiny word processor 7.4 Faces Encoding the look of pieces of text 7.5 Style Sheets Semantics What is to be defined 7.6 Style Sheets Implementation How they should be defined 7.7 A Tutorial on Style Sheets Step by step example
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
IF IF == THEN THEN THEN := ELSE ELSE ELSE := IF |
is legal, then a2ps just looks for some keywords, or some sequences.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
configure.in
and library m4
files.
To provide a high degree of expressivity, Claire uses:
Names of defstructs are not highlighted because this would not work with defstruct options.
The language itself is not just a programming language but also covers analysis, design and implementation.
Heavy highlight uses symbols to represent common math operators.
The style sheets for77kwds
and for90kwds
implements keywords only,
while the style sheets for-fixed
and for-free
implements comments
only.
This style sheet tries to support any of the various flavors (Fortran 77/90/95, fixed or free form). For more specific uses, you should use either:
See the documentation of the style sheet fortran
for more details.
See the documentation of the style sheet fortran
for more details.
See the documentation of the style sheet fortran
for more details.
int main (void) |
int main (void) |
Whenever the changes of encoding are clear, a2ps sets itself the encoding for the parts concerned.
Tag 1 is the subject, and Tag 2 the author of the mail/news.
Note: This style sheet is _very_ difficult to write. Please don't report behavior you don't like. Just send me improvements, or write a Bison parser for mails.
This sheet was designed based on Modula 3 home page.
Implementation of the sheet based on The Oberon Reference Site.
It can be a good choice of destination language for people who want to produce text to print (e.g. pretty-printing, automated documentation etc.) but who definitely do not want to learn PostScript, nor to require the use of LaTeX.
It provides by the use of LaTeX like commands, a way to describe the pages that this program should produce.
The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python web site, and can be freely distributed.
The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation.
The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). Python is also suitable as an extension language for customizable applications.
program --help | a2ps -Ecard |
Implementation of the sheet based on the Sather home page.
Heavy highlighting uses symbols for common mathematical operators.
Typical use of this style is:
diff -u old new | a2ps -Eudiff |
The prologue diff
helps to highlight the differences
(`a2ps -Ewdiff --prologue=diff').
wdiff
. wdiff
is a utility that underlines the differences
of words between to files. Where diff
make only the difference between
lines that have changed, wdiff
reports words that have changed inside the lines.
Typical use of this style is:
wdiff old new | a2ps -Ewdiff |
wdiff
can be found in usual GNU repositories. The prologue diff
helps to highlight the differences (`a2ps -Ewdiff --prologue=diff').
This style sheet highlights some classical program names and builtins in the second level of pretty-printing.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section presents a few style sheets that define page description languages (compared to most other style sheet meant to pretty print source files).
7.3.1 Symbol Access to the glyphs of the Symbol font 7.3.2 PreScript Typesetting in an a2ps like syntax 7.3.3 PreTeX Typesetting in a LaTeX like syntax 7.3.4 TeXScript Typesetting in a mixture of both
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The style sheet Symbol
introduces easy to type keywords to obtain
the special characters of the PostScript font Symbol
. The
keywords are named to provide a LaTeX taste. These keywords are also
the names used when designing a style sheet, hence to get the full list,
see 7.6.1 A Bit of Syntax.
If you want to know the correspondence, it is suggested to print the
style sheet file of Symbol
:
a2ps -g symbol.ssh |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
PreScript
has been designed in conjunction with a2ps@c. Since
bold sequences, special characters etc. were implemented in a2ps@c, we
thought it would be good to allow direct access to those features:
PreScript
became an input language for a2ps@c, where special
font treatments are specified in an ssh
syntax (see section 7.6 Style Sheets Implementation).
The main advantages for using PreScript
are:
It can be a good candidate for generation of PostScript output (syntactic pretty-printers, generation of various reports etc.).
7.3.2.1 Syntax Lexical specifications 7.3.2.2 PreScript Commands 7.3.2.3 Examples
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The main limit on PreScript
is that no command can be used inside
another command. For instance the following line will be badly
interpreted by a2ps@c:
\Keyword{Problems using \keyword{recursive \copyright} calls} |
The correct way to write this in PreScript
is
\Keyword{Problems using} \keyword{recursive} \copyright \Keyword{calls}. |
Everything from an unquoted % to the end of line is ignored (comments).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
PreScript
and a2ps
formating. For instance, on the `passwd' file:
ypcat passwd | awk -F: \ '{print "\Keyword{" $5 "} (" $1 ") \rightarrow\keyword{" $7 "}"}'\ | a2ps -Epre -P |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The aim of the PreTeX style sheet is to provide something similar to
PreScript
, but with a more LaTeX like syntax.
7.3.3.1 Special characters 7.3.3.2 PreTeX Commands 7.3.3.3 Differences with LaTeX
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
PreTeX
for compatibility with LaTeX,
and `%' introduces a comment. Hence they are the only symbols which
have to be quoted by a `\'. The following characters should also be
quoted to produce good LaTeX files, but are accepted by
PreScript
: `_', `&', `#'.
Note that inside a command, like \textbf
, the quotation
mechanism does not work in PreScript
(\textrm{#$%}
writes `#$%') though LaTeX still requires quotation. Hence whenever
special characters or symbols are introduced, they should be at the
outer most level.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Symbol
).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Symbol
, are
not supported by LaTeX:
`\Alpha', `\apple', `\Beta', `\carriagereturn', `\Chi', `\Epsilon', `\Eta', `\florin', `\Iota', `\Kappa', `\Mu', `\Nu', `\Omicron', `\omicron', `\radicalex', `\register', `\Rho', `\suchthat', `\Tau', `\therefore', `\trademark', `\varUpsilon', `\Zeta'.
LaTeX is more demanding about special symbols. Most of them must be in so-called math mode, which means that the command must be inside `$' signs. For instance, though
If \forall x \in E, x \in F then E \subseteq F. |
is perfectly legal in PreTeX, it should be written
If $\forall x \in E, x \in F$ then $E \subseteq F$. |
for LaTeX. Since in PreTeX every `$' is discarded (unless quoted by a `\'), the second form is also admitted.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
TeXScript
is a replacement of the old version of
PreScript
: it combines both the a2ps@c-like and the
LaTeX-like syntaxes through inheritance of both PreScript
and
PreTeX
.
In addition it provides commands meant to ease processing of file for a2ps
Everything between `%%TeXScript:skip' and `%%TeXScript:piks'
will be ignored in TeXScript
, so that there can be inserted
command definitions for LaTeX exclusively.
The commands `\textbi' (for bold-italic) and `\textsy' (for symbol) do not exist in LaTeX. They should be defined in the preamble:
%%TeXScript:skip \newcommand{\textbi}[1]{\textbf{\textit{#1}}} \newcommand{\textsy}[1]{#1} %%TeXScript:piks |
There is no way in TeXScript to get an automatic numbering. There is
no equivalent to the LaTeX environment enumerate
. But every
command beginning by \text
is doubled by a command beginning by
`\magic'. a2ps
Hence, if one specifies that arguments of those functions should be
ignored in the preamble of the LaTeX document, the numbering is
emulated. For instance
\begin{enumerate} \magicbf{1.}\item First line \magicbf{2.}\item Second line \end{enumerate} |
will be treated the same way both in TeXScript and LaTeX.
`\header' and `\footer', are not understood by LaTeX.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The faces a2ps
Actually, there is also the face `Symbol', but this one is particular: it is not legal changing its font.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
a2ps one per language. In the following is described how the style sheets are defined. You may skip this section if you don't care how a2ps
7.5.1 Name and key Both names of a style sheet 7.5.2 Comments Author name, version etc. 7.5.3 Alphabets What words are legal 7.5.4 Case sensitivity Is BEGIN different of begin 7.5.5 P-Rules Pretty Printing Rules 7.5.6 Sequences Strings, comments etc. 7.5.7 Optional entries Second level of pretty printing
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Anywhere a2ps uses the key} (in the `sheets.map' file, with the option `-E', etc.).
As an example, C++ is implemented in a file called `cxx.ssh', in which the name is declared to be `C++'.
The rationale is that not every system accepts any character in the file name (e.g., no `+' in MS-DOS). Moreover, it allows to make symbolic links on the ssh files (e.g., `ln -s cxx.ssh c++.ssh' let's you use `-E c++').
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A P-rule (Pretty printing rule), or rule for short, is a structure which consists of two items:
Just a short example: `(foo, bar, Keyword_strong)' as a rule
means that every input occurrence of `foo' will be replaced by
`bar', written with the Keyword_strong
face.
If the destination string is empty, then a2ps string. This is different from giving the source string as a destination string if the case is different. An example will make it fairly clear.
Let foobar
be a case insensitive style sheet including the
rules `(foo, "", Keyword)' and `(bar, bar, Keyword)'. Then,
on the input `FOO BAR', a2ps
Keyword
.
a2ps
comes from that some keywords are sensitive to the delimiters around
them (such as `unsigned' and `int' in C
, which are
definitely not the same thing as `unsignedint'), and others not (in
C
, `!=' is "different from" both in `a != b' and
`a!=b').
The first ones are called keywords in a2ps seconds are operators. Operators are matched anywhere they appear, while keywords need to have separators around them (see section 7.5.3 Alphabets).
Let us give a more complicated example: that of the Yacc
rules.
A rule in Yacc
is of the form:
a_rule : part1 part2 ; |
Suppose you want to highlight these rules. To recognize them, you will write a regular expression specifying that:
The regexp you want is: `/^[a-zA-Z0-9_]*[\t ]*:/'. But with the rule
/^[a-zA-Z0-9_]*[\t ]*:/, "", Label_strong |
the blanks and the colon are highlighted too. Hence you need to specify some parts in the regexp (see section `Back-reference Operator' in Regex manual), and use a longer list of destination strings. The correct rule is
(/^([a-zA-Z0-9_]*)([\t ]*:)/, \1 Label_strong, \2 Plain) |
Since it is a bit painful to read, regexps can be spread upon several lines. It is strongly suggested to break them by groups, and to document the group:
(/^([a-zA-Z0-9_]*)/ # \1. Name of the rule /([\t ]*:)/ # \2. Trailing space and colon \1 Label_strong, \2 Plain) |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In the previous section (see section 7.5 Style Sheets Semantics) were explained the various items needed to understand the machinery involved in pretty printing. Here, their implementation, i.e., how to write a style sheet file, is explained. The next section (see section 7.7 A Tutorial on Style Sheets), exposes a step by step simple example.
7.6.1 A Bit of Syntax Lexical rules of the ssh language 7.6.2 Style Sheet Header Declaration of a style 7.6.3 Syntax of the Words Classes of the Characters 7.6.4 Inheriting from Other Style Sheets Extending existing style sheets 7.6.5 Syntax for the P-Rules Atomic Pretty Printing rules 7.6.6 Declaring the keywords and the operators Special Classes of Identifiers 7.6.7 Declaring the sequences Bordered Lexical Entities 7.6.8 Checking a Style Sheet Ask a2ps to Check the Sheet
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
alphabet
,alphabets
,are
,case
,documentation
,end
,exceptions
,first
,in
,insensitive
,is
,keywords
,operators
,optional
,second
,sensitive
,sequences
,style
Comment
,Comment_strong
,Encoding
,Error
,Index1
,Index2
,Index3
,Index4
,Invisible
,Keyword
,Keyword_strong
,Label
,Label_strong
,Plain
,String
,Symbol
,Tag1
,Tag2
,Tag3
,Tag4
C-char
,C-string
It is a good idea to print the style sheet `symbols.ssh' to see them:---
,\Alpha
,\Beta
,\Chi
,\Delta
,\Downarrow
,\Epsilon
,\Eta
,\Gamma
,\Im
,\Iota
,\Kappa
,\Lambda
,\Leftarrow
,\Leftrightarrow
,\Mu
,\Nu
,\Omega
,\Omicron
,\Phi
,\Pi
,\Psi
,\Re
,\Rho
,\Rightarrow
,\Sigma
,\Tau
,\Theta
,\Uparrow
,\Upsilon
,\Xi
,\Zeta
,\aleph
,\alpha
,\angle
,\approx
,\beta
,\bullet
,\cap
,\carriagereturn
,\cdot
,\chi
,\circ
,\clubsuit
,\cong
,\copyright
,\cup
,\delta
,\diamondsuit
,\div
,\downarrow
,\emptyset
,\epsilon
,\equiv
,\eta
,\exists
,\florin
,\forall
,\gamma
,\geq
,\heartsuit
,\in
,\infty
,\int
,\iota
,\kappa
,\lambda
,\langle
,\lceil
,\ldots
,\leftarrow
,\leftrightarrow
,\leq
,\lfloor
,\mu
,\nabla
,\neq
,\not
,\not\in
,\not\subset
,\nu
,\omega
,\omicron
,\oplus
,\otimes
,\partial
,\perp
,\phi
,\pi
,\pm
,\prime
,\prod
,\propto
,\psi
,\radicalex
,\rangle
,\rceil
,\register
,\rfloor
,\rho
,\rightarrow
,\sigma
,\sim
,\spadesuit
,\subset
,\subseteq
,\suchthat
,\sum
,\supset
,\supseteq
,\surd
,\tau
,\theta
,\therefore
,\times
,\trademark
,\uparrow
,\upsilon
,\varUpsilon
,\varcopyright
,\vardiamondsuit
,\varphi
,\varpi
,\varregister
,\varsigma
,\vartheta
,\vartrademark
,\vee
,\wedge
,\wp
,\xi
,\zeta
a2ps symbols.ssh |
C
escaping mechanism is used.
C
escaping mechanism is used. Regexps can be
split in several parts, a` la C strings (i.e., `/part 1/ /part
2/').
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
|
The following constructions are optional:
version
version is version-number |
written
written by authors |
Giving your email is useful for bug reports about style sheets.
written by "Some Body |
requires
requires a2ps a2ps-version-number |
documentation
documentation is strings end documentation |
Please, write useful comments, not `This style is devoted to C
files', since the name is here for that, nor `Report errors to
mail@me.somewhere', since written by
is there for that.
documentation is "Not all the keywords are used, to avoid too much" "bolding. Heavy highlighting (code(-g)code), covers" "the whole language." end documentation |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
alphabet
first alphabet is string second alphabet is string |
If both are identical, you may use the shortcut
alphabets are string |
The default alphabets are
first alphabet is "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_" second alphabet is "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_\ 0123456789" |
Note that it is on purpose that no characters interval are used.
case
case insensitive # e.g., C, C++ etc. case sensitive # e.g., Perl, Sather, Java etc. |
The default is case insensitive
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is possible to extend an existing style. The syntax is:
ancestors are ancestor_1[, ancestor_2...] end ancestors |
where ancestor1 etc. are style sheet keys.
For semantics, the rules are the following:
As an example, both C++
and Objective C
style sheets
extend the C
style sheet:
style "Objective C" is #[...] ancestors are c end ancestors #[...] end style |
To the biggest surprise of the author, mutually dependent style sheets do work!
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
See section 7.5.5 P-Rules, for the definition of P-rule.
Because of various short cuts, there are many ways to declare a rule:
rules ::= rule_1 `,' rule_2... rule ::= `(' lhs rhs `)' | lhs srhs ; lhs ::= string | regex ; rhs ::= srhs `,' ... srhs ::= latex-keyword | expansion face expansion ::= string | `\'num | <nothing>; face ::= face-keyword | <nothing>; |
The rules are the following:
#define RE_SYNTAX_A2PS \ (/* Allow char classes. */ \ RE_CHAR_CLASSES \ /* Be picky. */ \ | RE_CONTEXT_INVALID_OPS \ /* Allow intervals with `{' and `}', forbid invalid ranges. */\ | RE_INTERVALS | RE_NO_BK_BRACES | RE_NO_EMPTY_RANGES \ /* `(' and `)' are the grouping operators. */ \ | RE_NO_BK_PARENS \ /* `|' is the alternation. */ \ | RE_NO_BK_VBAR) |
Basically it means that all of the possible operators are used, and that they are in non-backslashed form. For instance `(' and `)' stand for the group operator, while `\\(' stands for the character `('. See section `Regular Expression Syntax' in Regex manual, for a detailed description of the regular expressions.
Keyword
.
PLAIN
is used.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Basically, keywords and operators are lists of rules. The syntax is:
keywords are rules end keywords |
or
keywords in face-keyword are rules end keywords |
in which case the default face is set to face-keyword.
As an example:
keywords in Keyword_strong are /foo*/, "bar" "BAR" Keyword, -> \rightarrow end keywords |
is valid.
The syntax for the operators is the same, and both constructs can be
qualified with an optional
flag, in which case they are taken
into account in the heavy highlighting mode (see section 3.1.7 Pretty Printing Options).
This is an extract of the C
style sheet:
optional operators are -> \rightarrow, && \wedge, || \vee, != \neq, == \equiv, # We need to protect these, so that <= is not replaced in <<= <<=, >>=, <= \leq, >= \geq, ! \not end operators |
Note how `<<=' and `>>=' are protected (there are defined to be written as is when met in the source). This is to prevent the two last characters of `<<=' from being converted into a `less or equal' sign.
The order in which you define the elements of a category (but the
sequences) does not matter. But since a2ps
may save time if the alphabetical C
-order is more or less
followed.
You should be aware that when declaring a keyword with a regular expression as lhs, then a2ps matching only if there are no character of the first alphabet both just before, and just after the string.
In term of implementation, it means that
keywords are /foo|bar/ end keywords |
is exactly the same as
operators are /\\b(foo|bar)\\b/ end operators |
This can cause problems if you use anchors (e.g. $
, or ^
)
in keywords: the matcher will be broken. In this particular case,
define your keywords as operators, taking care of the `\\b' by
yourself.
See section `Match-word-boundary Operator' in Regex manual, for details on `\b'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Sequences admit several declarations too:
sequences ::= sequences are sequence_1 `,' sequence_2... end sequences sequence ::= rule in_face close_opt exceptions_opt | |
The rules are:
As a first example, here is the correct definition for a C
string:
sequences are "\"" Plain String "\"" Plain exceptions are "\\\\", "\\\"" end exceptions end sequences |
C-string
to mean exactly this, and C-char
for
manifest characters defined the C
way.
The following example comes from `ssh.ssh', the style sheet for
style sheet files, in which there are two kinds of pseudo-strings: the
strings (`"example"'), and the regular expressions
(`/example/'). We do not want the content of the pseudo-strings in
the face String
.
sequences are # The comments "#" Comment, # The name of the style sheet "style " Keyword_strong (Label + Index1) " is" Keyword_strong, # Strings are exactly the C-strings, though we don't want to # have them in the "string" face "\"" Plain "\"" exceptions are "\\\\", "\\\"" end exceptions, # Regexps "/" Plain "/" exceptions are "\\\\", "\\\/" end exceptions end sequences |
The order between sequences does matter. For instance in Java, `/**' introduces strong comments, and `/*' comments. `/**' must be declared before `/*', or it will be hidden.
There are actually some sequences that could have been implemented as
operators with a specific regular expression (that goes up to the
closer). Nevertheless be aware of a big difference: regular expression
are applied to a single line of the source file, hence, they cannot
match on several lines. For instance, the C
comments,
/* * a comment */ |
cannot be implemented with operators, though C++
comments can:
// // a comment // |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Once your style sheet is written, you may want to let a2ps simple tests on it (e.g., checking there are no rules involving upper case characters in a case insensitive style sheet, etc.). These tests are performed when verbosity includes the style sheets.
you may also want to use the special convention that when a style sheet is required with a suffix, then a2ps path, but precisely from when you are.
Suppose for instance you extended the `c.ssh' style sheet, which is in the current directory, and is said case insensitive. Run
ubu $ a2ps foo.c -Ec.ssh -P void -v sheets # Long output deleted Checking coherence of "C" (c.ssh) a2ps: c.ssh:`FILE' uses upper case characters a2ps: c.ssh:`NULL' uses upper case characters "C" (c.ssh) is corrupted. ---------- End of Finalization of c.ssh |
Here, it is clear that C
is not case insensitive.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
`ChangeLog' files are some kind of memory of changes done to files, so that various programmers can understand what happened to the sources. This helps a lot, for instance, in guessing what recent changes may have introduced new bugs.
7.7.1 Example and syntax ChangeLog files 7.7.2 Implementation Implementation of chlog.ssh 7.7.3 The Entry in `sheets.map' Getting automatic style selection 7.7.4 More Sophisticated Rules Complex regular expressions 7.7.5 Guide Line for Distributed Style Sheets Additional Constraints
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Sun Apr 27 14:29:22 1997 Akim Demaille <demaille@inf.enst.fr> * base.ps: Merged in color.ps, since now a lot is common [added box and underline features]. Fri Apr 25 14:05:20 1997 Akim Demaille <demaille@inf.enst.fr> * color.ps: Added box and underline routines. Mon Mar 17 20:39:11 1997 Akim Demaille <demaille@gargantua.enst.fr> * base.ps: Got rid of CourierBack and reencoded_backspace_font. Now the C has to handle this by itself. Sat Mar 1 19:12:22 1997 Akim Demaille <demaille@gargantua.enst.fr> * *.enc: they build their own dictionaries, to ease multi lingual documents. |
The syntax is really simple: A line specifying the author and the date of the changes, then a list of changes, all of them starting with an star followed by the name of the files concerned, then optionally between parentheses the functions affected, and then some comments.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ChangeLog
, hence:
style ChangeLog is written by "Akim Demaille |
A first interesting and easy entry is that of function names, between `(' and `)':
sequences are "(" Plain Label ")" Plain end sequences |
A small problem that may occur is that there can be several functions mentioned separated by commas, that we don't want to highlight this way. Commas, here, are exceptions. Since regular expressions are not yet implemented in a2ps@c, there is a simple but stupid way to avoid that white spaces are all considered as part of a function name, namely defining two exceptions: one which captures a single comma, and a second, capturing a comma and its trailing space.
For the file names, the problem is a bit more delicate, since they may end with `:', or when starts the list of functions. Then, we define two sequences, each one with one of the possible closers, the exceptions being attached to the first one:
sequences are "* " Plain Label_strong ":" Plain exceptions are ", " Plain, "," Plain end exceptions, "* " Plain Label_strong " " Plain end sequences |
Finally, let us say that some words have a higher importance in the core of text: those about removing or adding something.
keywords in Keyword_strong are add, added, remove, removed end keywords |
Since they may appear in lower or upper, of mixed case, the style will be defined as case insensitive.
Finally, we end up with this style sheet file, in which an optional highlighting of the mail address of the author is done. Saving the file is last step. But do not forget that a style sheet has both a name as nice as you may want (such as `Common Lisp'), and a key on which there are strict rules: the prefix must be alpha-numerical, lower case, with no more than 8 characters. Let's chose `chlog.ssh'.
# This is a tutorial on a2ps' style sheets style ChangeLog is written by "Akim Demaille |
As a last step, you may which to let a2ps its syntax, and common errors:
ubu $ a2ps -vsheet -E/tmp/chlog.ssh ChangeLog -P void Long output deleted Checking coherence of "ChangeLog" (/tmp/chlog.ssh) "ChangeLog" (/tmp/chlog.ssh) is sane. ---------- End of Finalization of /tmp/chlog.ssh |
It's all set, your style sheet is ready!
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The last touch is to include the pattern rules about `ChangeLog' files (which could appear as `ChangeLog.old' etc.) in `sheets.map':
# ChangeLog files chlog: /ChangeLog*/ |
This won't work... Well, not always. Not for instance if you print `misc/ChangeLog'. This is not a bug, but truly a feature, since sometimes one gets more information about the type of a file from its path, than from the file name.
Here, to match the preceding path that may appear, just use `*':
# ChangeLog files chlog: /*ChangeLog*/ |
If you want to be more specific (`FooChangeLog' should not match), use:
# ChangeLog files chlog: /ChangeLog*/ /*\/ChangeLog*/ |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The example we have presented until now uses only basic features, and does not take advantage of the regexp. In this section we should how to write more evolved pretty printing rules.
The target will be the lines like:
Sun Apr 27 14:29:22 1997 Akim Demaille <demaille@inf.enst.fr> Fri Apr 25 14:05:20 1997 Akim Demaille <demaille@inf.enst.fr> |
There are three fields: the date, the name, the mail. These lines all start at the beginning of line. The last field is the easier to recognize: is starts with a `<', and finishes with a `>'. Its rule is then `/<[^>]+>/'. It is now easier to specify the second: it is composed only of words, at least one, separated by blanks, and is followed by the mail: `/[[:alpha:]]+([ \t]+[[:alpha:]]+)*/'. To concatenate the two, we introduce optional blanks, and we put each one into a pair of `('-`)' to make each one a recognizable part:
([[:alpha:]]+([ \t]+[[:alpha:]]+)*) (.+) (<[^>]+>) |
Now the first part is rather easy: it starts at the beginning of the line, finishes with a digit. Once again, it is separated from the following field by blanks. Split by groups (see section `Grouping Operators' in Regex manual), we have:
^ ([^\t ].*[0-9]) ([ \t]+) ([[:alpha:]]+([ \t]+[[:alpha:]]+)*) (.+) (<[^>]+>) |
Now the destination is composed of back references to those groups, together with a face:
# We want to highlight the date and the maintainer name optional operators are (/^([^\t ].*[0-9])/ # \1. The date /([ \t]+)/ # \2. Spaces /([[:alpha:]]+([ \t]+[[:alpha:]]+)*)/ # \3. Name /(.+)/ # \5. space and < /(<[^>]+)>/ # \6. email \1 Keyword, \2 Plain, \3 Keyword_strong, \5 Plain, \6 Keyword, > Plain) end operators |
Notice the way regexps are split, to ease reading.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section is meant for people who wish to contribute style sheets. There is a couple of additional constraints, explained here.
Finally, make sure your style sheet behaves well! (see section 7.6.8 Checking a Style Sheet)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter is devoted to the information which is only relevant to PostScript.
8.1 Foreword: Good and Bad PostScript How to lose, how to win 8.2 Page Device Options Accessing some printers' features 8.3 Statusdict Options Some other features 8.4 Colors in PostScript Specifying a color or a gray 8.5 a2ps Convention for PostScript library files 8.6 Designing PostScript Prologues Make it look like what you want
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To read this section, the reader must understand what DSC are (see section A. Glossary).
Why are there good PostScript files, easy to post-process, and bad files that none of my tools seem to understand? They print fine though!
Once you understood that PostScript is not a page description format (like PDF is), you'll have understood most of the problem. Let's imagine for a second that you are a word processor.
The user asks you to print his/her 100 page document in PostScript. Up to page 50, there are few different fonts used. Then, on pages 51 to 80, there are now many different heavy fonts.
When/where will you download the fonts?
The most typical choice, sometimes called Optimize for Speed, is, once you arrived to page 51, to download those fonts once for the rest of the document. The global processing chain will have worked quite quickly: little effort from the software, same from the printer; better yet: you can start sending the file to the printer even before it is finished! The problem is that this is not DSC conformant, and it is easy to understand why: if somebody wants to print only the page 60, then s/he will lack the three fonts which were defined in page 51... This document is not page independent.
Another choice is to download the three fonts in each page ranging from 51 to 80, that is the PostScript file contains 30 times the definition of each font. It is easy for the application to do that, but the file is getting real big, and the printer will have to interpret 30 times the same definitions of fonts. But it is DSC conformant! And you can still send the file while you make it.
Now you understand why
Non DSC conformant files are not necessarily badly designed files from broken applications.
They are files meant to be sent directly to the printer (they are still perfect PostScript files after all!), they are not meant to be post-processed. And the example clearly shows why they are right.
There is a third possibility, sometimes called Optimize for Portability: downloading the three fonts in the prologue of the document, i.e., the section before the first page where are given all the common definitions of the whole file. This is a bit more complicated to implement (the prologue, which is issued first though, grows at the same time as you process the file), and cannot be sent concurrently with the processing (you have to process the whole file to design the prologue). This file is small (the fonts are downloaded once only), and DSC conformant. Well, there are problems, of course... You need to wait before sending the output, it can be costly for the computer (which cannot transfer as it produces), and for the printer (you've burnt quite a lot of RAM right since the beginning just to hold fonts that won't be used before page 51... This can be a real problem for small printers).
This is what a2ps
If should be clear that documents optimized for speed should never escape the way between the computer and the printer: no post-processing is possible.
What you should remember is that some applications offer the possibility to tune the PostScript output, and they can be praised for that. Unfortunately, when these very same applications don't automatically switch to "Optimize for Portability" when you save the PostScript file, and they can be criticized for that.
So please, think of the people after you: if you create a PostScript file meant to be exchanged, read, printed, etc; by other people: give sane DSC conformant, optimized for portability files.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Here are some usable page device options which can be selected with the `-S' option (`--setpagedevice'). For a complete listing, see PostScript Language Reference Manual (section 4.11 Device Setup in the second edition, or section 6, Device Control in the third edition).
Collate boolean
Duplex boolean
ManualFeed boolean
OutputFaceUp boolean
Tumble boolean
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
statusdict
is a special storage entity in PostScript (called
a dictionary), in which some variables and operators determine the
behavior of the printer. This is an historic horror that existed before
page device definitions were defined. They are even more printer
dependent, and are provided only for the people who don't have a level
printer. In any case, refer to the documentation of your printer for
supported options.
Here are some statusdict definitions in which you might be interested:
manualfeed boolean
setmanualfeed boolean
setduplexmode boolean
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Nevertheless, here are some tips on how to design your PostScript styles. It is strongly recommended to use `gray.pro' or `color.pro' as a template.
There are two PostScript instructions you might want to use in your new PostScript prologue:
setgray
setrgbcolor
a2ps
both use an argument as in setrgbcolor
. So if you wanted a gray
shade, just give three times the same ratio.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
All a2ps files have two parts, one being the comments, and the other being the content, separated by the following line:
% code follows this line |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is pretty known that satisfying the various human tastes is an NEXPTIME-hard problem, so a2ps through the prologue files. But since the authors feel a little small against NEXPTIME, they agreed on the fact that you are the one who will design the look you like.
Hence in this section, you will find what you need to know to be able to customize a2ps
Basically, a2ps "meaning" in the text. a2ps
8.6.1 Definition of the faces What goes in a characters style 8.6.2 Prologue File Format Including documentation 8.6.3 A step by step example
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Hence, never set the font by yourself, but ask a2ps done through a line:
%Face: face real-font-name size |
This line tells a2ps real-font-name. It will replace this line by the correct PostScript line to call the needed font, and will do everything needed to set up the font.
The size of the text body is bfs
.
true
to BG
:
0.8 0.8 0 true BG |
BG
with
false
:
false BG |
BG
, call FG
with an RGB ratio:
0 0.5 0 FG |
UL
requires a boolean argument, depending whether you want
or not the current face to be underlined.
true UL |
BX
let's a face have a box drawn around.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Prologue files for a2ps (reported with `--list-prologues') can be included in the comment part:
Documentation This prologue is the same as the prologue code(pb)code, but using the bold version of the fonts. EndDocumentation % code follows this line |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Here, we will start from `color.pro', trying to give it a funky look.
Say you want the keywords to be in Helvetica, drawn in a flashy pink on a light green. And strong keywords, in Times Bold Italic in brown on a soft Hawaiian sea green (you are definitely a fine art amateur).
Then you need to look for `k' and `K':
/k { false BG 0 0 0.9 FG %Face: Keyword Courier bfs Show } bind def /K { false BG 0 0 0.8 FG %Face: Keyword_strong Courier-Bold bfs Show } bind def |
and turn it into:
/k { 0.2 1 0.2 true BG 1 0.2 1 FG %Face: Keyword Helvetica bfs Show } bind def /K { 0.4 0.2 0 true BG 0.5 1 1 FG %Face: Keyword_strong Times-BoldItalic bfs Show } bind def |
Waouh! It looks great!
A bit trickier: let change the way the line numbers are printed.
First, let's look for the font definition:
%%BeginSetup % The font for line numbering /f# /Helvetica findfont bfs .6 mul scalefont def %%EndSetup |
Let it be in Times, twice bigger than the body font.
%%BeginSetup % The font for line numbering /f# /Times-Roman findfont bfs 2 mul scalefont def %%EndSetup |
How about its foreground color?
% Function print line number (<string> # -) /# { gsave sx cw mul 2 div neg 0 rmoveto f# setfont 0.8 0.1 0.1 FG c-show grestore } bind def |
Let it be blue. Now you know the process: just put `0 0 1' as
FG
arguments.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter documents the various shell scripts or other tools that are
distributed with the a2ps
reader should also look at the documentation of Ogonkify
(see section `Overview' in Ogonkify manual), written by Juliusz
Chroboczek.
9.1 card
Printing Reference Cards 9.2 fixps
Fixing Some Ill Designed PostScript Files 9.3 fixnt
Fixing Microsoft NT PostScript Files 9.4 pdiff
Produce Pretty Comparison of Files 9.5 psmandup
Printing Duplex on Simplex Printers 9.6 psset
Inserting calls to setpagedevice
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
card
The first version of this reference card was a PreScript file (see section 7.3.2 PreScript) to be printed by a2ps@c. Very soon a much better scheme was found: using a style sheet to pretty print directly the output of `a2ps --help'! A first advantage is then that the reference cards can be printed in the tongue you choose.
A second was that this treatment could be applied to any application supporting a `--help'-like option.
9.1.1 Invoking card
Command Line Interface 9.1.2 Caution when Using card
card runs commands
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
card
card [options] applications [-- a2ps@c-options] |
card
is a shell script which tries to guess how to get your
applications' help message (typically by the options `--help'
or `-h'), and pretty prints it thanks to a2ps
the environment variable `A2PS' if it is set).
a2ps@c-options are passed to a2ps@c.
Supported options are:
LC_ALL
etc.
(such as `fr', `it' etc.).
If the applications don't support internationalization, English will be used.
card --command="cc -flags" |
It is possible to give options to a2ps specifying them after `--'. For instance
card gmake gtar --command="cc -flags" -- -Pdisplay |
builds the reference card of GNU make
, GNU tar
(automatic
detection of `--help' support), and cc
thanks to
`-flags'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
card
Remember that card
runs the programs you give it, and the
commands you supplied. Hence if there is a silly programs that has a
weird behavior given the option `-h' etc., beware of the result.
It is even clearer using `--command': avoid running `card --command="rm -rf *"', because the result will be exactly what you think it will be!
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
fixps
The shell script fixps
tries its best to fix common problems in
PostScript files that may prevent post processing. It makes heavy use
of the psutils
. It is a good idea to use fixps
in the
PostScript delegations.
It first tries to make simple fixes, but some really broken files may
require a much deeper treatment. If fixps
feels the need for
such a major surgery act, it may give up local changes and ask
Ghostscript
for a global rewriting.
9.2.1 Invoking fixps
Command Line Interface
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
fixps
fixps [options] [file] |
sanitize the PostScript file (or of the standard input if no file is given, or if file is `-').
Supported options are:
ghoscript
for a full rewrite of the file. The output
file is really sane, but can be much longer than the original. For this
reason and others, it is not always a good idea to make a full rewrite.
This option should be used only for files that give major problems.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
fixnt
fixnt
(see its
\name\, home page) is
maintained by Holger Bauer and
Michael Rath. It is meant to fix
the problems of the PostScript files generated by the Microsoft
PostScript driver under Windows NT (3.5 and 4.0).
fixps
is aware of the cases where fixnt
should be used,
hence you should not worry of when to use fixnt
.
9.3.1 Invoking fixnt
Command Line Interface
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
fixnt
fixnt < `file.ps' |
sanitize the PostScript file file.ps and produce the result on the standard output.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
pdiff
The shell script pdiff
aims to pretty print diffs between files.
It basically uses GNU diff
(see section `Overview' in Comparing and Merging Files) or GNU wdiff
(see section `The word difference finder' in GNU wdiff) to extract the diff, then calls
a2ps
9.4.1 Invoking pdiff
Command Line Interface
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
pdiff
pdiff [options] file-1 file-2 [-- a2ps@c-options] |
make a pretty comparison between file-1 and file-2. a2ps@c-options are passed to a2ps@c.
Supported options are:
It is possible to give options to a2ps specifying them after `--'. For instance
pdiff COPYING COPYING.LIB -- -1 -P display |
Compares the files `COPYING' and `COPYING.LIB', and prints it
on the printer display
(usually Ghostview
or gv
).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
psmandup
I personally hate to print documents of hundreds of pages on a single sided printer. Too bad, here there are no Duplex printers. The idea is then simply first to print the odd pages, then the even in reversed order. To make sure one flips the page in the meanwhile, the second half should be printed from the manual feed tray.
Make a shell script that automates this, and you get psmandup
.
9.5.1 Invoking psmandup
Command Line Interface
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
psmandup
psmandup [options] [file] |
produce a manual duplex version of the PostScript file (or of the standard input if no file is given, or if file is `-'). Once the first half is printed, put the sheet stack in the manual feed tray for the second half(4).
Be aware that there is a time out for manually fed jobs, usually short, hence do not miss the moment when the printer asks for the stack. If ever you missed that moment, see option `--back' to recover the second half.
Supported options are:
psmandup
will fail on ill designed PostScript (well, actually the
psutils will). To avoid this, by default the PostScript file is
sanitized by fixps
.
When given this option, don't run fixps
. This is meant to be
used when fixps
has already been used higher in the processing
chain.
This option is especially useful when the manual feed time out expired before you could insert back the stack in the manual feed tray.
psmandup
assumes the printer is Level 2, and supports manual
feeding. The file should be reasonably sane, otherwise
psmandup
fails miserably.
Typical use is
psmandup file.ps | lp |
or can be put into a2ps@c' printer commands (see section 4.5 Your Printers).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
psset
The shell script psset
inserts calls to setpagedevice
in a
PostScript file. This is useful for instance to add Tumble or Manual
feed request. Actually, psmandup
uses psset
.
You should know nevertheless that a2ps
setpagedevice
by itself, i.e., you can run `a2ps
-SManualFeed foo' to print `foo' onto the manually fed tray, or run
`a2ps -s2 foo' to print Duplex. There are no need of psset
from a2ps@c.
9.6.1 Invoking psset
Command Line Interface
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
psset
psset [options] [file] |
produce a version of the PostScript file (or of the standard input
if no file is given, or if file is `-') that makes
protected calls to the PostScript operator setpagedevice
.
Typical use is making file print duplex, or on the manual tray
etc.
The call is protected so that the resulting file is safe, i.e., will still be portable, even with requests such as `-Sfoo:bar'.
It is safe to run psset
with no feature requests. Depending upon
the option `--no-fix', it is either equivalent to doing nothing, or
to running fixps
(see section 9.2 fixps
).
Supported options are:
psset
will fail on ill designed PostScript. Actually it is the
psutils that fail. To avoid this, by default the PostScript file is
sanitized by fixps
.
When given this option, don't run fixps
. This is meant to be
used when fixps
has already been used higher in the processing
chain.
setpagedevice
call setting key to value.
Multiple values accumulate. Lists of requests separated with `;'
are valid (e.g., `-SDuplex:true;Tumble:false').
setpagedevice
call should be done.
The page 0, which is the default, corresponds to the `Setup'
section of the document. More precisely, the insertion is performed at
the end of the `Setup' section, so that if there are multiple calls
to psset
on the same document (which is of course, a bad idea),
the last call is winning.
In a typical use you should not change the page.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Please, before sending us mail, make sure the problem you have is not known, and explained. Moreover, avoid using the mailing list for asking question about the options, etc. It has been built for announces and suggestions, not to contact the authors.
10.1 Why Does...? Questions on Error 10.2 How Can I ...? a2ps' How-To 10.3 Please tell me... Existential Questions on a2ps
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Error related questions.
10.1.1 Why Does it Print Nothing? The printer issues nothing 10.1.2 Why Does it Print in Simplex? While I asked for Duplex 10.1.3 Why Does it Print in Duplex? While I asked for Simplex 10.1.4 Why Does it Not Fit on the Paper? Some parts are missing 10.1.5 Why Does it Print Junk? Random characters 10.1.6 Why Does it Say my File is Binary? And refuses to print it 10.1.7 Why Does it Refuse to Change the Font Size
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
a2ps
There are two ways that printing can fail: silently, or with a diagnostic.
First, check that the printer received what you sent. a2ps may correctly do its job, but have the printer queue fail to deliver the job. In case of doubt, please check that the printer's leds blink (or whatever is its way to show that something is being processed).
If the printer does receive the job, but prints nothing at all, check that you did not give exotic options to an old printer (typically, avoid printing on two sides on a printer that does not support it). Avoid using `-S', `--setpagedevice' (see section 8.2 Page Device Options) and `--statusdict' (see section 8.3 Statusdict Options).
If the trouble persists, please try again but with the option `--debug' (a PostScript error handler is downloaded), and then send us:
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Though I ask a2ps printed Simplex.
If your printer is too old, then a2ps code it needs when `-s2' is specified. This is because your printer uses an old and not standardized interface for special features.
So you need to
Since this is painful to hit, a User Option (see section 4.6 Your Shortcuts) should help.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Though I ask a2ps printed Duplex.
Actually when you require Simplex, a2ps reasons. Hence, if your printer is defaulted to Duplex, the job will be Duplexed. So you have to force a2ps `-SDuplex:false'. The user options `-=s1' and `-=simplex' have names easier to remember.
In the next version of a2ps fixed in a user friendly way.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When I print text files with a2ps@c, it prints beyond the frame of the paper.
You are most probably printing with a bad medium, for instance using A4 paper within a2ps@c, while your printer uses Letter paper. Some jet printers have a small printable area, and a2ps both case, read 3.1.3 Sheet Options, option `--medium' for more.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
What I get on the printer is long and incomprehensible. It does not seem to correspond to what I wanted to print.
You are probably printing a PostScript file or equivalent. Try to print
with `-Z': a2ps
program that can help you (see section 4.10 Your Delegations). In case of doubt,
don't hesitate to save into a file, and check the content with
Ghostview
, or equivalent:
$ a2ps my_weird_file -Z -o mwf.ps $ gv mwf.ps |
If your a2ps fake-printer:
$ a2ps my_weird_file -Z -P display |
If it is incorrect, ask for help around you.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
a2ps
There are several reasons that can cause a2ps binary:
file(1)
said the type of the file is `data', in
which case a2ps
binary: <data*> |
# Load the system's sheets.map include(/usr/local/share/a2ps/sheets/sheets.map) # Override the rule for files with type `data' according to file(1) plain: <data*> |
But this is not very good, since then this rule is always the first
tested, which means that any file with type `data' according to
file(1)
will be printed in `plain' style, even if the file
is called `foo.c'.
# file(1) says it's data, but it's pure text plain: /*.txx/ |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
a2ps (or `--lines-per-page', or `--chars-per-line').
This is probably because you used `-1'..`-9' after the `--font-size'. This is wrong, because the options `-1'..`-9' set the font size (so that there are 80 characters per lines), and many other things (See section 3.1.4 Page Options, option `--font-size').
Hence `a2ps --font-size=12km -4' is exactly the same thing as `a2ps -4', but is different from `a2ps -4 --font-size=12km'. Note that the `pure' options (no side-effects) to specify the number of virtual pages are `--columns' and `--rows'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A mini how-to on a2ps@c.
10.2.1 How Can I Leave Room for Binding? Specifying Margins 10.2.2 How Can I Print stdin
?Using a2ps in a pipe chain 10.2.3 How Can I Change the Fonts? Tired of Courier? 10.2.4 How Can I Simulate the Old Option `-b'? Printing in Bold 10.2.5 How Can I Pass Options to `lpr' Disable the banner 10.2.6 How Can I Print on Non PostScript Printers? Using GhostScript 10.2.7 How Can I Print Man Pages with Underlines Now it Prints With Italics
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
stdin
? `You' can supply a name to the standard input (`--stdin=name') with which it could guess the language.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
How can I tella2ps
to asklpr
no to print the banner?How can I pass specific options to
lp
?
If your `Printer:' fields in the configuration files were properly
filled (see section 4.5 Your Printers), you can use the variable
`lp.options' to pass options to lpr
(or lp
, depending
on your environment):
a2ps -Dlp.options="-h -s" -P printer |
You can also define `lp.options' once for all, See section 4.9.1 Defining Variables.
Finally, you can use `Printer:' several times to reach a printer
with different lpr
options.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
I use a2ps not PostScript. How can I do?
Ghostscript
might be the tool you need (see section A. Glossary). It
support conversion to many different non PostScript printers.
Here are some tips on how to use a non PostScript printer. If somebody feels like writing a more precise documentation, she really is welcome.
Please refer to the Ghostscript
documentation for a precise
description of the tuning you need.
Basically, the first step you need is to achieve to call
Ghostscript
in a pipe chain. In other words, try to find out the
right arguments Ghostscript
needs in order to print with a
command like this:
$ cat file.ps | gs more arguments |
In general it is the same command as for calling Ghostscript
with
a filename, except that the file name to use is `-':
$ cat file.ps \ | gs -q -dNOPAUSE -sDEVICE=deskjet -sOutputFile=- - -c quit\ | lp -dprinter-name |
Once it works, it is then easy to settle the right Printer:
line
in your configuration file (see section 4.5 Your Printers). For instance:
Printer: djet \ | gs -q -dNOPAUSE -sDEVICE=deskjet -sOutputFile=- - -c quit\ | lp -d djet |
Christian Mondrup uses a2ps with a non PostScript printer. He uses:
DefaultPrinter: | //c/gstools/gs5.10/Gswin32c.exe \ -Ic:\gstools\gs5.10;c:\gstools\gs5.10\fonts \ -sDEVICE=ljet4 -sPAPERSIZE=a4 -dNOPAUSE -r300 -dSAFER \ -sOutputFile="\\spool\HP LaserJet 5L (PCL)" \ -q - -c quit |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
By the past, when I printed a man page with a2ps@c, it used underlines, but now it uses italics. I want underlines back!
Use `a2ps --pro=ul'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Wondering something?
10.3.1 Is a2ps Printing dates in short format 10.3.2 Why Have the Options Changed? Respect The Users 10.3.3 Why not having used yacc
and suchWhy Using Style Sheets
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The famous Y2K(5) problem...
Yes, a2ps more recent than 4.10.3. The expansions of the following escapes were broken (giving `100' instead of `00'): `%D', `%W', `$D', `$W'.
Nevertheless, please note that if you required a two digit year, expect to have `Jan 1st, 00' someday. You are responsible of the format you want for the date: See section 3.2 Escapes.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The options of this a2ps
True. But the old scheme (up to version 4.6.1) prevented us from offering more options. We had to drop it, and to fully redesign the options handling.
Since that profound change, we try to change as little as possible between versions. Nevertheless, as the time passes, we discover that some never used options should be renamed, or used for something else. In these cases, compatibility code is left for a long time.
Anywhere you put options but the command line (e.g., in a2ps files or in shell scripts), avoid using short options, since short options are much more likely to be changed (there are not so many, so it is a precious resource). Since there are as many long options as one wants, we can leave compatibility code with the long options.
yacc
and such There are several reasons why we decided not to use grammars to parse the files. Firstly it would have made the design of the style sheets much more tricky, and today a2ps
Secondly, it limits the number of persons who could build a style sheet.
Thirdly, we did not feel the need for such a powerful tool: handling the keywords and the sequences is just what the users expect.
Fourthly, any extension of a2ps
And last but not least, using a parser requires that the sources are syntactic bug free, which is too strong a requirement.
Nevertheless, PreScript
gives the possibility to have on the one
hand a syntactic parser which would produce PreScript
code, and
on the other hand, a2ps@c, which would make it PostScript. This schema
seems to us a good compromise. If it is still not enough for you, you
can use the library.
psnup
, psselect
etc.) can post process
PostScript files.
The DSC are edited by Adobe. A document which respects them is said to be DSC conformant.
a2ps
To know more about encodings, see 6.1 What is an Encoding.
Ghostscript
gs
Ghostscript
,
gs
for short, is a full PostScript interpreter running under many
various systems (Unices, MS-DOS, Mac etc.). It comes with a large set
of output formats allowing many different applications:
Ghostview
or gv
...).
ghostscript
, you may print PostScript files on non PostScript
printers.
A key is the identifier of a unique object. This is information that a2ps a2ps@c, use the key, not its name. For instance `latin1' is the unique identifier of the `ISO Latin 1' encoding.
HTML
, PostScript,
LaTeX, roff
and others are such languages. A file written in
those languages is not made to be read as is by a human, but to be
transformed (or compiled) into a readable form.
HTML
, or roff
, but as TeX and LaTeX, it is
truly a programming language which main purpose is to draw (on sheets).
Most programs are a list of instructions that describes lines, shades of
gray, or text to draw on a page. This is the language that most
printers understand.
Note that the fact that PostScript is a programming language is
responsible of both its success and its failure. It is a big win for
the PostScript programmer who can easily implement a lot of nice visual
effects. It is a big loss because the page descriptions can have an
arbitrary complexity, hence rendering can be really slow (remember the
first Laser you had, or even Ghostscript
. PDF
has been
invented by Adobe to remedy these problems).
PostScript is a trademark of Adobe Systems Incorporated.
PostScript has pretended to be a device independent page description language, and the PPD files are here to prove that device independence was a failure.
psutils
psutils
to run correctly, the PostScript files must be DSC
conformant, and the bad news is that many PostScript drivers produce
files which are not. For some common cases (e.g., Micro$oft tools),
Angus Duggan included in the package some tools (named fix...ps
)
to fix typical problems. fixps
is a collection of recipes on
when to run what fix
tool.
Here are some words on a2ps
B.1 History Where does it come from B.2 Thanks People who really helped B.3 Translators People who brought support of your tongue
The initial version was a shell program written by Evan Kirshenbaum. It was very slow and contained many bugs.
A new version was written in C
by fixes).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The subroutines and source code in the a2ps "free"; this means that everyone is free to use them and free to redistribute them on a free basis. The a2ps@c-related programs are not in the public domain; they are copyrighted and there are restrictions on their distribution, but these restrictions are designed to permit everything that a good cooperating citizen would want to do. What is not allowed is to try to prevent others from further sharing any version of these programs that they might get from you.
Specifically, we want to make sure that you have the right to give away copies of the programs that relate to a2ps@c, that you receive source code or else can get it if you want it, that you can change these programs or use pieces of them in new free programs, and that you know you can do these things.
To make sure that everyone has such rights, we have to forbid you to deprive anyone else of these rights. For example, if you distribute copies of the a2ps@c-related code, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights.
Also, for our own protection, we must make certain that everyone finds out that there is no warranty for the programs that relate to a2ps@c. If these programs are modified by someone else and passed on, we want their recipients to know that what they have is not what we distributed, so that any problems introduced by others will not reflect on our reputation.
The precise conditions of the licenses for the programs currently being distributed that relate to a2ps Public Licenses that accompany them.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Jump to: | %
.
:
A B C D E F G H I K L M N O P R S T U V W |
---|
Jump to: | %
.
:
A B C D E F G H I K L M N O P R S T U V W |
---|
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[Top] | [Contents] | [Index] | [ ? ] |
A classical Unix trick to make the difference between the option `-2', and the file `-2' is to type `./-2'.
Current a2ps
only handles PostScript output, i.e. out=`ps'
Because hiding its use into a2ps
just makes
it even more difficult to the users to know why it failed. Let them use
it by hand.
Many people seem to ignore that you can insert several sheets in the manual feed tray. Try at least once, it will save you from hours spent feeding page per page by hand!
Year 2000.
[Top] | [Contents] | [Index] | [ ? ] |
1. Introduction
1.1 Description2. User's Guide
1.2 Reporting Bugs
1.3 a2ps
1.4 Helping the Development
2.1 Purpose3. Invoking a2ps
2.2 How to print
2.2.1 Basics for Printing2.3 Important parameters
2.2.2 Special Printers
2.2.3 Using Delegations
2.2.4 Printing Duplex
2.2.5 Checking the Defaults
2.4 Localizing
2.5 Interfacing with Other Programs
2.5.1 Interfacing With a Mailer
2.5.2 Netscape
3.1 Command line options4. Configuration Files
3.1.1 Tasks Options3.2 Escapes
3.1.2 Global Options
3.1.3 Sheet Options
3.1.4 Page Options
3.1.5 Headings Options
3.1.6 Input Options
3.1.7 Pretty Printing Options
3.1.8 Output Options
3.1.9 PostScript Options
3.2.1 Use of Escapes
3.2.2 General Structure of the Escapes
3.2.3 Available Escapes
4.1 Including Configuration Files5. Library Files
4.2 Your Library Path
4.3 Your Default Options
4.4 Your Media
4.5 Your Printers
4.6 Your Shortcuts
4.7 Your PostScript magic number
4.8 Your Page Labels
4.9 Your Variables
4.9.1 Defining Variables4.10 Your Delegations
4.9.2 Predefined Variables
4.10.1 Defining a Delegation4.11 Your Internal Details
4.10.2 Guide Line for Delegations
4.10.3 Predefined Delegations
5.1 Documentation Format6. Encodings
5.2 Map Files
5.3 Font Files
5.3.1 Fonts Map File5.4 Style Sheet Files
5.3.2 Fonts Description Files
5.3.3 Adding More Font Support
6.1 What is an Encoding7. Pretty Printing
6.2 Encoding Files
6.2.1 Encoding Map File
6.2.2 Encoding Description Files
6.2.3 Some Encodings
7.1 Syntactic limits8. PostScript
7.2 Known Style Sheets
7.3 Type Setting Style Sheets
7.3.1 Symbol7.4 Faces
7.3.2 PreScript
7.3.2.1 Syntax7.3.3 PreTeX
7.3.2.2 PreScript Commands
7.3.2.3 Examples
7.3.3.1 Special characters7.3.4 TeXScript
7.3.3.2 PreTeX Commands
7.3.3.3 Differences with LaTeX
7.5 Style Sheets Semantics
7.5.1 Name and key7.6 Style Sheets Implementation
7.5.2 Comments
7.5.3 Alphabets
7.5.4 Case sensitivity
7.5.5 P-Rules
7.5.6 Sequences
7.5.7 Optional entries
7.6.1 A Bit of Syntax7.7 A Tutorial on Style Sheets
7.6.2 Style Sheet Header
7.6.3 Syntax of the Words
7.6.4 Inheriting from Other Style Sheets
7.6.5 Syntax for the P-Rules
7.6.6 Declaring the keywords and the operators
7.6.7 Declaring the sequences
7.6.8 Checking a Style Sheet
7.7.1 Example and syntax
7.7.2 Implementation
7.7.3 The Entry in `sheets.map'
7.7.4 More Sophisticated Rules
7.7.5 Guide Line for Distributed Style Sheets
8.1 Foreword: Good and Bad PostScript9. Contributions
8.2 Page Device Options
8.3 Statusdict Options
8.4 Colors in PostScript
8.5 a2ps
8.6 Designing PostScript Prologues
8.6.1 Definition of the faces
8.6.2 Prologue File Format
8.6.3 A step by step example
9.110. Frequently asked questionscard
9.1.1 Invoking9.2card
9.1.2 Caution when Usingcard
fixps
9.2.1 Invoking9.3fixps
fixnt
9.3.1 Invoking9.4fixnt
pdiff
9.4.1 Invoking9.5pdiff
psmandup
9.5.1 Invoking9.6psmandup
psset
9.6.1 Invokingpsset
10.1 Why Does...?A. Glossary
10.1.1 Why Does it Print Nothing?10.2 How Can I ...?
10.1.2 Why Does it Print in Simplex?
10.1.3 Why Does it Print in Duplex?
10.1.4 Why Does it Not Fit on the Paper?
10.1.5 Why Does it Print Junk?
10.1.6 Why Does it Say my File is Binary?
10.1.7 Why Does it Refuse to Change the Font Size
10.2.1 How Can I Leave Room for Binding?10.3 Please tell me...
10.2.2 How Can I Printstdin
?
10.2.3 How Can I Change the Fonts?
10.2.4 How Can I Simulate the Old Option `-b'?
10.2.5 How Can I Pass Options to `lpr'
10.2.6 How Can I Print on Non PostScript Printers?
10.2.7 How Can I Print Man Pages with Underlines
10.3.1 Is a2ps
10.3.2 Why Have the Options Changed?
10.3.3 Why not having usedyacc
and such
B. Genesis
B.1 HistoryC. Copying
B.2 Thanks
B.3 Translators
Concept Index
[Top] | [Contents] | [Index] | [ ? ] |
1. Introduction
2. User's Guide
3. Invoking a2ps
4. Configuration Files
5. Library Files
6. Encodings
7. Pretty Printing
8. PostScript
9. Contributions
10. Frequently asked questions
A. Glossary
B. Genesis
C. Copying
Concept Index
[Top] | [Contents] | [Index] | [ ? ] |
Button | Name | Go to | From 1.2.3 go to |
---|---|---|---|
[ < ] | Back | previous section in reading order | 1.2.2 |
[ > ] | Forward | next section in reading order | 1.2.4 |
[ << ] | FastBack | previous or up-and-previous section | 1.1 |
[ Up ] | Up | up section | 1.2 |
[ >> ] | FastForward | next or up-and-next section | 1.3 |
[Top] | Top | cover (top) of document | |
[Contents] | Contents | table of contents | |
[Index] | Index | concept index | |
[ ? ] | About | this page |