# Protecting against page breaks in markup

15 messages
Open this post in threaded view
|

## Protecting against page breaks in markup

 I'm creating an index to my scores, in the form of a sequence of LilyPond markups (for title, composer, first few bars etc). It is working well apart from page breaking which can occur mid-entry. Is there a way of turning page breaks off and back on around each entry? Richard Shann _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user
Open this post in threaded view
|

## Re: Protecting against page breaks in markup

 Am Di., 27. Nov. 2018 um 16:22 Uhr schrieb Richard Shann <[hidden email]>: > > I'm creating an index to my scores, in the form of a sequence of > LilyPond markups (for title, composer, first few bars etc). What exactly are you doing? An example would be nice. > It is working well apart from page breaking which can occur mid-entry. > Is there a way of turning page breaks off and back on around each > entry? Well, of course you know about \noPageBreak and \pageBreak. Probably you can wrap a \column around all the single markups. At least page-break can then only happen before or after the whole thingy. Depends on what you actually (want to) do. Cheers,   Harm _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user
Open this post in threaded view
|

## Re: Protecting against page breaks in markup

 In reply to this post by Richard Shann-2 ---------- Forwarded message ----------From: Richard Shann <[hidden email]>To: lilypond-user <[hidden email]>Cc: Bcc: Date: Tue, 27 Nov 2018 15:20:04 +0000Subject: Protecting against page breaks in markupI'm creating an index to my scores, in the form of a sequence of LilyPond markups (for title, composer, first few bars etc). It is working well apart from page breaking which can occur mid-entry. Is there a way of turning page breaks off and back on around each entry? Richard ShannWhen pagination gets hairy, I use \autoPageBreaksOff, and then manually put in all page breaks using \pageBreakHTH,Elaine Alt415 . 341 .4954                                           "Confusion is highly underrated"[hidden email]Producer ~ Composer ~ Instrumentalist-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user
Open this post in threaded view
|

## Re: Protecting against page breaks in markup

 In reply to this post by Thomas Morley-2 On Tue, 2018-11-27 at 21:48 +0100, Thomas Morley wrote: > Am Di., 27. Nov. 2018 um 16:22 Uhr schrieb Richard Shann > <[hidden email]>: > > > > I'm creating an index to my scores, in the form of a sequence of > > LilyPond markups (for title, composer, first few bars etc). > > What exactly are you doing? An example would be nice. Well, I have my printed scores of trio sonatas filed under composer but I needed to find just those scores with a Tenor as the second part - I have perhaps half-a-dozen of these, lost amongst just over a thousand scores. So I thought I would write a script in Scheme that would traverse the file system opening scores, extracting an incipit, title, composer, instrumentation etc and then creating a new score that just comprised top level markups, one for each entry. Each entry looks like this: \markup {\column {\draw-hline}}\markup "Fesch: Sonatina IV" \markup {instrumentation:Treble, Tenor, Basso} DenemoGlobalTranspose = #(define-music-function (parser location arg)(ly:music?) #{\transpose c' c'#arg #}) incipit = \markup \score {\DenemoGlobalTranspose { \clef treble  { \time 3/4 }  { \key f \major}  %{/home/rshann/musicScores/Fesch/IMSLP270267-PMLP437812-fesch_op7_1.pdf:202:7724:9%} d'' 4 g' 4. ees'' 8 d'' 4 g' 4. bes'' 8 } \layout {indent = 0.0\cm } } \incipit This all works nicely, and I even managed to allow the user to supply a custom Scheme expression to act as a filter, but I was left with the problem that LilyPond would page break in mid-entry. > > > It is working well apart from page breaking which can occur mid- > > entry. > > Is there a way of turning page breaks off and back on around each > > entry? > > Well, of course you know about \noPageBreak and \pageBreak. > > Probably you can wrap a \column around all the single markups. At > least page-break can then only happen before or after the whole > thingy. Ah, thank you - that works. I just looked back at the docs and I see it says "The default page breaking may be overridden by inserting \pageBreak or \noPageBreak commands.  [...] The \pageBreak and \noPageBreak commands may also be inserted at top- level, between scores and top-level markups." but I didn't spot where it said what the default page breaking is (besides allowing breaks at bar lines), I think the last bit is the clue - page breaks are allowed between top level markups, but nowhere inside them. I just hoped there might be a \pageBreaksOff and \pageBreaksOn command lurking somewhere, hence my question. But now I look at it with a clear understanding of where LilyPond might break it seems obvious where to put in sufficient \noPageBreak commands to keep each entry un-split. Richard _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user
