[Top][All Lists]

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

Re: footnotes to lyrics

From: Jean Abou Samra
Subject: Re: footnotes to lyrics
Date: Wed, 3 Aug 2022 14:49:33 +0200 (CEST)

> Le 01/08/2022 16:51 CEST, Mogens Lemvig Hansen <> a écrit :
> How do I get a footnote to lyrics – is it even possible. In the example 
> below, “Sing” doesn’t get a footnote mark, “this doesn’t” vanishes, and no 
> error message is given.
> \version "2.23.11"
> \markup { Some \auto-footnote regular "this works" text. }
> \score {
> { c d e f g }
> \addlyrics { \markup { \auto-footnote Sing "this doesn't" } an -- oth -- er 
> song. }
> }

It's quite more complicated, but possible. There
are two ways to add footnotes: the \footnote music
function, and the \footnote and \auto-footnote markup
commands. Yes, there are two different things called
\footnote. If you write \footnote outside of \markup,
it's the music function -- \relative and \transpose
are examples of music functions. On the other hand,
if you use \footnote in \markup, you get the \footnote
markup command, which is similar to \auto-footnote.
It's a known limitation of the implementation of footnotes
that you can't use the \footnote and \auto-footnote
markup commands to add a footnote in markup if this
markup is embedded in music, like you are doing with
the lyric word. They can only be used in standalone markup.
Within music, you need to use the \footnote music function,
which adds a footnote around an arbitrary grob
(= graphical object = layout object). The grob you want
to annotate here is LyricText, so the syntax is

\footnote #'(x . y) "footnote text" LyricText

Note that \footnote also supports another syntax:

\footnote #'(x . y) "footnote text" <event>

but in this case, the event would have to be your
lyric text "Sing", and there's no way to distinguish
this from the first case, so LilyPond would choose
the first interpretation and complain that "Sing"
isn't a grob. So, for a LyricText, you have no choice
but to use the first (\override-like) form.

Furthermore, the \footnote music function adds a line
between the grob and the footnote mark by default,
you need to suppress it by overriding annotation-line to ##f.
You also need to place the footnote mark well. The problem
here is the #'(x . y) offset is not sufficient for your
case since giving a positive y value makes the footnote
mark aligned to the top of the text, which is already too
high. So, you need to override the {X,Y}-attachment properties.

TL;DR: this is how I'd do it:

\version "2.23.11"

\markup { Some \auto-footnote regular "this works" text. }

\score {
  { c d e f g }
  \addlyrics {
    %% Remove line between lyric text and "2" mark.
    \once \override Footnote.annotation-line = ##f
    %% Set alignment of "2" mark.
    \once \override Footnote.X-attachment = #RIGHT
    \once \override Footnote.text-alignment-X = #LEFT
    \once \override Footnote.Y-attachment = #0.5
    %% Make some space for the footnote.
    \once \override LyricSpace.minimum-length = 6.5
    %% See
    \once \override LyricSpace.springs-and-rods = #ly:spanner::set-spacing-rods
    \footnote #'(0 . 0) "this also works" LyricText
    Sing an -- oth -- er song.


reply via email to

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