lilypond-user
[Top][All Lists]
Advanced

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

Re: Question about text formatting: hard line breaks?


From: Michael Werner
Subject: Re: Question about text formatting: hard line breaks?
Date: Tue, 24 Jan 2023 06:50:56 -0500

I've done a number of scores where I'm having extra stanzas of lyrics added either directly after the last staff of music, or, more frequently, on a separate page. Either way, I use the \string-lines command. It has the advantage of accepting an entire paragraph, and going along with the existing line breaks. Makes things easy when doing a copy and paste. The full description from the official docs:

\string-lines strg (string)

Takes the string strg and splits it at the character provided by the property split-char, defaulting to #\newline. Surrounding whitespace is removed from every resulting string. The returned list of markups is ready to be formatted by other markup or markup list commands like \column\line, etc.

\markup {
  \column
    \string-lines
     "foo, foo,
     bar, bar,
     buzz, buzz!"
}

[image of music]

Used properties:

  • split-char (#\newline)


And for reference, the part of the official docs you'll want to have a look at are A.12 ( http://lilypond.org/doc/v2.24/Documentation/notation/text-markup-commands ) and A.13 ( http://lilypond.org/doc/v2.24/Documentation/notation/text-markup-list-commands ) of the Notation Reference. The \string-lines command comes from A.13

One caveat about the \string-lines command I discovered by trying to get it to do something - if you want blank lines between sections of text, just entering extra new lines in the text won't work. Which I would have realized if I'd read the description a bit more carefully. Instead, you'll need something like:

    \column { \small
              \string-lines
              "1. I wonder as I wander out under the sky how Jesus my saviour did come for to die; for
poor orn'ry people like you and like I, I wonder as I wander ... out under the sky." }
    \vspace #1
    \column {  \small
               \string-lines
               "2. When Mary birthed Jesus, 'twas is a cow's stall, with wisemen and farmers and shepherds and all
But high from God's heaven a star's light did fall, and the promise of ages ... it then did recall." }

The \vspace gives the vertical space between stanzas.

Well, hopefully this might help. Or at least give you some ideas that might get you where you want to be.

Michael

On Mon, Jan 23, 2023 at 7:15 PM Alasdair McAndrew <amca01@gmail.com> wrote:
Hello,

I have a paragraph of descriptive text that I'd like to display in a box.  Currently I have:

\markup \small \box \wordwrap {
   .... several lines of text here ...
}

This works quite well, except that I'd like to modify some of the line breaks.  I could probably do this by either specifying the text as a list of lines (which I'm not sure how to do: that is, a list of lines all surrounded by a single box).

But in fact it would be easier to simply insert a "hard break" in the text where I want it.  Is this possible?  I know how to add a break to a score, but I can't find if there's an equivalent for text.

And where would I go looking for this - where can I find a comprehensive list of all text commands accepted by lilypond?

Many thanks,
Alasdair

--
Alasdair McAndrew (he/him)
mob: 0432 854 858

https://numbersandshapes.net

reply via email to

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