forked from sergutsan/groovyck
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeNewPDF
More file actions
executable file
·42 lines (42 loc) · 1.18 KB
/
makeNewPDF
File metadata and controls
executable file
·42 lines (42 loc) · 1.18 KB
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
#/bin/sh
VERSION_FILE=version.txt
LATEXFILE=main-intro
PDFFILE="BBK - DCS - Introduction to Computer Programming.pdf"
if [ -e ${VERSION_FILE} ]; then
echo "ERROR: There is a spurious ${VERSION_FILE} in this folder."
echo " Please delete it and run the script again"
exit 0
fi
if [ $# != 1 -a $# != 3 ]; then
echo "USAGE: makeNewPDF <version> [<main file> <filename>]"
echo "Example: makeNewPDF 1.32"
echo "Example: makeNewPDF 1.1 main-intro \"BBK - DCS - Introduction to Computer Programming.pdf\""
exit 0
fi
if [ "$1" != "" ]; then
echo $1 > ${VERSION_FILE}
fi
if [ "$2" != "" ]; then
LATEXFILE="$2"
fi
if [ "$3" != "" ]; then
PDFFILE="$3"
fi
echo "Compiling ${LATEXFILE}.tex (v${1}) in 3..."
sleep 1
echo "2..."
sleep 1
echo "1..."
sleep 1
latex ${LATEXFILE}
latex ${LATEXFILE}
latex ${LATEXFILE}
dvips ${LATEXFILE}.dvi -o
ps2pdf ${LATEXFILE}.ps
# If we wanted to include the version info in the title of the PDF,
# we would update $PDFFILE here. However, this is a bad idea because
# several web links beyond our control (and more to come) point to
# this file and we do not want to break them.
mv ${LATEXFILE}.pdf "$PDFFILE"
echo Created "$PDFFILE".
rm ${VERSION_FILE}