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: /usr/local/share/a2ps/sheets:/usr/local/share/a2ps/ps:/usr/local/share/a2ps/encoding:/usr/local/share/a2ps/afm:/usr/local/share/ogonkify/afm:/usr/local/share/a2ps/ppd:/usr/local/share/a2ps/fonts:/usr/local/share/ogonkify/fonts:/usr/local/share/a2ps 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 taged 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. 135Variable: del.acroread \ 136 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#Variable: del.acroread \ 141# 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 182# 183# Variables for special printers. 184# 185 186# Either GV (prefered) or Ghostview will be used as the "display" printer 187# We give -dNOPLATFONTS so that real fonts are used 188# (Strange results appear with Ogonkify's fonts for instance). 189Variable: ghostview ghostview -arguments -dNOPLATFONTS 190Variable: ghostview gv -antialias -arguments -dNOPLATFONTS 191 192# Used for the `pdf' printer. 193# Use as `#{ps2pdf} INPUT OUTPUT'. 194# Variable: ps2pdf gs -g"#wx#h" -r72 -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$N.pdf -c save pop -f #f0 195Variable: ps2pdf ps2pdf -g"#wx#h" -r72 196#Variable: ps2pdf distill -pairs -pagesize #w #h pts 197 198# 199# Some macro for ToC or page label 200# 201 202# Useful for the page label format: 203# pl.short: just the page intervals 204Variable: pl.short #!s|$p-|,| 205# pl.long: file name and page intervals 206Variable: pl.long #!s|$n $p-|,| 207 208# The default layout for Table of Contents 209Variable: toc \\Keyword{Table of Contents}\n\ 210#-1!f\ 211|$2# \\keyword{$-.20n} sheets $3s< to $3s> ($2s#) pages \ 212$3p<-$3p> $4l# lines\n|| 213 214 215 216################################################################# 217# 5) Preconfigured delegations # 218################################################################# 219# 220# Delegations are ways to hand off the processing of some 221# files to other filters. 222# 223# When delegating, interesting meta sequences are 224# $f -- current filename, i.e. the one to delegate. 225# Note that $f expands exactly to the file, which means 226# that in most cases you need '$f' (with the two quotes) 227# to avoid both (i) problems with space in names, and 228# (ii) other shell active characters, such as $. 229# Yeah, I know, we need something more elaborated in case 230# the file has quotes ' in it :-( 231# #f0 to #f9 -- temporary filename you can use. 232# rm is done by a2ps itself. No need to quote. 233# 234 235########## Compressed files 236# A compressed file should be decompressed and processed by a2ps 237# A consequence is that the decompressed file may be delegated. 238Delegation: gzip-a2ps gzip:ps gzip -cd $f | #{del.a2ps} 239 240Delegation: gzip-a2ps compress:ps gzip -cd $f | #{del.a2ps} 241 242Delegation: bzip-a2ps bzip:ps bzip -cd $f | #{del.a2ps} 243 244Delegation: bzip2-a2ps bzip2:ps bzip2 -cd $f | #{del.a2ps} 245 246########## DVI files 247# Pass DVI files to dvips. 248# * A problem with dvips is that even on failure it dumps its * 249# prologue, hence it looks like a success (output is produced). To 250# avoid that, we use an auxilary files and conditional call to psnup 251# instead of piping. 252# * It tries to figure if the doc is landscape (use of seminar for 253# instance) by looking for `landscape' in the three first strings of 254# the DVI file. 255Delegation: dvips dvi:ps\ 256 if strings '$f' | sed 10q | fgrep landscape > /dev/null 2>&1; then \ 257 #{del.dvips} -T#hpt,#wpt '$f' -o #f0 && #?o|cat|#{del.psnup} -r| #f0; \ 258 else \ 259 #{del.dvips} '$f' -o #f0 && #{del.psnup} #f0; \ 260 fi 261 262########## HTML files 263# Pass HTML to Netscape, hoping that there is an Netscape running... 264# Tricks: 265# 1. Netscape can't output on stdout, hence use a tmp file (#f0) 266# 2. openfile refuses relative paths, so prepend cwd (%d) when relative 267# 3. remote 'openfile' -remote 'saveas' is bad, because it is handled 268# asynchronously, and the output can correspond to a previously 269# loaded page (not that of openfile). So run Netscape twice. 270# 4. It asks the user if s/he wants to replace an existing output file, 271# so rm before. 272Delegation: Netscape html:ps \ 273 rm -f #f0; \ 274 if echo "$f" | grep '^/' >/dev/null 2>&1; then \ 275 ${NETSCAPE:-netscape} -noraise -remote 'openfile($f)'; \ 276 else \ 277 ${NETSCAPE:-netscape} -noraise -remote 'openfile(%d/$f)'; \ 278 fi && \ 279 ${NETSCAPE:-netscape} -noraise -remote 'saveas(#f0,postscript)' && \ 280 #{del.psselect} #f0 | #{del.psnup} 281 282########## MetaFont / MetaPost files 283Delegation: MetaFont metafont:ps \ 284 #{del.metafont} && #{del.dvips} -f $N.dvi | #{del.psnup} 285 286########## PDF files 287# Delegated to pdf2ps, GS 5.10 288Delegation: pdf2ps pdf:ps \ 289 pdf2ps $f #f0 && #{del.psselect} #f0 | #{del.psnup} 290# Delegated to AcrobatReader 291#Delegation: Acrobat pdf:ps \ 292# acroread -toPostScript < $f | #{del.psselnup} 293 294########## PostScript files 295# Pass the PostScript files to psnup and psselect 296Delegation: PsNup ps:ps fixps #?V||-q| $f | #{del.psselnup} 297 298########## ROFF files 299# Pass the roff files to groff. Ask grog how groff should be called. 300# Use fixps to ensure there is a %%BeginSetp/%%EndSetup section. 301#Delegation: Groff roff:ps \ 302# eval `grog -Tps $f` | fixps #?V!!-q! | #{del.psselnup} 303 304########## TeX files, supposed to be LaTeX files in fact 305# Use texi2dvi for TeX file 306#Delegation: texi2dvi tex:ps \ 307# #{del.texi2dvi} -l latex $f && mv $N.dvi #f0 && #{del.dvips} -f #f0 | #{del.psnup} 308 309########## Texinfo files 310# Use texi2dvi for Texinfo file 311# In a near future, we might no longer have to specify --expand, but 312# currently, it is safer. 313#Delegation: texi2dvi texinfo:ps \ 314# #{del.texi2dvi} -e -l texinfo $f && mv $N.dvi #f0 && #{del.dvips} -f #f0 | #{del.psnup} 315 316######################## Using ImageMagick for images 317########## GIF files 318Delegation: ImageMagick gif:ps\ 319 #{del.imagick} 'gif:$f' ps:- | #{del.psselnup} 320 321########## JPEG files 322Delegation: ImageMagick jpeg:ps\ 323 #{del.imagick} 'jpeg:$f' ps:- | #{del.psselnup} 324 325########## PNG files 326Delegation: ImageMagick png:ps\ 327 #{del.imagick} 'png:$f' ps:- | #{del.psselnup} 328 329########## TIFF files 330Delegation: ImageMagick tiff:ps\ 331 #{del.imagick} 'tiff:$f' ps:- | #{del.psselnup} 332 333########## XBM files 334Delegation: ImageMagick xbm:ps\ 335 #{del.imagick} 'xbm:$f' ps:- | #{del.psselnup} 336 337########## XPM files 338Delegation: ImageMagick xpm:ps\ 339 #{del.imagick} 'xpm:$f' ps:- | #{del.psselnup} 340 341 342################################################################# 343# 6) Some interesting UserOptions/Printers # 344################################################################# 345# Print like an old fashioned ASCII printer 346UserOption: lp -1m -Eplain -B --borders=no 347 348# Print mails. Strip some headers. 349UserOption: mail -gEmail --strip=1 350UserOption: longmail -gEmail --strip=1 -2R 351 352# Printing a booklet 353 354# To print a booklet, we must be sure to output Simplex, and 1 up. 355# Install the lp hook for booklets. 356UserOption: book -1Dlp.hook=#{lp.hook.book} -s1 357 358# This variable defines a hook for `lp'. The output is piped into 359# psbook in order to print a booklet. 360Variable: lp.hook.book \ 361#?o! psbook #?V,,-q, | psnup -2 #?V,,-q, | psset -nt | \ 362! echo "Cannot be used with more than two pages per sheet." >&2 ; exit 1! 363 364 365 366# Some special setpagedevice requests 367UserOption: manual -SManualFeed:true 368# Force a2ps to issue a Simplex request. 369UserOption: s1 -SDuplex:false 370UserOption: simplex -SDuplex:false 371 372# Nice display, i.e., use colors, and one virtual per page. 373UserOption: display -1 --prolog=color -Pdisplay 374 375# It is better not to pipe in ghostview 376Printer: display | cat > #f0 && #{ghostview} #f0 377 378# Save into a file named after the input files. 379# E.g. a2ps src/foo.c => foo.ps 380Printer: file > $N.#. 381 382# Dry run. Helpful to know the page usage etc. 383Printer: void > /dev/null 384 385# Produce PDF. 386# It is better not to output in two up, or even worse: in landscape. 387Printer: pdf | cat >#f0 && #{ps2pdf} #f0 $N.pdf 388UserOption: pdf -1 -P pdf --prologue=color 389 390# We define the DefaultPrinter and the Unknown Printer just in case 391# a2ps-site.cfg fails to define them. Under normal circumstances 392# these entries *will* be overridden. 393 394# First, the default printer (option -d, no argument) 395DefaultPrinter: | #{lp.default} 396 397# Second, a printer unknown to a2ps (option -P, argument is #o) 398UnknownPrinter: | #{lp} #o 399 400 401 402################################################################# 403# 7) Your local settings # 404################################################################# 405# How to call file(1), and if possible, follow the links 406FileCommand: file.exe 407 408 409# Define a variable to call lp/lpr on the default printer, preceeded 410# with a hook to post-process PostScript (to call psbook for instance). 411# Something like `#{lp.hook} lp #{lp.options}' 412# or `#{lp.hook} lpr #{lp.options}'. 413Variable: lp.default #{lp.hook} lpr #{lp.options} 414 415 416# The same, but when a printer is specified. 417# Something like `#{lp.hook} lp #{lp.options} -d' 418# or `#{lp.hook} lpr #{lp.options} -P'. 419Variable: lp #{lp.hook} lpr #{lp.options} -P 420 421 422# To avoid that the next installation of a2ps destroys your 423# definitions, local customization would be better done in 424# a2ps-site.cfg. 425 426Include: a2ps-site.cfg 427