10

verse package has \settowidth command to center a poetry. Example:

\settowidth{\versewidth}{There was an old party of Lyme}
\begin{verse}[\versewidth]
There was an old party of Lyme \\
Who married three wives at one time. \\
\vin When asked: ‘Why the third?’ \\
\vin He replied: ‘One’s absurd, \\
And bigamy, sir, is a crime.’
\end{verse}

I have a lot of poetries, and it's impossible to do this for everyone.

Is there a method to do the same thing without the specification of \versewidth?

Like, for example, this:

\begin{verse}
\start{unknown_command}
There was an old party of Lyme \\
Who married three wives at one time. \\
\vin When asked: ‘Why the third?’ \\
\vin He replied: ‘One’s absurd, \\
And bigamy, sir, is a crime.’
\end{unknown_command}
\end{verse}
3
  • Incidentally, is this limerick one of Edward lear's?
    – Bernard
    Commented Jul 21, 2014 at 1:14
  • Are you always using the first line for setting \versewidth?
    – egreg
    Commented Jul 21, 2014 at 8:18
  • @egreg No, the largest line is what should be used. Commented Sep 23, 2014 at 23:13

2 Answers 2

7

The final \cenverse seems to be the command you are expecting. Certainly, it can be transformed into an environment. The first two occurences of your limerick are for the comparision.

\documentclass{article}

\usepackage{verse}
\begin{document}


I have a lot of poetry, and it's impossible to do this for everyone.
I have a lot of poetry, and it's impossible to do this for everyone.

\settowidth{\versewidth}{There was an old party of Lyme}
\begin{verse}[\versewidth]
There was an old party of Lyme \\
Who married three wives at one time. \\
\vin When asked: ‘Why the third?’ \\
\vin He replied: ‘One’s absurd, \\
And bigamy, sir, is a crime.’
\end{verse}


I have a lot of poetry, and it's impossible to do this for everyone.
I have a lot of poetry, and it's impossible to do this for everyone.

\begin{verse}
There was an old party of Lyme \\
Who married three wives at one time. \\
\vin When asked: ‘Why the third?’ \\
\vin He replied: ‘One’s absurd, \\
And bigamy, sir, is a crime.’
\end{verse}


\def\cenverse#1\\{\settowidth{\versewidth}{#1}\begin{verse}[\versewidth]#1\\}

I have a lot of poetry, and it's impossible to do this for everyone.
I have a lot of poetry, and it's impossible to do this for everyone.


\cenverse
There was an old party of Lyme \\
Who married three wives at one time. \\
\vin When asked: ‘Why the third?’ \\
\vin He replied: ‘One’s absurd, \\
And bigamy, sir, is a crime.’
\end{verse}

\end{document}

enter image description here

3
  • Is there a method to use this in a poetry without //? For example if I use boldfirst [tex.stackexchange.com/a/192468/59415 ] I not insert // and it doesn't work!
    – ᴜsᴇʀ
    Commented Jul 21, 2014 at 11:24
  • 2
    And how can I turn the code into a \newenvironment for using it like \begin{cenverse} ..text... \end{cenverse}?
    – ᴜsᴇʀ
    Commented Jul 21, 2014 at 13:02
  • This just uses the first verse, which isn't necessarily the widest.
    – egreg
    Commented Aug 12 at 20:10
7

This will use the widest verse for deciding the width and center the poem. Footnotes are supported.

The second poem is the start of Aldo Palazzeschi's “La fontana malata” (The sick fountain).

\documentclass{article}
\usepackage{verse,varwidth}

\usepackage{lipsum} % just for the example

\newcounter{mockfootnote}
\newsavebox{\versebox}
\NewDocumentEnvironment{cverse}{+b}{%
  \setlength{\leftmargini}{0pt}%
  \begin{lrbox}{\versebox}
  % remember the current value of footnote
  \setcounter{mockfootnote}{\value{footnote}}%
  % disable footnotes in the first pass over the poem
  \renewcommand\footnote[1]{\stepcounter{mockfootnote}\textsuperscript{\themockfootnote}}%
  \begin{varwidth}{\textwidth}
  \begin{verse}
  #1
  \end{verse}
  \end{varwidth}
  \end{lrbox}%
  \begin{verse}[\wd\versebox]
  #1
  \end{verse}
}

\begin{document}

\lipsum[2]

\begin{cverse}
There was an old party of Lyme\footnote{Lyme Regis is a town in west Dorset, England} \\
Who married three wives at one time. \\
\vin When asked: ‘Why the third?’ \\
\vin He replied: ‘One’s absurd, \\
And bigamy, sir, is a crime.’
\end{cverse}

\begin{cverse}
Clof, clop, cloch,\\
cloffete,\\
cloppete,\\
clocchette,\\
chchch\dots\\
\`E gi\`u,\\
nel cortile,\\
la povera\\
fontana\\
malata;\\
che spasimo!\\
sentirla\\
tossire.\\
Tossisce,\\
tossisce,\\
un poco\\
si tace\dots\\
di nuovo.\\
tossisce.
\end{cverse}

\end{document}

enter image description here

5
  • This gives me a runaway argument error: file ended while scanning use of cverse. Commented Sep 24, 2014 at 0:21
  • @JohnPeyton Are you perhaps using cverse in the definition of another environment?
    – egreg
    Commented Sep 24, 2014 at 9:07
  • I don't think I was. However, I tried it again and it is working now­ … sorry that my problem was irreproducible. Commented Sep 25, 2014 at 2:32
  • I’ve also found that this fails when the poem contains footnotes. In such a case the entire block is aligned left. This is probably testable using your example. Commented Sep 26, 2014 at 0:06
  • 1
    @JohnPeyton I added a new definition of cverse to cope with footnotes.
    – egreg
    Commented Sep 26, 2014 at 9:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .