I'm trying to typeset some sanskrit verses, surrounding them by a quoting
environment for indentation. One line contains half a verse, the first half ended by |
, the second by ||
, and I would like to prevent page breaks between first and second half, so that a verse is never split over two pages.
Here's some things I tried:
\documentclass[a4paper]{memoir}
\usepackage{fontspec}
\usepackage[indentfirst=false]{quoting}
\usepackage{lipsum}
\newenvironment{absolutelynopagebreak}%See http://tex.stackexchange.com/posts/94702/edit
{\par\nobreak\vfil\penalty0\vfilneg
\vtop\bgroup}
{\par\xdef\tpd{\the\prevdepth}\egroup
\prevdepth=\tpd}
\begin{document}
\lipsum[1-4]
\begin{quoting}
xxxxx\\
aaaaaaaaaaaaaaaaaaaaaaaaaa |\\
bbbbbbbbbbbbbbbbbbbbbbbbbb ||\\
cccccccccccccccccccccccccc |\\
dddddddddddddddddddddddddd ||\\
eeeeeeeeeeeeeeeeeeeeeeeeee |\\
ffffffffffffffffffffffffff ||\\
gggggggggggggggggggggggggg |\\
hhhhhhhhhhhhhhhhhhhhhhhhhh ||\\
jjjjjjjjjjjjjjjjjjjjjjjjjj |\\
kkkkkkkkkkkkkkkkkkkkkkkkkk ||\\
%llllllllllllllllllllllllll |\\\nopagebreak%doesn't seem to be doing anything
%mmmmmmmmmmmmmmmmmmmmmmmmmm ||\\
%\begin{samepage}llllllllllllllllllllllllll |\\
%mmmmmmmmmmmmmmmmmmmmmmmmmm ||\\ \end{samepage}%doesn't seem to be doing anything either
%\begin{minipage}{\textwidth}llllllllllllllllllllllllll |\\
%mmmmmmmmmmmmmmmmmmmmmmmmmm ||\end{minipage} %works here but makes a mess in my real file
%\begin{absolutelynopagebreak}llllllllllllllllllllllllll |\\
%mmmmmmmmmmmmmmmmmmmmmmmmmm ||\\\end{absolutelynopagebreak}%breaks out of quoting's indentation, and introduces a new paragraph
llllllllllllllllllllllllll |\\
mmmmmmmmmmmmmmmmmmmmmmmmmm ||\\
nnnnnnnnnnnnnnnnnnnnnnnnnn |\\
oooooooooooooooooooooooooo ||\\
\end{quoting}
\end{document}
I know I can manually do a \newpage
, but if I were to write a command/environment for each verse, which then might do some other things such as formatting, stepping up a counter etc., it could not be included and I would have to take care of the page breaks manually, which I'd of course try to avoid.
Best Answer
You can add a new key to
quoting
. Specifying this key should allow page breaks only at explicit paragraphs (blank lines).I added
\raggedbottom
or the typesetting of the first page would be completely spoiled.