Skip to content

Add text marks

Jean Abou Samra requested to merge jeanas/lilypond:text-marks into master

This addresses several long-standing limitations with rehearsal marks, namely

  • the impossibility to have several rehearsal marks at the same moment,

  • the misnomer "RehearsalMark" for a grob that can also print completely arbitrary markups that aren't necessarily rehearsal indications, and relatedly, the impossibility to style true rehearsal marks and other marks separately.

This is done by adding a new TextMark grob separate from RehearsalMark. A TextMark is created by \textMark or \textEndMark .

There can be any number of text marks at a given moment. It is still not supported to have two true rehearsal marks at the same moment, but for actual rehearsal marks, this should not be a problem.

There are some more ways in which text marks unentangle their use cases from rehearsal marks:

  • Whether a text mark is visible on the previous or the next system if it sits on a line break is a fundamental property of the mark that the user needs to make a decision about every time. End-of-line text marks are expected not to be much more rare than begin-of-line ones. This is why there are two separate commands \textMark and \textEndMark, unlike \mark which requires tweaking break-visibility. The idea is that a text mark about the preceding music should use \textEndMark, and other text marks should use \textMark. This encourages writing the music semantically in a way that is robust to changes in line breaks. In this spirit, \textMark and \textEndMark also have different defaults for self-alignment-X mid-line (see below).

    In particular, note that Mark_engraver special-cases marks at the end of the score to make the end-of-line-visible. Since a true rehearsal mark doesn't make sense at the end of the score, this is meant for rehearsal marks (ab)used for text. With text marks, there is no such special case. A text mark at the end of the score should just use \textEndMark.

  • By default, \textMark produces left-aligned marks, and \textEndMark produces right-aligned marks. Rehearsal marks in contrast are often centered, which doesn't look good with somewhat wide text, as can be expected for most text marks (as compared to a 1-letter rehearsal mark).

Although commands like \jump and \sectionLabel cover most uses for non-musical text, they do not cover all uses. Thus, \textMark is intended for all special uses for which no built-in feature is present, and it is recommended to look for a more specific command first. These are some example use cases for text marks:

  • solo/duo indications (without using \partCombine),

  • "<location>, <year>" below the last system,

  • "ad lib" over a repeat bar line,

  • instructions for pedagogical exercises.

Fixes #5631 (closed), #3166 (closed)

I want this in the 2.24 release, so I have deferred the documentation for now. I propose to open an issue when (if) this is merged. When I address it, I will also convert uses of \mark "..." and \mark \markup ... to \textMark/\textEndMark.


Edited by Jean Abou Samra

Merge request reports