annotate makeBookeA4.sh @ 218:1a9d937b7765

Force Horn in F output to be in treble clef. Some lower tunes with the odd high note ended up in bass clef. This crap horn player doesn't do bass clef.
author Jim Hague <jim.hague@laicatc.com>
date Thu, 21 Feb 2013 07:23:49 +0000
parents 9dd24e61d6dd
children 1e4443d58177
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
181
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
1 #!/bin/bash
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
2 #
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
3 # Build the Booke. First assemble the book LaTeX, then build it
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
4 # into a PDF.
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
5 #
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
6 # All EPS and PDF tune graphics must be present already. Run
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
7 # makeGraphics.sh to make these.
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
8 #
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
9
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
10 if [ $# != 1 ]; then
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
11 echo "Usage: makeBookeA4.sh <book dir name>"
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
12 exit 1
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
13 fi
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
14
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
15 dir=`pwd`
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
16
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
17 booke=$dir/$1
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
18 builddir=$dir/build
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
19 graphicsdir=$dir/graphics/$1
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
20 output=dottesA4.tex
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
21 outputxdv=${output/%.tex/.xdv}
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
22 outputpdf=${output/%.tex/.pdf}
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
23
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
24 mkdir -p $builddir
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
25
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
26 cp buildno.txt $builddir
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
27 if [ -r $booke/subtitle.txt ]; then
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
28 cp $booke/subtitle.txt $builddir
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
29 else
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
30 touch $builddir/subtitle.txt
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
31 fi
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
32 if [ -r $booke/intro.txt ]; then
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
33 cp $booke/intro.txt $builddir
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
34 else
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
35 touch $builddir/intro.txt
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
36 fi
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
37 cp dottes.tex.a4header $builddir/$output
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
38
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
39 # Now, for each tune, make the tune graphic and add it, inside a
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
40 # centre section, so the document. Then add a TOC entry.
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
41 find $booke -name "*.abc" | sort |
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
42 while read filename
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
43 do
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
44 title=`$dir/abcfield.py --field T --latex $filename`
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
45 name=`basename $filename .abc`
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
46 echo -E "\begin{center}" >> $builddir/$output
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
47 echo -E "\phantomsection" >> $builddir/$output
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
48 echo -E "\hypertarget{$name}{\includegraphics[width=\textwidth,keepaspectratio]{$graphicsdir/$name}}" >> $builddir/$output
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
49 echo -E "\addcontentsline{toc}{subsection}{$title}" >> $builddir/$output
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
50 echo -E "\end{center}" >> $builddir/$output
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
51 text=$booke/$name.tex
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
52 if [ -r $text ]; then
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
53 cat $text >> $builddir/$output
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
54 fi
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
55 done
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
56
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
57 cat dottes.tex.firstlines >> $builddir/$output
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
58
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
59 find $booke -name "*.abc" | sort |
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
60 while read filename
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
61 do
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
62 title=`$dir/abcfield.py --field T --latex $filename`
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
63 name=`basename $filename .abc`
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
64 echo -E "\hyperlink{$name}{$title} & \raisebox{-.25\height}{\includegraphics[width=0.6\textwidth]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
65 done
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
66
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
67 cat dottes.tex.footer >> $builddir/$output
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
68
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
69 cd $builddir
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
70
185
9dd24e61d6dd When making A4 book, we don't need to do special A5 handling on Squeeze.
Jim Hague <jim.hague@acm.org>
parents: 181
diff changeset
71 xelatex $output
9dd24e61d6dd When making A4 book, we don't need to do special A5 handling on Squeeze.
Jim Hague <jim.hague@acm.org>
parents: 181
diff changeset
72 xelatex $output
181
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
73
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
74 mv $outputpdf $dir/$1-A4.pdf
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
75
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
76 cd $dir