lilypond-user
[Top][All Lists]
Advanced

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

Re: tips for formatting an interview


From: Thomas Morley
Subject: Re: tips for formatting an interview
Date: Tue, 17 Nov 2015 23:52:42 +0100

2015-11-17 21:24 GMT+01:00 Federico Bruni <address@hidden>:
> Il giorno mar 17 nov 2015 alle 18:52, Jean-Charles Malahieude
> <address@hidden> ha scritto:
>>
>> Le 14/11/2015 15:22, Federico Bruni a écrit :
>>>
>>> Hi all
>>>
>>> I'm trying to format directly in LilyPond an interview (the single text
>>> only part of a book). I don't want to use lilypond-book and LaTeX just
>>> because of this minor part of the book.
>>>
>>> I've two questions:
>>>
>>> 1) There's any way to place the text on two columns AND let LilyPond
>>> reflow it depending on the available space on the page?
>>> The documentation contains an example where you must decide in advance
>>> what goes into column left and what into column right. I'd like to avoid
>>> this.
>>>
>>>
>>
>> Have a look at Nicolas Sceaux's site. I used (once adapted to my purpose)
>> one of his markup definitions for the libretto of King Arthur.
>
>
> Thank you for the advice!
> I think I found it:
> https://github.com/nsceaux/nenuvar/blob/fa405cd074a4bc4210e33d6d2c13e7fa4ed2cdc8/common/columns.ily
>
> The default is two columns, but the width of each column is too narrow for
> my use case.
> How can I override it? I know how to reduce the column-padding, which is a
> property of page-columns-helper.
> But I have some problem with modifying column-width, as defined here:
> https://github.com/nsceaux/nenuvar/blob/fa405cd074a4bc4210e33d6d2c13e7fa4ed2cdc8/common/columns.ily#L75



Hi Federico,

for the record, below my own first approach to the problem. Be aware
it's more a sketch of an idea, not ready to commit, although it
compiles.
Much more primitive than Nicolas' code, maybe I'll somewhere find he
time to look into it with more depth (and into all the other points on
my personal todo-list...)

\version "2.19.29"

%% split-stil-list
%% first part contains all stils, which don't exceed `amount' with their
%% accumulated Y-length
%% second part all others.
%% Ofcourse only two sublists are created, which will limit the
%% later defined markup-list-command to two columns
%% If the length of both list don't match, add point-stencils unless they do
#(define (split-stil-list stil-list rl init amount)
  (cond ((null? stil-list)
         (reverse rl))
        ((> init amount)
         (let* ((rl-lngth (length rl))
                (st-l-lngth (length stil-list))
                (pt-stil-l
                  (make-list (abs (- rl-lngth st-l-lngth)) point-stencil)))
         (cons
           (if (< rl-lngth st-l-lngth)
               (append (reverse rl) pt-stil-l)
               (reverse rl))
           (if (< st-l-lngth rl-lngth)
               (append stil-list pt-stil-l)
               stil-list))))
        (else
         (split-stil-list
           (cdr stil-list)
           (cons (car stil-list) rl)
           (+ init (interval-length (ly:stencil-extent (car stil-list) Y)))
           amount))))


#(define-markup-list-command (wordwrap-two-columns-lines layout props args)
  (markup-list?)
  #:properties ((baseline-skip)
                (amount 20)
                (padding 10)
                wordwrap-internal-markup-list)
  (let* ((stils
           (space-lines
             baseline-skip
             (interpret-markup-list
               layout
               props
               (make-wordwrap-internal-markup-list #f args))))
         (divided-stils (split-stil-list stils '() 0 amount))
         (max-X-length-first-column
           (apply max 0
             (map
               (lambda (stil) (cdr (ly:stencil-extent stil X)))
               (car divided-stils)))))
        (map
          (lambda (s t)
            (ly:stencil-add
              s
              (ly:stencil-translate-axis
                t
                (+ padding max-X-length-first-column)
                X)))
          (car divided-stils)
          (cdr divided-stils))))

%% for testing of page-break-behaviour uncomment:
%\markup \box \with-dimensions #'(1 . 10) #'(1 . 120) \null

\markuplist
  %% be aware: line-width _and_ padding-overrides may exceed the visible area
  \override-lines #'(line-width . 50)
  \override-lines #'(padding . 10)
  \override-lines #'(amount . 25)
  \wordwrap-two-columns-lines {
    Lorem ipsum dolor sit amet, consectetur adipisicing
    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.

    Lorem ipsum dolor sit amet, consectetur adipisicing
    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.

    Lorem ipsum dolor sit amet, consectetur adipisicing
    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.
  }


Cheers,
  Harm



reply via email to

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