lilypond-user
[Top][All Lists]
Advanced

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

Re: how to automatically left-align rehearsal marks at the beginning of


From: Thomas Morley
Subject: Re: how to automatically left-align rehearsal marks at the beginning of a line
Date: Wed, 15 Oct 2014 18:33:33 +0200

2014-10-15 6:11 GMT+02:00 user3871075 <address@hidden>:
> Hello,
>
> I occasionally have a rehearsal mark fall on the first measure of a line,
> and I have to manually make it left-aligned so it will print.  (I use small
> margins.)  However, then I have more manual work if the music layout changes
> enough that the rehearsal mark is no longer on the first measure of the
> line.  I typically wait until the very end to do manual layout tweaks to
> minimize issues like this, but it would be nice not to have to do them at
> all.
>
> Here's a snippet which shows the problem in an extreme way:
>
> \relative c'' {
>   c1 \mark \markup "this should be left aligned" | \break c1
> }
>
> Is there a setting somewhere for this?
>
> Note: I don't want all rehearsal marks left-aligned - just the ones that
> happen to fall at the beginning of a line.
>
> The same question could be asked about rehearsal marks that are at the end
> of a line.  Although the importance is much lower since AFAIK manual
> tweaking is usually necessary to even get a rehearsal mark at the end of a
> line.
>
> Thanks for your help!
>
> -Russ

Hi,

how about:

\version "2.19.13"

\layout {
  \context {
    \Score
    \override RehearsalMark.self-alignment-X =
      #(lambda (grob)
        (let* ((break-dir (ly:item-break-dir grob)))
          (case break-dir
            ((-1) RIGHT)   ;; end-of-line -> right alignedd
            ((1) LEFT)     ;; begin-of-line -> left-aligned
            (else CENTER)  ;; otherwise -> center-aligned
            )))
  }
}

\relative c'' {
  c1
  \tweak break-visibility #end-of-line-visible
  \mark "this should be right aligned" |
  \break
  c1
  \mark "this should be center aligned"
  c1
  \mark "this should be left aligned" |
  \break
  c1
}

HTH,
  Harm



reply via email to

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