lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scheme help request: How can else of an if-statement be made to do n


From: Thomas Morley
Subject: Re: Scheme help request: How can else of an if-statement be made to do nothing?
Date: Sat, 17 Oct 2020 21:23:39 +0200

Am Sa., 17. Okt. 2020 um 20:33 Uhr schrieb David Kastrup <dak@gnu.org>:
>
> Thomas Morley <thomasmorley65@gmail.com> writes:
>
> > Am Sa., 17. Okt. 2020 um 19:39 Uhr schrieb Jean Abou Samra 
> > <jean@abou-samra.fr>:
> >>
> >> The point of interpret-markup is to turn a markup into a stencil, so I'd
> >> use empty-stencil:
> >>
> >> \version "2.20.0"
> >>
> >> #(define-markup-command (print-if-defined layout props sym text)
> >>                          (symbol? markup?)
> >>    (if (defined? sym)
> >>        (interpret-markup layout props
> >>          #{ \markup \with-color #'(0.8 0.2 0.2) #text #})
> >>        empty-stencil))
> >>
> >> symA = "Something"
> >>
> >> \markup {
> >>    \print-if-defined #'symA "Text"
> >>    \print-if-defined #'symB "More text"
> >> }
> >>
> >
> > An empty stencil will still be spaced (unless removed by other
> > markup-commands).
>
> empty-stencil will typically not trigger additional spacing.  That's
> typically what distinguishes it from point-stencil .
>
> --
> David Kastrup

Well, I'd say it depends how that empty-stencil is consumed. See:

\markup
  \box
  { \stencil #point-stencil \stencil #empty-stencil \stencil #point-stencil }

Here I did something silly (of course there are warnings emitted) and
the output _is_ affected.

Thus, the detailed use-case is important...

Cheers,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]