lilypond-user
[Top][All Lists]
Advanced

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

Re: Horizontal Alignment of Numbers in Table of Contents


From: Simon J Mackenzie
Subject: Re: Horizontal Alignment of Numbers in Table of Contents
Date: Sat, 13 Dec 2008 21:20:40 +0700

Hi Nicolas,
Thank you for your help and an elegant solution. Would have been very
lost otherwise.

Very much appreciated.

Simon

Sample result attached. The language is Thai


On Fri, 12 Dec 2008 23:37:07 +0100, "Nicolas Sceaux"
<address@hidden> said:
> 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
> 
--------------------------------------------------

Reverend Simon J Mackenzie <address@hidden>

LUTHERAN CHURCH OF AUSTRALIA
197 Archer Street,
North Adelaide,
South Australia,
AUSTRALIA, 5006





reply via email to

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