# How to suggest reasonable places for pagebreaks

I am currently typesetting a bilingual Afrikaans-English bible. I sometimes end up with ugly orphans and widows. Is there any way to mark the beginning of verses as friendly page-break places. In my example, I want the page to break as such: ...as I have done. \pagebreak ${}^{\mathbf{22}}$While the earth...

It is difficult to present clean source code to explain my dilemma, so I will ask the same question with a simpler example: Given a very very long paragraph spanning a few pages (no paragraph breaks, no newlines between sentences), what can I do to tell latex that if a page needs breaking, try to break the page after a full-stop.

I have tried to insert \pagebreak[#] after each fullstops, but changing the # number between 1, 2, 3, and 4 either results in my request being ignored or enforces with every instance of \pagebreak.

• how are you doing parallel input? normally \pagebreak would go from one column to the next but in your case you presumably keep English on the right, if you are not (directly) using tex's page breaker there may be alternative answers... – David Carlisle Oct 7 '14 at 16:36
• I use the parcolumns package \usepackage{parcolumns}. I can then create two columns as \begin{parcolumns}{2}\colchunk[1]{bla bla English}\colchunk[2]{bla bla Afrikaans}\end{parcolumns}. From what I gathered, the parallel columns' page-breaking works the same as if it was isolated text, that's why I presented the simpler more understandable example as well. I wonder if you can surround each verse in a "try not to break me" macro with some importance parameter? – Simon Streicher Oct 7 '14 at 17:11
• the try not to break me (over a page) bit is the easy bit, the hard bit is to set the following part as part of the same paragraph if the page doesn't break and as a new paragraph if it does. I may look at parcolumns later – David Carlisle Oct 7 '14 at 18:33

Without a sample document it is hard to give advice.

You can use use \pagebreak[1] or 0 or 2 or 3 depending on how strong a hint you want. 4 forces a break, however this inserts the page break hint after the current line of text.

You probably want something different, if you force a break you (I think) want to force a linebreak, pad out the rest of the line with white space, then pad to the bottom of the page with vertical white space, and then force a page break.

If that is what you want it's (very) hard to do in TeX due to the asynchronous nature of the page breaker, the paragraph is broken into lines before any page breaking is considered.

That said, if you are prepared to intervene a bit into tex's normal flow you can do something like this which first ads the next verse inline after the text so far, if the resulting column is too high, that is discarded, the column is output padded with a vfil and a forced break penalty at the bottom and the verse reset starting a new paragraph in a new column.

\documentclass[twocolumn]{article}
\showoutput
\setlength\textwidth{12cm}
\setlength\textheight{10\baselineskip}
\setlength\parindent{0pt}

\newcommand\myverse[1]{%
\setbox2\vbox{%
\parskip0pt
\parindent0pt
\unvcopy0
\setbox4\lastbox
\unskip
\unpenalty
\setbox6\lastbox
\copy6
\nobreak
\prevdepth\dp6
\ifvoid4 \else
\unhbox4\unskip\unskip\unpenalty
\hspace{1em plus .5em}%
\fi
\refstepcounter{enumi}\strut\textsuperscript{\textbf{\theenumi}}#1}%
\showthe\ht2
\ifdim\ht2<\textheight
\setbox0\box2
\else
\unvbox0
\setbox0\vbox{%
\vfil
\break
\strut\textsuperscript{\textbf{\theenumi}}#1}%
\fi}

\newenvironment{myverses}
{\setbox0\vbox{}\samepage}
{\unvbox0 }
\begin{document}
\begin{myverses}
\myverse{One two three four five six seven eight nine ten eleven.}
\myverse{Red green blue yellow One two three four five six seven eight nine ten eleven.}
\myverse{Red green blue yellow. One two three four five six seven eight nine ten eleven.}
\myverse{Car, one two train, three four bus, five six tram, seven eight boat, nine ten eleven.}
\myverse{One emacs two three four five six seven eight nine ten eleven.}
\myverse{Red green vim blue yellow One two three four five six seven eight nine ten eleven.}
\myverse{Red green blue sed yellow. One two three four five six seven eight nine ten eleven.}
\myverse{Car, one two train, three notepad four bus, five six tram, seven eight boat, nine ten eleven.}
\end{myverses}
\end{document}

• Thanks David. I edited my question to clear up some ambiguity. It is quite difficult to present some code, my example is quite a tangled mess generated from a python script I wrote. Anycase, I already tried \pagebreak without success and I don't want to manually "fix" this one certain case, but rather compile the document in such a way that latex breaks pages only after verses or headers. – Simon Streicher Oct 7 '14 at 16:04
• @SimonStreicher unfortunately the clarified question confirms what I hinted at in my answer, basically you can't do this in TeX. You want the fact that you are near a page border to influence the line breaker and that just isn't the way tex works. What you can perhaps do is automatically detect the situation and write something into the aux file to force a break on the next run, but as changing one line break affects all the others this may be rather unstable and require a lot of runs after any edit. – David Carlisle Oct 7 '14 at 16:12
• @SimonStreicher see update:-) – David Carlisle Oct 7 '14 at 22:38
• Wow thanks, I managed to compile the source code and the output is exactly what I wanted. I will later have a look at how you achieved this feat. – Simon Streicher Oct 8 '14 at 9:52