Mercurial > dottes
annotate makeBooke.sh @ 107:b3fa49555481
Increase width of first music line to just under text width.
author | Jim Hague <jim.hague@laicatc.com> |
---|---|
date | Wed, 14 Mar 2012 15:46:28 +0000 |
parents | 6ced110a62aa |
children | 6ac6c797586d |
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 | 2 # |
3 # Build the Booke. First assemble the book LaTeX, then build it | |
4 # into a PDF. | |
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 | 9 |
10 if [ $# != 1 ]; then | |
38
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
11 echo "Usage: makeBooke.sh <book dir name>" |
0 | 12 exit 1 |
13 fi | |
14 | |
16 | 15 dir=`pwd` |
16 | |
17 booke=$dir/$1 | |
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 |
13 | 20 output=dottes.tex |
38
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
21 outputpdf=dottes.pdf |
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
22 outputa4=dottesona4.tex |
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
23 outputa4pdf=dottesona4.pdf |
0 | 24 |
16 | 25 mkdir -p $builddir |
26 | |
40
93955def7313
Revise page footers, and add build number.
Jim Hague <jim.hague@laicatc.com>
parents:
39
diff
changeset
|
27 cp buildno.txt $builddir |
39
9681f6cd9c2b
Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents:
38
diff
changeset
|
28 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
|
29 cp $booke/subtitle.txt $builddir |
38
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
30 else |
39
9681f6cd9c2b
Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents:
38
diff
changeset
|
31 touch $builddir/subtitle.txt |
38
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
32 fi |
39
9681f6cd9c2b
Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents:
38
diff
changeset
|
33 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
|
34 cp $booke/intro.txt $builddir |
38
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
35 else |
39
9681f6cd9c2b
Change subtitle and intro files to .txt extension.
Jim Hague <jim.hague@laicatc.com>
parents:
38
diff
changeset
|
36 touch $builddir/intro.txt |
38
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
37 fi |
16 | 38 cp dottes.tex.header $builddir/$output |
13 | 39 |
38
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
40 # 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
|
41 # centre section, so the document. Then add a TOC entry. |
13 | 42 find $booke -name "*.abc" | sort | |
43 while read filename | |
44 do | |
16 | 45 title=`grep "^T:" $filename | head -1 | sed -e "s/^T: *//"` |
13 | 46 name=`basename $filename .abc` |
37
72b5d67756e1
Fix up troubles with \. echo -E disables expansion.
Jim Hague <jim.hague@laicatc.com>
parents:
34
diff
changeset
|
47 echo -E "\begin{center}" >> $builddir/$output |
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
|
48 echo -E "\includegraphics[width=\textwidth]{$graphicsdir/$name}" >> $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 "\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
|
50 echo -E "\end{center}" >> $builddir/$output |
13 | 51 done |
52 | |
50
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
53 cat dottes.tex.firstlines >> $builddir/$output |
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
54 |
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
55 find $booke -name "*.abc" | sort | |
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
56 while read filename |
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
57 do |
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
58 title=`grep "^T:" $filename | head -1 | sed -e "s/^T: *//"` |
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
59 name=`basename $filename .abc` |
107
b3fa49555481
Increase width of first music line to just under text width.
Jim Hague <jim.hague@laicatc.com>
parents:
65
diff
changeset
|
60 echo -E "$title & \raisebox{-.25\height}{\includegraphics[width=9cm]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output |
50
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
61 done |
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
62 |
16 | 63 cat dottes.tex.footer >> $builddir/$output |
13 | 64 |
38
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
65 cp $outputa4 $builddir |
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
66 |
16 | 67 cd $builddir |
34
80af9457d566
Remove use of abc pacakge and do the graphics outselves.
Jim Hague <jim.hague@acm.org>
parents:
32
diff
changeset
|
68 pdflatex $output |
80af9457d566
Remove use of abc pacakge and do the graphics outselves.
Jim Hague <jim.hague@acm.org>
parents:
32
diff
changeset
|
69 pdflatex $output |
38
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
70 pdflatex $outputa4 |
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
71 |
01c4d873153f
Quick attempt to parameterise different book builds.
Jim Hague <jim.hague@laicatc.com>
parents:
37
diff
changeset
|
72 mv $outputpdf $dir/$1.pdf |
65
6ced110a62aa
Fix renaming of the A4 booklet.
Jim Hague <jim.hague@acm.org>
parents:
50
diff
changeset
|
73 mv $outputa4pdf $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
|
74 |
b61b090cd4c7
Produce an A4 PDF document with the A5 pages in booklet form.
Jim Hague <jim.hague@acm.org>
parents:
16
diff
changeset
|
75 cd $dir |