xref: /minix3/external/bsd/bind/dist/doc/arm/latex-fixup.pl (revision 00b67f09dd46474d133c95011a48590a8e8f94c7)
1*00b67f09SDavid van Moolenbroek#!/usr/bin/perl -w
2*00b67f09SDavid van Moolenbroek#
3*00b67f09SDavid van Moolenbroek# Copyright (C) 2005, 2007, 2012  Internet Systems Consortium, Inc. ("ISC")
4*00b67f09SDavid van Moolenbroek#
5*00b67f09SDavid van Moolenbroek# Permission to use, copy, modify, and/or distribute this software for any
6*00b67f09SDavid van Moolenbroek# purpose with or without fee is hereby granted, provided that the above
7*00b67f09SDavid van Moolenbroek# copyright notice and this permission notice appear in all copies.
8*00b67f09SDavid van Moolenbroek#
9*00b67f09SDavid van Moolenbroek# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10*00b67f09SDavid van Moolenbroek# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11*00b67f09SDavid van Moolenbroek# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12*00b67f09SDavid van Moolenbroek# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13*00b67f09SDavid van Moolenbroek# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14*00b67f09SDavid van Moolenbroek# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15*00b67f09SDavid van Moolenbroek# PERFORMANCE OF THIS SOFTWARE.
16*00b67f09SDavid van Moolenbroek
17*00b67f09SDavid van Moolenbroek# Id: latex-fixup.pl,v 1.5 2007/06/19 23:47:13 tbox Exp
18*00b67f09SDavid van Moolenbroek
19*00b67f09SDavid van Moolenbroek# Sadly, the final stages of generating a presentable PDF file always
20*00b67f09SDavid van Moolenbroek# seem to require some manual tweaking.  Doesn't seem to matter what
21*00b67f09SDavid van Moolenbroek# typesetting tool one uses, sane forms of automation only go so far,
22*00b67f09SDavid van Moolenbroek# at least with present technology.
23*00b67f09SDavid van Moolenbroek#
24*00b67f09SDavid van Moolenbroek# This script is intended to be a collection of tweaks.  The theory is
25*00b67f09SDavid van Moolenbroek# that, while we can't avoid the need for tweaking, we can at least
26*00b67f09SDavid van Moolenbroek# write the silly things down in a form that a program might be able
27*00b67f09SDavid van Moolenbroek# to execute.  Undoubtedly everythig in here will break, eventually,
28*00b67f09SDavid van Moolenbroek# at which point it will need to be updated, but since the alternative
29*00b67f09SDavid van Moolenbroek# is to do the final editing by hand every time, this approach seems
30*00b67f09SDavid van Moolenbroek# the lesser of two evils.
31*00b67f09SDavid van Moolenbroek
32*00b67f09SDavid van Moolenbroekwhile (<>) {
33*00b67f09SDavid van Moolenbroek
34*00b67f09SDavid van Moolenbroek    # Fix a db2latex oops.  LaTeX2e does not like having tables with
35*00b67f09SDavid van Moolenbroek    # duplicate names.  Perhaps the dblatex project will fix this
36*00b67f09SDavid van Moolenbroek    # someday, but we can get by with just deleting the offending
37*00b67f09SDavid van Moolenbroek    # LaTeX commands for now.
38*00b67f09SDavid van Moolenbroek
39*00b67f09SDavid van Moolenbroek    s/\\addtocounter\{table\}\{-1\}//g;
40*00b67f09SDavid van Moolenbroek
41*00b67f09SDavid van Moolenbroek    # Line break in the middle of quoting one period looks weird.
42*00b67f09SDavid van Moolenbroek
43*00b67f09SDavid van Moolenbroek    s/{\\texttt{{\.\\dbz{}}}}/\\mbox{{\\texttt{{\.\\dbz{}}}}}/;
44*00b67f09SDavid van Moolenbroek
45*00b67f09SDavid van Moolenbroek    # Add any further tweaking here.
46*00b67f09SDavid van Moolenbroek    # https://en.wikibooks.org/wiki/LaTeX/Special_Characters
47*00b67f09SDavid van Moolenbroek    s/&#50102;/{\\"o}/;  # omlaut o &#xc3b6; or &#50102;
48*00b67f09SDavid van Moolenbroek
49*00b67f09SDavid van Moolenbroek    # Write out whatever we have now.
50*00b67f09SDavid van Moolenbroek    print;
51*00b67f09SDavid van Moolenbroek}
52