lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rationale for LaTeX lilypond-book syntax?


From: Carl Sorensen
Subject: Re: Rationale for LaTeX lilypond-book syntax?
Date: Sun, 18 Apr 2010 18:45:30 -0600



On 4/18/10 11:21 AM, "David Kastrup" <address@hidden> wrote:

> Werner LEMBERG <address@hidden> writes:
> 
>>> the "LaTeX" syntax for lilypond-book happens to be something like
>>> 
>>> \begin[verbatim,fragment]{lilypond}
>>>   \relative c' { c << { d e } { b c } >> <c es g> }
>>> \end{lilypond}
>>> 
>>> Unfortunately, this is quite annoying since actual optional
>>> arguments for environments come _after_ the environment name in
>>> LaTeX, like
>>> 
>>> \begin{lilypond}[verbatim,fragment]
>>>   \relative c' { c << { d e } { b c } >> <c es g> }
>>> \end{lilypond}
>>> 
>>> Would it be feasible to obsolete the first syntax and support (and
>>> recommend) the second syntax?
>> 
>> I don't see any reason not to do that.  We even don't have to change
>> the name of the environment.  Just allow both
>> 
>>   \begin{lilypond}[...]
>> 
>> and
>> 
>>   \begin[...]{lilypond}
>> 
>> It should be straightforward to extend lilypond-book's regexp to make
>> this work.
> 
> It is not an entirely backward-compatible change since
> 
> \begin{lilypond}[c16 d e f]
> \end{lilypond}
> 
> is likely currently valid input.  Also LaTeX has the rather annoying
> feature to skip whitespace before prospective optional arguments.  So
> 
> \begin{lilypond}
> [c16 d e f]
> \end{lilypond}
> 
> would still count, from a LaTeX point of view, as an optional argument.
> 
> My personal take on this would be to have lilypond-book interpret
> \begin{lilypond}[...
> as introducing options, but don't interpret [ as an option introducer
> after any spaces have occured after \begin{lilypond}.
> 
> One can implement this on the TeX side (once one wants to implement
> lilypond-book in that manner) as well, in order to avoid having to write
> 
> \begin{lilypond}[]
> [c16 d e f]
> \end{lilypond}
> 
> in order to convince LaTeX that no options are present.


Actually,  [c16 d e f] is *not* valid lilypond.  The first brace needs to
come after the c16:

sorensen2:lilypond Carl$ lilypond testbrace.ly
GNU LilyPond 2.13.19
Processing `testbrace.ly'
Parsing...
testbrace.ly:2:2: error: syntax error, unexpected '['
  
  [c16 d e f]
testbrace.ly:1:0: error: errors found, ignoring music expression

{
testbrace.ly:0: warning: no \version statement found, please add

\version "2.13.19"

for future compatibility
error: failed files: "testbrace.ly"


So I don't think there's a problem with the options coming after the
{lilypond}.

Thanks,

Carl





reply via email to

[Prev in Thread] Current Thread [Next in Thread]