diff --git a/abctitle.py b/abcfield.py similarity index 90% rename from abctitle.py rename to abcfield.py index f6cbe60..197b537 100755 --- a/abctitle.py +++ b/abcfield.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -# Extact the first tune title from a .abc data, and print it out -# formatted for use in LaTeX. +# Extact a text field (title, by default) from a .abc file, and print it out +# formatted for use in LaTeX or HTML. # import optparse @@ -107,12 +107,14 @@ def convertTitle(t, options): def process(inf, options): for line in inf: line = line.strip() - if line[0:2] == "T:": + if len(line) > 2 and line[0] == options.field and line[1] == ':': print(convertTitle(line[2:].strip(), options)) break parser = optparse.OptionParser(usage="usage: %prog [options] [filename]\n\n" - " Extract title from ABC file.") + " Extract field data from ABC file.") +parser.add_option("-f", "--field", dest="field", default="T", + help="extract the field FIELD", metavar="FIELD") parser.add_option("-m", "--html", dest="html", action="store_true", default=False, help="format output for HTML") diff --git a/dottes.tex.header b/dottes.tex.header index d218813..f4ef639 100644 --- a/dottes.tex.header +++ b/dottes.tex.header @@ -27,13 +27,17 @@ \setlength{\parindent}{0pt} -% Adjust margins for A5 landscape. Increase width by 2cm and height by 4cm. -\addtolength{\textwidth}{2cm} -\addtolength{\hoffset}{-1cm} +% 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} + % ----- \begin{document} diff --git a/makeBooke.sh b/makeBooke.sh index 2c3f0d6..ca08825 100755 --- a/makeBooke.sh +++ b/makeBooke.sh @@ -43,8 +43,9 @@ cp dottes.tex.header $builddir/$output find $booke -name "*.abc" | sort | while read filename do - title=`$dir/abctitle.py --latex $filename` + title=`$dir/abcfield.py --field T --latex $filename` name=`basename $filename .abc` + echo -E "\newpage" >> $builddir/$output echo -E "\begin{center}" >> $builddir/$output echo -E "\phantomsection" >> $builddir/$output echo -E "\hypertarget{$name}{\includegraphics[width=\textwidth,height=0.9\textheight,keepaspectratio]{$graphicsdir/$name}}" >> $builddir/$output @@ -57,7 +58,7 @@ cat dottes.tex.firstlines >> $builddir/$output find $booke -name "*.abc" | sort | while read filename do - title=`$dir/abctitle.py --latex $filename` + title=`$dir/abcfield.py --field T --latex $filename` name=`basename $filename .abc` echo -E "\hyperlink{$name}{$title} & \raisebox{-.25\height}{\includegraphics[width=0.6\textwidth]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output done diff --git a/makeGraphics.sh b/makeGraphics.sh index 86cd457..8ec9030 100755 --- a/makeGraphics.sh +++ b/makeGraphics.sh @@ -23,7 +23,7 @@ find $booke -name "*.abc" | sort | name=`basename $filename .abc` # Make the tune graphic. - abcm2ps -j0 +c -n -E -O $graphicsdir/$name.eps $filename + abcm2ps -E -F singletune -O $graphicsdir/$name.eps $filename # Make $name.eps so we can build with LaTeX. mv $graphicsdir/${name}001.eps $graphicsdir/${name}.eps # And make the corresponding PDF. diff --git a/makeWeb.sh b/makeWeb.sh index 6535c1c..5d91eb6 100755 --- a/makeWeb.sh +++ b/makeWeb.sh @@ -37,7 +37,7 @@ cp $1.pdf $1-booklet.pdf $webdir find $booke -name "*.abc" | sort | while read filename do - title=`$dir/abctitle.py --html $filename` + title=`$dir/abcfield.py --field T --html $filename` name=`basename $filename .abc` # Copy tune PDF from common graphics. diff --git a/singletune.fmt b/singletune.fmt new file mode 100644 index 0000000..9d19f36 --- /dev/null +++ b/singletune.fmt @@ -0,0 +1,20 @@ +% Format for a graphic with a single tune +mmmeasurenb 0 +botmargin 0 +leftmargin 0 +rightmarin 0 +topmargin 0 +scale 0.9 +titleformat T0 C1 +titlespace 0 +topspace 0 +% I only want to include Notes in the tune graphics. To turn off the +% other fields, give a blank infoname for that letter. +infoname S +infoname R +infoname B +infoname D +infoname Z +infoname H +infoline true +writehistory true