\version "2.19.17" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%% SETUP LANGUAGE COMMAND %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % PREREQUISITES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % modified from define-note-names.scm:970 #(define-public (note-names-language parser lang) (_ "Select note names language.") (let ((alist (assoc-get lang language-pitch-names '()))) (if (pair? alist) (begin (ly:debug (_ "Using `~a' note names...") lang) (set! pitchnames alist) (ly:parser-set-note-names parser alist)) (ly:warning (_ "Could not find language `~a'. Ignoring.") lang)))) #(define output-language 'english) % FUNCTION DEFINITION %%%%%%%%%%%%%%%%%%%%%%%%%%%% % extended from music-functions-init.ly:603 language = #(define-void-function (parser location arg) ;; Usage: ;; \language input.LANG or ;; \language output.LANG or ;; \language LANG—which is equivalent to ;; \language general.LANG or to the first two combined (symbol-list-or-symbol?) (_i "Define languages for input (i.e. set note names for @var{language}), output (i.e. display tagline and table of contents in @var{language}), or both.") (let* ((correct-input (if (> (length arg) 2) #f #t)) (channel (if (= 2 (length arg)) ;if a channel is given, (car arg) ;use it 'general)) ;else apply to both (language (cond ((= 1 (length arg)) (list-ref arg 0)) ((= 2 (length arg)) (list-ref arg 1)))) (input-lang (if language ;if input isn’t wrong language 'nederlands)) ;default (output-lang (if language language 'english))) (if (not correct-input) (ly:warning "\\language must be given a list of one or two symbols. Using default languages.")) (if (not (eq? channel 'output)) (note-names-language parser input-lang)) (if (not (eq? channel 'input)) (set! output-language output-lang)))) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\language input.deutsch %\language output.deutsch \language deutsch %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % SETUP TAGLINES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % should probably go into titling-init.ly englishTaglineText = #(format #f "Music typeset using LilyPond ~a~awww.lilypond.org" (lilypond-version) (ly:wide-char->utf-8 #x2014) ;; 2014 = em dash. ) germanTaglineText = #(format #f "Noten gesetzt mit LilyPond ~a ~a www.lilypond.org" (lilypond-version) (ly:wide-char->utf-8 #x2013) ;;2013 = en dash. ) tagline-texts = #`((deutsch . ,germanTaglineText) (english . ,englishTaglineText) ) % should this go into define-markup-commands.scm? if yes, where? #(define-markup-command (format-tagline layout props text) (markup?) (interpret-markup layout props #{ \markup { \pad-to-box #'(0 . 0) #'(0 . 3) { \with-url #"http://lilypond.org/" $text } } #})) % adapted from titling-init.ly:13 tagline = \markup \format-tagline #(let ((tagl (assoc-get output-language tagline-texts))) (if tagl tagl (begin (ly:warning (format #f "Tagline for ~a not defined, using the english one." (symbol->string output-language))) (assoc-get 'english tagline-texts)))) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % SETUP TOC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % should go into toc-init.ly % Using capitals is not due to German brutishness, % but adopted from some reference scores I consulted :-) germanTocTitleText = "INHALT" % This is current Lilypond default. englishTocTitleText = "Table of Contents" toc-title-texts = #`((deutsch . ,germanTocTitleText) (english . ,englishTocTitleText) ) % should this go into define-markup-commands.scm? if yes, where? #(define-markup-command (format-toc-title layout props text) (markup?) (interpret-markup layout props #{ \markup \huge \column { \fill-line { \null $text \null } \null } #})) \paper { % adapted from toc-init.ly:26 tocTitleMarkup = \markup \format-toc-title #(let ((text (assoc-get output-language toc-title-texts))) (if text text (begin (ly:warning (format #f "Title of Table of Contents is not defined for ~a, using the english one." (symbol->string output-language))) (assoc-get 'english toc-title-texts)))) } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TEST MUSIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % necessary to update tagline in this test case only \header { } \markup \fill-line { \override #'(line-width . 25) \box \pad-markup #2 \column \table-of-contents } \tocItem "H" { h } \tocItem "C" { c' } \tocItem "D" { d' } %%%