Le 12 déc. 08 à 07:59, Simon J Mackenzie a écrit :
Hi
I have a table of contents which contains the following...
1. Joy to the
Universe 1
56. Woe Beyond Hope 3
112.
Frankly
9
2001. Same Old Same Old 26
[...]
Is it possible to right align the preceding numbers in each \tocItem
entry above
One possible trick is to add space at the left of the number, for
instance:
\version "2.11.65"
#(define-markup-command (toc-number layout props text) (string?)
(let* ((gauge-stencil (interpret-markup layout props "0000."))
(x-ext (ly:stencil-extent gauge-stencil X))
(y-ext (ly:stencil-extent gauge-stencil Y))
(stencil (interpret-markup layout props text))
(gap (- (interval-length x-ext)
(interval-length (ly:stencil-extent stencil X)))))
(interpret-markup layout props
(markup #:concat (#:hspace gap text #:hspace 1)))))
numTocItem =
#(define-music-function (parser location num text) (string? string?)
"Add a line to the table of content, using the
@code{tocItemMarkup} paper
variable markup"
(add-toc-item! 'tocItemMarkup (markup #:small #:line (#:toc-number
num text))))
\markuplines \table-of-contents
\numTocItem "1." "Joy to the Universe"
\numTocItem "56." "Woe Beyond Hope"
\numTocItem "112." "Frankly"
\numTocItem "2001." "Same Old Same Old"
\markup \null
nicolas
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user