From: Trevor Daniels Date: Thu, 11 Apr 2013 09:33:08 +0000 (+0100) Subject: Doc: Error message: unexpected \new (3285) X-Git-Tag: release/2.17.17-1~27^2~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=54d23d6ca9b231155f5d171b6c0e86edf489c36b;p=lilypond.git Doc: Error message: unexpected \new (3285) Explain reason for the message and what should be done to avoid it. --- diff --git a/Documentation/usage/running.itely b/Documentation/usage/running.itely index 76d6823b9e..303edd155b 100644 --- a/Documentation/usage/running.itely +++ b/Documentation/usage/running.itely @@ -923,6 +923,7 @@ are easily handled. * Error message Unbound variable %:: * Error message FT_Get_Glyph_Name:: * Warning staff affinities should only decrease:: +* Error message unexpected \new:: @end menu @node Music runs off the page @@ -1043,3 +1044,53 @@ staff by inserting @noindent at its start. For details, see @qq{Spacing of non-staff lines} in @ruser{Flexible vertical spacing within systems}. + + +@node Error message unexpected \new +@unnumberedsubsec Error message unexpected @code{\new} + +A @code{\score} block must contain a @emph{single} music expression. +If instead it contains several @code{\new Staff}, +@code{\new StaffGroup} or similar contexts introduced with @code{\new} +without them being enclosed in either curly brackets, +@code{@{ @dots{} @}}, or double angle brackets, @code{<< @dots{} >>}, +like this: + +@example +\score @{ + % Invalid! Generates error: syntax error, unexpected \new + \new Staff @{ @dots{} @} + \new Staff @{ @dots{} @} +@} +@end example + +@noindent +the error message will be produced. + +To avoid the error, enclose all the @code{\new} statements in +curly or double angle brackets. + +Using curly brackets will introduce the @code{\new} statements +sequentially: + +@lilypond[quote,verbatim] +\score { + { + \new Staff { a' a' a' a' } + \new Staff { g' g' g' g' } + } +} +@end lilypond + +@noindent +but more likely you should be using double angle brackets so the new +staves are introduced in parallel, i.e. simultaneously: + +@lilypond[quote,verbatim] +\score { + << + \new Staff { a' a' a' a' } + \new Staff { g' g' g' g' } + >> +} +@end lilypond