Strikethrough text: Difference between revisions
Appearance
Import snippet from LSR |
m New category |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
Here is how to print text with a horizontal line drawn in the middle, <s>much like what you can get in HTML or CSS</s>. | Here is how to print text with a horizontal line drawn in the middle, <s>much like what you can get in HTML or CSS</s>. | ||
<lilypond version="2.24 | <lilypond version="2.24"> | ||
#(define-markup-command (strikethrough layout props arg) | #(define-markup-command (strikethrough layout props arg) | ||
(markup?) | (markup?) | ||
| Line 34: | Line 34: | ||
[[Category:Text]] | [[Category:Text]] | ||
[[Category:Snippet]] | |||
Latest revision as of 23:25, 21 November 2025
Here is how to print text with a horizontal line drawn in the middle, much like what you can get in HTML or CSS.
\version "2.24"
#(define-markup-command (strikethrough layout props arg)
(markup?)
#:category font
#:properties ((thickness 2))
"
@cindex strikethrough, text
Draw an horizontal line through the markup's middle.
@lilypond[verbatim,quote]
\\markup {
The \\strikethrough Well- Tempered Clavier
}
@end lilypond"
(let* ((th (* (ly:output-def-lookup layout 'line-thickness)
thickness))
(stil (interpret-markup layout props arg))
(xextent (ly:stencil-extent stil X))
(yextent (ly:stencil-extent stil Y))
(y-pos (/ (- (cdr yextent) (car yextent)) 2)))
(ly:stencil-add
stil
(make-line-stencil
th (car xextent) y-pos (cdr xextent) y-pos))))
\header { title = \markup { The \strikethrough Well- Tempered Clavier } }
\markup { by \strikethrough J.S. P.D.Q. Bach. }