A.11.5 Conditionals

\if condition? (procedure) argument (markup)

Test condition, and only insert argument if it is true. The condition is provided as a procedure taking an output definition and a property alist chain. The procedure is applied, and its result determines whether to print the markup. This command is most useful inside oddHeaderMarkup or similar. Here is an example printing page numbers in bold:

\paper {
  oddHeaderMarkup =
    \markup \fill-line {
      ""
      \if #print-page-number
           \bold \fromproperty #'page:page-number-string
    }
  evenHeaderMarkup =
    \markup \fill-line {
      \if #print-page-number
           \bold \fromproperty #'page:page-number-string
      ""
    }
}
\unless condition? (procedure) argument (markup)

Similar to \if, printing the argument if the condition is false.

The following example shows how to print the copyright notice on all pages but the last instead of just the first page.

\paper {
  oddFooterMarkup = \markup {
    \unless #on-last-page-of-part \fill-line {
      \fromproperty #'header:copyright
    }
  }
}

\header {
  copyright = "? LilyPond Authors. License: GFDL."
  tagline = "? LilyPond Authors.  Documentation placed
under the GNU Free Documentation License
version 1.3."
}

LilyPond — Referencia de la notación v2.23.82 (rama de desarrollo).