paracol
我正在尝试使用和listings
文档类并排排版一些代码和一些注释amsbook
。它大部分都有效,但我遇到了一个错误,当有分页符时,段落会立即下列的分页符为“底部齐平”。例如:
在分页符之前,左列开始与右列垂直对齐,但分页符之后不再如此。
如果我从环境mdframed
中移除背景listings
,事情就会按预期进行:
(如果没有右列中“块”之间的垂直线,辨别起来会有些困难,但这是事实。)
amsbook
这仅仅是文档类的问题,至少在我将输出与 、 和 进行比较的实验中是如此book
。article
老实说amsart
,我不明白到底amsbook
做了什么不同的事情,导致事情发生了变化。
它似乎与语法高亮、颜色使用或字体编码无关。
重现此问题的最小工作示例,尽管很长(抱歉):
\documentclass[leqno,oneside]{amsbook}
\usepackage[inner=6pc,outer=6pc,bottom=6pc,top=5pc,headheight=13.6pt]{geometry}
\usepackage{listings}
\usepackage{mdframed}
\mdfsetup{skipabove=\medskipamount,
outermargin=0pt,
innermargin=0pt,
leftmargin=0pt,
rightmargin=0pt,
innerleftmargin=0.25em,
innerrightmargin=0pt,
rightline=false,
leftline=false,
frametitlerule=false,
innertopmargin=0pt,
innerbottommargin=0pt,
splittopskip=\topsep
}
\lstset{%
basicstyle=\ttfamily,
language=Mizar,
}
\lstnewenvironment{mizar}%
{\lstset{language=Mizar,
basicstyle=\ttfamily\small,
upquote=true}\mdframed[usetwoside=false]}%
{\endmdframed}
\usepackage{paracol}
\begin{document}
\chapter{Foundations}
\section{Tarski Grothendieck Set Theory}
\begin{paracol}{2}
For simplicity we adopt the following convention: $x$, $y$,
$z$, $u$ will denote objects of any type; $N$, $M$, $X$, $Y$, $Z$
will denote objects of the type set.
Next we will state two axioms:
\begin{equation}
x \mbox{ is } \textrm{set},
\end{equation}
\begin{equation}
(\mbox{ for } x\mbox{ holds } x\in X\mbox{ iff } x\in Y)\mbox{ implies } X=Y.
\end{equation}
\switchcolumn
\begin{mizar}
reserve x,y,z,u for object;
reserve N,M,X,Y,Z for set;
:: Everything is a set
theorem :: TARSKI:1
for x being object holds x is set;
:: Extensionality
theorem :: TARSKI:2
(for x being object
holds x in X iff x in Y)
implies X = Y;
\end{mizar}
\switchcolumn*
We now introduce two functors. Let us consider $y$. The functor
\[ \{\,y\,\} \]
with values of the type set, is defined by
\[ x\in\mbox{ it } \mbox{ iff } x=y.\]
Let us consider $z$. The functor
\[ \{\,y,z\,\} \]
with values of the type set, is defined by
\[ x\in\mbox{ it } \mbox{ iff } x=y \mbox{ or } x=z.\]
The following axioms hold:
\begin{equation}
X=\{y\} \mbox{ iff }\ \mbox{ for } x \mbox{ holds } x\in X \mbox{ iff } x=y,
\end{equation}
\begin{multline}
X=\{y,z\} \mbox{ iff }\ \mbox{ for } x\mbox{ holds } x\in X\mbox{ iff }\\
%\textbf{iff}~
x=y\mbox{ or } x=z.
\end{multline}
\switchcolumn
\begin{mizar}
definition
let y be object;
func { y } -> set means
:: TARSKI:def 1
for x being object
holds x in it iff x = y;
let z be object;
func { y, z } -> set means
:: TARSKI:def 2
x in it iff x = y or x = z;
commutativity;
end;
\end{mizar}
\switchcolumn*
Let us consider $X$, $Y$. The predicate
\[ X\subset Y\quad\mbox{is defined by}\quad x\in
X\mbox{ implies } x\in Y.\]
\switchcolumn
\begin{mizar}
definition
let X,Y;
pred X c= Y
means :: TARSKI:def 3
for x being object
holds x in X implies x in Y;
reflexivity;
end;
\end{mizar}
\switchcolumn*
Let us consider $X$. The functor
\[\bigcup X,\]
with values of the type set, is defined by
\[x\in\mbox{ it }\ \mbox{ iff }\ \mbox{ ex } Y\mbox{ st } x\in Y\mathrel{\&} Y\in X.\]
Then we get
\begin{multline}
X=\bigcup Y\mbox{ iff }\ \mbox{ for } x\mbox{ holds } x\in
X\mbox{ iff }\\
\mbox{ ex } Z\mbox{ st } x\in Z\mathrel{\&} Z\in Y,
\end{multline}
\begin{equation}
X=\mbox{ bool } Y\mbox{ iff }\ \mbox{ for } Z\mbox{ holds }
Z\in X \mbox{ iff } Z\subset Y.
\end{equation}
\switchcolumn
\begin{mizar}
definition
let X;
func union X -> set means
:: TARSKI:def 4
x in it iff ex Y st x in Y & Y in X;
end;
\end{mizar}
\switchcolumn*
The regularity axiom claims that
\begin{multline}
x\in X\mbox{ implies }\ \mbox{ ex } Y\mbox{ st } Y\in X\mathrel{\&}\\
\neg\ \mbox{ ex } x\mbox{ st } x\in X\mathrel{\&} x\in Y.
\end{multline}
\switchcolumn
\begin{mizar}
:: Regularity
theorem :: TARSKI:3
x in X implies
ex Y st Y in X &
not ex x st x in X & x in Y;
\end{mizar}
\begin{mizar}
definition let x, X be set;
redefine pred x in X;
asymmetry;
end;
\end{mizar}
\switchcolumn*
The scheme \textit{Fraenkel} deals with a constant $\mathcal{A}$ that
has the type set and a binary predicate $\mathcal{P}$ and states that
the following holds:
\begin{multline*}
\mbox{ ex } X\mbox{ st }\ \mbox{ for } x\mbox{ holds } \\
x\in X\mbox{ iff }
\mbox{ ex } y\mbox{ st } y\in\mathcal{A}\mathrel{\&}\mathcal{P}[y,x]
\end{multline*}
provided the parameters satisfy the following extra condition:
\begin{itemize}
\item $\mbox{ for }$ $x$, $y$, $z$ $\mbox{ st }$
$\mathcal{P}[x,y]\mathrel{\&}\mathcal{P}[x,z]$ $\mbox{ holds }$ $y=z$.
\end{itemize}
\switchcolumn
\begin{mizar}
scheme :: TARSKI:sch 1
Replacement{ A() -> set,
P[object,object] }:
ex X
st for x being object
holds x in X iff
ex y being object
st y in A() & P[y,x]
provided
for x,y,z being object
st P[x,y] & P[x,z]
holds y = z;
\end{mizar}
\switchcolumn*
Let us consider $x$, $y$. The functor
\[\langle x,y\rangle,\]
is defined by
\[\mbox{ it } = \{\,\{x,y\,\},\{\,x\,\}\,\}.\]
According to the definition
\begin{equation}
\langle x,y\rangle = \{\,\{x,y\,\},\{\,x\,\}\,\}.
\end{equation}
\switchcolumn
\begin{mizar}
definition
let x,y be object;
func [x,y] -> object equals
:: TARSKI:def 5
{ { x,y }, { x } };
end;
\end{mizar}
\switchcolumn*
Let us consider $X$, $Y$. The predicate
\[X\approx Y\]
is defined by
\begin{multline*}
\mbox{ ex } Z\mbox{ st }\!\! (\mbox{ for } x\mbox{ st } x\in X\mbox{ ex }
y\mbox{ st } y\in Y\mathrel{\&}\langle x,y\rangle\in Z)\mathrel{\&}\\
(\mbox{ for } x\mbox{ st } x\in X\mbox{ ex }
y\mbox{ st } y\in Y\mathrel{\&}\langle x,y\rangle\in Z)\mathrel{\&}\\
\mbox{ for } x,y,z,u\mbox{ st } \langle x,y\rangle\in Z\mathrel{\&}\langle z,u\rangle\in Z\\
\mbox{ holds } x=z\mbox{ iff } y=u.
\end{multline*}
\switchcolumn
\begin{mizar}
definition let X,Y;
pred X,Y are_equipotent means
:: TARSKI:def 6
ex Z st
(for x st x in X
ex y st y in Y & [x,y] in Z) &
(for y st y in Y
ex x st x in X & [x,y] in Z) &
for x,y,z,u st [x,y] in Z & [z,u] in Z
holds x = z iff y = u;
end;
\end{mizar}
\switchcolumn*
The Tarski's axiom A claims that
\begin{multline}
\mbox{ ex } M \mbox{ st } N\in M\mathrel{\&}\\
(\mbox{ for } X,Y \mbox{ holds } X\in M\mathrel{\&}
Y\subset X \mbox{ implies } Y\in M)\mathrel{\&}\\
(\mbox{ for } X \mbox{ holds } X\in M
\mbox{ implies } \mbox{ bool } X\in M)\mathrel{\&}\\
(\mbox{ for } X \mbox{ holds } X\subset M \mbox{ implies }
X\approx M \mbox{ or } X\in M).
\end{multline}
\switchcolumn\nopagebreak
\begin{mizar}
theorem :: TARSKI_A:1
ex M st N in M &
(for X,Y holds X in M & Y c= X
implies Y in M) &
(for X st X in M
ex Z st Z in M &
for Y st Y c= X
holds Y in Z) &
(for X holds X c= M
implies X,M are_equipotent
or X in M);
\end{mizar}
\end{paracol}
\end{document}
使用 PDFlatex(TeX live 2022 中的 3.141592653-2.6-1.40.22 版本)会生成一个 3 页的 PDF,其中两个分页符后立即出现未对齐的左列。
如果我添加,例如,\ensurevspace{5cm}
到每个\switchcolumn*
,那么就这个奇怪的错误而言,情况保持不变。
(而且我的实际 TeX 代码看起来比这干净得多,具有语义宏等,但这是我能创建的最小的独立示例。)
答案1
Barbara Beeton 的见解非常深刻,这让我更加仔细地检查了 的代码amsbook
。我发现有一个宏,每当章节开始时都会调用它,它会将 更改topskip
为7.5pc
全局的……但这并不是该特定代码行的预期目标。解决方法是添加以下几行:
\makeatletter
\def\@makechapterhead#1{\vspace*{7.5pc}\relax%
\begingroup
\fontsize{\@xivpt}{18}\bfseries\centering
\ifnum\c@secnumdepth>\m@ne
\leavevmode \hskip-\leftskip
\rlap{\vbox to\z@{\vss
\centerline{\normalsize\mdseries
\uppercase\@xp{\chaptername}\enspace\thechapter}
\vskip 3pc}}\hskip\leftskip\fi
#1\par \endgroup
\skip@34\p@ \advance\skip@-\normalbaselineskip
\vskip\skip@ }
\def\@makeschapterhead#1{\vspace*{7.5pc}\relax
\begingroup
\fontsize{\@xivpt}{18}\bfseries\centering
#1\par \endgroup
\skip@34\p@ \advance\skip@-\normalbaselineskip
\vskip\skip@ }
\makeatother
这只会更改第一行,更改\global\topskip7.5pc
为\vspaces*{7.5pc}
。根据文档,这显然是目标,而且没有人真正费心去检查代码确实做到了。