annotate makeBookeA5.sh @ 223:0ef955669a9a

Make transposed tunes use the original audio. The aim of MIDI and MP3 is to allow the user to hear what a tune sounds like. For transposed bookes, I think this should be reused from the main booke page, because hearing it at the transposed pitch isn't a major help. And in fact given the way cello transposition is done, the sound won't be transposed anyway. And Jane hasn't complained. This will speed up building the bookes by removing audio generation, the slowest process, from the transposed bookes.
author Jim Hague <jim.hague@acm.org>
date Fri, 22 Feb 2013 01:09:37 +0000
parents 6a0bdabfb255
children 1e4443d58177
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 #
42
0e7d2830cb8b Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents: 40
diff changeset
6 # All EPS and PDF tune graphics must be present already. Run
0e7d2830cb8b Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents: 40
diff changeset
7 # makeGraphics.sh to make these.
0e7d2830cb8b Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents: 40
diff changeset
8 #
0
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
9
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
10 if [ $# != 1 ]; then
181
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents: 122
diff changeset
11 echo "Usage: makeBookeA5.sh <book dir name>"
0
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
12 exit 1
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
13 fi
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
14
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
15 dir=`pwd`
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
17 booke=$dir/$1
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
18 builddir=$dir/build
42
0e7d2830cb8b Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents: 40
diff changeset
19 graphicsdir=$dir/graphics/$1
181
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents: 122
diff changeset
20 output=dottesA5.tex
119
15ce1ecb5ba3 Fix page size issue on xetex on Squeeze.
Jim Hague <jim.hague@acm.org>
parents: 118
diff changeset
21 outputxdv=${output/%.tex/.xdv}
15ce1ecb5ba3 Fix page size issue on xetex on Squeeze.
Jim Hague <jim.hague@acm.org>
parents: 118
diff changeset
22 outputpdf=${output/%.tex/.pdf}
181
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents: 122
diff changeset
23 outputa4=dottesA5onA4booklet.tex
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents: 122
diff changeset
24 outputa4pdf=dottesA5onA4booklet.pdf
0
215b3a1aa761 Beginnings.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
25
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
26 mkdir -p $builddir
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
27
40
93955def7313 Revise page footers, and add build number.
Jim Hague <jim.hague@laicatc.com>
parents: 39
diff changeset
28 cp buildno.txt $builddir
39
9681f6cd9c2b Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents: 38
diff changeset
29 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
30 cp $booke/subtitle.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/subtitle.txt
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
33 fi
39
9681f6cd9c2b Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents: 38
diff changeset
34 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
35 cp $booke/intro.txt $builddir
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
36 else
39
9681f6cd9c2b Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents: 38
diff changeset
37 touch $builddir/intro.txt
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
38 fi
181
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents: 122
diff changeset
39 cp dottes.tex.a5header $builddir/$output
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
40
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
41 # 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
42 # 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
43 find $booke -name "*.abc" | sort |
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
44 while read filename
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
45 do
122
295ba8275ab4 Make output larger where possible.
Jim Hague <jim.hague@laicatc.com>
parents: 120
diff changeset
46 title=`$dir/abcfield.py --field T --latex $filename`
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
47 name=`basename $filename .abc`
122
295ba8275ab4 Make output larger where possible.
Jim Hague <jim.hague@laicatc.com>
parents: 120
diff changeset
48 echo -E "\newpage" >> $builddir/$output
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
115
c4efe8b5eea1 Add internal hyperlinks to the book.
Jim Hague <jim.hague@acm.org>
parents: 110
diff changeset
50 echo -E "\phantomsection" >> $builddir/$output
116
19ba410d891f Ensure tune graphic is confined to a single page.
Jim Hague <jim.hague@acm.org>
parents: 115
diff changeset
51 echo -E "\hypertarget{$name}{\includegraphics[width=\textwidth,height=0.9\textheight,keepaspectratio]{$graphicsdir/$name}}" >> $builddir/$output
37
72b5d67756e1 Fix up troubles with \. echo -E disables expansion.
Jim Hague <jim.hague@laicatc.com>
parents: 34
diff changeset
52 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
53 echo -E "\end{center}" >> $builddir/$output
181
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents: 122
diff changeset
54 text=$booke/$name.tex
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents: 122
diff changeset
55 if [ -r $text ]; then
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents: 122
diff changeset
56 cat $text >> $builddir/$output
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents: 122
diff changeset
57 fi
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
58 done
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
59
50
e666306c5ab1 Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents: 42
diff changeset
60 cat dottes.tex.firstlines >> $builddir/$output
e666306c5ab1 Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents: 42
diff changeset
61
e666306c5ab1 Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents: 42
diff changeset
62 find $booke -name "*.abc" | sort |
e666306c5ab1 Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents: 42
diff changeset
63 while read filename
e666306c5ab1 Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents: 42
diff changeset
64 do
122
295ba8275ab4 Make output larger where possible.
Jim Hague <jim.hague@laicatc.com>
parents: 120
diff changeset
65 title=`$dir/abcfield.py --field T --latex $filename`
50
e666306c5ab1 Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents: 42
diff changeset
66 name=`basename $filename .abc`
115
c4efe8b5eea1 Add internal hyperlinks to the book.
Jim Hague <jim.hague@acm.org>
parents: 110
diff changeset
67 echo -E "\hyperlink{$name}{$title} & \raisebox{-.25\height}{\includegraphics[width=0.6\textwidth]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output
50
e666306c5ab1 Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents: 42
diff changeset
68 done
e666306c5ab1 Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents: 42
diff changeset
69
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
70 cat dottes.tex.footer >> $builddir/$output
13
232a778181e3 First go at LaTeX booklet.
Jim Hague <jim.hague@laicatc.com>
parents: 0
diff changeset
71
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
72 cp $outputa4 $builddir
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
73
16
780f49972b68 Update book making command.
Jim Hague <jim.hague@acm.org>
parents: 13
diff changeset
74 cd $builddir
119
15ce1ecb5ba3 Fix page size issue on xetex on Squeeze.
Jim Hague <jim.hague@acm.org>
parents: 118
diff changeset
75
15ce1ecb5ba3 Fix page size issue on xetex on Squeeze.
Jim Hague <jim.hague@acm.org>
parents: 118
diff changeset
76 # The version of xetex on Squeeze doesn't do pass the A5 landscape instruction
15ce1ecb5ba3 Fix page size issue on xetex on Squeeze.
Jim Hague <jim.hague@acm.org>
parents: 118
diff changeset
77 # down to the PDF generator. So split out and do manually.
120
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
78 #
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
79 # And, sigh, this fails on Sid. The first page comes out as A4 portrait.
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
80 # So try to work out which we are using and run the appropriate command.
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
81 ver=`xetex -version | head -n 1`
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
82 ver=${ver/*TeX Live /}
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
83 ver=${ver/\/*/}
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
84 if [ "$ver" == "2009" ]; then
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
85 xelatex -no-pdf $output
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
86 xelatex -no-pdf $output
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
87 xdvipdfmx -p a5 -l $outputxdv
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
88 else
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
89 xelatex $output
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
90 xelatex $output
4b0025be9d22 Try to cope with Squeeze and Sid xetex problems.
Jim Hague <jim.hague@acm.org>
parents: 119
diff changeset
91 fi
118
8f3b50ede59c Switch to XeTeX to render. Opens up random OpenType fonts and UTF-8.
Jim Hague <jim.hague@acm.org>
parents: 116
diff changeset
92 xelatex $outputa4
38
01c4d873153f Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents: 37
diff changeset
93
181
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents: 122
diff changeset
94 mv $outputpdf $dir/$1-A5.pdf
6a0bdabfb255 Add a A4 portrait book with multiple tunes per page.
Jim Hague <jim.hague@acm.org>
parents: 122
diff changeset
95 mv $outputa4pdf $dir/${1}-A5bookletA4.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
96
b61b090cd4c7 Produce an A4 PDF document with the A5 pages in booklet form.
Jim Hague <jim.hague@acm.org>
parents: 16
diff changeset
97 cd $dir