Mercurial > dottes
comparison makeBooke.sh @ 38:01c4d873153f
Quick attempt to parameterise different book builds.
Move subtitle and intro text into book directory.
Do all building in build directory.
Name output by the book name.
author | Jim Hague <jim.hague@laicatc.com> |
---|---|
date | Sat, 03 Mar 2012 14:08:41 +0000 |
parents | 72b5d67756e1 |
children | 9681f6cd9c2b |
comparison
equal
deleted
inserted
replaced
37:72b5d67756e1 | 38:01c4d873153f |
---|---|
3 # Build the Booke. First assemble the book LaTeX, then build it | 3 # Build the Booke. First assemble the book LaTeX, then build it |
4 # into a PDF. | 4 # into a PDF. |
5 # | 5 # |
6 | 6 |
7 if [ $# != 1 ]; then | 7 if [ $# != 1 ]; then |
8 echo "Usage: make.sh <book dir name>" | 8 echo "Usage: makeBooke.sh <book dir name>" |
9 exit 1 | 9 exit 1 |
10 fi | 10 fi |
11 | 11 |
12 dir=`pwd` | 12 dir=`pwd` |
13 | 13 |
14 booke=$dir/$1 | 14 booke=$dir/$1 |
15 builddir=$dir/build | 15 builddir=$dir/build |
16 output=dottes.tex | 16 output=dottes.tex |
17 outputpdf=dottes.pdf | |
18 outputa4=dottesona4.tex | |
19 outputa4pdf=dottesona4.pdf | |
17 | 20 |
18 mkdir -p $builddir | 21 mkdir -p $builddir |
19 | 22 |
23 cp buildno $builddir | |
24 if [ -r $booke/subtitle.tex ]; then | |
25 cp $booke/subtitle.tex $builddir | |
26 else | |
27 touch $builddir/subtitle.tex | |
28 fi | |
29 if [ -r $booke/intro.tex ]; then | |
30 cp $booke/intro.tex $builddir | |
31 else | |
32 touch $builddir/intro.tex | |
33 fi | |
20 cp dottes.tex.header $builddir/$output | 34 cp dottes.tex.header $builddir/$output |
21 | 35 |
22 # Now, for each tune, add | 36 # Now, for each tune, make the tune graphic and add it, inside a |
23 # | 37 # centre section, so the document. Then add a TOC entry. |
24 # \addcontentsline{toc}{subsection}{<Tune title>} | |
25 # \begin{abc}[name=<filename>] | |
26 # ... ABC ... | |
27 # \end{abc} | |
28 | |
29 find $booke -name "*.abc" | sort | | 38 find $booke -name "*.abc" | sort | |
30 while read filename | 39 while read filename |
31 do | 40 do |
32 title=`grep "^T:" $filename | head -1 | sed -e "s/^T: *//"` | 41 title=`grep "^T:" $filename | head -1 | sed -e "s/^T: *//"` |
33 name=`basename $filename .abc` | 42 name=`basename $filename .abc` |
34 abcm2ps -j0 +c -n -E -O $builddir/$name.eps $filename | 43 abcm2ps -j0 +c -n -E -O $builddir/$name.eps $filename |
35 epstopdf --outfile=$builddir/$name.pdf $builddir/${name}001.eps | 44 # Make $name.eps so we can build with LaTeX. |
45 mv $builddir/${name}001.eps $builddir/${name}.eps | |
46 # And make the corresponding PDF for pdflatex. | |
47 epstopdf --outfile=$builddir/$name.pdf $builddir/${name}.eps | |
48 | |
36 echo -E "\begin{center}" >> $builddir/$output | 49 echo -E "\begin{center}" >> $builddir/$output |
37 echo -E "\includegraphics[width=\textwidth]{$name}" >> $builddir/$output | 50 echo -E "\includegraphics[width=\textwidth]{$name}" >> $builddir/$output |
38 echo -E "\addcontentsline{toc}{subsection}{$title}" >> $builddir/$output | 51 echo -E "\addcontentsline{toc}{subsection}{$title}" >> $builddir/$output |
39 echo -E "\end{center}" >> $builddir/$output | 52 echo -E "\end{center}" >> $builddir/$output |
40 done | 53 done |
41 | 54 |
42 cat dottes.tex.footer >> $builddir/$output | 55 cat dottes.tex.footer >> $builddir/$output |
43 | 56 |
57 cp $outputa4 $builddir | |
58 | |
44 cd $builddir | 59 cd $builddir |
45 pdflatex $output | 60 pdflatex $output |
46 pdflatex $output | 61 pdflatex $output |
62 pdflatex $outputa4 | |
63 | |
64 mv $outputpdf $dir/$1.pdf | |
65 mv $outputa4 $dir/${1}-booklet.pdf | |
47 | 66 |
48 cd $dir | 67 cd $dir |
49 pdflatex dottesona4.tex |