Next: , Previous: , Up: Your Delegations   [Contents][Index]


4.10.2 Guide Line for Delegations

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 delegations4. As a thumb rule, you should check that the PostScript generating applications produce files that start by:

%!PS-Adobe-3.0

a2ps needs the ‘%%BeginSetup’-‘%%EndSetup’ section 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:

the input file

available via the escape ‘$f’. You should be aware that there are people who have great fun having spaces or dollars in their file names, so you probably should always use ‘'$f'’. Some other variables are affected. Yes, I know, we need a special mechanism for ‘'’ itself. Well, we’ll see that later ‘;-)’.

the medium

the dimension of the medium selected by the user are available through ‘#w’ and ‘#h’.

the page layout

the number of virtual pages is ‘#v’.

the page range

the page range (in a form ‘1-2,4-6,10-’ for instance) is available by ‘#p’.

the verbosity level

please, do not make your delegations verbose by default. The silent mode should always be requested, unless ‘#?V’ is set (see the above example with 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).


Footnotes

(4)

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.


Next: Predefined Delegations, Previous: Defining a Delegation, Up: Your Delegations   [Contents][Index]