Forcing line breaks without changing bar lines

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Forcing line breaks without changing bar lines

Li Jie Wong-2
Is it possible to make a function that will do the equivalent of...

  \break

when at a bar boundary, and

  \bar "" \break

otherwise?

Basically, I just want a line break at a point, without lilypond fussing about whether the break is at a valid position or not, but I also don't want to erase any bar lines (which happens if I just indiscriminately use \bar "" \break).

Thanks,
lj

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Forcing line breaks without changing bar lines

David Kastrup
Li Jie Wong <[hidden email]> writes:

> Is it possible to make a function that will do the equivalent of...
>
>   \break
>
> when at a bar boundary, and
>
>   \bar "" \break
>
> otherwise?
>
> Basically, I just want a line break at a point, without lilypond fussing
> about whether the break is at a valid position or not, but I also don't
> want to erase any bar lines (which happens if I just indiscriminately use
> \bar "" \break).
Not sure this is the best way: it seems sort of hackish.


maybeBreak =
\context Score
\applyContext #(lambda (c)
                (if (not (string? (ly:context-property c 'whichBar)))
                 (set! (ly:context-property c 'whichBar) "")))

{
  r8
  \repeat unfold 40 { r4 \bar "|" \maybeBreak r2 \maybeBreak r4 }
  r2.. | \bar "|."
}


--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Forcing line breaks without changing bar lines

Li Jie Wong-2
Thanks! It works perfectly :)

On Tue, 6 Jun 2017 at 01:57 David Kastrup <[hidden email]> wrote:
Li Jie Wong <[hidden email]> writes:

> Is it possible to make a function that will do the equivalent of...
>
>   \break
>
> when at a bar boundary, and
>
>   \bar "" \break
>
> otherwise?
>
> Basically, I just want a line break at a point, without lilypond fussing
> about whether the break is at a valid position or not, but I also don't
> want to erase any bar lines (which happens if I just indiscriminately use
> \bar "" \break).

Not sure this is the best way: it seems sort of hackish.


--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user