5

I'm trying to typeset some poetry, but I would like to force pagebreaks to occur between stanzas, to avoid breaking within a stanza. I've searched for a variety of methods, shown within my example below, but none of them seem to be working. Is there a way to do this?

\documentclass[12pt]{scrartcl}
\usepackage[letterpaper,margin=1in]{geometry}
\setlength{\parskip}{12pt}

% try not to have a page break in the middle of a stanza
\widowpenalty=10000
\clubpenalty=10000
\linepenalty=400
  \raggedbottom

\begin{document}

\begin{verse}

Lorem \textbf{ipsum} dolor sit amet, \emph{consectetur}\\adipisicing
elit, sed do eiusmod\\tempor incididunt ut labore et\\dolore magna
aliqua. Ut enim

ad minim veniam, quis nostrud\\exercitation ullamco laboris\\nisi ut
aliquip ex ea commodo\\consequat. Donec\\gravida quis augue in
tincidunt.\\Ut pulvinar ac sapien venenatis dignissim.\\Fusce vulputate
congue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.\\Aenean sit amet tellus non nisi
vulputate ornare. Vestibulum in nibh cursus, volutpat leo in, auctor
lacus. Donec euismod suscipit nunc sed tempus.

Lorem ipsum dolor sit amet,\\consectetur adipiscing elit.\\Sed
ullamcorper est in erat efficitur congue. Integer ullamcorper ac lorem
non maximus. Aliquam ut placerat nisl, eget euismod ante.

Sed ut perspiciatis\\unde omnis iste\\natus error sit\\voluptatem
accusantium.

Lorem \textbf{ipsum} dolor sit amet, \emph{consectetur}\\adipisicing
elit, sed do eiusmod\\tempor incididunt ut labore et\\dolore magna
aliqua. Ut enim

ad minim veniam, quis nostrud\\exercitation ullamco laboris\\nisi ut
aliquip ex ea commodo\\consequat. Donec\\gravida quis augue in
tincidunt.\\Ut pulvinar ac sapien venenatis dignissim.\\Fusce vulputate
congue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.\\Aenean sit amet tellus non nisi
vulputate ornare. Vestibulum in nibh cursus, volutpat leo in, auctor
lacus. Donec euismod suscipit nunc sed tempus.

ad minim veniam, quis nostrud\\exercitation ullamco laboris\\nisi ut
aliquip ex ea commodo\\consequat. Donec\\gravida quis augue in
tincidunt.\\Ut pulvinar ac sapien venenatis dignissim.\\Fusce vulputate
congue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.\\Aenean sit amet tellus non nisi
vulputate ornare. Vestibulum in nibh cursus, volutpat leo in, auctor
lacus. Donec euismod suscipit nunc sed tempus.

ad minim veniam, quis nostrud\\exercitation ullamco laboris\\nisi ut
aliquip ex ea commodo\\consequat. Donec\\gravida quis augue in
tincidunt.\\Ut pulvinar ac sapien venenatis dignissim.\\Fusce vulputate
congue dui, at dictum risus congue vel.\\Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.\\Aenean sit amet tellus non nisi
vulputate ornare. Vestibulum in nibh cursus, volutpat leo in, auctor
lacus. Donec euismod suscipit nunc sed tempus.


\end{verse}

\end{document}
  • Use \pagebreak[4] in the point where you want the page break. – karlkoeller Feb 16 '15 at 6:09
  • ! Undefined control sequence. <argument> \undefinedpagestyle – David Carlisle Feb 16 '15 at 11:09
  • Thanks for the note about the undefined page style. I've updated the example to fix that. – Dylan Kinnett Feb 16 '15 at 15:38
6

The line and widow penalties have no effect as internally inside verse \\ is \par so each line is a separate paragraph at the Tex primitive level at which those penalties operate. You can use \\* which prevents a page break:

Note this version does not generate an error about undefined page styles.

\documentclass[12pt]{scrartcl}
%\pagestyle{fancy}
\usepackage[letterpaper,margin=1in]{geometry}
\setlength{\parskip}{12pt}



\begin{document}

\begin{verse}

Lorem \textbf{ipsum} dolor sit amet, \emph{consectetur}\\*adipisicing
elit, sed do eiusmod\\*tempor incididunt ut labore et\\*dolore magna
aliqua. Ut enim

ad minim veniam, quis nostrud\\*exercitation ullamco laboris\\*nisi ut
aliquip ex ea commodo\\*consequat. Donec\\*gravida quis augue in
tincidunt.\\*Ut pulvinar ac sapien venenatis dignissim.\\*Fusce vulputate
congue dui, at dictum risus congue vel.\\*Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.\\*Aenean sit amet tellus non nisi
vulputate ornare. Vestibulum in nibh cursus, volutpat leo in, auctor
lacus. Donec euismod suscipit nunc sed tempus.

Lorem ipsum dolor sit amet,\\*consectetur adipiscing elit.\\*Sed
ullamcorper est in erat efficitur congue. Integer ullamcorper ac lorem
non maximus. Aliquam ut placerat nisl, eget euismod ante.

Sed ut perspiciatis\\*unde omnis iste\\*natus error sit\\*voluptatem
accusantium.

Lorem \textbf{ipsum} dolor sit amet, \emph{consectetur}\\*adipisicing
elit, sed do eiusmod\\*tempor incididunt ut labore et\\*dolore magna
aliqua. Ut enim

