我正在尝试重现这样的结构:
但我所能想到的只有以下代码:
\begin{table}[!htb]
\caption{Global caption}
\begin{minipage}{.5\linewidth}
\caption*{$G$}
\centering
\begin{tabular}{|c|c|lll}
\cline{1-2}
\textbf{Vertex} & \textbf{Label}\\ \cline{1-2}
b & 1 \\
c & 1 \\
d & 1 \\ \cline{1-2}
\end{tabular}
\end{minipage}%
\begin{minipage}{.5\linewidth}
\centering
\caption*{$F$}
\begin{tabular}{|c|c|lll}
\cline{1-2}
\textbf{Vertex} & \textbf{Label}\\ \cline{1-2}
b & 1 \\
c & 1 \\
d & 1 \\ \cline{1-2}
\end{tabular}
\end{minipage}
\end{table}
\begin{table}[!htb]
\caption*{Global caption}
\begin{minipage}{.5\linewidth}
\caption*{$G$}
\centering
\begin{tabular}{|c|c|lll}
\cline{1-2}
\textbf{Vertex} & \textbf{Label}\\ \cline{1-2}
b & 1 \\
c & 1 \\
d & 1 \\ \cline{1-2}
\end{tabular}
\end{minipage}%
\begin{minipage}{.5\linewidth}
\centering
\caption*{$F$}
\begin{tabular}{|c|c|lll}
\cline{1-2}
\textbf{Vertex} & \textbf{Label}\\ \cline{1-2}
b & 1 \\
c & 1 \\
d & 1 \\ \cline{1-2}
\end{tabular}
\end{minipage}
\end{table}
\begin{table}[!htb]
\caption*{Global caption}
\begin{minipage}{.5\linewidth}
\caption*{$G$}
\centering
\begin{tabular}{|c|c|lll}
\cline{1-2}
\textbf{Vertex} & \textbf{Label}\\ \cline{1-2}
b & 1 \\
c & 1 \\
d & 1 \\ \cline{1-2}
\end{tabular}
\end{minipage}%
\begin{minipage}{.5\linewidth}
\centering
\caption*{$F$}
\begin{tabular}{|c|c|lll}
\cline{1-2}
\textbf{Vertex} & \textbf{Label}\\ \cline{1-2}
b & 1 \\
c & 1 \\
d & 1 \\ \cline{1-2}
\end{tabular}
\end{minipage}
\end{table}
它与结构有些相似,但会使我的表格彼此分离太多。有人能建议我采用更好的方法来获得所需的结果吗?
先感谢您。
答案1
也可以使用以下方法构建这些表格卡路里和一个calstable
。通过定义删除单元格边框的快捷键,可以方便地删除单元格周围必要的边框。当然,子标签是普通文本,因此无法引用subtable 1(c)
。如果您喜欢更窄的表格,只需在计算列宽时增加除数即可。
\documentclass{article}
\usepackage{cals, caption}
\let\nc=\nullcell % Shortcuts
\let\sc=\spancontent
\begin{document}
\begin{table}[ht]
\begin{calstable}[c] % Centre the tabular
% Defining columns relative to the margin
\colwidths{{\dimexpr(\columnwidth)/5\relax} % Increase 5 to 6 or 7 to make the tabular more narrow
{\dimexpr(\columnwidth)/5\relax}
{\dimexpr(\columnwidth)/5\relax}
{\dimexpr(\columnwidth)/5\relax}
{\dimexpr(\columnwidth)/5\relax}
}
% Set up the tabular
\makeatletter
\def\cals@framers@width{0.4pt} % Outside frame rules, reduce if the rule is too heavy
\def\cals@framecs@width{0.4pt}
\def\cals@bodyrs@width{0.4pt}
\def\cals@cs@width{0.4pt} % Inside rules, reduce if the rule is too heavy
\def\cals@rs@width{0.4pt}
\def\tb{\ifx\cals@borderT\relax % Top border switch (off-on)
\def\cals@borderT{0pt}
\else \let\cals@borderT\relax\fi}
\def\bb{\ifx\cals@borderB\relax % Botton border switch (off-on)
\def\cals@borderB{0pt}
\else \let\cals@borderB\relax\fi}
\def\rb{\ifx\cals@borderR\relax % Right border switch (off-on)
\def\cals@borderR{0pt}
\else \let\cals@borderR\relax\fi}
\def\lb{\ifx\cals@borderL\relax % Left border switch (off-on)
\def\cals@borderL{0pt}
\else \let\cals@borderL\relax\fi}
% R1H1
\brow
\lb\tb\rb\alignC\nc{ltb}
\nc{rtb}\sc{$G$}
\bb\cell{}\bb
\nc{ltb}
\nc{rtb}\sc{$H$}\lb\tb\rb
\erow
% R2B1
\brow
\cell{Vertex}
\cell{Label}
\bb\cell{}\bb
\cell{Vertex}
\cell{Label}
\erow
% R3B2
\brow
\cell{b}
\cell{1}
\bb\cell{}\bb
\cell{c}
\cell{1}
\erow
% R4B3
\brow
\cell{c}
\cell{1}
\bb\cell{}\bb
\cell{a}
\cell{1}
\erow
% R5B4
\brow
\cell{d}
\cell{1}
\bb\cell{}\bb
\cell{d}
\cell{1}
\erow
% R6B5
\brow
\lb\rb\nc{ltb}
\nc{tb}
\nc{tb}
\nc{tb}
\nc{rtb}\sc{(a)}\lb\rb
\erow
% R7B6
\brow
\lb\tb\rb\alignC\nc{ltb}
\nc{rtb}\sc{$G$}
\bb\cell{}\bb
\nc{ltb}
\nc{rtb}\sc{$H$}\lb\tb\rb
\erow
% R8B7
\brow
\cell{Vertex}
\cell{Label}
\bb\cell{}\bb
\cell{Vertex}
\cell{Label}
\erow
% R9B8
\brow
\cell{c}
\cell{11}
\bb\cell{}\bb
\cell{a}
\cell{11}
\erow
% R10B9
\brow
\cell{d}
\cell{10}
\bb\cell{}\bb
\cell{d}
\cell{11}
\erow
% R11B10
\brow
\rb\lb\nc{ltb}
\nc{tb}
\nc{tb}
\nc{tb}
\nc{rtb}\sc{(b)}\rb\lb
\erow
% R12B11
\brow
\lb\tb\rb\alignC\nc{ltb}
\nc{rtb}\sc{$G$}
\bb\cell{}\bb
\nc{ltb}
\nc{rtb}\sc{$H$}\lb\tb\rb
\erow
% R13B12
\brow
\cell{Vertex}
\cell{Label}
\bb\cell{}\bb
\cell{Vertex}
\cell{Label}
\erow
% R14B13
\brow
\cell{d}
\cell{101}
\bb\cell{}\bb
\cell{d}
\cell{101}
\erow
% R15B14
\brow
\lb\rb\bb\nc{ltb}
\nc{tb}
\nc{tb}
\nc{tb}
\nc{rtb}\sc{(c)}\lb\rb\bb
\erow
\makeatletter
\end{calstable}\par % \par to align the tabular
\caption{Labels on the non-mapped vertices of $G$ and $H$ with mapping: Fig (a) $M={a,b}$, Fig. (b) $M={ab,bc}$, and (c) $M={abc, bca}$}
\end{table}
\end{document}
答案2
我建议您加载subcaption
包,它提供了一个名为的环境subtable
。为了(或多或少)复制您发布的屏幕截图中显示的结构,您可以在整体环境中设置三个subtable
环境,每个环境都有自己的。在下面的代码中,每个环境都包含两个环境。\caption
table
subtable
tabular
\documentclass{article} % or some other, more suitable document class
\usepackage{array} % for '\extrarowheight' macro
\usepackage{subcaption} % for 'subtable' environment
\begin{document}
\begin{table}[!htb]
\setlength{\extrarowheight}{1pt} % for a more open "look"
\centering
\begin{subtable}{.55\linewidth} % choose width suitably
\begin{tabular}{|c|c|} % 1st tabular
\multicolumn{2}{c}{$G$}\\
\hline
Vertex & Label\\
\hline
b & 1 \\
c & 1 \\
d & 1 \\ \hline
\end{tabular}%
\hfill % maximize distance between adjacent tabulars
\begin{tabular}{|c|c|} % 2nd tabular
\multicolumn{2}{c}{$H$}\\
\hline
Vertex & Label\\
\hline
c & 1 \\
a & 1 \\
d & 1 \\ \hline
\end{tabular}
\smallskip
\caption{$M=\{a,b\}$}
\end{subtable}
\vspace{5mm} % insert a bit of vertical whitespace
\begin{subtable}{.55\linewidth}
\begin{tabular}{|c|c|}
\multicolumn{2}{c}{$G$}\\
\hline
Vertex & Label\\
\hline
c & 11 \\
d & 10 \\ \hline
\end{tabular}%
\hfill
\begin{tabular}{|c|c|}
\multicolumn{2}{c}{$H$}\\
\hline
Vertex & Label\\
\hline
a & 11 \\
d & 11 \\ \hline
\end{tabular}
\smallskip
\caption{$M=\{ab,bc\}$}
\end{subtable}
\vspace{5mm}
\begin{subtable}{.55\linewidth}
\begin{tabular}{|c|c|}
\multicolumn{2}{c}{$G$}\\
\hline
Vertex & Label\\
\hline
d & 101 \\ \hline
\end{tabular}%
\hfill
\begin{tabular}{|c|c|}
\multicolumn{2}{c}{$H$}\\
\hline
Vertex & Label\\
\hline
d & 110 \\ \hline
\end{tabular}
\smallskip
\caption{$M=\{abc,bca\}$}
\end{subtable}
\caption{Labels on the non-mapped vertices of $G$ and $H$, for selected choices of mapping $M$}
\end{table}
\end{document}