Jump to content

Using markup for a staff's instrumentName: Difference between revisions

From LilyPond wiki
Import snippet from LSR
 
m New category
Tags: Mobile edit Mobile web edit
 
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:
This example also shows how to combine several text markup objects and properly shift them before overlaying them.
This example also shows how to combine several text markup objects and properly shift them before overlaying them.


<lilypond version="2.24.0">
<lilypond version="2.24">
%% http://lsr.di.unimi.it/LSR/Item?id=515
%% http://lsr.di.unimi.it/LSR/Item?id=515


Line 24: Line 24:
[[Category:Editorial annotations]]
[[Category:Editorial annotations]]
[[Category:Percussion]]
[[Category:Percussion]]
[[Category:Snippet]]

Latest revision as of 23:22, 21 November 2025

The instrumentName property of a staff or a staff group can take arbitrary markup. For example, rather than writing “Percussion”, you can also print two sticks to indicate percussion.

This example also shows how to combine several text markup objects and properly shift them before overlaying them.

\version "2.24"

%% http://lsr.di.unimi.it/LSR/Item?id=515

\new Staff = "Percussion" <<
  %Use a markup as the instrumentName for the staff!
  \set Staff.instrumentName = \markup {
    \combine
      \translate #(cons -1.25 0) \combine
        \draw-circle #0.65 #0 ##t
        \override #'(thickness . 2.5) \draw-line #'(3 . -3)
      \translate #(cons 1.25 0) \combine
        \draw-circle #0.65 #0 ##t
        \override #'(thickness . 2.5) \draw-line #'(-3 . -3)
  }
  \new Voice \relative c' { c1 }
>>