On Mon, Apr 22, 2002 at 11:09:16AM +0200, Han-Wen Nienhuys wrote:
> [EMAIL PROTECTED] writes:
> >
> > if I don't forget the attachment as usually, you should find included an
>
> you did. :)
OK, next try.
Thomas
--
http://www.thomas.willhalm.de/
*** /usr/local/bin/lilypond-book Thu Apr 11 11:32:21 2002
--- linux/bin/lilypond-book Sun Apr 21 19:13:37 2002
***************
*** 365,371 ****
'letterpaper': {12: in2pt(6)}}
option_definitions = [
! ('EXT', 'f', 'format', 'set format. EXT is one of texi and latex.'),
('DIM', '', 'default-music-fontsize', 'default fontsize for music. DIM is
assumed to be in points'),
('DIM', '', 'default-lilypond-fontsize', 'deprecated, use
--default-music-fontsize'),
('DIM', '', 'force-music-fontsize', 'force fontsize for all inline lilypond. DIM
is assumed be to in points'),
--- 365,371 ----
'letterpaper': {12: in2pt(6)}}
option_definitions = [
! ('EXT', 'f', 'format', 'set format. EXT is one of texi, latex and pdflatex.'),
('DIM', '', 'default-music-fontsize', 'default fontsize for music. DIM is
assumed to be in points'),
('DIM', '', 'default-lilypond-fontsize', 'deprecated, use
--default-music-fontsize'),
('DIM', '', 'force-music-fontsize', 'force fontsize for all inline lilypond. DIM
is assumed be to in points'),
***************
*** 406,411 ****
--- 406,434 ----
'output-tex': '{\\preLilypondExample \\input %(fn)s.tex
\\postLilypondExample\n}',
'pagebreak': r'\pagebreak',
},
+ 'pdflatex': {
+ 'output-lilypond-fragment' : r"""\begin[pdf,singleline,%s]{lilypond}
+ \context Staff <
+ \context Voice{
+ %s
+ }
+ >
+ \end{lilypond}""",
+ 'output-filename' : r'''
+
+ \verb+%s+:''',
+ 'output-lilypond': r"""\begin[%s]{lilypond}
+ %s
+ \end{lilypond}""",
+ 'output-verbatim': "\\begin{verbatim}%s\\end{verbatim}",
+ 'output-default-post': "\\def\postLilypondExample{}\n",
+ 'output-default-pre': "\\def\preLilypondExample{}\n",
+ 'usepackage-graphics': '\\usepackage{graphics}\n',
+ 'output-pdf':
+'\\noindent\\parbox{\\lilypondepswidth{%(fn)s.eps}}{\includegraphics{%(fn)s.pdf}}',
+ 'output-tex': '{\\preLilypondExample \\input %(fn)s.pdftex
+\\postLilypondExample\n}',
+ 'midi-link': '\\href{run:%(fn)s.midi}{Midi}',
+ 'pagebreak': r'\pagebreak',
+ },
'texi' : {'output-lilypond': """@lilypond[%s]
%s
@end lilypond
***************
*** 473,478 ****
--- 496,520 ----
'singleline-comment': r"(?m)^.*?(?P<match>(?P<code>^%.*$\n+))",
'numcols': r"(?P<code>\\(?P<num>one|two)column)",
},
+ 'pdflatex': {'input': r'(?m)^[^%\n]*?(?P<match>\\mbinput{?([^}\t \n}]*))',
+ 'include':
+r'(?m)^[^%\n]*?(?P<match>\\mbinclude{(?P<filename>[^}]+)})',
+ 'option-sep' : ',\s*',
+ 'header': r"\\documentclass\s*(\[.*?\])?",
+ 'geometry':
+r"^(?m)[^%\n]*?\\usepackage\s*(\[(?P<options>.*)\])?\s*{geometry}",
+ 'preamble-end': r'(?P<code>\\begin{document})',
+ 'verbatim': r"(?s)(?P<code>\\begin{verbatim}.*?\\end{verbatim})",
+ 'verb': r"(?P<code>\\verb(?P<del>.).*?(?P=del))",
+ 'lilypond-file':
+r'(?m)^[^%\n]*?(?P<match>\\lilypondfile\s*(\[(?P<options>.*?)\])?\s*\{(?P<filename>.+)})',
+ 'lilypond' :
+r'(?m)^[^%\n]*?(?P<match>\\lilypond\s*(\[(?P<options>.*?)\])?\s*{(?P<code>.*?)})',
+ 'lilypond-block':
+r"(?sm)^[^%\n]*?(?P<match>\\begin\s*(\[(?P<options>.*?)\])?\s*{lilypond}(?P<code>.*?)\\end{lilypond})",
+ 'def-post-re': r"\\def\\postLilypondExample",
+ 'def-pre-re': r"\\def\\preLilypondExample",
+ 'usepackage-graphics': r"\usepackage{graphics}",
+ 'intertext': r',?\s*intertext=\".*?\"',
+ 'multiline-comment': no_match,
+ 'singleline-comment': r"(?m)^.*?(?P<match>(?P<code>^%.*$\n+))",
+ 'numcols': r"(?P<code>\\(?P<num>one|two)column)",
+ },
# why do we have distinction between @mbinclude and @include?
***************
*** 689,695 ****
if __main__.format == 'texi':
scan_texi_preamble(chunks)
else:
! assert __main__.format == 'latex'
scan_latex_preamble(chunks)
--- 731,737 ----
if __main__.format == 'texi':
scan_texi_preamble(chunks)
else:
! assert __main__.format == 'latex' or __main__.format == 'pdflatex'
scan_latex_preamble(chunks)
***************
*** 802,808 ****
return [('lilypond', m.group('code'), options)]
def do_columns(m):
! if __main__.format != 'latex':
return []
if m.group('num') == 'one':
return [('numcols', m.group('code'), 1)]
--- 844,850 ----
return [('lilypond', m.group('code'), options)]
def do_columns(m):
! if __main__.format != 'latex' and __main__.format != 'pdflatex':
return []
if m.group('num') == 'one':
return [('numcols', m.group('code'), 1)]
***************
*** 905,917 ****
basename = basename + "-%i" % taken_file_names[basename]
if not g_read_lys:
update_file(file_body, os.path.join(g_outdir, basename) + '.ly')
! needed_filetypes = ['tex']
if format == 'texi':
needed_filetypes.append('eps')
needed_filetypes.append('png')
if 'eps' in opts and not ('eps' in needed_filetypes):
needed_filetypes.append('eps')
pathbase = os.path.join (g_outdir, basename)
def f(base, ext1, ext2):
a = os.path.isfile(base + ext2)
--- 947,965 ----
basename = basename + "-%i" % taken_file_names[basename]
if not g_read_lys:
update_file(file_body, os.path.join(g_outdir, basename) + '.ly')
! if format == 'pdflatex':
! needed_filetypes = ['pdftex']
! else:
! needed_filetypes = ['tex']
if format == 'texi':
needed_filetypes.append('eps')
needed_filetypes.append('png')
if 'eps' in opts and not ('eps' in needed_filetypes):
needed_filetypes.append('eps')
+ if 'pdf' in opts and not ('pdf' in needed_filetypes):
+ needed_filetypes.append('eps')
+ needed_filetypes.append('pdf')
pathbase = os.path.join (g_outdir, basename)
def f(base, ext1, ext2):
a = os.path.isfile(base + ext2)
***************
*** 924,931 ****
--- 972,983 ----
todo = []
if 'tex' in needed_filetypes and f(pathbase, '.ly', '.tex'):
todo.append('tex')
+ if 'pdftex' in needed_filetypes and f(pathbase, '.ly', '.pdftex'):
+ todo.append('pdftex')
if 'eps' in needed_filetypes and f(pathbase, '.tex', '.eps'):
todo.append('eps')
+ if 'pdf' in needed_filetypes and f(pathbase, '.eps', '.pdf'):
+ todo.append('pdf')
if 'png' in needed_filetypes and f(pathbase, '.eps', '.png'):
todo.append('png')
newbody = ''
***************
*** 945,957 ****
m = re.search ('intertext="(.*?)"', o)
if m:
newbody = newbody + m.group (1) + "\n\n"
if format == 'latex':
if 'eps' in opts:
s = 'output-eps'
! else:
s = 'output-tex'
! else: # format == 'texi'
! s = 'output-all'
newbody = newbody + get_output (s) % {'fn': basename }
return ('lilypond', newbody, opts, todo, basename)
--- 997,1019 ----
m = re.search ('intertext="(.*?)"', o)
if m:
newbody = newbody + m.group (1) + "\n\n"
+
+ if 'midi' in opts:
+ newbody = newbody + get_output ('midi-link') % {'fn': basename }
+
if format == 'latex':
if 'eps' in opts:
s = 'output-eps'
! else:
s = 'output-tex'
! else:
! if format == 'pdflatex':
! if 'pdf' in opts:
! s = 'output-pdf'
! else:
! s = 'output-tex'
! else: # format == 'texi'
! s = 'output-all'
newbody = newbody + get_output (s) % {'fn': basename }
return ('lilypond', newbody, opts, todo, basename)
***************
*** 1013,1018 ****
--- 1075,1081 ----
global foutn
eps = []
tex = []
+ pdf = []
png = []
for c in chunks:
***************
*** 1027,1034 ****
--- 1090,1103 ----
#ugh
if base + '.ly' not in tex:
tex.append (base + '.ly')
+ elif e == 'pdftex':
+ #ugh
+ if base + '.ly' not in tex:
+ tex.append (base + '.ly')
elif e == 'png' and g_do_pictures:
png.append (base)
+ elif e == 'pdf' and g_do_pictures:
+ pdf.append (base)
d = os.getcwd()
if g_outdir:
os.chdir(g_outdir)
***************
*** 1046,1052 ****
if g_outdir:
lilyopts = lilyopts + '--dep-prefix=' + g_outdir + '/'
texfiles = string.join (tex, ' ')
! system ('lilypond --header=texidoc %s %s' % (lilyopts, texfiles))
#
# Ugh, fixing up dependencies for .tex generation
--- 1115,1124 ----
if g_outdir:
lilyopts = lilyopts + '--dep-prefix=' + g_outdir + '/'
texfiles = string.join (tex, ' ')
! if __main__.format != 'pdflatex':
! system ('lilypond --header=texidoc %s %s' % (lilyopts, texfiles))
! else :
! system ('lilypond --header=texidoc -fpdftex %s %s' % (lilyopts,
texfiles))
#
# Ugh, fixing up dependencies for .tex generation
***************
*** 1068,1073 ****
--- 1140,1148 ----
for g in png:
make_pixmap (g)
+
+ for e in pdf:
+ system(r"epstopdf %s" % e)
os.chdir (d)