%%%  BEGINNING OF FILE
\version "2.27.3"

%%  FUNCTIONS — Credits: Lukas and Kieren
pack = {
  \override Score.SpacingSpanner.packed-spacing = ##t
  \newSpacingSection
}

unpack = {
  \override Score.SpacingSpanner.packed-spacing = ##f
  \newSpacingSection
}

vanish = {
  \omit Score.NoteHead
  \omit Score.Dots
  \omit Score.Stem
  \omit Score.Beam
  \omit Score.Flag
  \omit Score.Tie
  \omit Score.Slur
  \omit Score.Rest
  \set Score.squashedPosition = 0
  \set Score.nullAccidentals = ##t
  \override Score.NoteHead.no-ledgers = ##t
  \override Score.NoteColumn.ignore-collision = ##t
}

unvanish = \undo \vanish

hider = \context Bottom {
  s1 \vanish s4*4 \unvanish s4*6 |
  
  s1 \vanish s4*11 \unvanish s4*9 |
}

%%  LYRICS and MUSIC
% Text: Psalm 56:4
words = \lyricmode {
  I will praise God, be --
  cause of his word:
  
  I have put my trust in God,
  and will not fear what
  flesh can do un -- to me.
}

% Music
chant = \relative c'' {
  \time 14/4
  \pack
  d1 % With \pack on, I can enter a whole note,
  % which is more intuitive and quick for me
  % than typing d1*1/4 — hooray!
  4 4 4 4 % end of reciting note
  \unpack
  f e d2 e2 |

  \time 24/4
  \pack
  d1
  4 4 4 4 4 4
  4 4 4 4 4 % end of reciting note
  \unpack
  e d d c c b2( a2) |
}

%%  STAVES
% Staff with one voice only:
staffCantor = \new Staff <<
  \new Voice = "cantor" \chant
  \new Lyrics \lyricsto "cantor" \words
>>

% Staff with two voices (soprano and alto in unison):
staffSA = \new Staff <<
  \new Voice = "soprano" { \voiceOne \chant }
  \new Voice = "alto" { \voiceTwo \chant }
  \new Lyrics \lyricsto "soprano" \words
>>

%%  LAYOUT and PAPER
\layout {
  \context {
    \Score
    \omit TimeSignature
    forbidBreakBetweenBarLines = ##f
    % allows breaks to occur within measures/bars
  }
  \context {
    \Voice
    \consists Pitch_squash_engraver % for \vanish command
  }
  \context {
    \Lyrics
    % Force all lyric hyphens to display for clarity to singers:
    \override LyricHyphen.minimum-distance = #0.8
  }
}

\paper {
  indent = 0
  % Default line width for this book:
  line-width = 140\mm
}

%%  SCORES
% Score 1B (different from yesterday’s Score 1)
\markup \wordwrap {
  \circle 1B Plain score, now with the
  \typewriter "\\pack" command applied:
}
\score {
  \staffCantor
}
\markup \vspace #2

% Score 4 (for 2 and 3, see previous email to list)
\markup \wordwrap {
  \circle 4 Using the \typewriter "\\pack" and
  \typewriter "\\hider" commands:
}
\score {
  <<
    \staffCantor
    \hider
  >>
}
\markup \vspace #2

% Score 5
\markup \wordwrap {
  \circle 5 With \typewriter "\\line-width" of 80 mm:
}
\score {
  <<
    \staffCantor
    \hider
  >>
  \layout {
    line-width = 80\mm
  }
}
\markup \vspace #2

% Score 6
\markup \wordwrap {
  \circle 6 With \typewriter "\\line-width" of 89 mm
  and a line break forced before “have”:
}
\score {
  <<
    \staffCantor
    % Add a line break after “I”:
    \new Devnull { s4*15 \break }
    \hider
  >>
  \layout {
    line-width = 89\mm
  }
}
\markup \wordwrap {
  This score shows an extreme case. The point is simply
  to illustrate how tight the horizontal spacing can
  get. In real engraving projects, I would not do this.
  Considering the (unreasonable) layout constraints that
  I have given to LilyPond, it has done a good job here!
}
\markup \vspace #2

%% Scores with two voices (soprano and alto in unison):
% Score 7
\markup \wordwrap {
  \circle 7 With two voices sharing a single staff
  (sopranos and altos in unison):
}
\score {
  <<
    \staffSA
    \hider
  >>
}
\markup \wordwrap {
  This score is analogous to score \circle 4 above.
  The problem:
  There is too much space in “I will” and “I have.”
}
\markup \vspace #2

% Score 8
\markup \wordwrap {
  \circle 8 Using \typewriter "\\omit Stem" to omit stems:
}
\score {
  <<
    \staffSA
    \hider
  >>
  \layout {
    \context {
      \Voice
      \omit Stem % See https://lists.gnu.org/archive/html/lilypond-user/2014-06/msg00055.html
      \override NoteHead.stem-attachment = #'(0 . 0)
      % Source: https://lists.gnu.org/archive/html/lilypond-user/2026-03/msg00002.html
    }
  }
}
\markup \wordwrap {
  The problem from score \circle 7 remains even when
  \typewriter "\\omit Stem" is applied.
}
%%%  END OF FILE