我正在尝试格式化下表,以便在水平线下方留出更多空间。
\begin{equation*}
\begin{array}{|c|c|c|}
\hline
i & (266)_i & [266]_i\\[3pt]
\hline
1 & 2^{2^{2+1}} + 2^{2+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + \omega \\
2 & 3^{3^{3+1}} + 3^{3+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 2 \\
3 & 4^{4^{4+1}} + 4^{4+1} + 1 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 1 \\
4 & 5^{5^{5+1}} + 5^{5+1} & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} \\
5 & 3^{3^{3+1}} + 3^{3+1} + 2 & 3^{3^{3+1}} + 3^{3+1} + 2 \\
\vdots & \vdots & \vdots \\
\hline
\end{array}
\end{equation*}
我尝试hline
用替换\hline\noalign{\vskip 3pt}
,但这会在边框中留下垂直断点{|c|c|c|}
。
答案1
基于cellspace
包的简单解决方案,它使用以字母为前缀的限定符来定义minimal
列中单元格顶部或底部的垂直间距S
:
\documentclass{article}
\usepackage{array, amsmath}
\usepackage[math]{cellspace}
\setlength\cellspacetoplimit{3pt}
\setlength\cellspacebottomlimit{3pt}
\begin{document}
\begin{equation*}
\begin{array}{|Sc|>{$}Sc<{$}|c|}
\hline
i & (266)_i & [266]_i\\
\hline
1 & 2^{2^{2+1}} + 2^{2+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + \omega \\
2 & 3^{3^{3+1}} + 3^{3+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 2 \\
3 & 4^{4^{4+1}} + 4^{4+1} + 1 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 1 \\
4 & 5^{5^{5+1}} + 5^{5+1} & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} \\
5 & 3^{3^{3+1}} + 3^{3+1} + 2 & 3^{3^{3+1}} + 3^{3+1} + 2 \\[-6pt]
\vdots & \vdots & \vdots \\
\hline
\end{array}
\end{equation*}
\end{document}
答案2
两个版本(我认为第二个更好)
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\usepackage{booktabs}
\begin{document}
First version with vertical rules
\begin{equation*}
\renewcommand{\arraystretch}{1.5}
\begin{array}{|c|c|c|}
\hline
i & (266)_i & [266]_i \\
\hline
1 & 2^{2^{2+1}} + 2^{2+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + \omega \\
2 & 3^{3^{3+1}} + 3^{3+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 2 \\
3 & 4^{4^{4+1}} + 4^{4+1} + 1 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 1 \\
4 & 5^{5^{5+1}} + 5^{5+1} & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} \\
5 & 3^{3^{3+1}} + 3^{3+1} + 2 & 3^{3^{3+1}} + 3^{3+1} + 2 \\
\vdots & \vdots & \vdots \\
\hline
\end{array}
\end{equation*}
and the second version without them
\begin{equation*}
\renewcommand{\arraystretch}{1.5}
\setlength{\extrarowheight}{2pt}
\addtolength{\arraycolsep}{6pt}
\begin{array}{@{}ccc@{}}
\toprule
\addlinespace[-2pt]
i & (266)_i & [266]_i \\
\midrule
1 & 2^{2^{2+1}} + 2^{2+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + \omega \\
2 & 3^{3^{3+1}} + 3^{3+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 2 \\
3 & 4^{4^{4+1}} + 4^{4+1} + 1 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 1 \\
4 & 5^{5^{5+1}} + 5^{5+1} & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} \\
5 & 3^{3^{3+1}} + 3^{3+1} + 2 & 3^{3^{3+1}} + 3^{3+1} + 2 \\
\vdots & \vdots & \vdots \\
\bottomrule
\end{array}
\end{equation*}
\end{document}
答案3
如果想要到处都有空间,可以使用数组包中的 \extrarowheight。如果要在一行中留出更多空间,可以插入一个空行,然后往后退一点,或者使用一些支撑,例如 \vphantom 方程式:
\documentclass{article}
\usepackage{array}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\extrarowheight5pt
\begin{array}{|c|c|c|}
\hline
i & (266)_i & [266]_i\\[3pt]
\hline
1 & 2^{2^{2+1}} + 2^{2+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + \omega \\
2 & 3^{3^{3+1}} + 3^{3+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 2 \\
3 & 4^{4^{4+1}} + 4^{4+1} + 1 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 1 \\
4 & 5^{5^{5+1}} + 5^{5+1} & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} \\
5 & 3^{3^{3+1}} + 3^{3+1} + 2 & 3^{3^{3+1}} + 3^{3+1} + 2 \\
\vdots & \vdots & \vdots \\
\hline
\end{array}
\end{equation*}
\begin{equation*}
\begin{array}{|c|c|c|}
\hline
i & (266)_i & [266]_i\\[3pt]
\hline &&\\[\dimexpr-\normalbaselineskip+5pt]
1 & 2^{2^{2+1}} + 2^{2+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + \omega \\
2 & 3^{3^{3+1}} + 3^{3+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 2 \\
3 & 4^{4^{4+1}} + 4^{4+1} + 1 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 1 \\
4 & 5^{5^{5+1}} + 5^{5+1} & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} \\
5 & 3^{3^{3+1}} + 3^{3+1} + 2 & 3^{3^{3+1}} + 3^{3+1} + 2 \\
\vdots & \vdots & \vdots \\
\hline
\end{array}
\end{equation*}
\begin{equation*}
\begin{array}{|c|c|c|}
\hline
i & (266)_i & [266]_i\\[3pt]
\hline
\vphantom{2^{2^{2+1^{2^{1^{1}}}}}}%
1 & 2^{2^{2+1}} + 2^{2+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + \omega \\
2 & 3^{3^{3+1}} + 3^{3+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 2 \\
3 & 4^{4^{4+1}} + 4^{4+1} + 1 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 1 \\
4 & 5^{5^{5+1}} + 5^{5+1} & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} \\
5 & 3^{3^{3+1}} + 3^{3+1} + 2 & 3^{3^{3+1}} + 3^{3+1} + 2 \\
\vdots & \vdots & \vdots \\
\hline
\end{array}
\end{equation*}
\end{document}
答案4
使用老旧的 mdwtab 很简单:
\documentclass{article}
\usepackage{amsmath}
\usepackage{mdwtab}
\begin{document}
\begin{equation*}
\begin{tabular}{|c|Mc|Mc|}
\hlx{hv}
i & (266)_i & [266]_i\\[3pt]
\hlx{hvv}
1 & 2^{2^{2+1}} + 2^{2+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + \omega \\
2 & 3^{3^{3+1}} + 3^{3+1} + 2 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 2 \\
3 & 4^{4^{4+1}} + 4^{4+1} + 1 & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} + 1 \\
4 & 5^{5^{5+1}} + 5^{5+1} & \omega^{\omega^{\omega+1}} + \omega^{\omega+1} \\
5 & 3^{3^{3+1}} + 3^{3+1} + 2 & 3^{3^{3+1}} + 3^{3+1} + 2 \\
\vdots & \vdots & \vdots \\
\hlx{h}
\end{tabular}
\end{equation*}
\end{document}
注意:mdwtab
与不兼容colortbl
,即单元格、列或行不能有颜色。