# Automatic versewidth

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}

-
Incidentally, is this limerick one of Edward lear's? –  Bernard Jul 21 at 1:14
Are you always using the first line for setting \versewidth? –  egreg Jul 21 at 8:18

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}


-
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! –  user Jul 21 at 11:24
And how can I turn the code into a \newenvironment for using it like \begin{cenverse} ..text... \end{cenverse}? –  user Jul 21 at 13:02