Jump to content

Aligning text marks to notes: Difference between revisions

From LilyPond wiki
m added categories
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
By default, <code>TextMark</code> objects are aligned to the left edge of the staff. They can be aligned to the first note of the line instead by setting the <code>non-musical</code> property to false.
By default, <code>TextMark</code> objects are aligned to so-called <code>NonMusicalPaperColumn</code> grobs, like the left edge of the staff or a bar line. They can be aligned to a note instead by setting the <code>non-musical</code> property to <code>#f</code>.


<lilypond version="2.24">
<lilypond version="2.24">
\paper {
\layout {
   indent = #0
   line-length = 80\mm
  ragged-right = ##t
}
}


{
{
   \textMark "mark a"
   \textMark "mark a" c'1 |
   c'1 |
   \textMark "mark b" c'1 |
   \break
   \break
   \override Score.TextMark.non-musical = ##f
   \override Score.TextMark.non-musical = ##f
   \textMark "mark b"
   \textMark "mark c" c'1 |
   c' |
   \textMark "mark d" c'1 |
}
}
</lilypond>
</lilypond>
[[Category:Really simple]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Text]]
[[Category:Text]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 05:36, 24 December 2025

By default, TextMark objects are aligned to so-called NonMusicalPaperColumn grobs, like the left edge of the staff or a bar line. They can be aligned to a note instead by setting the non-musical property to #f.

\version "2.24"

\layout {
  line-length = 80\mm
}

{
  \textMark "mark a" c'1 |
  \textMark "mark b" c'1 |
  \break
  \override Score.TextMark.non-musical = ##f
  \textMark "mark c" c'1 |
  \textMark "mark d" c'1 |
}