Came back for another go.

This time I've defined a variable called instrumentNameFieldWidth and used \markup \overlay to create a custom-width field just for the part names. It's a bit of a manual hack and isn't the elegant auto-solution you wanted, but it works.

Disregard my earlier attachment. This is a refinement.


On 19/4/22 11:34 pm, Adam Griggs wrote:
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.22.2"

global = 
{
	\key g \dorian
}

SopranoOne = 
\relative d''
{
	d1 |
}

AltoOne = 
\relative c''
{
	R1 |
}

TenorOne = 
\relative c'
{
	R1 |
}

BassOne = 
\relative c'
{
	R1 |
}

cantusNotes =
<<
	\global
	\SopranoOne
>>

altoNotes =
<<
	\global
	\AltoOne
>>

tenorNotes =
<<
	\global
	\TenorOne
>>

bassusNotes =
<<
	\global
	\BassOne
>>

incipitCantus =
\relative d''
{
	\clef "petrucci-c1"
	\key g \dorian
	\time 4/4
	d1
}

incipitAltus =
\relative g'
{
	\clef "petrucci-c3"
	\key g \dorian
	\time 4/4
	g1
}

incipitTenor =
\relative d'
{
	\clef "petrucci-c4"
	\key g \dorian
	\time 4/4
	d1
}

incipitBassus =
\relative g
{
	\clef "petrucci-f4"
	\key g \dorian
	\time 4/4
	g1
}

instrumentNameFieldWidth = #15/2

\score {
	%\keepWithTag #'score
	\transpose c d % score transposition
	<<
		\new StaffGroup
		<<
			%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
			\new Staff = "cantusStaff" \with {
				instrumentName =
				\markup
				\overlay
				{
					\hspace #instrumentNameFieldWidth
					"Cantus"
				}
				shortInstrumentName = ""
			}
			{
				\new Voice = "cantusVoice"
				\incipit \incipitCantus
				\clef "treble"
				\cantusNotes
			}
			%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
			\new Staff = "altusStaff" \with {
				instrumentName =
				\markup
				\overlay
				{
					\hspace #instrumentNameFieldWidth
					"Altus"
				}
				shortInstrumentName = ""
			}
			{
				\new Voice = "altusVoice"
				\incipit \incipitAltus
				\clef "treble"
				\altoNotes
			}
			%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
			\new Staff = "tenorStaff" \with {
				instrumentName =
				\markup
				\overlay
				{
					\hspace #instrumentNameFieldWidth
					"Tenor"
				}
				shortInstrumentName = ""
			}
			{
				\new Voice = "tenorVoice"
				\incipit \incipitTenor
				\clef "treble_8"
				\tenorNotes
			}
			%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
			\new Staff = "bassusStaff" \with {
				instrumentName =
				\markup
				\overlay
				{
					\hspace #instrumentNameFieldWidth
					"Bassus"
				}
				shortInstrumentName = ""
			}
			{
				\new Voice = "bassusVoice"
				\incipit \incipitBassus
				\clef "bass"
				\bassusNotes
			}
			%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
		>>
	>>
	\layout {
		\context {
			\Staff
			\override InstrumentName.extra-offset = #'(-1/2 . 0)
			%\override InstrumentName.self-alignment-X = #LEFT
		}
		\context {
			\Voice
			\consists "Ambitus_engraver"
		}
		\context {
			\MensuralStaff
			\override TimeSignature.style = #'neomensural
			\override InstrumentName.extra-offset = #'(-1/2 . 0)
		}
		\context {
			\MensuralVoice
			\override Stem.neutral-direction = #up
			\override NoteHead.style = #'neomensural
			\override Rest.style = #'neomensural
		}
	}
}

\paper{
	indent = 40
}

Reply via email to