annotate makeBooke.sh @ 40:93955def7313

Revise page footers, and add build number.
author Jim Hague <jim.hague@laicatc.com>
date Sat, 03 Mar 2012 16:06:23 +0000
parents 9681f6cd9c2b
children 0e7d2830cb8b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37
72b5d67756e1 Fix up troubles with \. echo -E disables expansion.
Jim Hague <jim.hague@laicatc.com>
parents: 34
diff changeset
1 #!/bin/bash
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
2 #
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
3 # Build the Booke. First assemble the book LaTeX, then build it
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
4 # into a PDF.
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
5 #
0
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
6
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
7 if [ $# != 1 ]; then
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
8 echo "Usage: makeBooke.sh <book dir name>"
0
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
9 exit 1
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
10 fi
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
11
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
12 dir=`pwd`
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
13
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
14 booke=$dir/$1
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
15 builddir=$dir/build
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
16 output=dottes.tex
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
17 outputpdf=dottes.pdf
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
18 outputa4=dottesona4.tex
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
19 outputa4pdf=dottesona4.pdf
0
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
20
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
21 mkdir -p $builddir
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
22
40
93955def7313 Revise page footers, and add build number.
Jim Hague <jim.hague@laicatc.com>
parents: 39
diff changeset
23 cp buildno.txt $builddir
39
9681f6cd9c2b Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents: 38
diff changeset
24 if [ -r $booke/subtitle.txt ]; then
9681f6cd9c2b Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents: 38
diff changeset
25 cp $booke/subtitle.txt $builddir
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
26 else
39
9681f6cd9c2b Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents: 38
diff changeset
27 touch $builddir/subtitle.txt
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
28 fi
39
9681f6cd9c2b Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents: 38
diff changeset
29 if [ -r $booke/intro.txt ]; then
9681f6cd9c2b Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents: 38
diff changeset
30 cp $booke/intro.txt $builddir
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
31 else
39
9681f6cd9c2b Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents: 38
diff changeset
32 touch $builddir/intro.txt
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
33 fi
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
34 cp dottes.tex.header $builddir/$output
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
35
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
36 # Now, for each tune, make the tune graphic and add it, inside a
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
37 # centre section, so the document. Then add a TOC entry.
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
38 find $booke -name "*.abc" | sort |
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
39 while read filename
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
40 do
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
41 title=`grep "^T:" $filename | head -1 | sed -e "s/^T: *//"`
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
42 name=`basename $filename .abc`
34
80af9457d566 Remove use of abc pacakge and do the graphics outselves.
Jim Hague <jim.hague@acm.org>
parents: 32
diff changeset
43 abcm2ps -j0 +c -n -E -O $builddir/$name.eps $filename
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
44 # Make $name.eps so we can build with LaTeX.
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
45 mv $builddir/${name}001.eps $builddir/${name}.eps
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
46 # And make the corresponding PDF for pdflatex.
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
47 epstopdf --outfile=$builddir/$name.pdf $builddir/${name}.eps
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
48
37
72b5d67756e1 Fix up troubles with \. echo -E disables expansion.
Jim Hague <jim.hague@laicatc.com>
parents: 34
diff changeset
49 echo -E "\begin{center}" >> $builddir/$output
72b5d67756e1 Fix up troubles with \. echo -E disables expansion.
Jim Hague <jim.hague@laicatc.com>
parents: 34
diff changeset
50 echo -E "\includegraphics[width=\textwidth]{$name}" >> $builddir/$output
72b5d67756e1 Fix up troubles with \. echo -E disables expansion.
Jim Hague <jim.hague@laicatc.com>
parents: 34
diff changeset
51 echo -E "\addcontentsline{toc}{subsection}{$title}" >> $builddir/$output
72b5d67756e1 Fix up troubles with \. echo -E disables expansion.
Jim Hague <jim.hague@laicatc.com>
parents: 34
diff changeset
52 echo -E "\end{center}" >> $builddir/$output
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
53 done
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
54
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
55 cat dottes.tex.footer >> $builddir/$output
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
56
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
57 cp $outputa4 $builddir
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
58
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
59 cd $builddir
34
80af9457d566 Remove use of abc pacakge and do the graphics outselves.
Jim Hague <jim.hague@acm.org>
parents: 32
diff changeset
60 pdflatex $output
80af9457d566 Remove use of abc pacakge and do the graphics outselves.
Jim Hague <jim.hague@acm.org>
parents: 32
diff changeset
61 pdflatex $output
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
62 pdflatex $outputa4
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
63
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
64 mv $outputpdf $dir/$1.pdf
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
65 mv $outputa4 $dir/${1}-booklet.pdf
21
b61b090cd4c7 Produce an A4 PDF document with the A5 pages in booklet form.
Jim Hague <jim.hague@acm.org>
parents: 16
diff changeset
66
b61b090cd4c7 Produce an A4 PDF document with the A5 pages in booklet form.
Jim Hague <jim.hague@acm.org>
parents: 16
diff changeset
67 cd $dir