我正在尝试排版一些梵文诗句,并在它们周围设置quoting
缩进环境。一行包含半节诗句,前半部分以 结尾|
,后半部分以 结尾||
,我想避免前半部分和后半部分之间出现分页符,这样诗句就不会分成两页。
以下是我尝试过的一些方法:
\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}
我知道我可以手动做一个\newpage
,但如果我为每一节写一个命令/环境,然后可能会做一些其他的事情,如格式化,加强计数器等,它就不能被包括在内,我必须手动处理分页符,我当然会尽量避免。
答案1
您可以向 添加新键quoting
。指定此键应允许仅在明确段落(空白行)处分页。
\documentclass[a4paper]{memoir}
\usepackage[indentfirst=false]{quoting}
\usepackage{lipsum}
\makeatletter
\define@key{quo}{nopagebreak}[true]{\interlinepenalty=10000 }
\makeatother
\raggedbottom
\begin{document}
\lipsum[1-4]
\begin{quoting}[nopagebreak]
xxxxx\\
aaaaaaaaaaaaaaaaaaaaaaaaaa |\\
bbbbbbbbbbbbbbbbbbbbbbbbbb ||\\
cccccccccccccccccccccccccc |\\
dddddddddddddddddddddddddd ||\\
eeeeeeeeeeeeeeeeeeeeeeeeee |\\
ffffffffffffffffffffffffff ||\\
gggggggggggggggggggggggggg |\\
hhhhhhhhhhhhhhhhhhhhhhhhhh ||\\
jjjjjjjjjjjjjjjjjjjjjjjjjj |\\
kkkkkkkkkkkkkkkkkkkkkkkkkk ||\\
llllllllllllllllllllllllll |\\
mmmmmmmmmmmmmmmmmmmmmmmmmm ||\\
llllllllllllllllllllllllll |\\
mmmmmmmmmmmmmmmmmmmmmmmmmm ||\\
llllllllllllllllllllllllll |\\
mmmmmmmmmmmmmmmmmmmmmmmmmm ||\\
nnnnnnnnnnnnnnnnnnnnnnnnnn |\\
oooooooooooooooooooooooooo ||
\end{quoting}
\end{document}
我添加了\raggedbottom
,否则第一页的排版将被完全破坏。
答案2
尝试\\*
在强制换行后抑制分页符。
答案3
一个可行的解决方案是将每节诗句放在它自己的quoting
环境中,并向其中添加(方便的全局)选项vskip=0cm
,这样就无需在诗句后半部分末尾添加手动换行符。
\documentclass[a4paper]{memoir}
\usepackage{fontspec}
\usepackage[indentfirst=false,vskip=0cm]{quoting}
\usepackage{lipsum}
\begin{document}
\lipsum[1-4]
xxxxx
\begin{quoting}
Simple letters make a very bad example. |\\
Simple letters make a very bad example. ||
\end{quoting}
\begin{quoting}
Simple letters make a very bad example. |\\
Simple letters make a very bad example. ||
\end{quoting}
\begin{quoting}
Simple letters make a very bad example. |\\
Simple letters make a very bad example. ||
\end{quoting}
\begin{quoting}
Simple letters make a very bad example. |\\
Simple letters make a very bad example. ||
\end{quoting}
\begin{quoting}
Simple letters make a very bad example. |\\
Simple letters make a very bad example. ||
\end{quoting}
\begin{quoting}
Simple letters make a very bad example. |\\
Simple letters make a very bad example. ||
\end{quoting}
\begin{quoting}
Simple letters make a very bad example. |\\
Simple letters make a very bad example. ||
\end{quoting}
\end{document}