• Willkommen im Forum „Archiviertes Lilypond Forum (2017)“.
 

Dies ist das Archiv des alten Forums (bis März 2017). Das aktuelle Forum ist unter lilypondforum.de zu finden.
This is the archive of the old forum (until March 2017). You can find the current forum at lilypondforum.de.

Hauptmenü

Zeilenlänge bei Strophensetzung ändern

Begonnen von Manuela, Sonntag, 30. Oktober 2016, 11:58

Vorheriges Thema - Nächstes Thema

Manuela

Hallo Harm,

gibt es eine einfache Möglichkeit, die Zeilenlänge bei der von dir geschriebenen Funktion \formatAdditionalVerses zu ändern? Nicht innerhalb der Funktion, sondern erst bei der Anwendung, sodass ich bei verschiedenen Lieder verschiedene Zeilenlängen einstellen könnte.

Hier ein kompilierbares Beispiel:

\version "2.19.42"

#(define-markup-list-command (paragraph layout props args) (markup-list?)
   #:properties ((x-shift 2))
   (interpret-markup-list layout props
     (make-justified-lines-markup-list (cons (make-hspace-markup x-shift) args))))

#(define (equal-sized-splited-list lst n rl)
   "Split @var{lst} in equal sized parts of length @var{n}.
If @var{lst} is finally not empty add the remaining rest."
   (cond ((null? lst) (reverse rl))
     ((< (length lst) n) (reverse (cons lst rl)))
     (else
      (equal-sized-splited-list (drop lst n) n (cons (take lst n) rl)))))

columns-markup-list =
#(define-scheme-function (lines-per-verse ls)(index? markup-list?)
   "Returns a markup-list.  Each markup is done from a subset of @var{ls} under
control of @var{lines-per-verse}.  The markups are custom-formated using
@code{\\column-lines}, @code{\\column} and a hard-coded @code{baseline-skip} of
value 3"
   (let ((splitted-ls (equal-sized-splited-list ls lines-per-verse '())))
     (map
      (lambda (l)
        #{ \markup
           \override #'(baseline-skip . 3)
           \column \column-lines $l #})
      splitted-ls) ))

#(define (numbering-start lst strt)
   "Returns a list of custom formated markups for numbers, relying on the length
of @var{lst}, starting with number 2"
   (if (eq? strt 0)
       (map
        (lambda (i)
          #{ \markup \concat \paragraph { " " } #})
        (iota (length lst)))
       (map
        (lambda (i)
          #{ \markup \concat \paragraph { \bold #(format #f "~2d." i) } #})
        (iota (length lst) strt 1)))
   )

formatAdditionalVerses =
#(define-scheme-function (center-overshoot number-start columns lst)
   ((boolean? #t) index? index? markup-list?)
   (let* ((numberings (numbering-start lst number-start))
          (new-list
           (map
            (lambda (x y)
              #{
                \markup
                \override #'(baseline-skip . 3)
                \line {
                  \paragraph {
                    \overlay {
                      \right-align \transparent "222"
                      \right-align \number $x
                    }
                  }
                  $y
                }
              #})
            numberings
            lst))
          (lst-lngth (length lst))
          (table-lst
           (if (and (odd? lst-lngth)
                    (= (remainder lst-lngth columns) 1)
                    center-overshoot)
               (drop-right new-list 1)
               new-list))
          (odd-tail
           (if (and (odd? lst-lngth)
                    (= (remainder lst-lngth columns) 1)
                    center-overshoot)
               (take-right new-list 1)
               #f))
          (columns-format-list (make-list columns LEFT))
          (args-list
           #{ \markuplist {
             \override #'(font-size . -1)
             \table #columns-format-list #table-lst
           } #})
          (args-list-rev
           (append
            args-list
            (if odd-tail
                #{
                  \markuplist
                  %% hier nix ändern, das sind die Nummerierungen!!
                  \column-lines { \fill-line { \line { #odd-tail } } }
                #}
                '()))))
     args-list-rev))

%% kann ich hier noch die Zeilenlänge ändern?
%% entweder mit \override #'(line- width . xxx)
%% oder \override-lines #'(line- width . xxx) ??
%% wenn ja, wo muss ich den Override einfügen?

\markuplist {
  \override #'(padding . 1)
  \override #'(x-shift . 1)
  \override #'(baseline-skip . 5)
  \formatAdditionalVerses
  %% additional verses starts with this numbering
  #2
  %% amount of columns
  #2
  \columns-markup-list #3
  \markuplist {
    "Vers 2 Line 1"
    "Vers 2 Line 2"
    "Vers 2 Line 3"

    "Vers 3 Line 1"
    "Vers 3 Line 2"
    "Vers 3 Line 3"

    "Vers 4 Line 1"
    "Vers 4 Line 2"
    "Vers 4 Line 3"

    "Vers 5 Line 1"
    "Vers 5 Line 2"
    "Vers 5 Line 3"

    "Vers 6 Line 1"
    "Vers 6 Line 2"
    "Vers 6 Line 3"
  }
}

harm6

Nicht automatisch.

Spiel rum den Werten für padding und line-width, \box um es besser zu kontrollieren
Zitat
\markuplist \box
  \override-lines #'(line-width . 74) {
  \override #'(padding . 40)
  \override #'(x-shift . 1)
  \override #'(baseline-skip . 5)
  \formatAdditionalVerses
  ...

Gruß,
  Harm

Manuela

Danke Harm.

Zitat von: harm6 am Sonntag, 30. Oktober 2016, 12:56
Nicht automatisch.

Ich hatte auch an keinen Automatismus gedacht, sondern an individuelle Anpassung für manche Lieder. Ich probiers mal aus, wenn du nix mehr hörst, bin ich zufrieden mit der Lösung  ;)