Attached an other way to create aligned incipits.

HTH

Rémy

envoyé : 19 avril 2022 à 16:34
de : Adam Griggs <adammgri...@gmail.com>
à : lilypond-user@gnu.org
objet : Re: Incipit alignment


Use that \incipit command, and move as much as you can to the \layout
block to simplify the \score.

See the attached file for how I do it. One catch though: you said you'd
like the part names to be left-aligned. Sorry, I don't have time to set
that up right now.

Out of curiosity, what piece is that you are engraving there?


On 19/4/22 10:50 pm, Martin Baker wrote:

Thanks, David, that’s very helpful and certainly an improvement. I’ll keep working along the lines you suggest. M

>> On 19 Apr 2022, at 14:41, David Kastrup <d...@gnu.org> wrote:>>
>> Martin Baker <martinbake...@mac.com> writes:
>>
>>> Ah, I thought I’d deleted everything unnecessary, but missed the
>>> “system-spacing = “ line. Code re-pasted below.
>> Well, I outcommented it. You could try doing it in this manner:
>>
>> \version "2.22.2"
>> \language "english"
>>
>> incipitwidth = 5
>>
>> global =
>> {
>> \key g \major
>> }
>>
>> SopranoOne =
>> \relative c''
>> {
>> e1 |
>> }
>>
>> AltoOne =
>> \relative c''
>> {
>> R1 |
>> }
>>
>> TenorOne =
>> \relative c'
>> {
>> R1 |
>> }
>>
>> BassOne =
>> \relative c'
>> {
>> R1 |
>> }
>>
>> incipitCantus = \markup {
>> \score
>> {
>> {
>> \set Staff.instrumentName = "Cantus"
>> \override NoteHead.style = #'neomensural
>> \override Rest.style = #'neomensural
>> \override Staff.TimeSignature.style = #'neomensural
>> \clef "petrucci-c1"
>> \key f \major
>> \time 4/4
>> d''1
>> }
>> \layout {
>> line-width=\incipitwidth
>> indent = 0
>> }
>> }
>> }
>>
>> incipitAltus = \markup {
>> \score
>> {
>> {
>> \set Staff.instrumentName = "Altus"
>> \override NoteHead.style = #'neomensural
>> \override Rest.style = #'neomensural
>> \override Staff.TimeSignature.style = #'neomensural
>> \clef "petrucci-c3"
>> \key f \major
>> \time 4/4
>> g'1
>> }
>> \layout {
>> line-width=\incipitwidth
>> indent = 0
>> }
>> }
>> }
>>
>> incipitTenor = \markup {
>> \score
>> {
>> {
>> \set Staff.instrumentName = "Tenor"
>> \override NoteHead.style = #'neomensural
>> \override Rest.style = #'neomensural
>> \override Staff.TimeSignature.style = #'neomensural
>> \clef "petrucci-c4"
>> \key f \major
>> \time 4/4
>> d'1
>> }
>> \layout {
>> line-width=\incipitwidth
>> indent = 0
>> }
>> }
>> }
>>
>> incipitBassus = \markup {
>> \score
>> {
>> {
>> \set Staff.instrumentName = "Bassus"
>> \override NoteHead.style = #'neomensural
>> \override Rest.style = #'neomensural
>> \override Staff.TimeSignature.style = #'neomensural
>> \clef "petrucci-f4"
>> \key f \major
>> \time 4/4
>> g1
>> }
>> \layout {
>> line-width=\incipitwidth
>> indent = 0
>> }
>> }
>> }
>>
>> incipitWith = \with
>> {
>> \override InstrumentName.self-alignment-X = #RIGHT
>> \override InstrumentName.self-alignment-Y = ##f
>> }
>>
>> \score {
>> <<
>> \new ChoirStaff
>> <<
>> \new Staff \with \incipitWith <<
>> \global
>> \set Staff.instrumentName = \incipitCantus
>> \clef "G"
>> \new Voice="v1" {
>> \SopranoOne
>> }
>> >>
>>
>> \new Staff \with \incipitWith <<
>> \global
>> \set Staff.instrumentName = \incipitAltus
>> \clef "G"
>> \new Voice="v2" {
>> \AltoOne
>> }
>> >>
>>
>> \new Staff \with \incipitWith <<
>> \global
>> \set Staff.instrumentName = \incipitTenor
>> \clef "G_8"
>> \new Voice="v3" {
>> \TenorOne
>> }
>> >>
>>
>> \new Staff \with \incipitWith <<
>> \global
>> \set Staff.instrumentName = \incipitBassus
>> \clef "F"
>> \new Voice="v4" {
>> \BassOne
>> }
>> >>
>> }
>>
>>
>> \paper{
>> indent = 3.5\cm
>> % system-system-spacing =
>> }
>>
>> Not fond of that indentation but not willing to invest time fixing it,
>> either.
>>
>> I think there is an \incipit command that can help with the task but I
>> am too lazy to read up on it right now. But it should be documented
>> somewhere. At any rate, your code just needs working with the
>> self-alignment-X and self-alignment-Y settings of the outer
>> InstrumentName .
>>
>> --
>> David Kastrup
>

