我决定将两个表格放在多列块中,这样可以节省一些空间并使其看起来更整洁。
但是,发生了以下情况 - 第二个块的间距不对(表格稍微向下移动,文本向下移动了相当多):
以下是我使用的代码:
\begin{multicols}{2}
\begin{center}
\begin{tabular}{@{} llll @{}}
\toprule
$P$ & $Q$ & $\neg \left(P \land Q \right)$ & $\neg P \lor \neg Q$\\
\midrule
T & T & F & F \\
T & F & T & T \\
F & T & T & T \\
F & F & T & T \\
\bottomrule
\end{tabular}
\begin{center}
\small{Proof of equivalence: $\neg \left(P \land Q \right) \equiv \neg P \lor \neg Q$.}
\end{center}
\end{center}
\columnbreak
\begin{center}
\begin{tabular}{@{} llll @{}}
\toprule
$P$ & $Q$ & $\neg \left(P \land Q \right)$ & $\neg P \lor \neg Q$\\
\midrule
T & T & F & F \\
T & F & T & T \\
F & T & T & T \\
F & F & T & T \\
\bottomrule
\end{tabular}
\begin{center}
\small{Proof of equivalence: $\neg \left(P \land Q \right) \equiv \neg P \lor \neg Q$.}
\end{center}
\end{center}
\end{multicols}
有人能告诉我怎么修复它吗?谢谢!
答案1
另一种方法是使用两个小页面、tabular*
表格和caption
包,如下所示:
\documentclass{article}
\usepackage{booktabs}
\usepackage{caption}
\begin{document}
\begin{center}
\captionsetup{font=small}
\begin{minipage}[t]{0.4\textwidth}
\centering
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} cccc }
\toprule
$P$ & $Q$ & $\neg (P \land Q )$ & $\neg P \lor \neg Q$\\
\midrule
T & T & F & F \\
T & F & T & T \\
F & T & T & T \\
F & F & T & T \\
\bottomrule
\end{tabular*}
\captionof*{table}{Proof of equivalence: $\neg (P \land Q ) \equiv \neg P \lor \neg Q$.}
\end{minipage}
\hfil
\begin{minipage}[t]{0.4\textwidth}
\centering
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} cccc }
\toprule
$P$ & $Q$ & $\neg (P \land Q )$ & $\neg P \lor \neg Q$\\
\midrule
T & T & F & F \\
T & F & T & T \\
F & T & T & T \\
F & F & T & T \\
\bottomrule
\end{tabular*}
\captionof*{table}{Proof of equivalence: $\neg (P \land Q ) \equiv \neg P \lor \neg Q$.}
\end{minipage}
\end{center}
\end{document}
答案2
我认为将手头的材料强行塞入双列multicols
环境不是一个好主意。使用 aminipage
和(可选)使用threeparttable
环境将图例的宽度限制为相关环境的宽度tabular
似乎是一种更直接的方法。
\documentclass{article}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable} % for 'threeparttable' environment
\begin{document}
\noindent % <-- important
\begin{minipage}{\textwidth}
\centering
\begin{threeparttable} % first 'threeparttable'
\begin{tabular}[t]{@{} cccc @{}}
\toprule
$P$ & $Q$ & $\neg (P \land Q )$ & $\neg P \lor \neg Q$\\
\midrule
T & T & F & F \\
T & F & T & T \\
F & T & T & T \\
F & F & T & T \\
\bottomrule
\end{tabular}
\small\raggedright
\begin{tablenotes}
\item[]Proof of equivalence: $\neg (P \land Q ) \equiv \neg P \lor \neg Q$.
\end{tablenotes}
\end{threeparttable}% % <-- the '%' symbol is important
\qquad
\begin{threeparttable} % second 'threeparttable'
\begin{tabular}[t]{@{} cccc @{}}
\toprule
$P$ & $Q$ & $\neg (P \land Q )$ & $\neg P \lor \neg Q$\\
\midrule
T & T & F & F \\
T & F & T & T \\
F & T & T & T \\
F & F & T & T \\
\bottomrule
\end{tabular}
\small\raggedright
\begin{tablenotes}
\item[]Proof of equivalence: $\neg (P \land Q ) \equiv \neg P \lor \neg Q$.
\end{tablenotes}
\end{threeparttable}
\end{minipage}
\end{document}
答案3
通过两个并排的 minipage 环境,您可以实现以下输出:
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\noindent
\begin{minipage}[t]{0.45\textwidth}
\centering
Proof of equivalence: $\neg (P \land Q ) \equiv \neg P \lor \neg Q$.
\begin{tabular}[t]{@{} cccc @{}}
\toprule
$P$ & $Q$ & $\neg (P \land Q )$ & $\neg P \lor \neg Q$\\
\midrule
T & T & F & F \\
T & F & T & T \\
F & T & T & T \\
F & F & T & T \\
\bottomrule
\end{tabular}
\end{minipage}
\centering
\hfill
\begin{minipage}[t]{0.45\linewidth}
\centering
Proof of equivalence: $\neg (P \land Q ) \equiv \neg P \lor \neg Q$.
\begin{tabular}[t]{@{} cccc @{}}
\toprule
$P$ & $Q$ & $\neg (P \land Q )$ & $\neg P \lor \neg Q$\\
\midrule
T & T & F & F \\
T & F & T & T \\
F & T & T & T \\
F & F & T & T \\
\bottomrule
\end{tabular}
\end{minipage}
\end{document}