lilypond-user-fr
[Top][All Lists]
Advanced

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

Re: deux colonnes musique et texte


From: Valentin Villenave
Subject: Re: deux colonnes musique et texte
Date: Wed, 13 May 2020 13:26:42 +0200

On 5/13/20, Gerard <address@hidden> wrote:
> Est-il possible de réaliser facilement ce que l'image ci-joint montre à
> savoir un deux colonnes musique d'un côté et texte de l'autre ?

On peut même s’amuser à faire tout ça automatiquement :

%%%%

\version "2.19.81"

pageITexte = "Lorem ipsum dolor sit amet,
consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim
id est laborum."

pageIa = { c'2( f') }
pageIaTexte = "intervalle ascendant"

pageIb = { e''2( g') }
pageIbTexte = "intervalle descendant"

%%%%

serie = #`(a b c d e f g h i j k l)

chercheMusique =
#(define-music-function (nom) (symbol?)
   (let ((mus (ly:parser-lookup nom)))
     (if (ly:music? mus) mus
         (make-music 'Music 'void #t))))

#(define (chercheTexte nom)
   (let ((mark (ly:parser-lookup nom)))
     (cond
      ((string? mark) (make-justify-string-markup mark))
      ((markup? mark) mark)
      (else (make-null-markup)))))

fabriquerPage  =
#(define-music-function (nom) (symbol?)
   (let* ((text-suffix 'Texte)
          (suffix-list (ly:parser-lookup 'serie))
          (columns 2)
          (paper #{ \paper { } #})
          ;; LSR #1013.
          (landscape (ly:output-def-lookup paper 'landscape))
          (paper-width (ly:output-def-lookup paper 'paper-width))
          (paper-height (ly:output-def-lookup paper 'paper-height))
          (plain-line-width (ly:output-def-lookup paper 'line-width))
          (plain-left-margin (ly:output-def-lookup paper 'left-margin))
          (page-width (if landscape paper-height paper-width))
          (page-height (if landscape paper-width paper-height))
          (left-margin (if (null? plain-left-margin)
                           (if (null? plain-line-width)
                               10
                               (/ (- page-width plain-line-width) 2))
                           plain-left-margin))
          (total-width (if (null? plain-line-width)
                           (- page-width (* (* columns 2)
                                            left-margin))
                           plain-line-width))
          (line-width (/ total-width (1+ columns))))

     (define (symbol-append . args)
       (string->symbol
        (apply string-append
               (map symbol->string args))))

       (collect-scores-for-book
        (list #{
          \markup
          \fill-line {
            \override #(cons 'line-width line-width)
            \fill-line {
              \hspace #(* left-margin -1)
              \center-column {
                $(map
                  (lambda (n)
                    (let* ((name (symbol-append nom n))
                           (lookup (ly:parser-lookup name)))
                      (if (null? lookup)
                          ""
                          #{
                            \markup
                            \center-column {
                              \vspace #2
                              \score {
                                \chercheMusique $name
                              }
                              $(chercheTexte
                                (symbol-append name text-suffix))
                          } #}))) suffix-list)
              }
              ""
            }
            \line {
              \hspace #(* left-margin -1.5)
              \column {\vspace #8 \draw-line #'(0 . 20)}
            }
            \override #(cons 'line-width line-width)
            \center-column {
              $(chercheTexte (symbol-append nom text-suffix))
            }
              } #}))
       #{ \pageBreak
       #}))

\fabriquerPage #'pageI

%%%%

V.



reply via email to

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