view makeBooke.sh @ 13:232a778181e3

First go at LaTeX booklet.
author Jim Hague <jim.hague@laicatc.com>
date Mon, 27 Feb 2012 08:50:45 +0000
parents 215b3a1aa761
children 780f49972b68
line wrap: on
line source

#!/bin/sh
#
# 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

booke=$1
output=dottes.tex

cp dottes.tex.header $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 | sed -e "s/^T: *//"`
        name=`basename $filename .abc`
        echo "\\\\addcontentsline{toc}{subsection}{$title}" >> $output
        echo "\\\\begin{abc}[name=$name]" >> $output
        cat $filename >> $output
        echo "\\\\end{abc}" >> $output
    done

echo "\\\\end{document}" >> $output

#pdflatex -shell-escape $output
#pdflatex -shell-escape $output