lilypond-user
[Top][All Lists]
Advanced

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

Re: Word wrapping section headers (book-titling.ily)


From: Thomas Morley
Subject: Re: Word wrapping section headers (book-titling.ily)
Date: Sun, 28 Oct 2012 22:07:23 +0100

2012/10/28 Olivier Biot <address@hidden>:
> On Sun, Oct 28, 2012 at 8:29 PM, Thomas Morley
> <address@hidden> wrote:
>> 2012/10/28 Olivier Biot <address@hidden>:
>>> Hi all,
>>>
>>> I'm using the book-titling.ily macros by Nicolas Sceaux to create an etude 
>>> book.
>>>
>>> I can't however get long section titles to word wrap.
>>>
>>> I suppose the code I have to edit is this but I am no Scheme expert:
>>>
>>> section =
>>> #(define-music-function (parser location title) (string?)
>>>   (add-toc-item parser 'tocSectionMarkup title)
>>>   (add-toplevel-markup parser (markup #:section-title
>>> (string-upper-case title)))
>>>   (add-no-page-break parser)
>>>   (make-music 'Music 'void #t))
>>>
>>> Can some helpful mind shed some light on how to do so?
>>
>> Hi Oliver,
>>
>> Nicolas' template is a very special one. He deals a lot with strings,
>> formating them in different ways.
>> And it works with 2.14.2 only (if you use the LSR-version)
>>
>> You could try:
>>
>> section =
>> #(define-music-function (parser location title) (markup?)
>>   (add-toc-item parser 'tocSectionMarkup title)
>>   ;(add-toplevel-markup parser (markup #:section-title
>> (string-upper-case title)))
>>   (add-toplevel-markup parser (markup #:section-title title))
>>   (add-no-page-break parser)
>>   (make-music 'Music 'void #t))
>>
>> with
>>
>>   \section \markup {
>>   \override #'(line-width . 40)
>>   \justify-string #"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.
>>
>>
>>       Excepteur sint occaecat cupidatat non proident, sunt in culpa
>>       qui officia deserunt mollit anim id est laborum"
>> }
>>
>>
>> But I'm not sure you realy want this output. :)
>>
>> Please note that the string-upper-case-feature of \section doesn't
>> work any more.
>
> Hi Thomas,
>
> Thank you for your input! This is maybe a silly question, but isn't
> there a simple way to hide the following markup code into the Scheme
> procedure?
>
> \override #'(line-width . 40) \justify-string
>
> I'd love to keep my 60 etude input files as simple as possible, so if
> possible I'd rather write 60 times the shorthand:
>
> \section "The section title comes here. It can be lengthy but it
> should gently word wrap if its length exceeds one line."
>
> Best regards,
>
> Olivier

How about

\version "2.14.2"

section =
#(define-music-function (parser location arg) (string?)
  (let* ((title (markup #:override '(line-width . 40)
                  #:justify-string arg)))
  (add-toc-item parser 'tocSectionMarkup title)
  ;(add-toplevel-markup parser (markup #:section-title
(string-upper-case title)))
  (add-toplevel-markup parser (markup #:section-title title))
  (add-no-page-break parser)
  (make-music 'Music 'void #t)))

  \section  "The section title comes here. It can be lengthy but it
        should gently word wrap if its length exceeds one line."



-Harm



reply via email to

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