Aligning objects created with the \mark command (obsolete in 2.23)

Revision as of 18:49, 16 November 2025 by Jean Abou Samra (talk | contribs) (Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series)

By default the \mark command centers objects over a bar line. This behavior can be modified to align at right or left.

This snippet is less necessary starting from LilyPond version 2.23.14, where the \textMark and \textEndMark commands have been introduced as an alternative to \mark used with markup. To obtain a left-aligned text mark, use \textMark, and \textEndMark for a right-aligned mark. In most cases, this interface is enough. If you would like to fine-tune the alignment nevertheless, you can still use the override in this snippet, replacing RehearsalMark with TextMark.

Furthermore, using self-alignment-X is explained multiple times in NR. Thus I unapprove it. --Harm

\version "2.24"

\relative c' {
  c1 \mark "(Center)"
  c1
  \once \override Score.RehearsalMark.self-alignment-X = #LEFT
  \mark "(Left)"
  % In 2.23.14 and later, do this instead:
  % \textMark "(Left)"
  c4 c c c
  c4 c c c
  \once \override Score.RehearsalMark.self-alignment-X = #RIGHT
  \mark "(Right)"
  % In 2.23.14 and later, do this instead:
  % \textEndMark "(Right)"
  c1
}