ad minim veniam, quis nostrud\\*exercitation ullamco laboris\\*nisi ut
aliquip ex ea commodo\\*consequat. Donec\\*gravida quis augue in
tincidunt.\\*Ut pulvinar ac sapien venenatis dignissim.\\*Fusce vulputate
congue dui, at dictum risus congue vel.\\*Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.\\*Aenean sit amet tellus non nisi
vulputate ornare. Vestibulum in nibh cursus, volutpat leo in, auctor
lacus. Donec euismod suscipit nunc sed tempus.

ad minim veniam, quis nostrud\\*exercitation ullamco laboris\\*nisi ut
aliquip ex ea commodo\\*consequat. Donec\\*gravida quis augue in
tincidunt.\\*Ut pulvinar ac sapien venenatis dignissim.\\*Fusce vulputate
congue dui, at dictum risus congue vel.\\*Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.\\*Aenean sit amet tellus non nisi
vulputate ornare. Vestibulum in nibh cursus, volutpat leo in, auctor
lacus. Donec euismod suscipit nunc sed tempus.

ad minim veniam, quis nostrud\\*exercitation ullamco laboris\\*nisi ut
aliquip ex ea commodo\\*consequat. Donec\\*gravida quis augue in
tincidunt.\\*Ut pulvinar ac sapien venenatis dignissim.\\*Fusce vulputate
congue dui, at dictum risus congue vel.\\*Vivamus rutrum commodo nunc,
sed elementum velit consectetur nec.\\*Aenean sit amet tellus non nisi
vulputate ornare. Vestibulum in nibh cursus, volutpat leo in, auctor
lacus. Donec euismod suscipit nunc sed tempus.


\end{verse}

\end{document}
|improve this answer|||||
  • Thanks for this. It looks like at suitable fix, but I'm using pandoc to create the .tex file, before moving on to other formats. Is there perhaps another way to accomplish this without changing the way the linebreaks are written, as pandoc prefers to write the linebreaks per my example above? – Dylan Kinnett Feb 16 '15 at 15:39
  • 1
    @DylanKinnett you could use \makeatletter\def\@centercr{\ifhmode \unskip\else \@nolnerr\fi \par\@ifstar{\nobreak\@xcentercr}{\nobreak\@xcentercr}}\makeatother in the preamble then in these kinds of enviornments \\ and \\* will work the same way – David Carlisle Feb 16 '15 at 16:09
  • That seems to have done the trick nicely. Thank you so much. – Dylan Kinnett Feb 16 '15 at 19:29
1

In poemscol you can redefine the stanza environment to change the penalty to whatever you wish. Poemscol also automatically marks cases in which there is (or in which there is not) a stanza break at a page boundary. That may be helpful to you too.

Here is a minimal example of poemscol. Penalties are actually set to slightly encourage page turns between stanza environments. But if there is a stanza break at a page turn, poemscol puts a * (or whatever you wish) at the bottom of the page.

\documentclass{article}
\usepackage{fancyhdr,geometry,keyval,ifthen,mparhack}
\usepackage{poemscol}
\stanzaatbottom{*}
\nostanzaatbottom{\relax}
\geometry{textwidth=4in,textheight=6.75in,headheight=14pt,paperwidth=6in,paperheight=9in}
\begin{document}
\poemtitle{The Funeral Day}


\epigraph{Suffield, Connecticut, 1952}

\begin{poem}
\begin{stanza}
Later, we folded our hands in his tidy room.\verseline
Patience taught us nothing: we sat for hours\verseline
While the brass clock mumbled to itself like a nun.\verseline
The shadows in the eaves began\verseline
To knot up all the air. And then outside\verseline
This bird just sang and sang and sang.\verseline
What was it to him? Where did he get the right?\verseline
I got up to close the window\end{stanza}

\begin{stanza}
And there I saw the tobacco-fields\verseline
Moving their shrouds in the dusk.\verseline
The wind came thoughtlessly over the wide cloth\verseline
And lifted the white undersides of leaves.\verseline
I didn't close the window. When I sat back down,\verseline
I didn't say what I had seen.\end{stanza}
\end{poem}

\end{document}

Poemscol defines the stanza environment this way:

\newenvironment{stanza}{\penalty-100\instanzatrue\mark{\nostanzaatbottomvalue\ }}
 {\nobreak\mark{\stanzaatbottomvalue\ }\nobreak\ifspeciallinelock%
\relax\else%
\nolinebreak\incrementverselinenumber%
\fi%
\speciallinelockfalse%
\nobreak
  \instanzafalse

  \stanzaskip
}

If you want to alter the stanza environment to discourage, or even to prevent, page breaks at stanza breaks, use \renewenvironment and change the value of the penalty in the first line.

|improve this answer|||||
  • For some reason the post did not preserve my lineation, making the code harder to read. \verseline ends every line of verse. I had put each line on its own line in my source, rather than concatenating the entire stanza like a prose paragraph. But I don't know how to fix that on stackexchange. – John Burt May 11 '19 at 15:29
  • There is a {} button when writing the question. Select the code and click the button to format as code. I did that for you :) I think that you could delete your other answer (or add it to this one) to avoid clutter. – Phelype Oleinik May 11 '19 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.