# Poetry layout by page rather than verse

I am setting a book of poetry that is one long continuous poem. Some of the verses have quite short line lengths. Others have quite long line lengths. Is there a way to have LaTeX find an optimal horizontal position for the lines on any given page rather than for the individual verse?

There are no lines long enough that they need to be broken. Ideally the text box would be centred, but a rough approximation of centre would also suffice.

I have used both memoir's own poetry functions often, and I have also used the verse package. Neither of these offer an option to set lines page by page rather than verse by verse. I have no minimum working example at the moment, because I'm not even sure how to approach the problem.

• What have you tried so far? What packages are you using/hoping to use? An MWE would help. Mar 11 '14 at 20:08
• Steven, I have updated the question, though I'm not sure how much more help I have been. Mar 11 '14 at 20:20
• The answer to the question is "yes" but the details depend on what you mean by optimal. In particular are any lines ling enough to require line breaking, if so how do you want long broken lines distinguished from short lines. Do you want the text block on a given page to be centred or .... Mar 11 '14 at 21:21
• David, I have added to the question the information that you requested. Mar 11 '14 at 22:38
• @Jeremy if you use @ DavidCarlisle then I get pinged with your comment (as is you were lucky I wandered back here) Mar 11 '14 at 23:49

Please always provide a complete example. That would have saved you from reading my literary masterpiece below, and save me composing it.

\documentclass{article}

\begin{document}

\setbox0\vbox{\parindent0pt\obeylines

This is my poem
it has lines
that are short
very short
later they get longer
as we will see
\bigskip
one
two
three
four
five
\bigskip
verse 3
starts short
but the lines get longer
and then they get really quite long
some would say that this line is excessively long
\bigskip
and then we shrink again
in time for the third page
\bigskip
1
2
3
4
5
6
7
\bigskip
8
9
10
11
12
13
14
\vfill}

\centering

\loop
\setbox2\vsplit0 to \textheight
\ifvoid2
\else
\global\setbox1\vbox{}%
\setbox4\vbox{\unvbox2
\loop
\setbox0\lastbox
\skip0\lastskip\unskip
\skip2\lastskip\unskip
\global\setbox1\vbox{%
\vskip\skip2
\vskip\skip0
\hbox{\unhbox0\unskip\unskip}%
\unvbox1}%
\ifnum\lastnodetype=-1
\else
\repeat}%
\leavevmode\box1
\par
\pagebreak
\repeat

\end{document}

• That worked perfectly. Mar 12 '14 at 1:47
• Very Shakespearean. :) Mar 12 '14 at 10:09

I think if I were a book designer and had to do with a long poem in which there were stretches of short lines and stretches of longer lines, I would not want to center the verse block on a page by page basis, since that would undermine the impression you would want to maintain in the reader's mind that all of these lines are part of a single poem.

If, however, I were of a mind to do this, I think what I would do is to find where the page breaks are, and set each page as if it were a separate poem, using the \versewidth mechanism used in both verse and poemscol to center the poetry of that particular page. If you are adding line numbers you can work around starting and stopping the poem at the page breaks by using the \savelinenumber and \restorelinenumber commands.