lilypond-user
[Top][All Lists]
Advanced

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

Re: Adding \noPageBreak Programatically


From: Jay Anderson
Subject: Re: Adding \noPageBreak Programatically
Date: Thu, 23 Nov 2017 23:40:31 -0700

I'm coming back to this again. Here's the example below updated and a bit smaller:

=======
\version "2.19.80"

makeStuff =
#(define-void-function () ()
  (add-text #{\markup "fill some space" #})
  (add-score #{ \score { \new Staff { c'1 } } #})
  (add-text #{\markup "Keep with next"#})
  ; This doesn't work:
  (add-score #{ \noPageBreak #})
  (add-score #{ \score { \new Staff { c'1 } } #}))

\makeStuff
=======

Compiling the above results in this error:
=======
GNU LilyPond 2.19.80
Processing `test.ly'
Parsing...
Interpreting music...
Preprocessing graphical objects...lilypond: /home/gub/NewGub/gub/target/linux-64/src/lilypond-git.sv.gnu.org--lilypond.git-stable-2.20/lily/book.cc:258: void Book::process_score(SCM, Paper_book*, Output_def*): Assertion `0' failed.
Aborted
=======

The regular written out way is somehow adding the \noPageBreak directive differently which I haven't tracked down yet. (Using "(add-score #{ \score { \noPageBreak } #})" avoids the above error, but of course creates a blank staff.)

Essentially I have some functions which generate scores and markup (music/text is passed in and applied to a score template), but I don't have a way to control the page breaking between them. (E.g. explanatory text before an etude shouldn't have a line break). The main alternative I see is external code generation. This would solve some other issues with this method of generating scores (mostly bad line numbers in compile errors), but I'd prefer to not add another tool in the compile chain for the scores if possible.

Thanks.

-----Jay

On Tue, Dec 16, 2014 at 10:31 PM, Jay Anderson <address@hidden> wrote:
I'm putting in some text before a score and I don't want a page break
between them. I know how to do this manually. Here's an example:

===================================================
\version "2.19.15"

\book
{
  \markup "fill some space"
  \score
  {
    \new Staff \relative c'
    {
      \repeat unfold 13 {c1 | \break}
    }
    \layout
    {
      ragged-right = ##t
    }
  }
  \markup "Keep with next"

  \noPageBreak %%%%%%% <----  What I want to do programatically.

  \score
  {
    \new Staff \relative c'
    {
      c1 |
    }
    \layout
    {
      ragged-right = ##t
    }
  }
}
===================================================


I want to do this programatically. Something like this:
===================================================
\version "2.19.15"

makeStuff =
#(define-void-function (parser loc) ()
  (add-text parser #{\markup "fill some space" #})
  (add-score parser #{
    \score
    {
      \new Staff \relative c'
      {
        \repeat unfold 13 {c1 | \break}
      }
      \layout
      {
        ragged-right = ##t
      }
    }
  #})
  (add-text parser #{\markup "Keep with next"#})
  ; This doesn't work:
  (add-score parser #{ \noPageBreak #})
  (add-score parser #{
    \score
    {
      \new Staff \relative c'
      {
        c1 |
      }
      \layout
      {
        ragged-right = ##t
      }
    }
  #}))

\makeStuff
===================================================

Unfortunately I can't get the \noPageBreak to work here. Any ideas on
the difference? Thanks.

-----Jay


reply via email to

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