Mark Knoop <[email protected]> writes:

> At 20:20 on 14 May 2025, James Harkins wrote:
>>   \tempo \markup { \rhythm { 8 } = \rhythm { 8 } }
>
>> Lilypond does not like it one bit:
>
>> ./common/globals.ily:139:28: error: wrong type for argument 1.  Expecting 
>> music, found (ly:make-duration 3)
>>   \tempo \markup { \rhythm 
>>                            { 8 } = \rhythm { 8 } }
>
>> Now I didn't think I differed *so much* from the docs example, but 
>> apparently I've done something wrong.
>
> Your syntax works for me with 2.25.25 - are you sure you're running
> the same version as the docs you're reading?

The docs James quoted stated

\relative {
  \tempo \markup {
    Swing
    \hspace #0.4
    \rhythm { 8[ 8] } = \rhythm { \tuplet 3/2 { 4 8 } }
  }
  b8 g' c, d ees d16 ees d c r8
}

which can only interpret the \rhythm arguments as music.  The
disambiguation necessary for accepting { 8 } was added in version 2.25.0
with

commit 276d688a358ff49e04b8b18e91ac15d56276cb62
Author: Jean Abou Samra <[email protected]>
Date:   Sun Dec 18 18:27:24 2022 +0100

    Accept bare pitches/durations as music arguments to markup commands
    
    This adds a tiny bit of the smart argument handling music functions have to
    markup commands.  Namely, if a command expects a Scheme argument (i.e., the
    predicate is not markup? or markup-list?), and { <pitch> } or { <duration> 
} is
    passed, the music interpretation as note event of those constructs is tried 
as
    well against the predicate.  The most obvious use case is
    
      \markup \rhythm { 8. }


The original commit implementing \rhythm in version 2.23.11 listed the
original limitation:

commit fd36c2f4e62a9a8122712e489b17d7227c6571a1
Author: Jean Abou Samra <[email protected]>
Date:   Wed Jul 6 19:21:45 2022 +0200

    Add \rhythm markup command
    
    \rhythm takes a music expression and typesets it using an embedded
    score, which is mostly useful for tempo specifications.  This feature
    has asked about frequently (last time today on -user-fr), and is found
    in the popular LSR snippets https://lsr.di.unimi.it/LSR/Item?id=204
    and https://lsr.di.unimi.it/LSR/Item?id=1029
    
    Its internals are powered by new context types,
    StandaloneRhythmic(Score|Staff|Voice).  One reason is to allow global
    tweaks with \layout { \context { \StandaloneRhythmicXXX ... } }.
    Another is to avoid settings from stylesheets made with \context {
    \Voice ... } being applied to \rhythm accidentally, as they're likely
    not intended there.  They can be applied to StandaloneRhythmicVoice
    explicitly if needed.
    
    Known issue: \rhythm { 8 } does not work because 8 is interpreted as a
    duration.  One has to use \rhythm { { 8 } }.
    
    Fixes #6221


-- 
David Kastrup


Reply via email to