Strikethrough text: Difference between revisions
Appearance
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series |
No edit summary |
||
| Line 33: | Line 33: | ||
</lilypond> | </lilypond> | ||
[[Category:Text]] | [[Category:Text]][[Category:Snippet]] | ||
Revision as of 23:01, 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. }