Would there be a way to conditionally include a \pageBreak at top level? E.g.
\if #(some-predicate) { \pageBreak } On Fri, May 5, 2023 at 7:58 AM Valentin Petzel <valen...@petzel.at> wrote: > Hello Eric, > > that is understandable. For some context: > > when you put \pageBreak at toplevel (or bookpart level) it is first just a > music stream made up of a single event. Now, when Lilypond encounters > toplevel > music objects it usually defaults to truning it into a score, using the > scheme > procedure (scorify-music music). But there is some additional logic, which > is > done by the scheme procedure (collect-music-aux score-handler music) > (where > score-handler is a function that handles the created score). This > procedure > has a special path for single event music of type page-marker (which > something > like \pageBreak falls under as can be seen in \displayMusic \pageBreak). > > Basically instead of a score it creates a Page_marker object, which you > can > see if you do > > { c } > \pageBreak > { c } > #(display toplevel-scores) > > Now, of course in markup this does not work, as first a markup will not > take > music, and very importantly markup will not include any page layout events > of > any sort. It would be possible to do something like > > (collect-music-aux add-score #{ \pageBreak #}) > > in a markup, scheme or void function, but this would cause some trouble in > when exactly this is evaluated. Usually we’d expect something like this to > to > be placed positionally where the markup is. Let’s say we use a scheme > function: > > pagebreak = > #(define-void-function () () > (collect-music-aux add-score #{ \pageBreak #})) > > This is evaluated at the time the expression is parsed (more or less). So > doing > > \markup "a" > \markup "b" > \markup{ \pagebreak } > \markup "c" > > will behave as intended, but > > \markup "a" > test = \markup { \pagebreak } > \markup "b" > \test > \markup "c" > > will not. If we use a markup function like this > > #(define-markup-command (pagebreak layout props) () > (collect-music-aux add-score #{ \pageBreak #}) > empty-stencil) > > the command is only evaluated when interpreting that markup, at which > point > all scores have been added (so we do not get any effect): > > \markup "a" > \markup "b" > \markup { \pagebreak } > \markup "c" > > So you see there is currently no real way of any kind for getting page > layout > commands into a markup. Of course this can be limiting if you want to do > complex formatting of markups and markuplists, but Lilypond is a music > engraving software, not a typesetting or text layouting software. > Lilypond’s > handling of text is quite primitive, as this is not the main focus of > development. > > Cheers, > Valentin > > Am Freitag, 5. Mai 2023, 01:34:56 CEST schrieb Eric Benson: > > Well then, sorry for bothering you all! I don't know how I confused > myself > > so badly, but I'm just glad to be out of that hole! I think I tried to > put > > the \pageBreak inside the \markup, which definitely does not work. > > > > On Thu, May 4, 2023 at 4:24 PM Kieren MacMillan > > <kie...@kierenmacmillan.info> > > wrote: > > > Hi Eric, > > > > > > > Oh! I think this is new behavior. > > > > > > I don’t think so…? > > > I’ve been using this for many years. :) > > > > > > Cheers, > > > Kieren. > > > ______________________________________________ > > > > > > My work day may look different than your work day. Please do not feel > > > obligated to read or respond to this email outside of your normal > working > > > hours. > >