\version "2.18.2"

incipit =
#(define-music-function (parser location incipit-music) (ly:music?)
   #{
     \once \override Staff . InstrumentName . self-alignment-X = #RIGHT
     \once \override Staff . InstrumentName . self-alignment-Y = ##f
     \once \override Staff . InstrumentName . padding = #0.5
     \once \override Staff . InstrumentName . stencil =
     #(lambda (grob)
        (let* ((instrument-name (ly:grob-property grob 'long-text)))
          (set! (ly:grob-property grob 'long-text)
                #{ \markup { 
                  \score
                  {
                    { \context PetrucciStaff \with {
                      instrumentName = #instrument-name                      
                      \once \override Staff . KeySignature #'X-offset = #-1.2
                      } $incipit-music            
                    } 
                    \layout { $(ly:grob-layout grob)
                              line-width = \indent
                              indent =
                              % primitive-eval is probably easiest for
                              % escaping lexical closure and evaluating
                              % everything respective to (current-module).
                              #(primitive-eval
                                '(or (false-if-exception (- indent incipit-width))
                                     (* 0.5 indent)))
                              ragged-right = ##f
                              ragged-last = ##f
                              system-count = #1 }
                  } 
                  \hspace #0.5                  
                   }
                #})
          (system-start-text::print grob)))
   #})

music_incipit = {
  \override Staff . Accidental #'glyph-name-alist = #alteration-mensural-glyph-name-alist
  \override Staff . KeySignature #'glyph-name-alist = #alteration-mensural-glyph-name-alist
  \override Staff . TimeSignature #'glyph-name-alist = #alteration-mensural-glyph-name-alist
  \override Staff . BassFigure #'glyph-name-alist = #alteration-mensural-glyph-name-alist
  \override Staff . BarLine . transparent = ##t
  \override Staff . Rest . style  = #'mensural  
  \override Staff . TimeSignature #'stencil = #ly:text-interface::print
  \override Staff . TimeSignature #'text = \markup \musicglyph #"timesig.mensural22"
  \key f \major 
  s4
  }
\score {
  \keepWithTag #'Cond
  \new GrandStaff
  <<
    \new PianoStaff
    <<
      \new Staff
      <<        
        \incipit { \clef "petrucci-c1"  \music_incipit a'4 c' s4}
        \set Staff . instrumentName =  \markup\center-column { "Viola" "Prima"  }
        \set Staff.shortInstrumentName = \markup { "Vn. I" }
        \new Voice { \autoBeamOn \clef treble a'4 c' }
      >>
      \new Staff
      <<
        \incipit { \clef "petrucci-c1"\music_incipit c'4 a' s4 }
        \set Staff . instrumentName =  \markup\center-column { "Viola" "Secunda"  }
        \new Voice { \autoBeamOn  \clef treble c'4 a' }
      >>
    >>
  >>
  \layout
  {
    indent = 4.5 \cm
    short-indent = 0.5\cm
    incipit-width = 1.6\cm
  }
}

Reply via email to