Open this post in threaded view
|

## Re: Protecting against page breaks in markup

 In reply to this post by Flaming Hakama by Elaine On Tue, 2018-11-27 at 16:33 -0800, Flaming Hakama by Elaine wrote: > > ---------- Forwarded message ---------- > > From: Richard Shann <[hidden email]> > > To: lilypond-user <[hidden email]> > > Cc:  > > Bcc:  > > Date: Tue, 27 Nov 2018 15:20:04 +0000 > > Subject: Protecting against page breaks in markup > > I'm creating an index to my scores, in the form of a sequence of > > LilyPond markups (for title, composer, first few bars etc). > > It is working well apart from page breaking which can occur mid- > > entry. > > Is there a way of turning page breaks off and back on around each > > entry? > > > > Richard Shann > > When pagination gets hairy, I use \autoPageBreaksOff, and then > manually put in all page breaks using \pageBreak Sorry, I should have made it clearer that this index is being automatically generated. Now you point out that there is an \autoOageBreaksOff, which is what I thought I needed, I realize that it wouldn't help - I would need to turn them off and back on between each entry in the hope that LilyPond would take advantage of such an Off/On sequence to insert a page break in between if needed, which I'm sure it wouldn't :( Richard _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user
Open this post in threaded view
|

## Re: Protecting against page breaks in markup

 > Sorry, I should have made it clearer that this index is being > automatically generated. Now you point out that there is an > \autoOageBreaksOff, which is what I thought I needed, I realize that it > wouldn't help - I would need to turn them off and back on between each > entry in the hope that LilyPond would take advantage of such an Off/On > sequence to insert a page break in between if needed, which I'm sure it > wouldn't :( I'm not sure I understand you correctly, but it is perfectly possible to forbid page breaks between arbitrary markup lines: \version "2.19.80" three-line-entry = #(define-void-function (a b c) (string? string? string?)            (add-text a)            (add-music #{ \noPageBreak #})            (add-text b)            (add-music #{ \noPageBreak #})            (add-text c)            ) #(do ((i 1 (1+ i)))     ((> i 200))    (three-line-entry "Entry nr.:" (number->string i) "End of entry. Only good place for page break.")) Best Lukas _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user
Open this post in threaded view
|

## Re: Protecting against page breaks in markup

 In reply to this post by Richard Shann-2 On Wed, Nov 28, 2018, 1:50 AM Richard Shann <[hidden email] wrote:On Tue, 2018-11-27 at 16:33 -0800, Flaming Hakama by Elaine wrote: > > ---------- Forwarded message ---------- > > From: Richard Shann <[hidden email]> > > To: lilypond-user <[hidden email]> > > Cc:  > > Bcc:  > > Date: Tue, 27 Nov 2018 15:20:04 +0000 > > Subject: Protecting against page breaks in markup > > I'm creating an index to my scores, in the form of a sequence of > > LilyPond markups (for title, composer, first few bars etc). > > It is working well apart from page breaking which can occur mid- > > entry. > > Is there a way of turning page breaks off and back on around each > > entry? > > > > Richard Shann > > When pagination gets hairy, I use \autoPageBreaksOff, and then > manually put in all page breaks using \pageBreak Sorry, I should have made it clearer that this index is being automatically generated. Now you point out that there is an \autoOageBreaksOff, which is what I thought I needed, I realize that it wouldn't help - I would need to turn them off and back on between each entry in the hope that LilyPond would take advantage of such an Off/On sequence to insert a page break in between if needed, which I'm sure it wouldn't :( RichardYeah, once autoPageBreaksOff is declared, all page breaks need to be added manually.  I've found that when the automatic page breaks don't work, it usually easier to go this way than the other alternative, which is to use auto page breaks and add noPageBreak where necessary. Mostly because forcing a no page break doesn't guarantee that the newly calculated automatic break will be in a good place, so you often end up adding lots of noPageBreak commands in close succession, and it ends up being more tedious and less semantic.Also, page break calculations take up time, so using manual breaks speeds up compilation and saves time in the long run.I'm not sure if when you say this is being automatically generated that it may be produced in different editions which need different page breaks. But even in that case it is probably easiest to use tags or something like the addition engraver to specify the page breaks.You can also try putting scores in book Parts which have the effect of forcing a page break at the start of the book part. _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user
Open this post in threaded view
|

## Re: Protecting against page breaks in markup

 In reply to this post by Lukas-Fabian Moser On Wed, 2018-11-28 at 15:45 +0100, Lukas-Fabian Moser wrote: > > Sorry, I should have made it clearer that this index is being > > automatically generated. Now you point out that there is an > > \autoOageBreaksOff, which is what I thought I needed, I realize > > that it > > wouldn't help - I would need to turn them off and back on between > > each > > entry in the hope that LilyPond would take advantage of such an > > Off/On > > sequence to insert a page break in between if needed, which I'm > > sure it > > wouldn't :( > > I'm not sure I understand you correctly, but it is perfectly possible > to  > forbid page breaks between arbitrary markup lines: yes, that's what I needed to do, and I'm now doing that - it's working fine now. What I didn't realize was that Lily will not put page breaks inside a \markup {} - Harm pointed this out to me via his \column {\line .. \line ...} example, Lily does not break at any of the \lines.  Once he'd tipped me off I looked again at the docs and saw that, although they don't quite explicitly say that Lily will not page break inside a markup block it is implied by the bit of the docs I quoted "The \pageBreak and \noPageBreak commands may also be inserted [...] between [...] top-level markups." Perhaps the Docs should contain an explicit statement there that no automatic breaking will happen inside a \markup {} ... Richard _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user
Open this post in threaded view
|

## Re: Protecting against page breaks in markup

 Am Do., 29. Nov. 2018 um 09:33 Uhr schrieb Richard Shann <[hidden email]>: > > On Wed, 2018-11-28 at 15:45 +0100, Lukas-Fabian Moser wrote: > > > Sorry, I should have made it clearer that this index is being > > > automatically generated. Now you point out that there is an > > > \autoOageBreaksOff, which is what I thought I needed, I realize > > > that it > > > wouldn't help - I would need to turn them off and back on between > > > each > > > entry in the hope that LilyPond would take advantage of such an > > > Off/On > > > sequence to insert a page break in between if needed, which I'm > > > sure it > > > wouldn't :( > > > > I'm not sure I understand you correctly, but it is perfectly possible > > to > > forbid page breaks between arbitrary markup lines: > yes, that's what I needed to do, and I'm now doing that - it's working > fine now. What I didn't realize was that Lily will not put page breaks > inside a \markup {} - Harm pointed this out to me via his \column > {\line .. \line ...} example, Lily does not break at any of the > \lines. > Once he'd tipped me off I looked again at the docs and saw that, > although they don't quite explicitly say that Lily will not page break > inside a markup block it is implied by the bit of the docs I quoted > "The \pageBreak and \noPageBreak commands may also be inserted [...] > between [...] top-level markups." > Perhaps the Docs should contain an explicit statement there that no > automatic breaking will happen inside a \markup {} ... > > Richard Well, in NR 1.8.1 Writing text one can read about toplevel markup/markuplist: " Separate text ... Separate text blocks can be spread over multiple pages, making it possible to print text documents or books entirely within LilyPond. This feature, and the specific syntax it requires, are described in Multi-page markup. ... " And later " Multi-page markup Although standard markup objects are not breakable, a specific syntax makes it possible to enter lines of text that can spread over multiple pages: " Could you suggest how to improve this? Cheers,   Harm _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user
Open this post in threaded view
|

## Re: Protecting against page breaks in markup

 On Thu, 2018-11-29 at 09:50 +0100, Thomas Morley wrote: > Am Do., 29. Nov. 2018 um 09:33 Uhr schrieb Richard Shann > <[hidden email]>: > > > > On Wed, 2018-11-28 at 15:45 +0100, Lukas-Fabian Moser wrote: > > > > Sorry, I should have made it clearer that this index is being > > > > automatically generated. Now you point out that there is an > > > > \autoOageBreaksOff, which is what I thought I needed, I realize > > > > that it > > > > wouldn't help - I would need to turn them off and back on > > > > between > > > > each > > > > entry in the hope that LilyPond would take advantage of such an > > > > Off/On > > > > sequence to insert a page break in between if needed, which I'm > > > > sure it > > > > wouldn't :( > > > > > > I'm not sure I understand you correctly, but it is perfectly > > > possible > > > to > > > forbid page breaks between arbitrary markup lines: > > > > yes, that's what I needed to do, and I'm now doing that - it's > > working > > fine now. What I didn't realize was that Lily will not put page > > breaks > > inside a \markup {} - Harm pointed this out to me via his \column > > {\line .. \line ...} example, Lily does not break at any of the > > \lines. > > Once he'd tipped me off I looked again at the docs and saw that, > > although they don't quite explicitly say that Lily will not page > > break > > inside a markup block it is implied by the bit of the docs I quoted > > "The \pageBreak and \noPageBreak commands may also be inserted > > [...] > > between [...] top-level markups." > > Perhaps the Docs should contain an explicit statement there that no > > automatic breaking will happen inside a \markup {} ... > > > > Richard > > Well, in NR 1.8.1 Writing text one can read about toplevel > markup/markuplist: > " > Separate text > ... > Separate text blocks can be spread over multiple pages, making it > possible to print text documents or books entirely within LilyPond. > This feature, and the specific syntax it requires, are described in > Multi-page markup. > ... > " > > And later > > " > Multi-page markup > > Although standard markup objects are not breakable, a specific syntax > makes it possible to enter lines of text that can spread over > multiple > pages: > " > > Could you suggest how to improve this? Yes, I think I can. The presence of the word "Although" in the last- quoted paragraph indicates that the writer expected that the fact that standard markup objects were not breakable had been documented elsewhere. I suggest "4.3.2 Page breaking The default page breaking may be overridden by inserting \pageBreak or \noPageBreak commands. " could become "4.3.2 Page breaking By default page breaks may be inserted at bar lines and between top- level markups. The default page breaking may be overridden by inserting \pageBreak or \noPageBreak commands. " As a further point is the term "standard markup objects" well- documented - does it mean "top-level markups", or what I tend to refer to as \markup{} blocks? Richard _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user
Open this post in threaded view
|

## Re: Protecting against page breaks in markup

 Hi Richard, please bear in mind I'm not a native speaker. Thus work on the docs is pretty difficult for me. That said: Am Do., 29. Nov. 2018 um 11:04 Uhr schrieb Richard Shann <[hidden email]>: > On Thu, 2018-11-29 at 09:50 +0100, Thomas Morley wrote: > > Well, in NR 1.8.1 Writing text one can read about toplevel > > markup/markuplist: > > " > > Separate text > > ... > > Separate text blocks can be spread over multiple pages, making it > > possible to print text documents or books entirely within LilyPond. > > This feature, and the specific syntax it requires, are described in > > Multi-page markup. > > ... > > " > > > > And later > > > > " > > Multi-page markup > > > > Although standard markup objects are not breakable, a specific syntax > > makes it possible to enter lines of text that can spread over > > multiple > > pages: > > " > > > > Could you suggest how to improve this? > > Yes, I think I can. The presence of the word "Although" in the last- > quoted paragraph indicates that the writer expected that the fact that > standard markup objects were not breakable had been documented > elsewhere. I think "standard markup" is a little foggy. Probably: "Although text objects invoked with \markup are not breakable, ..." and in NR 1.8.1 Separate text ... Separate text entered with \markup can't be distributed over multiple pages, thus a a page break will happen only before or after the whole text. In extreme cases the text will exceed the paper bottom. Nevertheless, separate text blocks can be spread over multiple pages, making it possible to print text documents or books entirely within LilyPond. This feature, and the specific syntax it requires, are described in Multi-page markup. > I suggest > > "4.3.2 Page breaking > > The default page breaking may be overridden by inserting \pageBreak or > \noPageBreak commands. " > > could become > > "4.3.2 Page breaking > > By default page breaks may be inserted at bar lines and between top- > level markups. The default page breaking may be overridden by inserting > \pageBreak or \noPageBreak commands. " Quoting a little more from NR: "The default page breaking may be overridden by inserting \pageBreak or \noPageBreak commands. These commands are analogous to \break and \noBreak. They should be inserted at a bar line. [...] The \pageBreak and \noPageBreak commands may also be inserted at top-level, between scores and top-level markups." Does it not contain all what's needed to know? > > As a further point is the term "standard markup objects" well- > documented - does it mean "top-level markups", or what I tend to refer > to as \markup{} blocks? I think what's meant is the difference between \markup and \markuplist Cheers,   Harm _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user
Open this post in threaded view
|

## Re: Protecting against page breaks in markup

 Thomas Morley <[hidden email]> writes: > Am Do., 29. Nov. 2018 um 11:04 Uhr schrieb Richard Shann > <[hidden email]>: > >> >> As a further point is the term "standard markup objects" well- >> documented - does it mean "top-level markups", or what I tend to refer >> to as \markup{} blocks? > > I think what's meant is the difference between \markup and \markuplist It's worth pointing out that for typographic treatment a toplevel markup (namely a markup invoked outside of any other expression) is indistinguishable from a markup list with a single element: either are processed by calling toplevel-text-handler with a markup list (in case of the markup, a list containing just one markup as element). -- David Kastrup _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user
Open this post in threaded view
|

## Re: Protecting against page breaks in markup

 Am Do., 29. Nov. 2018 um 23:22 Uhr schrieb David Kastrup <[hidden email]>: > > Thomas Morley <[hidden email]> writes: > > > Am Do., 29. Nov. 2018 um 11:04 Uhr schrieb Richard Shann > > <[hidden email]>: > > > >> > >> As a further point is the term "standard markup objects" well- > >> documented - does it mean "top-level markups", or what I tend to refer > >> to as \markup{} blocks? > > > > I think what's meant is the difference between \markup and \markuplist > > It's worth pointing out that for typographic treatment a toplevel markup > (namely a markup invoked outside of any other expression) is > indistinguishable from a markup list with a single element: either are > processed by calling toplevel-text-handler with a markup list (in case > of the markup, a list containing just one markup as element). > > -- > David Kastrup You mean what can be observed with below? \markup \italic "foo-1" \markup \italic "bar-1" \markup \italic "buzz-1" \markuplist \italic { "foo-2" "bar-2" "buzz-2" } #(newline) #(display-scheme-music (reverse (ly:parser-lookup 'toplevel-scores))) => (list (list (markup #:italic "foo-1"))       (list (markup #:italic "bar-1"))       (list (markup #:italic "buzz-1"))       (list (markup #:italic "foo-2")             (markup #:italic "bar-2")             (markup #:italic "buzz-2"))) If I add: \paper {   ragged-last-bottom = ##f   markup-markup-spacing.stretchability = 1000 } and watch the printed output, the single markups are distributed over the page, while the elements of the markuplist are kept close together. Am undecided whether I should have expected it or should be surprised ... lol Cheers,   Harm _______________________________________________ lilypond-user mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/lilypond-user