Make output larger where possible.

This is done by

a) reducing the page margins
b) compressing the heading and removing all but Notes: fields.

The latter produced vertically smaller tune PDFs that will scale wider.

In the process, modify abctitle.py to extract the first of any header field, and
move formatting for a single tune into a .fmt file.
This commit is contained in:
Jim Hague 2012-04-21 19:47:30 +01:00
parent b5db705868
commit 4c8f2a3ade
6 changed files with 38 additions and 11 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
# Extact the first tune title from a .abc data, and print it out # Extact a text field (title, by default) from a .abc file, and print it out
# formatted for use in LaTeX. # formatted for use in LaTeX or HTML.
# #
import optparse import optparse
@ -107,12 +107,14 @@ def convertTitle(t, options):
def process(inf, options): def process(inf, options):
for line in inf: for line in inf:
line = line.strip() 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)) print(convertTitle(line[2:].strip(), options))
break break
parser = optparse.OptionParser(usage="usage: %prog [options] [filename]\n\n" 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", parser.add_option("-m", "--html", dest="html",
action="store_true", default=False, action="store_true", default=False,
help="format output for HTML") help="format output for HTML")

View File

@ -27,13 +27,17 @@
\setlength{\parindent}{0pt} \setlength{\parindent}{0pt}
% Adjust margins for A5 landscape. Increase width by 2cm and height by 4cm. % Adjust margins for A5 landscape. Increase width by 4cm and height by 4cm.
\addtolength{\textwidth}{2cm} \addtolength{\textwidth}{4cm}
\addtolength{\hoffset}{-1cm} \addtolength{\hoffset}{-2cm}
\addtolength{\textheight}{4cm} \addtolength{\textheight}{4cm}
\addtolength{\voffset}{-2cm} \addtolength{\voffset}{-2cm}
% Move the top margin up a further cm.
\addtolength{\textheight}{1cm}
\addtolength{\voffset}{-1cm}
% ----- % -----
\begin{document} \begin{document}

View File

@ -43,8 +43,9 @@ cp dottes.tex.header $builddir/$output
find $booke -name "*.abc" | sort | find $booke -name "*.abc" | sort |
while read filename while read filename
do do
title=`$dir/abctitle.py --latex $filename` title=`$dir/abcfield.py --field T --latex $filename`
name=`basename $filename .abc` name=`basename $filename .abc`
echo -E "\newpage" >> $builddir/$output
echo -E "\begin{center}" >> $builddir/$output echo -E "\begin{center}" >> $builddir/$output
echo -E "\phantomsection" >> $builddir/$output echo -E "\phantomsection" >> $builddir/$output
echo -E "\hypertarget{$name}{\includegraphics[width=\textwidth,height=0.9\textheight,keepaspectratio]{$graphicsdir/$name}}" >> $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 | find $booke -name "*.abc" | sort |
while read filename while read filename
do do
title=`$dir/abctitle.py --latex $filename` title=`$dir/abcfield.py --field T --latex $filename`
name=`basename $filename .abc` name=`basename $filename .abc`
echo -E "\hyperlink{$name}{$title} & \raisebox{-.25\height}{\includegraphics[width=0.6\textwidth]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output echo -E "\hyperlink{$name}{$title} & \raisebox{-.25\height}{\includegraphics[width=0.6\textwidth]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output
done done

View File

@ -23,7 +23,7 @@ find $booke -name "*.abc" | sort |
name=`basename $filename .abc` name=`basename $filename .abc`
# Make the tune graphic. # 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. # Make $name.eps so we can build with LaTeX.
mv $graphicsdir/${name}001.eps $graphicsdir/${name}.eps mv $graphicsdir/${name}001.eps $graphicsdir/${name}.eps
# And make the corresponding PDF. # And make the corresponding PDF.

View File

@ -37,7 +37,7 @@ cp $1.pdf $1-booklet.pdf $webdir
find $booke -name "*.abc" | sort | find $booke -name "*.abc" | sort |
while read filename while read filename
do do
title=`$dir/abctitle.py --html $filename` title=`$dir/abcfield.py --field T --html $filename`
name=`basename $filename .abc` name=`basename $filename .abc`
# Copy tune PDF from common graphics. # Copy tune PDF from common graphics.

20
singletune.fmt Normal file
View File

@ -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