On 2024-04-29 7:50 am, Pierre-Luc Gauthier wrote:
Can a markup command introspect its direction ?

Is it possible to set in a markup command some conditionals (not paper
related) ?

\version "2.25.15"

#(define-markup-command (conditionalMrkp layout props)
   ()
   (interpret-markup layout props #{
     \markup {
       %\if #DOWN
       "↑"
       %\if #UP
       "↓"
                     }#}))

{b'^\markup \conditionalMrkp b'_\markup \conditionalMrkp}


%%%%
\version "2.24.3"

is-directional =
#(lambda (layout props)
  (number? (chain-assoc-get 'direction props #f)))

is-upward =
#(lambda (layout props)
  (eq? UP (chain-assoc-get 'direction props #f)))

is-downward =
#(lambda (layout props)
  (eq? DOWN (chain-assoc-get 'direction props #f)))

asdf = \markup \circle \overlay {
  \if \is-upward ↑ \if \is-downward ↓
  \unless \is-directional \pad-around #0.25 *
}

\layout { indent = 0 }
\asdf
{ b'4-\asdf 4_\asdf 2^\asdf }
%%%%


-- Aaron Hill

Reply via email to