Mercurial > dottes
view 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 |
line wrap: on
line source
#!/bin/bash # # Build the Booke. First assemble the book LaTeX, then build it # into a PDF. # if [ $# != 1 ]; then echo "Usage: makeBooke.sh <book dir name>" exit 1 fi dir=`pwd` booke=$dir/$1 builddir=$dir/build output=dottes.tex outputpdf=dottes.pdf outputa4=dottesona4.tex outputa4pdf=dottesona4.pdf mkdir -p $builddir cp buildno $builddir if [ -r $booke/subtitle.tex ]; then cp $booke/subtitle.tex $builddir else touch $builddir/subtitle.tex fi if [ -r $booke/intro.tex ]; then cp $booke/intro.tex $builddir else touch $builddir/intro.tex fi cp dottes.tex.header $builddir/$output # Now, for each tune, make the tune graphic and add it, inside a # centre section, so the document. Then add a TOC entry. find $booke -name "*.abc" | sort | while read filename do title=`grep "^T:" $filename | head -1 | sed -e "s/^T: *//"` name=`basename $filename .abc` abcm2ps -j0 +c -n -E -O $builddir/$name.eps $filename # Make $name.eps so we can build with LaTeX. mv $builddir/${name}001.eps $builddir/${name}.eps # And make the corresponding PDF for pdflatex. epstopdf --outfile=$builddir/$name.pdf $builddir/${name}.eps echo -E "\begin{center}" >> $builddir/$output echo -E "\includegraphics[width=\textwidth]{$name}" >> $builddir/$output echo -E "\addcontentsline{toc}{subsection}{$title}" >> $builddir/$output echo -E "\end{center}" >> $builddir/$output done cat dottes.tex.footer >> $builddir/$output cp $outputa4 $builddir cd $builddir pdflatex $output pdflatex $output pdflatex $outputa4 mv $outputpdf $dir/$1.pdf mv $outputa4 $dir/${1}-booklet.pdf cd $dir