Hi Gabriel,

Am 01.04.26 um 05:05 schrieb Gabriel Ellsworth:

I am already getting the output that I need, but I am curious:

  * Why does specifying a context for InstrumentName.X-offsetcause
    problems?
  * Or, put another way, why do I get what I need only if I
    don’tspecify a context for InstrumentName.X-offset?

IIUC, an incipit is part of an instrumentNamegrob.

I'm not an expert in this area, but the way I understand it:

 * Both instrumentName and vocalName (same for shortXXX) are used by
   the Instrument_name_engraver. This engraver (if I read the C++
   source correctly) tries to read its context's
   instrumentName/shortInstrumentName, and if they are both empty,
   takes vocalName and shortVocalName instead. In any case, the grob it
   creates is an InstrumentName grob.
 * The Instrument_name_engraver is \consist'ed by default to the
   following contexts:
     o FretBoards
     o Staff
     o RhythmicStaff
     o StaffGroup
     o Lyrics
 * If you do \override InstrumentName.X-offset = ... without specifying
   a context, then "bottom" context is affected (that's the part where
   my understanding is a bit vague)
 * Lyrics is a bottom context, whereas in usual music, the Bottom
   context is a Voice context. You can try this by inserting
   \showContext at various places in your .ly source code with defining

showContext = \applyContext #(lambda (ctx) (pretty-print ctx))

Taken together, these points seem to me to explain the behaviour you observed: Setting the X-offset without a Context specification affects the InstrumentName grob (taken from vocalName) for Lyrics. It also would affect the InstrumentName in a Voice context, but this doesn't get created. If you specify Staff.InstrumentName.X-offset, you only affect the InstrumentName in Staff contexts without affecting those in a Lyrics context. If you specify Score.InstrumentName.X-offset, you affect all InstrumentName grobs (as they all live in child contexts of Score).

So, what I'd propose would be to use

\override Lyrics.InstrumentName.X-offset

in order to make your LilyPond file self-explanatory.

Lukas

Reply via email to