|
From: | Simon Mackenzie |
Subject: | Re: problems with learning lilypond |
Date: | Thu, 13 Aug 2009 12:00:33 +0700 |
%% toc-number : Begin : right align a string(number) against a preset gauge-stencil(####) and return the right aligned result
% #(define-markup-command (toc-number layout props text) (string?) (let* ( (gauge-stencil (interpret-markup layout props "####")) (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)))
) ) % % toc-number : End % %% numTocItem : Begin : Combine two strings and insert them as a single tocItemMarkup string into a table of contents.
%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 #:line (#:toc-number num text))) ) % % numTocItem : End % Usage ===================In each book part I can now insert the Hymn number and the Hymn title and each will be correctly aligned and formatted. Elegant solution and straightforward usage.
\book \bookpart { \numTocItem "61." "พระเจ้ายิ่งใหญ่" . . . } \bookpart {\numTocItem "66." "ชีวิตเราพระเจ้า ทรงสร้าง"
. . . } }See attached pdf for sample toc output. Note all Hymn numbers are correctly right aligned and the Hymn titles are correctly left aligned. Many thanks to Nicolas Sceaux <address@hidden> for his solution to my request posted on address@hidden
Simon On 13/08/2009, at 02:13, Mark Polesky wrote:
James E. Bailey wrote:Surely the calculations can be performed outside of lilypond, and then simply input into lilypond for a score, right? Or am I missing something?Sure, but scheme can greatly facilitate things. I should clarify that algorithmic music hardly represents the bulk of my LilyPond work, but I mentioned it as an example of something the benefits from scheme. I'll try to respond differently to what you wrote earlier:Scheme is, as far as I'm concerned, what other people do to save typing. In fact, I'm of the opinion that there's no need to use Scheme, it's just there if you know how to use it. So, if you take Scheme out of the lilypond learning curve, it's actually not that difficult.I think what David was saying in his earlier post(http://lists.gnu.org/archive/html/lilypond-user/2009-08/ msg00323.html)was that he's gotten to the level where he needs scheme to do what he wants. As one example, if you need your slurs and ties to hide behind time-signatures, scheme is absolutely required, as far as I see it:http://lsr.dsi.unimi.it/LSR/Item?id=613 Scheme enables far more functionality than simply saving typing. So if you find yourself needing scheme in LilyPond, you may very well find yourself fighting its counterintuitive elements. Certainly scheme isn't "required" to produce beautiful scores, but I typeset a lot of contemporary music, and the demands of the new notation are simply too great to avoid it. So, as I said, perhaps it just depends on your typesetting needs. - Mark
ThaiMusicBookTOC.pdf
Description: Adobe PDF document
[Prev in Thread] | Current Thread | [Next in Thread] |