view makeBooke.sh @ 37:72b5d67756e1

Fix up troubles with \. echo -E disables expansion.
author Jim Hague <jim.hague@laicatc.com>
date Sat, 03 Mar 2012 12:00:35 +0000
parents 80af9457d566
children 01c4d873153f
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: make.sh <book dir name>"
    exit 1
fi

dir=`pwd`

booke=$dir/$1
builddir=$dir/build
output=dottes.tex

mkdir -p $builddir

cp dottes.tex.header $builddir/$output

# Now, for each tune, add
#
# \addcontentsline{toc}{subsection}{<Tune title>}
# \begin{abc}[name=<filename>]
# ... ABC ...
# \end{abc}

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
        epstopdf --outfile=$builddir/$name.pdf $builddir/${name}001.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

cd $builddir
pdflatex $output
pdflatex $output

cd $dir
pdflatex dottesona4.tex