以下是我正在定义的表格的最小示例。第一行($v_1$
和$v_2$
)未居中,但后续行居中。我做错了什么?
\documentclass{article}
\usepackage{array}
\begin{document}
\begin{tabular}{| m{1cm} | m{1cm} |}
\multicolumn{2}{c}{\footnotesize Subgraph Matches} \\ \hline
$v_{1}$ & $v_{2}$ \\ \hline
\{005\} & \{006\} \\ \hline
\{007\} & \{008\} \\ \hline
\end{tabular}
\end{document}
答案1
居中tabular
是通过列类型完成的c
。m
列类型用于垂直居中,而不是水平居中,而水平居中正是此表所需要的:
然而你真的应该考虑一下包裹booktabs
生成看起来更专业的表格:
代码:
\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{| c | c |}
\multicolumn{2}{c}{\footnotesize Subgraph Matches} \\ \hline
$v_{1}$ & $v_{2}$ \\ \hline
\{005\} & \{006\} \\ \hline
\{007\} & \{008\} \\ \hline
\end{tabular}
\bigskip\bigskip
\begin{tabular}{ c c }
\multicolumn{2}{c}{\footnotesize Subgraph Matches} \\ \toprule
$v_{1}$ & $v_{2}$ \\ \cmidrule(lr){1-2}
\{005\} & \{006\} \\ %\cmidrule(lr){1-2}
\{007\} & \{008\} \\ \bottomrule
\end{tabular}
\end{document}