2012-03-03 12:00:35 +00:00
|
|
|
#!/bin/bash
|
2012-02-27 08:50:45 +00:00
|
|
|
#
|
|
|
|
# Build the Booke. First assemble the book LaTeX, then build it
|
|
|
|
# into a PDF.
|
|
|
|
#
|
2012-03-04 12:00:30 +00:00
|
|
|
# All EPS and PDF tune graphics must be present already. Run
|
|
|
|
# makeGraphics.sh to make these.
|
|
|
|
#
|
2012-02-25 14:32:23 +00:00
|
|
|
|
|
|
|
if [ $# != 1 ]; then
|
2012-03-03 14:08:41 +00:00
|
|
|
echo "Usage: makeBooke.sh <book dir name>"
|
2012-02-25 14:32:23 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2012-02-27 13:04:37 +00:00
|
|
|
dir=`pwd`
|
|
|
|
|
|
|
|
booke=$dir/$1
|
|
|
|
builddir=$dir/build
|
2012-03-04 12:00:30 +00:00
|
|
|
graphicsdir=$dir/graphics/$1
|
2012-02-27 08:50:45 +00:00
|
|
|
output=dottes.tex
|
2012-04-13 15:57:02 +01:00
|
|
|
outputxdv=${output/%.tex/.xdv}
|
|
|
|
outputpdf=${output/%.tex/.pdf}
|
2012-03-03 14:08:41 +00:00
|
|
|
outputa4=dottesona4.tex
|
|
|
|
outputa4pdf=dottesona4.pdf
|
2012-02-25 14:32:23 +00:00
|
|
|
|
2012-02-27 13:04:37 +00:00
|
|
|
mkdir -p $builddir
|
|
|
|
|
2012-03-03 16:06:23 +00:00
|
|
|
cp buildno.txt $builddir
|
2012-03-03 15:24:59 +00:00
|
|
|
if [ -r $booke/subtitle.txt ]; then
|
|
|
|
cp $booke/subtitle.txt $builddir
|
2012-03-03 14:08:41 +00:00
|
|
|
else
|
2012-03-03 15:24:59 +00:00
|
|
|
touch $builddir/subtitle.txt
|
2012-03-03 14:08:41 +00:00
|
|
|
fi
|
2012-03-03 15:24:59 +00:00
|
|
|
if [ -r $booke/intro.txt ]; then
|
|
|
|
cp $booke/intro.txt $builddir
|
2012-03-03 14:08:41 +00:00
|
|
|
else
|
2012-03-03 15:24:59 +00:00
|
|
|
touch $builddir/intro.txt
|
2012-03-03 14:08:41 +00:00
|
|
|
fi
|
2012-02-27 13:04:37 +00:00
|
|
|
cp dottes.tex.header $builddir/$output
|
2012-02-27 08:50:45 +00:00
|
|
|
|
2012-03-03 14:08:41 +00:00
|
|
|
# Now, for each tune, make the tune graphic and add it, inside a
|
|
|
|
# centre section, so the document. Then add a TOC entry.
|
2012-02-27 08:50:45 +00:00
|
|
|
find $booke -name "*.abc" | sort |
|
|
|
|
while read filename
|
|
|
|
do
|
2012-04-21 19:47:30 +01:00
|
|
|
title=`$dir/abcfield.py --field T --latex $filename`
|
2012-02-27 08:50:45 +00:00
|
|
|
name=`basename $filename .abc`
|
2012-04-21 19:47:30 +01:00
|
|
|
echo -E "\newpage" >> $builddir/$output
|
2012-03-03 12:00:35 +00:00
|
|
|
echo -E "\begin{center}" >> $builddir/$output
|
2012-03-16 10:37:48 +00:00
|
|
|
echo -E "\phantomsection" >> $builddir/$output
|
2012-03-16 10:40:09 +00:00
|
|
|
echo -E "\hypertarget{$name}{\includegraphics[width=\textwidth,height=0.9\textheight,keepaspectratio]{$graphicsdir/$name}}" >> $builddir/$output
|
2012-03-03 12:00:35 +00:00
|
|
|
echo -E "\addcontentsline{toc}{subsection}{$title}" >> $builddir/$output
|
|
|
|
echo -E "\end{center}" >> $builddir/$output
|
2012-02-27 08:50:45 +00:00
|
|
|
done
|
|
|
|
|
2012-03-04 20:16:48 +00:00
|
|
|
cat dottes.tex.firstlines >> $builddir/$output
|
|
|
|
|
|
|
|
find $booke -name "*.abc" | sort |
|
|
|
|
while read filename
|
|
|
|
do
|
2012-04-21 19:47:30 +01:00
|
|
|
title=`$dir/abcfield.py --field T --latex $filename`
|
2012-03-04 20:16:48 +00:00
|
|
|
name=`basename $filename .abc`
|
2012-03-16 10:37:48 +00:00
|
|
|
echo -E "\hyperlink{$name}{$title} & \raisebox{-.25\height}{\includegraphics[width=0.6\textwidth]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output
|
2012-03-04 20:16:48 +00:00
|
|
|
done
|
|
|
|
|
2012-02-27 13:04:37 +00:00
|
|
|
cat dottes.tex.footer >> $builddir/$output
|
2012-02-27 08:50:45 +00:00
|
|
|
|
2012-03-03 14:08:41 +00:00
|
|
|
cp $outputa4 $builddir
|
|
|
|
|
2012-02-27 13:04:37 +00:00
|
|
|
cd $builddir
|
2012-04-13 15:57:02 +01:00
|
|
|
|
|
|
|
# The version of xetex on Squeeze doesn't do pass the A5 landscape instruction
|
|
|
|
# down to the PDF generator. So split out and do manually.
|
2012-04-13 16:20:43 +01:00
|
|
|
#
|
|
|
|
# And, sigh, this fails on Sid. The first page comes out as A4 portrait.
|
|
|
|
# So try to work out which we are using and run the appropriate command.
|
|
|
|
ver=`xetex -version | head -n 1`
|
|
|
|
ver=${ver/*TeX Live /}
|
|
|
|
ver=${ver/\/*/}
|
|
|
|
if [ "$ver" == "2009" ]; then
|
|
|
|
xelatex -no-pdf $output
|
|
|
|
xelatex -no-pdf $output
|
|
|
|
xdvipdfmx -p a5 -l $outputxdv
|
|
|
|
else
|
|
|
|
xelatex $output
|
|
|
|
xelatex $output
|
|
|
|
fi
|
2012-04-04 11:52:29 +01:00
|
|
|
xelatex $outputa4
|
2012-03-03 14:08:41 +00:00
|
|
|
|
|
|
|
mv $outputpdf $dir/$1.pdf
|
2012-03-05 14:49:17 +00:00
|
|
|
mv $outputa4pdf $dir/${1}-booklet.pdf
|
2012-02-29 14:05:18 +00:00
|
|
|
|
|
|
|
cd $dir
|