1# a2ps.cfg                                           -*- Makefile -*-
2#
3# System configuration file for a2ps.
4# Copyright (c) 1988-1993 Miguel Santana
5# Copyright (c) 1995-2000 Akim Demaille, Miguel Santana
6#
7
8#
9# This file is part of a2ps.
10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2, or (at your option)
14# any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; see the file COPYING.  If not, write to
23# the Free Software Foundation, 59 Temple Place - Suite 330,
24# Boston, MA 02111-1307, USA.
25#
26
27#
28# This file defines everything a2ps needs to know about
29# -- your system (access to the printers)
30#    It is strongly suggested that you check these parameters
31#    are adapted to your system.
32# -- customizable features
33#
34# It is related to the whole system, i.e., it is not the file
35# the users should modify themselves for their own preferences.
36# ~/.a2ps/a2psrc is the user's own configuration file, which
37# is read after this file.
38#
39
40
41#################################################################
42# 1)		Definition of some media 			#
43# (Must be defined before --medium)				#
44#################################################################
45# Medium: name, width height [llx lly urx ury]
46Medium: A3	    842    1190
47Medium: A4	    595     842
48Medium: A5	    420     595
49Medium: B4	    729    1032
50Medium: B5	    516     729
51Medium: Letter	    612     792
52Medium: Legal	    612    1008
53Medium: Tabloid	    792    1224
54Medium: Ledger	   1224     792
55Medium: Statement   396	    612
56Medium: Executive   540     720
57Medium: Folio	    612     936
58Medium: Quarto	    610     780
59Medium: 10x14	    720    1008
60
61# Desk Jet users: bigger margins
62Medium: A4dj		595	842	24	50	571	818
63Medium: Letterdj	612	792	24	40	588	768
64
65
66
67#################################################################
68# 2)	Path to the a2ps resource				#
69#################################################################
70# Default path where a2ps dropped its library files.
71LibraryPath: @libpath@
72
73# It may be useful to extend it so that a2ps can see some
74# TeX or X11 resources: it likes AFM files and PF[AB] files.
75#AppendLibraryPath: foo
76
77
78#################################################################
79# 3)	Default settings					#
80#################################################################
81# Two virtual pages per sheet
82Options: -2
83
84# Set automatic pretty-printing on (set to "plain" for off)
85Options: --pretty-print
86
87# By default, single sided printing.
88Options: -s1
89
90# Name of the document is the list of files
91# (Don't put too many of them: it breaks some PS interpreters)
92Options: --title='#10!f|$n|, |'
93
94# Header is the client of the job
95Options: --header=%a
96
97# Title of the page is the (short) name of the current file
98# or the first tagged text if there is
99Options: --center-title=#?1|$t1|$n|
100
101# Left part of the title is the mod. date of the file
102# or empty is there is a tag2
103Options: --left-title='#?2||$e $T|'
104
105# Right part of the title is the page number
106# or tag2 if there is
107Options: --right-title='#?2|$t2|$Q|'
108
109# If in landscape, print date on the left hand side
110# If portrait, then print date on recto, and sheet # on verso
111Options: --left-footer=#?l!%E!#?v|%E|%s./%s#|!
112
113# Center footer is the list of files on this sheet if landscape
114Options: --footer='#?l|#!s-$f-, -||'
115
116# If in landscape, print date on the right hand side
117# If portrait, then print date on verso, and sheet # on recto
118Options: --right-footer=#?l!%s./%s#!#?v|%s./%s#|%E|!
119
120# We want the %%Page comments to be instructive.
121# There are two predefined choices: #{pl.short} and #{pl.long}
122PageLabelFormat: #{pl.short}
123
124# Report the number of lines which were wrapped.
125Variable: cfg.wrapped 1
126
127###############################################################
128# 4)	Preconfigured Variables		                      #
129###############################################################
130#
131# Some variables for the delegations
132#
133
134# Calling AcrobatReader for PDF to PostScript.
135@COM_acroread@Variable: del.acroread \
136@COM_acroread@   @acroread@ -toPostScript
137
138# Acrobat 4 lets us specify the medium, which is precious sometimes, and
139# that we should shrink the document to the size of the medium.
140@COM_acroread4@Variable: del.acroread \
141@COM_acroread4@   @acroread@ -toPostScript -size "#wx#h" -shrink
142
143# Passes the options to psnup.  A problem with psnup is that even if
144# no service is requested, the PostScript is altered.  There are such
145# problems with dvips.  A symptom is that the figure are spread on
146# several pages.  To avoid that, with ``-1'', we use cat instead of
147# psnup -1.
148# The files (in and out) are to be given if not stdin and stdout.
149Variable: del.psnup \
150   #?o!cat!@psnup@ -#v #?V||-q| #?j|-d|| #?r||-c| -w#w -h#h!
151
152# Passes to psselect for PS page selection.
153Variable: del.psselect \
154   #?p!@psselect@ #?V||-q| -p#p!cat!
155
156# Passes to psselect, and then psnup
157Variable: del.psselnup #{del.psselect} | #{del.psnup}
158
159# Calls to dvips.  The sequence waits for the file name, and
160# produces on stdout.
161Variable: del.dvips @dvips@ #?p|-pp#p|| #?V||-q| -T#wpt,#hpt -f
162
163# We use a modified texi2dvi which accepts -b (--batch), -c (--clean),
164# and -l (--language).
165Variable: del.texi2dvi \
166 texi2dvi4a2ps -b -c #?V|--verbose|--quiet| 1>&2
167
168# a2ps will be called upon decompressed files.
169Variable: del.a2ps\
170 a2ps #?p|-a#p|| #?V|-v2|-q| -#v -o- --stdin=$N
171
172# convert, part of ImageMagick, is used for many image formats
173# If you want the name of the file to be printed along with the picture,
174# add `-label $f'
175Variable: del.imagick @convert@ -page #wx#h
176
177# TeX MetaFont and MetaPost files.
178Variable: del.metafont \
179	(TEXINPUTS=%d:$$TEXINPUTS && \
180	 mft $f && tex $N.tex '\\end') #?V|1>&2|> /dev/null|
181
182Variable: del.metapost \
183	(TEXINPUTS=%d:$$TEXINPUTS && \
184	 mft $f && mv $f.tex $N.tex && tex $N.tex '\\end') #?V|1>&2|> /dev/null|
185
186#
187# Variables for special printers.
188#
189
190# Either GV (prefered) or Ghostview will be used as the "display" printer
191# We give -dNOPLATFONTS so that real fonts are used
192# (Strange results appear with Ogonkify's fonts for instance).
193@COM_ghostview@Variable: ghostview @ghostview@ -arguments -dNOPLATFONTS
194@COM_gv@Variable: ghostview @gv@ -antialias -arguments -dNOPLATFONTS
195
196# Used for the `pdf' printer.
197# Use as `#{ps2pdf} INPUT OUTPUT'.
198# @COM_ps2pdf@Variable: ps2pdf gs -g"#wx#h" -r72 -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$N.pdf -c save pop -f #f0
199@COM_ps2pdf@Variable: ps2pdf ps2pdf -g"#wx#h" -r72
200@COM_distill@Variable: ps2pdf distill -pairs -pagesize #w #h pts
201
202#
203# Some macro for ToC or page label
204#
205
206# Useful for the page label format:
207# pl.short: just the page intervals
208Variable: pl.short #!s|$p-|,|
209# pl.long: file name and page intervals
210Variable: pl.long #!s|$n $p-|,|
211
212# The default layout for Table of Contents
213Variable: toc \\Keyword{Table of Contents}\n\
214#-1!f\
215|$2# \\keyword{$-.20n} sheets $3s< to $3s> ($2s#) pages \
216$3p<-$3p> $4l# lines\n||
217
218
219
220#################################################################
221# 5)	Preconfigured delegations                               #
222#################################################################
223#
224# Delegations are ways to hand off the processing of some
225# files to other filters.
226#
227# When delegating, interesting meta sequences are
228# $f         -- current filename, i.e. the one to delegate.
229#               Note that $f expands exactly to the file, which means
230#               that in most cases you need '$f' (with the two quotes)
231#               to avoid both (i) problems with space in names, and
232#               (ii) other shell active characters, such as $.
233#               Yeah, I know, we need something more elaborated in case
234#               the file has quotes ' in it :-(
235# #f0 to #f9 -- temporary filename you can use.
236#               rm is done by a2ps itself.  No need to quote.
237#
238
239########## Compressed files
240# A compressed file should be decompressed and processed by a2ps
241# A consequence is that the decompressed file may be delegated.
242@COM_gzip@Delegation: gzip-a2ps gzip:ps     @gzip@ -cd '$f' | #{del.a2ps}
243
244@COM_gzip@Delegation: gzip-a2ps compress:ps @gzip@ -cd '$f' | #{del.a2ps}
245
246@COM_bzip@Delegation: bzip-a2ps bzip:ps     @bzip@ -cd '$f' | #{del.a2ps}
247
248@COM_bzip2@Delegation: bzip2-a2ps bzip2:ps   @bzip2@ -cd '$f' | #{del.a2ps}
249
250########## DVI files
251# Pass DVI files to dvips.
252# * A problem with dvips is that even on failure it dumps its
253#   prologue, hence it looks like a success (output is produced). To
254#   avoid that, we use an auxiliary files and conditional call to psnup
255#   instead of piping.
256# * It tries to figure if the doc is landscape (use of seminar for
257#   instance) by looking for `landscape' in the first strings of
258#   the DVI file.
259@COM_PSUTILS@@COM_dvips@Delegation: dvips dvi:ps\
260@COM_PSUTILS@@COM_dvips@   if strings '$f' | sed 10q | fgrep landscape > /dev/null 2>&1; then \
261@COM_PSUTILS@@COM_dvips@     #{del.dvips} -T#hpt,#wpt '$f' -o #f0 && #?o|cat|#{del.psnup} -r| #f0; \
262@COM_PSUTILS@@COM_dvips@   else \
263@COM_PSUTILS@@COM_dvips@     #{del.dvips} '$f' -o #f0 && #{del.psnup} #f0; \
264@COM_PSUTILS@@COM_dvips@   fi
265
266########## HTML files
267# Pass HTML to Netscape, hoping that there is an Netscape running...
268# Tricks:
269# 1. Netscape can't output on stdout, hence use a tmp file (#f0)
270# 2. openfile refuses relative paths, so prepend cwd (%d) when relative
271# 3. remote 'openfile' -remote 'saveas' is bad, because it is handled
272#    asynchronously, and the output can correspond to a previously
273#    loaded page (not that of openfile).  So run Netscape twice.
274# 4. It asks the user if s/he wants to replace an existing output file,
275#    so rm before.
276@COM_PSUTILS@Delegation: Netscape html:ps    \
277@COM_PSUTILS@  rm -f #f0; \
278@COM_PSUTILS@  if echo '$f' | grep '^/' >/dev/null 2>&1; then \
279@COM_PSUTILS@    ${NETSCAPE:-netscape} -noraise -remote 'openfile($f)'; \
280@COM_PSUTILS@  else \
281@COM_PSUTILS@    ${NETSCAPE:-netscape} -noraise -remote 'openfile(%d/$f)'; \
282@COM_PSUTILS@  fi && \
283@COM_PSUTILS@  ${NETSCAPE:-netscape} -noraise -remote 'saveas(#f0,postscript)' && \
284@COM_PSUTILS@  #{del.psselect} #f0 | #{del.psnup}
285
286########## MetaFont / MetaPost files
287Delegation: MetaFont mf:ps \
288      #{del.metafont} && #{dvips} $N.dvi | #{psnup}
289
290Delegation: MetaPost mp:ps \
291      #{del.metapost} && #{dvips} $N.dvi | #{psnup}
292
293########## PDF files
294# Delegated to pdf2ps, GS 5.50
295@COM_PSUTILS@@COM_pdf2ps@Delegation: pdf2ps pdf:ps \
296@COM_PSUTILS@@COM_pdf2ps@   @pdf2ps@ '$f' #f0 && #{del.psselect} #f0 | #{del.psnup}
297# Delegated to AcrobatReader
298@COM_PSUTILS@@COM_acroread@Delegation: Acrobat pdf:ps \
299@COM_PSUTILS@@COM_acroread@   #{del.acroread} < '$f' | #{del.psselnup}
300
301########## PostScript files
302# Pass the PostScript files to psnup and psselect
303@COM_PSUTILS@Delegation: PsNup ps:ps fixps #?V||-q| '$f' | #{del.psselnup}
304
305########## ROFF files
306# Pass the roff files to groff.  Ask grog how groff should be called.
307# Use fixps to ensure there is a %%BeginSetup/%%EndSetup section.
308@COM_PSUTILS@@COM_grog@Delegation: Groff roff:ps	\
309@COM_PSUTILS@@COM_grog@  eval `grog -Tps '$f'` | fixps #?V!!-q! | #{del.psselnup}
310
311########## TeX files, supposed to be LaTeX files in fact
312# Use texi2dvi for TeX file
313@COM_PSUTILS@@COM_LATEX@Delegation: texi2dvi tex:ps	\
314@COM_PSUTILS@@COM_LATEX@  #{del.texi2dvi} -l latex -o #f0 '$f' && #{del.dvips} -f #f0 | #{del.psnup}
315
316########## Texinfo files
317# Use texi2dvi for Texinfo file
318# In a near future, we might no longer have to specify --expand, but
319# currently, it is safer.
320@COM_PSUTILS@@COM_TEXI@Delegation: texi2dvi texinfo:ps	\
321@COM_PSUTILS@@COM_TEXI@  #{del.texi2dvi} -e -o #f0 -l texinfo '$f' && #{del.dvips} -f #f0 | #{del.psnup}
322
323######################## Using ImageMagick for images
324########## GIF files
325@COM_PSUTILS@@COM_convert@Delegation: ImageMagick gif:ps\
326@COM_PSUTILS@@COM_convert@        #{del.imagick} 'gif:$f' ps:- | #{del.psselnup}
327
328########## JPEG files
329@COM_PSUTILS@@COM_convert@Delegation: ImageMagick jpeg:ps\
330@COM_PSUTILS@@COM_convert@        #{del.imagick} 'jpeg:$f' ps:- | #{del.psselnup}
331
332########## PNG files
333@COM_PSUTILS@@COM_convert@Delegation: ImageMagick png:ps\
334@COM_PSUTILS@@COM_convert@        #{del.imagick} 'png:$f' ps:- | #{del.psselnup}
335
336########## TIFF files
337@COM_PSUTILS@@COM_convert@Delegation: ImageMagick tiff:ps\
338@COM_PSUTILS@@COM_convert@        #{del.imagick} 'tiff:$f' ps:- | #{del.psselnup}
339
340########## XBM files
341@COM_PSUTILS@@COM_convert@Delegation: ImageMagick xbm:ps\
342@COM_PSUTILS@@COM_convert@        #{del.imagick} 'xbm:$f' ps:- | #{del.psselnup}
343
344########## XPM files
345@COM_PSUTILS@@COM_convert@Delegation: ImageMagick xpm:ps\
346@COM_PSUTILS@@COM_convert@        #{del.imagick} 'xpm:$f' ps:- | #{del.psselnup}
347
348
349#################################################################
350# 6)	Some interesting UserOptions/Printers			#
351#################################################################
352# Print like an old fashioned ASCII printer
353UserOption: lp -1m -Eplain -B --borders=no
354
355# Print mails.  Strip some headers.
356UserOption: mail     -gEmail --strip=1
357UserOption: longmail -gEmail --strip=1 -2R
358
359# Printing a booklet
360
361# To print a booklet, we must be sure to output Simplex, and 1 up.
362# Install the lp hook for booklets.
363UserOption: book -1Dlp.hook=#{lp.hook.book} -s1
364
365# This variable defines a hook for `lp'.  The output is piped into
366# psbook in order to print a booklet.
367Variable: lp.hook.book \
368#?o! psbook #?V,,-q, | psnup -2 #?V,,-q, | psset -nt | \
369! echo "Cannot be used with more than two pages per sheet." >&2 ; exit 1!
370
371
372
373# Some special setpagedevice requests
374UserOption: manual -SManualFeed:true
375# Force a2ps to issue a Simplex request.
376UserOption: s1      -SDuplex:false
377UserOption: simplex -SDuplex:false
378
379# Nice display, i.e., use colors, and one virtual per page.
380UserOption: display -1 --prolog=color -Pdisplay
381
382# It is better not to pipe in ghostview
383@COM_DISPLAY@Printer: display | cat > #f0 && #{ghostview} #f0
384
385# Save into a file named after the input files.
386# E.g. a2ps src/foo.c => foo.ps
387Printer: file > $N.#.
388
389# Dry run.  Helpful to know the page usage etc.
390Printer: void > /dev/null
391
392# Produce PDF.
393# It is better not to output in two up, or even worse: in landscape.
394@COM_PS2PDF@Printer: pdf | cat >#f0 && #{ps2pdf} #f0 $N.pdf
395UserOption: pdf -1 -P pdf --prologue=color
396
397# We define the DefaultPrinter and the Unknown Printer just in case
398# a2ps-site.cfg fails to define them.  Under normal circumstances
399# these entries *will* be overridden.
400
401# First, the default printer (option -d, no argument)
402DefaultPrinter: | #{lp.default}
403
404# Second, a printer unknown to a2ps (option -P, argument is #o)
405UnknownPrinter: | #{lp} #o
406
407
408
409#################################################################
410# 7)	Your local settings					#
411#################################################################
412# How to call file(1), and if possible, follow the links
413FileCommand: @FILE_LINK@
414
415
416# Define a variable to call lp/lpr on the default printer, preceded
417# with a hook to post-process PostScript (to call psbook for instance).
418# Something like `#{lp.hook} lp  #{lp.options}'
419#             or `#{lp.hook} lpr #{lp.options}'.
420Variable: lp.default #{lp.hook} @LPR@ #{lp.options}
421
422
423# The same, but when a printer is specified.
424# Something like `#{lp.hook} lp  #{lp.options} -d'
425#             or `#{lp.hook} lpr #{lp.options} -P'.
426Variable: lp #{lp.hook} @LPR@ #{lp.options} @LPR_QUEUE_OPTION@
427
428
429# To avoid that the next installation of a2ps destroys your
430# definitions, local customization would be better done in
431# a2ps-site.cfg.
432
433Include: a2ps-site.cfg
434