Jump to content

Volta text markup using repeatCommands: Difference between revisions

From LilyPond wiki
No edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Though volte are best specified using <code>\repeat volta</code>, the context property <code>repeatCommands</code> must be used in cases where the volta text needs more advanced formatting with <code>\markup</code>.
Though volte are best specified using <code>\repeat volta</code>, the context property <code>repeatCommands</code> must be used in cases where the volta text needs more advanced formatting with <code>\markup</code>.


Since <code>repeatCommands</code> takes a list, the simplest method of including markup is to use an identifier for the text and embed it in the command list using the Scheme syntax <code>#(list (list 'volta textIdentifier))</code>. Start- and end-repeat commands can be added as separate list elements:
Since <code>repeatCommands</code> takes a list, the simplest method of including markup is to use an identifier for the text and embed it in the command list using the Scheme syntax <code>#`((volta ,<var>textIdentifier</var>) ...)</code> (note the use of the backtick after <code>#</code> and the comma before <var>textIdentifier</var>). Start- and end-repeat commands can be added as separate list elements.


<lilypond version="2.24">
<lilypond version="2.24">
Line 8: Line 8:
\relative c'' {
\relative c'' {
   c1
   c1
   \set Score.repeatCommands = #(list (list 'volta voltaAdLib) 'start-repeat)
   \set Score.repeatCommands = #`((volta ,voltaAdLib) start-repeat)
   c4 b d e
   c4 b d e
   \set Score.repeatCommands = #'((volta #f) (volta "4.") end-repeat)
   \set Score.repeatCommands = #'((volta #f) (volta "4.") end-repeat)
Line 16: Line 16:
</lilypond>
</lilypond>


[[Category:Repeats]]
[[Category:Repeats]]
[[Category:Repeats]]
[[Category:Symbols and glyphs]]
[[Category:Symbols and glyphs]]
[[Category:Text]]
[[Category:Text]]
[[Category:Included in the official documentation]][[Category:Snippet]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 10:59, 4 December 2025

Though volte are best specified using \repeat volta, the context property repeatCommands must be used in cases where the volta text needs more advanced formatting with \markup.

Since repeatCommands takes a list, the simplest method of including markup is to use an identifier for the text and embed it in the command list using the Scheme syntax #`((volta ,textIdentifier) ...) (note the use of the backtick after # and the comma before textIdentifier). Start- and end-repeat commands can be added as separate list elements.

\version "2.24"

voltaAdLib = \markup { 1. 2. 3... \text \italic { ad lib. } }

\relative c'' {
  c1
  \set Score.repeatCommands = #`((volta ,voltaAdLib) start-repeat)
  c4 b d e
  \set Score.repeatCommands = #'((volta #f) (volta "4.") end-repeat)
  f1
  \set Score.repeatCommands = #'((volta #f))
}