annotate makeBooke.sh @ 13:232a778181e3

First go at LaTeX booklet.
author Jim Hague <jim.hague@laicatc.com>
date Mon, 27 Feb 2012 08:50:45 +0000
parents 215b3a1aa761
children 780f49972b68
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
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
12 booke=$1
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
13 output=dottes.tex
0
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
14
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
15 cp dottes.tex.header $output
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
16
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
17 # Now, for each tune, add
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
18 #
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
19 # \addcontentsline{toc}{subsection}{<Tune title>}
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
20 # \begin{abc}[name=<filename>]
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
21 # ... ABC ...
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
22 # \end{abc}
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 find $booke -name "*.abc" | sort |
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
25 while read filename
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
26 do
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
27 title=`grep "^T:" $filename | sed -e "s/^T: *//"`
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
28 name=`basename $filename .abc`
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
29 echo "\\\\addcontentsline{toc}{subsection}{$title}" >> $output
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
30 echo "\\\\begin{abc}[name=$name]" >> $output
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
31 cat $filename >> $output
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
32 echo "\\\\end{abc}" >> $output
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
33 done
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
34
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
35 echo "\\\\end{document}" >> $output
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
36
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
37 #pdflatex -shell-escape $output
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
38 #pdflatex -shell-escape $output