lilypond-user
[Top][All Lists]
Advanced

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

Centering columns on the page


From: Richard Shann
Subject: Centering columns on the page
Date: Mon, 17 Apr 2023 18:51:29 +0100
User-agent: Evolution 3.38.3-1

Someone asked me how to set some verses in columns across the page
after the title in their piece. I found a snippet in the LSR which
defines a markup command \columns to place columns evenly spaced across
the page. So with three verses you get one aligned at the left, one 1/3
and one 2/3 of the way across the page. With two columns the second
column starts at the page center.
What is nice about this definition is that it scales nicely when you
alter the global staff size.

I have tried to modify the definition to move the whole set of columns
to the left, so that e.g. the second of three columns straddles the
center of the page or the space between two columns is centered.
My efforts have been in vain, so I was wondering if someone could
suggest how to do this.

The code is as follows:

8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><

\version "2.24.0"
#(set-global-staff-size 12) 
%#(set-global-staff-size 32) 

#(define-markup-command (columns layout props args) (markup-list?)
   (ly:message "~s" make-line-markup)
   (let ((line-width (/ (chain-assoc-get 'line-width props
                                         (ly:output-def-lookup layout 
'line-width))
                         (max (length args) 1))))
     (interpret-markup layout props
                       (make-line-markup  (map (lambda (line)
                                                (markup #:pad-to-box `(0 . 
,line-width) '(0 . 0)
                                                        #:override `(line-width 
. ,line-width)
                                                        line))
                                              args)))))
\markup \columns  {

                  \column {
                            \line {Verse One }
                            \line {Second Line }

                  }
                  \column {
                           \line {Verse Two }
                           \line {Second Line }
                  }
                  
                  \column {
                           \line {Verse Three }
                           \line {Second Line }
                                      
                  }        
}

8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><

Where a change of global staff size is commented out for ease of testing.

Best wishes,

Richard Shann






reply via email to

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