annotate makeBooke.sh @ 21:b61b090cd4c7

Produce an A4 PDF document with the A5 pages in booklet form. Print the A4 with long edge duplex to get a ready booklet.
author Jim Hague <jim.hague@acm.org>
date Wed, 29 Feb 2012 14:05:18 +0000
parents 780f49972b68
children b05fca550d33
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
1 #!/bin/sh
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
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
8 echo "Usage: make.sh <book dir name>"
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
0
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
17
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
18 mkdir -p $builddir
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
19
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
20 cp dottes.tex.header $builddir/$output
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
21
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
22 # Now, for each tune, add
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
23 #
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
24 # \addcontentsline{toc}{subsection}{<Tune title>}
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
25 # \begin{abc}[name=<filename>]
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
26 # ... ABC ...
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
27 # \end{abc}
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
28
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
29 find $booke -name "*.abc" | sort |
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
30 while read filename
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
31 do
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
32 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
33 name=`basename $filename .abc`
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
34 echo "\\\\addcontentsline{toc}{subsection}{$title}" >> $builddir/$output
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
35 echo "\\\\begin{abc}[options=-j0 +c,name=$name]" >> $builddir/$output
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
36 cat $filename >> $builddir/$output
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
37 echo "\\\\end{abc}" >> $builddir/$output
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
38 done
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
39
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
40 cat dottes.tex.footer >> $builddir/$output
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
41
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
42 cd $builddir
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
43 pdflatex -shell-escape $output
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
44 pdflatex -shell-escape $output
21
b61b090cd4c7 Produce an A4 PDF document with the A5 pages in booklet form.
Jim Hague <jim.hague@acm.org>
parents: 16
diff changeset
45
b61b090cd4c7 Produce an A4 PDF document with the A5 pages in booklet form.
Jim Hague <jim.hague@acm.org>
parents: 16
diff changeset
46 cd $dir
b61b090cd4c7 Produce an A4 PDF document with the A5 pages in booklet form.
Jim Hague <jim.hague@acm.org>
parents: 16
diff changeset
47 pdflatex dottesona4.tex