# [tex-eplain] Poetry environment

Wed Mar 10 17:21:25 CET 2010

On 13 Jan 2010, at 14:14, John Was wrote:
> Does this solution not preclude splitting of the poem between pages?

Yes, unfortunately.

> I should think that if you want to allow such splitting where a poem
> will not fit on a page you would have to put the left-hand poem in one
> \vbox, the right-hand poem in another, then using \loop progressively
> \vsplit the two boxes into  \vboxes of \baselineskip height, pairing
> the resultant one-line boxes until you end up with an empty \vbox
> which will let the \loop know that it is at the end of the poem.  And
> then if you want to make sure that there are at least two lines of
> poetry at the bottom or top of a page, you would need to feed in some
> more \if...\else...\fi coding (after the first and before the last
> lines) to allow \nobreak commands to kick in at the right time (unless
> you could make \noalign{\nobreak} work between lines of the table,
> which might be tricky if you are then telling \vsplit to break off
> lines one at a time).

I think that's a little beyond me at the moment, but thanks for
outlining a suitable approach.

> ----- Original Message ----- From: "Adam Fenn" <acwfenn at ntlworld.com>
> To: "John Frampton" <j.frampton at neu.edu>
> Cc: "eplain" <tex-eplain at tug.org>
> Sent: Wednesday, January 13, 2010 1:59 PM
> Subject: Re: [tex-eplain] Poetry environment
>
>
>>
>> On 13 Jan 2010, at 12:09, John Frampton wrote:
>>
>>>
>>> Sorry, I didn't get what you wanted.  How about?
>>>
>>> \def\poem{\line\bgroup
>>>    \hfil
>>>    \vtop\bgroup
>>>       \halign\bgroup ##\hfil\cr
>>> }
>>> \def\midpoem{\egroup\egroup \hfil
>>>    \vtop\bgroup
>>>       \halign\bgroup ##\hfil\cr
>>> }
>>> \def\endpoem{\egroup\egroup \hfil\egroup}
>>>
>>> \poem
>>> I wandered lonely as a cloud\cr
>>> That floats on high o'er vales and hills,\cr
>>> When all at once I saw a crowd,\cr
>>> A host, of golden daffodils;\cr
>>> Beside the lake, beneath the trees,\cr
>>> Fluttering and dancing in the breeze.\cr
>>> \midpoem
>>> Continuous as the stars that shine\cr
>>> And twinkle on the milky way,\cr
>>> They stretched in never-ending line\cr
>>> Along the margin of a bay:\cr
>>> Ten thousand saw I at a glance,\cr
>>> Tossing their heads in sprightly dance.\cr
>>> \endpoem
>>
>> Yes, that works very well, and because I am bone idle I added
>> \let\par=\cr \obeylines
>> so that I need not type \cr after every line.
>>
>> Thanks very much.