blob: c0df879392649261f316cd9122d7e1346061ffc9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#!/bin/sh
# + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
# | Copyright(C) 1997-2005 by F. Bosisio |
# | |
# | This program can be redistributed and/or modified under |
# | the terms of the LaTeX Project Public License, distributed |
# | from CTAN archives in directory macros/latex/base/lppl.txt; |
# | either version 1 of the License, or any later version. |
# | |
# | E-mail: fbosisio@bigfoot.com |
# | CTAN location: macros/latex/contrib/bosisio/ |
# + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
#
# If there isn't a command-line parameter, ask for a filename
#
if test $1
then
FILE=$1
else
printf '\tInsert the filename you want to process with makedoc\n'
read FILE
fi
#
# Strip the ".dtx" extension (if present) and check that the file exists
#
FILE=`basename ${FILE} .dtx`
test -f ${FILE}.dtx || exit 1
#
# Run LaTeX on the ".dtx" file to generate the ".sty" and ".drv" files
#
printf '\n\t\tRunning LaTeX on %s.dtx ...\n\n' "${FILE}"
latex ${FILE}.dtx || exit 2
#
# Run LaTeX once to generate the ".aux", ".idx" and ".glo" files
#
printf '\n\t\tRunning LaTeX on %s.drv ...\n\n' "${FILE}"
latex ${FILE}.drv || exit 3
#
# Run BibTeX to generate the bibliography file (".bbl")
#
if grep -q bibdata ${FILE}.aux
then
printf '\n\t\tRunning BibTeX on %s.aux ...\n\n' "${FILE}"
bibtex ${FILE} || exit 4
rm ${FILE}.blg
fi
#
# Run MakeIndex on the index file
#
if test ${FILE}.idx
then
printf '\n\t\tRunning MakeIndex on %s.idx ...\n\n' "${FILE}"
makeindex -s gind.ist -o ${FILE}.ind ${FILE}.idx || exit 5
rm ${FILE}.ilg
fi
#
# Run MakeIndex on the glossary file
#
if test ${FILE}.glo
then
printf '\n\t\tRunning MakeIndex on %s.glo ...\n\n' "${FILE}"
makeindex -s gglo.ist -o ${FILE}.gls ${FILE}.glo || exit 6
rm ${FILE}.ilg
fi
#
# Rerun LaTeX to read the ".bbl", ".ind" and ".gls" files
#
printf '\n\t\tRe-running LaTeX on %s.drv ...\n\n' "${FILE}"
latex ${FILE}.drv
#
# Rerun LaTeX again to get the cross-references right
#
if grep -q 'Rerun to get cross-references right' ${FILE}.log
then
printf '\n\t\tRe-running LaTeX again on %s.drv ...\n\n' "${FILE}"
latex ${FILE}.drv
fi
#
# Remove temporary files
#
rm -f ${FILE}.drv ${FILE}.log ${FILE}.aux ${FILE}.ind ${FILE}.glo \
${FILE}.bbl ${FILE}.idx ${FILE}.gls
#
# Show the generated output
#
xdvi ${FILE}.dvi
#
# Run DviPdf to produce the PDF file
#
printf '\n\t\tRunning DviPdf ...\n\n'
dvipdf ${FILE}.dvi
#
# Remove DVI file
#
rm ${FILE}.dvi
|