view makeBooke.sh @ 602:c95364aa550c

Put the title and subtitle on the section intro page. Contents, for some reason, can't be taken from file.
author Jim Hague <jim.hague@acm.org>
date Fri, 04 Nov 2016 00:48:23 +0000
parents 507d853433ef
children ef0d66742e01
line wrap: on
line source

#!/bin/bash
#
# Build the Booke. Move subfiles into place and build the Booke into a PDF.
#
# The Booke tune content and all EPS and PDF tune graphics must be
# present already. Run makeGraphics.sh first and then
# makeBookeTunePages.sh.
#

if [ $# != 2 ]; then
    echo "Usage: makeBooke.sh <book dir name> <A4|A5>"
    exit 1
fi

dir=`pwd`

booke=$dir/$1
papersize=$2
builddir=$dir/build
booketex=$dir/dottes.tex
bookepdf=$builddir/dottes.pdf

mkdir -p $builddir

cp dottes.tex $builddir
cp buildno.txt $builddir
cp buzzard.pdf $builddir
for item in title subtitle instrument
do
    rm -f $builddir/$item.txt $builddir/$1-$item.txt
    if [ -r $booke/$item.txt ]; then
        cp $booke/$item.txt $builddir/$item.txt
        cp $booke/$item.txt $builddir/$1-$item.txt
    else
        touch $builddir/$item.txt
        touch $builddir/$1-$item.txt
    fi
done
for item in intro
do
    rm -f $builddir/$1-$item.tex
    if [ -r $booke/$item.md ]; then
        pandoc --from=markdown --to=latex --output=$builddir/$1-$item.tex $booke/$item.md
    else
        touch $builddir/$1-$item.tex
    fi
done

sed -e "s/@SECTION@/$1/" dottes.tex.section-tunes > $builddir/tunes.tex
sed -e "s/@SECTION@/$1/" dottes.tex.section-firstlines > $builddir/firstlines.tex

for filename in $dir/*.${papersize}.tex
do
    name=`basename $filename .${papersize}.tex`
    cp $filename $builddir/$name.tex
done

cd $builddir

xelatex $booketex
xelatex $booketex
xelatex $booketex

mv $bookepdf $dir/$1-${papersize}.pdf

cd $dir