lilypond-user
[Top][All Lists]
Advanced

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

Re: vertical spacing of footnotes


From: Jean Abou Samra
Subject: Re: vertical spacing of footnotes
Date: Wed, 15 Feb 2023 00:01:04 +0100
User-agent: Evolution 3.46.3 (3.46.3-1.fc37)

Le mardi 14 février 2023 à 15:13 +0000, Werner LEMBERG a écrit :

Excellent, thanks!  I slowly arrive at some nice results, see attached code and image.  However, there is one problem that I don't understand: Why is the space between footnotes 3 and 4 (and 4 and 5) larger than between 1 and 2 (and 2 and 3)?

Well, in footnotes 1 and 2, there is only one strut for the two lines. Try this, but I'm tired and have other things to do, so there may still be oddities.

\version "2.24.0"

#(set-default-paper-size "a7landscape")

#(define-markup-command (footnote-strut layout props)
   ()
   #:properties ((baseline-skip))
   (let ((yext (cons (* -0.3 baseline-skip)
                     (* 0.7 baseline-skip))))
     (ly:make-stencil
      (ly:stencil-expr (make-transparent-box-stencil '(0 . 0.05) yext))
      empty-interval
      yext)))

#(define-markup-command (footnote-strut-on-all-lines layout props elts) (markup-list?)
   #:properties ((baseline-skip))
   (let* ((stils (interpret-markup-list layout props elts))
          (new-mkups (map (lambda (stil)
                            #{ \markup { \override #`(baseline-skip . ,baseline-skip) \footnote-strut \stencil #stil } #})
                          stils)))
     (interpret-markup layout props #{ \markup \override #'(baseline-skip . 0) \column #new-mkups #})))

#(define (markup-list-or-markup? x)
   (or (markup-list? x) (markup? x)))

myFootnote =
#(define-music-function (mark offset text item)
   ((markup?) number-pair? markup-list-or-markup? symbol-list-or-music?)
   (let ((text (if (markup? text) (list text) text)))
     (if mark
         #{ \footnote #mark #offset \markup \footnote-strut-on-all-lines #text #item #}
         #{ \footnote #offset \markup \footnote-strut-on-all-lines #text #item #})))

\book {
  \header { tagline = ##f }

  \paper {
   text-font-defaults.baseline-skip = 2
   footnote-padding = 0\mm
   footnote-separator-markup =
     \markup \column {
       \line { \override #'(span-factor . 1/3) \draw-hline }
       \vspace #0.2
     }
   footnote-number-raise = 0
   footnote-numbering-function =
     #(lambda (n)
        (let ((text (numbered-footnotes n)))
          #{
            \markup \with-dimension #Y #'(0 . 0)
            \raise #0.5 % 0.5 is default footnote-number-raise
            \general-align #Y #UP #text #}))
  }

  \markup "time-based footnotes"
  \score {
    \relative c'' {
      r1 |
      \myFootnote #'(-0.5 . -1)
        \markuplist {
          \line { + Meter change. This is a multi-line }
          \line { + footnote grob. }
        } Staff.TimeSignature
        \time 3/4
      \myFootnote #'(1 . -1)
        \markuplist {
          \override #'(line-width . 40)
          \wordwrap-lines {
            + Note stem. This is another multi-line
            + footnote grob.
          }
        } Stem
      <c e g>4
      \myFootnote #'(1 . -1) "+ Another stem." Stem
        q q |
      \myFootnote #'(-0.5 . 2) "+ Bar line." Staff.BarLine
        q q
      \myFootnote #'(0.5 . -1) "+ Key change." Staff.KeySignature
        \key c \minor q |
    }
  }
}

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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