From ade33377043307b7783d7842338922155f7097f2 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Wed, 26 Jun 2013 23:37:45 +0100 Subject: [PATCH] Revise scripts for building printed Bookes. A lot of stuff was being duplicated between different page size. Consolidate where possible, and in particular put as much into a single source file (dottes.tex) as possible. Making a single Booke is now potentially quicker, as the tune pages don't necessarily have to be regenerate every time. --- docclass.A4.tex | 1 + docclass.A5.tex | 1 + docsetup.A4.tex | 32 +++++++++++ docsetup.A5.tex | 32 +++++++++++ dottes.tex | 104 ++++++++++++++++++++++++++++++++++ dottes.tex.a4header | 86 ---------------------------- dottes.tex.a5header | 89 ----------------------------- dottes.tex.firstlines | 12 ---- dottes.tex.footer | 5 -- dottes.tex.intro | 27 --------- makeAll.sh | 12 ++-- makeBooke.sh | 53 +++++++++++++++++ makeBookeA4.sh | 108 ----------------------------------- makeBookeA5.sh | 129 ------------------------------------------ makeBookeTunePages.sh | 62 ++++++++++++++++++++ makeBooklet.sh | 27 +++++++++ 16 files changed, 320 insertions(+), 460 deletions(-) create mode 100644 docclass.A4.tex create mode 100644 docclass.A5.tex create mode 100644 docsetup.A4.tex create mode 100644 docsetup.A5.tex create mode 100644 dottes.tex delete mode 100644 dottes.tex.a4header delete mode 100644 dottes.tex.a5header delete mode 100644 dottes.tex.firstlines delete mode 100644 dottes.tex.footer delete mode 100644 dottes.tex.intro create mode 100755 makeBooke.sh delete mode 100755 makeBookeA4.sh delete mode 100755 makeBookeA5.sh create mode 100755 makeBookeTunePages.sh create mode 100755 makeBooklet.sh diff --git a/docclass.A4.tex b/docclass.A4.tex new file mode 100644 index 0000000..31b6f0e --- /dev/null +++ b/docclass.A4.tex @@ -0,0 +1 @@ +\documentclass[a4paper,11pt]{article} diff --git a/docclass.A5.tex b/docclass.A5.tex new file mode 100644 index 0000000..94fc694 --- /dev/null +++ b/docclass.A5.tex @@ -0,0 +1 @@ +\documentclass[a5paper,landscape,11pt]{article} diff --git a/docsetup.A4.tex b/docsetup.A4.tex new file mode 100644 index 0000000..fb0a964 --- /dev/null +++ b/docsetup.A4.tex @@ -0,0 +1,32 @@ +% ----- Page setup + +% Adjust margins for A4 portrait. Increase width by 4cm and height by 4cm. +\addtolength{\textwidth}{4cm} +\addtolength{\hoffset}{-2cm} + +\addtolength{\textheight}{4cm} +\addtolength{\voffset}{-2cm} + +% Move the top margin up a further cm. +\addtolength{\textheight}{1cm} +\addtolength{\voffset}{-1cm} + +% ----- + +% Title page +\newfontfamily\havocfont[Scale=3.5]{English Towne} + +\newcommand*{\titleBoD}{\begingroup +\centering +{\Large \havocfont{Ye}}\\[\baselineskip] +{\Huge \havocfont{Crie Havock}}\\[\baselineskip] +{\Large \havocfont{Booke of}}\\[\baselineskip] +{\Huge \havocfont{\instrument Dottes}}\\[\baselineskip] +\vfill +{\Huge \input{title.txt}}\\[\baselineskip] +{\Large \input{subtitle.txt}}\\[\baselineskip] +\vfill +\includegraphics[width=0.5\textwidth,keepaspectratio]{buzzard} +\vfill +{Compiled by Jim Hague}\\ +\endgroup} diff --git a/docsetup.A5.tex b/docsetup.A5.tex new file mode 100644 index 0000000..7d75d45 --- /dev/null +++ b/docsetup.A5.tex @@ -0,0 +1,32 @@ +% ----- Page setup + +% Adjust margins for A5 landscape. Increase width by 4cm and height by 4cm. +\addtolength{\textwidth}{4cm} +\addtolength{\hoffset}{-2cm} + +\addtolength{\textheight}{4cm} +\addtolength{\voffset}{-2cm} + +% Move the top margin up a further cm. +\addtolength{\textheight}{1cm} +\addtolength{\voffset}{-1cm} + +% ----- + +% Title page +\newfontfamily\havocfont[Scale=2.1]{English Towne} + +\newcommand*{\titleBoD}{\begingroup +\centering +{\Large \havocfont{Ye}}\\[\baselineskip] +{\Huge \havocfont{Crie Havock}}\\[\baselineskip] +{\Large \havocfont{Booke of}}\\[\baselineskip] +{\Huge \havocfont{\instrument Dottes}}\\[\baselineskip] +\vfill +{\huge \input{title.txt}}\\%[\baselineskip] +{\large \input{subtitle.txt}}\\[\baselineskip] +\vfill +\includegraphics[width=0.12\textwidth,keepaspectratio]{buzzard} +\vfill +{Compiled by Jim Hague}\\ +\endgroup} diff --git a/dottes.tex b/dottes.tex new file mode 100644 index 0000000..3dfc13a --- /dev/null +++ b/dottes.tex @@ -0,0 +1,104 @@ +\input{docclass.tex} + +\usepackage{fontspec} +\usepackage{graphicx} +\usepackage{fancyhdr} +\usepackage{longtable} +\usepackage[toc]{multitoc} + +\usepackage{hyperref} +\hypersetup{ + bookmarks=true,% + colorlinks=true,% + citecolor=black,% + filecolor=black,% + linkcolor=black,% + urlcolor=black +} + +% ----- Common variables + +\def \build {\input{buildno.txt}} +\def \instrument {\input{instrument.txt}} + +% ----- Paper size document setup + +\input{docsetup.tex} + +% ----- Appearance + +\setmainfont{Times New Roman} + +% Don't show section numbers. +\setcounter{secnumdepth}{-1} + +% ----- + +\begin{document} + +% ----- Title page + +\begin{titlepage} +\titleBoD +\end{titlepage} + +% ----- Headers and footers + +\pagestyle{fancyplain} +\fancyhf{} +\lfoot{Issue \build} +\rfoot{\thepage} +\renewcommand{\headrulewidth}{0pt} + +% ----- Contents + +\tableofcontents + +% ----- + +\section{Introduction} + +\input{intro.txt} + +All tunes in this book are believed to be in the public domain, or at the +very least enjoy widespread currency on the folk music scene. If I have +inadvertantly transgressed on anyone's copyright, please contact me at +\href{mailto:dottes@cryhavoc.org.uk}{\texttt{dottes@cryhavoc.org.uk}} and I will +remove the offending tune. + +Being folk tunes, many of the tunes herein have many variations. +The music presented here is my attempt at reflecting what the musicians +of Cry Havoc play. I'm in no way suggesting that they are +in any way \emph{correct}. This is just how we go about them. + +The Booke of Dottes is a constant work in progress. You can download the latest +version from \url{http://dottes.cryhavoc.org.uk/}. + +% ----- + +\section{Tunes} + +Tunes are arranged in alphabetical order of tune title. + +\newpage + +\input{tunes.tex} + +% ----- + +\newpage +\section{List of tune first lines} + +You know the feeling. Everyone has just launched into a well-loved tune. +You've heard it before, but don't remember the name. So here's a list of +tune first lines to help you figure out what it is in time to join in. + +\setlength\LTleft{0pt} +\setlength\LTright{0pt} +\begin{longtable}{lr} +\input{firstlines.tex} +\end{longtable} + +% ----- + +\end{document} diff --git a/dottes.tex.a4header b/dottes.tex.a4header deleted file mode 100644 index 851b361..0000000 --- a/dottes.tex.a4header +++ /dev/null @@ -1,86 +0,0 @@ -\documentclass[a4paper,11pt]{article} -\usepackage{fontspec} -\usepackage{graphicx} -\usepackage{fancyhdr} -\usepackage{longtable} -\usepackage[toc]{multitoc} - -\usepackage{hyperref} -\hypersetup{ - bookmarks=true,% - colorlinks=true,% - citecolor=black,% - filecolor=black,% - linkcolor=black,% - urlcolor=black -} - -% ----- Common variables - -\def \build {\input{buildno.txt}} -\def \instrument {\input{instrument.txt}} - -% ----- Appearance - -%\setmainfont{Century Schoolbook L} -\setmainfont{Times New Roman} - -% ----- Page setup - -% Adjust margins for A4 portrait. Increase width by 4cm and height by 4cm. -\addtolength{\textwidth}{4cm} -\addtolength{\hoffset}{-2cm} - -\addtolength{\textheight}{4cm} -\addtolength{\voffset}{-2cm} - -% Move the top margin up a further cm. -\addtolength{\textheight}{1cm} -\addtolength{\voffset}{-1cm} - -% ----- - -% Don't show section numbers. -\setcounter{secnumdepth}{-1} - -% ----- - -% Title page -\newfontfamily\havocfont[Scale=3.5]{English Towne} - -\newcommand*{\titleDB}{\begingroup -\centering -{\Large \havocfont{Ye}}\\[\baselineskip] -{\Huge \havocfont{Crie Havock}}\\[\baselineskip] -{\Large \havocfont{Booke of}}\\[\baselineskip] -{\Huge \havocfont{\instrument Dottes}}\\[\baselineskip] -\vfill -{\Huge \input{title.txt}}\\[\baselineskip] -{\Large \input{subtitle.txt}}\\[\baselineskip] -\vfill -\includegraphics[width=0.5\textwidth,keepaspectratio]{buzzard} -\vfill -{Compiled by Jim Hague}\\ -\endgroup} - -% ----- - -\begin{document} - -% ----- Title page - -\begin{titlepage} -\titleDB -\end{titlepage} - -% ----- Headers and footers - -\pagestyle{fancyplain} -\fancyhf{} -\lfoot{Issue \build} -\rfoot{\thepage} -\renewcommand{\headrulewidth}{0pt} - -% ----- Contents - -\tableofcontents diff --git a/dottes.tex.a5header b/dottes.tex.a5header deleted file mode 100644 index 7e7a47e..0000000 --- a/dottes.tex.a5header +++ /dev/null @@ -1,89 +0,0 @@ -\documentclass[a5paper,landscape,11pt]{article} -\usepackage{fontspec} -\usepackage{graphicx} -\usepackage{fancyhdr} -\usepackage{longtable} -\usepackage[toc]{multitoc} - -\usepackage{hyperref} -\hypersetup{ - bookmarks=true,% - colorlinks=true,% - citecolor=black,% - filecolor=black,% - linkcolor=black,% - urlcolor=black -} - -% ----- Common variables - -\def \build {\input{buildno.txt}} -\def \instrument {\input{instrument.txt}} - -% ----- Appearance - -%\setmainfont{Century Schoolbook L} -\setmainfont{Times New Roman} - -% ----- Page setup - -% Adjust margins for A5 landscape. Increase width by 4cm and height by 4cm. -\addtolength{\textwidth}{4cm} -\addtolength{\hoffset}{-2cm} - -\addtolength{\textheight}{4cm} -\addtolength{\voffset}{-2cm} - -% Move the top margin up a further cm. -\addtolength{\textheight}{1cm} -\addtolength{\voffset}{-1cm} - -% ----- - -% Don't show section numbers. -\setcounter{secnumdepth}{-1} - -% ----- - -% Title page -\newfontfamily\havocfont[Scale=2.1]{English Towne} - -\newcommand*{\titleDB}{\begingroup -\centering -{\Large \havocfont{Ye}}\\[\baselineskip] -{\Huge \havocfont{Crie Havock}}\\[\baselineskip] -{\Large \havocfont{Booke of}}\\[\baselineskip] -{\Huge \havocfont{\instrument Dottes}}\\[\baselineskip] -\vfill -{\huge \input{title.txt}}\\%[\baselineskip] -{\large \input{subtitle.txt}}\\[\baselineskip] -\vfill -\includegraphics[width=0.12\textwidth,keepaspectratio]{buzzard} -\vfill -{Compiled by Jim Hague}\\ -\endgroup} - -% ----- - -\begin{document} - -% ----- Title page - -\begin{titlepage} -\pagestyle{empty} -\titleDB -\end{titlepage} - -% ----- Headers and footers - -\pagestyle{fancyplain} -\fancyhf{} -\lfoot{Issue \build} -\rfoot{\thepage} -\renewcommand{\headrulewidth}{0pt} - -% ----- Contents - -\tableofcontents - -\newpage diff --git a/dottes.tex.firstlines b/dottes.tex.firstlines deleted file mode 100644 index a716705..0000000 --- a/dottes.tex.firstlines +++ /dev/null @@ -1,12 +0,0 @@ -% ----- - -\newpage -\section{List of tune first lines} - -You know the feeling. Everyone has just launched into a well-loved tune. -You've heard it before, but don't remember the name. So here's a list of -tune first lines to help you figure out what it is in time to join in. - -\setlength\LTleft{0pt} -\setlength\LTright{0pt} -\begin{longtable}{lr} diff --git a/dottes.tex.footer b/dottes.tex.footer deleted file mode 100644 index 6e7b565..0000000 --- a/dottes.tex.footer +++ /dev/null @@ -1,5 +0,0 @@ -\end{longtable} - -% ----- - -\end{document} diff --git a/dottes.tex.intro b/dottes.tex.intro deleted file mode 100644 index ab007fc..0000000 --- a/dottes.tex.intro +++ /dev/null @@ -1,27 +0,0 @@ -% ----- - -\section{Introduction} - -\input{intro.txt} - -All tunes in this book are believed to be in the public domain, or at the -very least enjoy widespread currency on the folk music scene. If I have -inadvertantly transgressed on anyone's copyright, please contact me at -\href{mailto:dottes@cryhavoc.org.uk}{\texttt{dottes@cryhavoc.org.uk}} and I will -remove the offending tune. - -Being folk tunes, many of the tunes herein have many variations. -The music presented here is my attempt at reflecting what the musicians -of Cry Havoc play. I'm in no way suggesting that they are -in any way \emph{correct}. This is just how we go about them. - -The Booke of Dottes is a constant work in progress. You can download the latest -version from \url{http://dottes.cryhavoc.org.uk/}. - -% ----- - -\section{Tunes} - -Tunes are arranged in alphabetical order of tune title. - -\newpage diff --git a/makeAll.sh b/makeAll.sh index a6e99ed..021809a 100755 --- a/makeAll.sh +++ b/makeAll.sh @@ -10,8 +10,10 @@ fi makeABooke() { ./makeGraphics.sh "$1" - ./makeBookeA5.sh "$1" - ./makeBookeA4.sh "$1" + ./makeBookeTunePages.sh "$1" + ./makeBooke.sh "$1" A4 + ./makeBooke.sh "$1" A5 + ./makeBooklet.sh "$1" ./makeWebGraphics.sh "$1" ./makeWebAudio.sh "$1" ./makeWeb.sh "$1" "$1" "$2" @@ -20,8 +22,10 @@ makeABooke() makeATransposedBooke() { ./makeGraphics.sh "$1" - ./makeBookeA5.sh "$1" - ./makeBookeA4.sh "$1" + ./makeBookeTunePages.sh "$1" + ./makeBooke.sh "$1" A4 + ./makeBooke.sh "$1" A5 + ./makeBooklet.sh "$1" ./makeWebGraphics.sh "$1" ./makeWeb.sh "$1" "$2" "$3" } diff --git a/makeBooke.sh b/makeBooke.sh new file mode 100755 index 0000000..a8cbd0a --- /dev/null +++ b/makeBooke.sh @@ -0,0 +1,53 @@ +#!/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 " + exit 1 +fi + +dir=`pwd` + +booke=$dir/$1 +papersize=$2 +builddir=$dir/build +graphicsdir=$dir/graphics/$1 +booketex=$dir/dottes.tex +bookepdf=$builddir/dottes.pdf + +mkdir -p $builddir + +cp dottes.tex $builddir +cp buildno.txt $builddir +cp buzzard.eps $builddir +for item in title subtitle intro instrument +do + rm -f $builddir/$item.txt + if [ -r $booke/$item.txt ]; then + cp $booke/$item.txt $builddir + else + touch $builddir/$item.txt + fi +done + +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 diff --git a/makeBookeA4.sh b/makeBookeA4.sh deleted file mode 100755 index 4f656a1..0000000 --- a/makeBookeA4.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash -# -# Build the Booke. First assemble the book LaTeX, then build it -# into a PDF. -# -# All EPS and PDF tune graphics must be present already. Run -# makeGraphics.sh to make these. -# - -# Restore titles like 'Exploding Potato, The' to the -# expected 'The Exploding Potato'. -fixtitle() -{ - retval=`echo "$1" | sed -e "s/\(.*\), *\(.*\)/\2 \1/"` -} - -if [ $# != 1 ]; then - echo "Usage: makeBookeA4.sh " - exit 1 -fi - -dir=`pwd` - -booke=$dir/$1 -builddir=$dir/build -graphicsdir=$dir/graphics/$1 -output=dottesA4.tex -outputxdv=${output/%.tex/.xdv} -outputpdf=${output/%.tex/.pdf} - -mkdir -p $builddir - -cp buildno.txt $builddir -cp buzzard.eps $builddir -if [ -r $booke/title.txt ]; then - cp $booke/title.txt $builddir -else - touch $builddir/title.txt -fi -if [ -r $booke/subtitle.txt ]; then - cp $booke/subtitle.txt $builddir -else - touch $builddir/subtitle.txt -fi -if [ -r $booke/intro.txt ]; then - cp $booke/intro.txt $builddir -else - touch $builddir/intro.txt -fi -rm $builddir/instrument.txt -if [ -r $booke/instrument.txt ]; then - cp $booke/instrument.txt $builddir -else - touch $builddir/instrument.txt -fi -cp dottes.tex.a4header $builddir/$output -cat dottes.tex.intro >> $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 - name=`basename $filename .abc` - title=`$dir/abcfield.py --field T --latex $filename` - fixtitle "$title" - title=$retval - - echo -E "\vfill \begin{center}" >> $builddir/$output - echo -E "\phantomsection" >> $builddir/$output - echo -E "\hypertarget{$name}{\includegraphics[width=\textwidth,keepaspectratio]{$graphicsdir/$name}}" >> $builddir/$output - echo -E "\addcontentsline{toc}{subsection}{$title}" >> $builddir/$output - echo -E "\end{center}" >> $builddir/$output - - changefile=`$dir/abcfield.py --field N $filename | grep "Change:" | sed -e "s/Change: *//"` - changetitle="" - if [ -n "$changefile" ]; then - changetitle=`$dir/abcfield.py --field T --latex $booke/$changefile` - fixtitle "$changetitle" - changetitle=$retval - changename=`basename $changefile .abc` - echo -E "Change: \hyperlink{$changename}{$changetitle}" >> $builddir/$output - fi - done - -cat dottes.tex.firstlines >> $builddir/$output - -find $booke -name "*.abc" | sort | - while read filename - do - name=`basename $filename .abc` - title=`$dir/abcfield.py --field T --latex $filename` - fixtitle "$title" - title=$retval - echo -E "\hyperlink{$name}{$title} & \raisebox{-.25\height}{\includegraphics[width=0.6\textwidth]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output - done - -cat dottes.tex.footer >> $builddir/$output - -cd $builddir - -xelatex $output -xelatex $output -xelatex $output - -mv $outputpdf $dir/$1-A4.pdf - -cd $dir diff --git a/makeBookeA5.sh b/makeBookeA5.sh deleted file mode 100755 index c0777a7..0000000 --- a/makeBookeA5.sh +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/bash -# -# Build the Booke. First assemble the book LaTeX, then build it -# into a PDF. -# -# All EPS and PDF tune graphics must be present already. Run -# makeGraphics.sh to make these. -# - -# Restore titles like 'Exploding Potato, The' to the -# expected 'The Exploding Potato'. -fixtitle() -{ - retval=`echo "$1" | sed -e "s/\(.*\), *\(.*\)/\2 \1/"` -} - -if [ $# != 1 ]; then - echo "Usage: makeBookeA5.sh " - exit 1 -fi - -dir=`pwd` - -booke=$dir/$1 -builddir=$dir/build -graphicsdir=$dir/graphics/$1 -output=dottesA5.tex -outputxdv=${output/%.tex/.xdv} -outputpdf=${output/%.tex/.pdf} -outputa4=dottesA5onA4booklet.tex -outputa4pdf=dottesA5onA4booklet.pdf - -mkdir -p $builddir - -cp buildno.txt $builddir -cp buzzard.eps $builddir -if [ -r $booke/title.txt ]; then - cp $booke/title.txt $builddir -else - touch $builddir/title.txt -fi -if [ -r $booke/subtitle.txt ]; then - cp $booke/subtitle.txt $builddir -else - touch $builddir/subtitle.txt -fi -if [ -r $booke/intro.txt ]; then - cp $booke/intro.txt $builddir -else - touch $builddir/intro.txt -fi -rm $builddir/instrument.txt -if [ -r $booke/instrument.txt ]; then - cp $booke/instrument.txt $builddir -else - touch $builddir/instrument.txt -fi -cp dottes.tex.a5header $builddir/$output -cat dottes.tex.intro >> $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 - name=`basename $filename .abc` - title=`$dir/abcfield.py --field T --latex $filename` - fixtitle "$title" - title=$retval - - echo -E "\vfill \begin{center}" >> $builddir/$output - echo -E "\phantomsection" >> $builddir/$output - echo -E "\hypertarget{$name}{\includegraphics[width=\textwidth,height=0.85\textheight,keepaspectratio]{$graphicsdir/$name}}" >> $builddir/$output - echo -E "\addcontentsline{toc}{subsection}{$title}" >> $builddir/$output - echo -E "\end{center}" >> $builddir/$output - - changefile=`$dir/abcfield.py --field N $filename | grep "Change:" | sed -e "s/Change: *//"` - changetitle="" - if [ -n "$changefile" ]; then - changetitle=`$dir/abcfield.py --field T --latex $booke/$changefile` - fixtitle "$changetitle" - changetitle=$retval - changename=`basename $changefile .abc` - echo -E "Change: \hyperlink{$changename}{$changetitle}" >> $builddir/$output - fi - done - -cat dottes.tex.firstlines >> $builddir/$output - -find $booke -name "*.abc" | sort | - while read filename - do - name=`basename $filename .abc` - title=`$dir/abcfield.py --field T --latex $filename` - fixtitle "$title" - title=$retval - echo -E "\hyperlink{$name}{$title} & \raisebox{-.25\height}{\includegraphics[width=0.6\textwidth]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output - done - -cat dottes.tex.footer >> $builddir/$output - -cp $outputa4 $builddir - -cd $builddir - -# 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. -# -# 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 - xelatex -no-pdf $output - xdvipdfmx -p a5 -l $outputxdv -else - xelatex $output - xelatex $output - xelatex $output -fi -xelatex $outputa4 - -mv $outputpdf $dir/$1-A5.pdf -mv $outputa4pdf $dir/${1}-A5bookletA4.pdf - -cd $dir diff --git a/makeBookeTunePages.sh b/makeBookeTunePages.sh new file mode 100755 index 0000000..c283300 --- /dev/null +++ b/makeBookeTunePages.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Generate the LaTeX for the Booke tune pages (tunes.tex) and the index +# of first lines (firstlines.tex). These are generated into the build +# directory. +# +# All EPS and PDF tune graphics must be present already. Run +# makeGraphics.sh to make these. +# + +# Restore titles like 'Exploding Potato, The' to the +# expected 'The Exploding Potato'. +fixtitle() +{ + retval=`echo "$1" | sed -e "s/\(.*\), *\(.*\)/\2 \1/"` +} + +if [ $# != 1 ]; then + echo "Usage: makeBookeTunePages.sh " + exit 1 +fi + +dir=`pwd` + +booke=$dir/$1 +builddir=$dir/build +graphicsdir=$dir/graphics/$1 +tunesoutput=$builddir/tunes.tex +indexoutput=$builddir/firstlines.tex + +mkdir -p $builddir + +rm -f $tunesoutput $indexoutput + +# 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 + name=`basename $filename .abc` + title=`$dir/abcfield.py --field T --latex $filename` + fixtitle "$title" + title=$retval + + echo -E "\vfill \begin{center}" >> $tunesoutput + echo -E "\phantomsection" >> $tunesoutput + echo -E "\hypertarget{$name}{\includegraphics[width=\textwidth,height=0.85\textheight,keepaspectratio]{$graphicsdir/$name}}" >> $tunesoutput + echo -E "\addcontentsline{toc}{subsection}{$title}" >> $tunesoutput + echo -E "\end{center}" >> $tunesoutput + + changefile=`$dir/abcfield.py --field N $filename | grep "Change:" | sed -e "s/Change: *//"` + changetitle="" + if [ -n "$changefile" ]; then + changetitle=`$dir/abcfield.py --field T --latex $booke/$changefile` + fixtitle "$changetitle" + changetitle=$retval + changename=`basename $changefile .abc` + echo -E "Change: \hyperlink{$changename}{$changetitle}" >> $tunesoutput + fi + + echo -E "\hyperlink{$name}{$title} & \raisebox{-.25\height}{\includegraphics[width=0.6\textwidth]{$graphicsdir/firstline-$name}} \\\\" >> $indexoutput + done diff --git a/makeBooklet.sh b/makeBooklet.sh new file mode 100755 index 0000000..2eaa35d --- /dev/null +++ b/makeBooklet.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Assuming the existance of the A5 PDF of the given Booke, produce the +# A4 booklet-that-prints-as-A5. +# + +if [ $# != 1 ]; then + echo "Usage: makeBookelet.sh " + exit 1 +fi + +dir=`pwd` + +builddir=$dir/build + +booke=$1-A5.pdf +# This assumes dottesA5.pdf as input. +booklet=$dir/dottesA5onA4booklet.tex +bookletpdf=$builddir/dottesA5onA4booklet.pdf + +mkdir -p $builddir + +cp $booke $builddir/dottesA5.pdf + +cd $builddir +xelatex $booklet +mv $bookletpdf $dir/${1}-A5bookletA4.pdf