[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: vertical spacing of footnotes
From: |
Werner LEMBERG |
Subject: |
Re: vertical spacing of footnotes |
Date: |
Wed, 15 Feb 2023 14:18:27 +0000 (UTC) |
>> 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, [...]
Excellent, thanks again! Here's my new version – the (baseline)
distance between footnotes is now controlled by the paper variable
`footnote-dist`, while the baseline skip within a footnote is taken
from `text-font-defaults.baseline-skip`. I've split the strut into
two components, to be inserted before the first line and after the
last line of a footnote.
Werner
\version "2.24.0"
#(set-default-paper-size "a7landscape")
#(define-markup-command (footnote-height-strut layout props)
()
"Insert a height strut. The value is derived from the
`footnote-dist` paper variable."
(let* ((dist (ly:output-def-lookup layout 'footnote-dist))
(yext (cons 0 (* 0.7 dist))))
(ly:make-stencil
(ly:stencil-expr
(make-transparent-box-stencil '(0 . 0.05) yext))
empty-interval
yext)))
#(define-markup-command (footnote-depth-strut layout props)
()
"Insert a depth strut. The value is derived from the
`footnote-dist` paper variable."
(let* ((dist (ly:output-def-lookup layout 'footnote-dist))
(yext (cons (* -0.3 dist) 0)))
(ly:make-stencil
(ly:stencil-expr
(make-transparent-box-stencil '(0 . 0.05) yext))
empty-interval
yext)))
#(define-markup-command (footnote-struts layout props elts)
(markup-list?)
"Insert a height strut at the beginning of the first line
and a depth strut at the end of the last line of a footnote
`elts` (which is a markup list holding the lines)."
(let ((stils (interpret-markup-list layout props elts)))
(if (null? (cdr stils))
(let ((stil (car stils)))
(interpret-markup layout props
#{ \markup {
\footnote-height-strut
\stencil #stil
\footnote-depth-strut } #}))
(let* ((first-stil (car stils))
(first-mkup #{ \markup {
\footnote-height-strut
\stencil #first-stil } #})
(last-stil (last stils))
(last-mkup #{ \markup {
\stencil #last-stil
\footnote-depth-strut } #})
(rest-stils (cdr stils))
(rest-stils (drop-right rest-stils 1))
(rest-mkups
(map (lambda (stil)
#{ \markup \stencil #stil #})
rest-stils)))
(interpret-markup layout props
#{ \markup {
\column {
#first-mkup
#rest-mkups
#last-mkup } } #})))))
#(define (markup-list-or-markup? x)
(or (markup-list? x) (markup? x)))
% This command accepts either a markup (for a single-line
% footnote) or a markup list (for a multi-line footnote).
% The baseline skip between the lines of a multi-line
% footnote is controlled by the paper variable
% `text-font-defaults.baseline-skip`.
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-struts #text #item #}
#{ \footnote #offset
\markup \footnote-struts #text #item #})))
\book {
\header { tagline = ##f }
\paper {
text-font-defaults.baseline-skip = 1.8
footnote-dist = 3.5
footnote-padding = 0\mm
footnote-separator-markup =
\markup { \override #'(span-factor . 1/3) \draw-hline }
footnote-number-raise = -0.5\mm
}
\markup "time-based footnotes"
\score {
\relative c'' {
r1 |
\myFootnote #'(-0.5 . -1)
\markuplist {
\override #'(line-width . 40)
\wordwrap-lines {
Meter change. This is a multi-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 with a lot of senseless text. }
} Stem
<c e g>4 q q |
\myFootnote #'(-0.5 . 2) "Bar line." Staff.BarLine
q q
\myFootnote #'(0.5 . -1) "Key change." Staff.KeySignature
\key c \minor q |
}
}
}
- vertical spacing of footnotes, Werner LEMBERG, 2023/02/13
- Re: vertical spacing of footnotes, Aaron Hill, 2023/02/13
- Re: vertical spacing of footnotes, kieren, 2023/02/13
- Re: vertical spacing of footnotes, Jean Abou Samra, 2023/02/13
- Re: vertical spacing of footnotes, Werner LEMBERG, 2023/02/14
- Re: vertical spacing of footnotes, Jean Abou Samra, 2023/02/14
- Re: vertical spacing of footnotes, Werner LEMBERG, 2023/02/14
- Re: vertical spacing of footnotes, Jean Abou Samra, 2023/02/14
- Re: vertical spacing of footnotes,
Werner LEMBERG <=
- Re: vertical spacing of footnotes, Werner LEMBERG, 2023/02/16
- Re: vertical spacing of footnotes, Valentin Petzel, 2023/02/14
- Re: vertical spacing of footnotes, Werner LEMBERG, 2023/02/14
- Re: vertical spacing of footnotes, Jean Abou Samra, 2023/02/14
- Re: vertical spacing of footnotes, Valentin Petzel, 2023/02/14
- Re: vertical spacing of footnotes, Jean Abou Samra, 2023/02/14
- Re: vertical spacing of footnotes, Valentin Petzel, 2023/02/14