我有一张长表,里面装满了各种大小的矩阵,但行间距太小。这是一个最小的工作示例:
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\begin{document}
\begin{longtable}{>{$}l<{$}>{$}l<{$}}
\toprule
\text{Group:} & \text{Matrix:} \\
\midrule
Z_{2} \times Z_{2} \times Z_{2} \times Z_{2} \times Z_{2} & {\small
\begin{bmatrix}
00001 & 00010 & 00100 & 01000 & 10000 \\
00010 & 00100 & 01000 & 10000 & 00101 \\
00100 & 01000 & 10000 & 00101 & 01010 \\
01000 & 10000 & 00101 & 01010 & 10100 \\
10000 & 00101 & 01010 & 10100 & 01101
\end{bmatrix}} \\
Z_{4} \times Z_{2} \times Z_{2} \times Z_{2} & {\small
\begin{bmatrix}
0001 & 0010 & 0100 & 1000 & 2000 \\
0010 & 0100 & 2001 & 0001 & 1000 \\
1001 & 2110 & 0001 & 0010 & 0101
\end{bmatrix}} \\
Z_{4} \times Z_{4} \times Z_{2} & {\small
\begin{bmatrix}
001 & 010 & 020 & 100 & 200 \\
021 & 001 & 211 & 010 & 100 \\
220 & 101 & 200 & 210 & 320
\end{bmatrix}}\\
Z_{8} \times Z_{2} \times Z_{2} & {\small
\begin{bmatrix}
010 & 100 & 200 & 001 & 400 \\
210 & 010 & 100 & 400 & 401
\end{bmatrix}} \\
Z_{8} \times Z_{4} & {\small
\begin{bmatrix}
01 & 10 & 20 & 02 & 40 \\
21 & 01 & 10 & 40 & 42
\end{bmatrix}} \\
Z_{16} \times Z_{2} & {\small
\begin{bmatrix}
01 & 10 & 20 & 40 & 80 \\
81 & 01 & 10 & 20 & 40
\end{bmatrix}} \\
Z_{32} & {\small
\begin{bmatrix}
1 & 2 & 4 & 8 & (16)
\end{bmatrix}} \\
\bottomrule
\end{longtable}
\end{document}
想要增加行距时,首先要尝试的是使用类似 的方法\renewcommand{\arraystretch}{1.5}
,所以我尝试了这种方法。这很不方便,因为您必须\arraystretch
为表中的每个矩阵重置 ,但这里是代码:
{\renewcommand{\arraystretch}{3}
\begin{longtable}{>{$}l<{$}>{$}l<{$}}
\toprule
\text{Group:} & \text{Matrix:} \\
\midrule
Z_{2} \times Z_{2} \times Z_{2} \times Z_{2} \times Z_{2} & {\small
\renewcommand{\arraystretch}{1}
\begin{bmatrix}
00001 & 00010 & 00100 & 01000 & 10000 \\
00010 & 00100 & 01000 & 10000 & 00101 \\
00100 & 01000 & 10000 & 00101 & 01010 \\
01000 & 10000 & 00101 & 01010 & 10100 \\
10000 & 00101 & 01010 & 10100 & 01101
\end{bmatrix}} \\
Z_{4} \times Z_{2} \times Z_{2} \times Z_{2} & {\small
\renewcommand{\arraystretch}{1}
\begin{bmatrix}
0001 & 0010 & 0100 & 1000 & 2000 \\
0010 & 0100 & 2001 & 0001 & 1000 \\
1001 & 2110 & 0001 & 0010 & 0101
\end{bmatrix}} \\
Z_{4} \times Z_{4} \times Z_{2} & {\small
\renewcommand{\arraystretch}{1}
\begin{bmatrix}
001 & 010 & 020 & 100 & 200 \\
021 & 001 & 211 & 010 & 100 \\
220 & 101 & 200 & 210 & 320
\end{bmatrix}}\\
Z_{8} \times Z_{2} \times Z_{2} & {\small
\renewcommand{\arraystretch}{1}
\begin{bmatrix}
010 & 100 & 200 & 001 & 400 \\
210 & 010 & 100 & 400 & 401
\end{bmatrix}} \\
Z_{8} \times Z_{4} & {\small
\renewcommand{\arraystretch}{1}
\begin{bmatrix}
01 & 10 & 20 & 02 & 40 \\
21 & 01 & 10 & 40 & 42
\end{bmatrix}} \\
Z_{16} \times Z_{2} & {\small
\renewcommand{\arraystretch}{1}
\begin{bmatrix}
01 & 10 & 20 & 40 & 80 \\
81 & 01 & 10 & 20 & 40
\end{bmatrix}} \\
Z_{32} & {\small
\renewcommand{\arraystretch}{1}
\begin{bmatrix}
1 & 2 & 4 & 8 & (16)
\end{bmatrix}} \\
\bottomrule
\end{longtable}}
另一个解决方案是在每个 处添加可选的额外间距\\
,例如\\[1em]
。我不会在这里重复代码,但结果看起来也不太好:
有人对如何让这张桌子看起来好看有什么建议吗?
答案1
由于您正在加载booktabs
包,您不妨使用该包的\addlinespace
宏在行之间插入令人满意的(即恒定数量的)垂直空格。
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\newcolumntype{L}{>{$}l<{$}}
\usepackage{longtable}
\usepackage{booktabs}
\begin{document}
\begin{longtable}{@{} L >{\small}L @{}}
\toprule
\text{Group} & \text{\normalsize Matrix} \\
\midrule
\endhead
\bottomrule
\endfoot
Z_{2} \times Z_{2} \times Z_{2} \times Z_{2} \times Z_{2} &
\begin{bmatrix}
00001 & 00010 & 00100 & 01000 & 10000 \\
00010 & 00100 & 01000 & 10000 & 00101 \\
00100 & 01000 & 10000 & 00101 & 01010 \\
01000 & 10000 & 00101 & 01010 & 10100 \\
10000 & 00101 & 01010 & 10100 & 01101
\end{bmatrix} \\ \addlinespace
Z_{4} \times Z_{2} \times Z_{2} \times Z_{2} &
\begin{bmatrix}
0001 & 0010 & 0100 & 1000 & 2000 \\
0010 & 0100 & 2001 & 0001 & 1000 \\
1001 & 2110 & 0001 & 0010 & 0101
\end{bmatrix} \\ \addlinespace
Z_{4} \times Z_{4} \times Z_{2} &
\begin{bmatrix}
001 & 010 & 020 & 100 & 200 \\
021 & 001 & 211 & 010 & 100 \\
220 & 101 & 200 & 210 & 320
\end{bmatrix} \\ \addlinespace
Z_{8} \times Z_{2} \times Z_{2} &
\begin{bmatrix}
010 & 100 & 200 & 001 & 400 \\
210 & 010 & 100 & 400 & 401
\end{bmatrix} \\ \addlinespace
Z_{8} \times Z_{4} &
\begin{bmatrix}
01 & 10 & 20 & 02 & 40 \\
21 & 01 & 10 & 40 & 42
\end{bmatrix} \\ \addlinespace
Z_{16} \times Z_{2} &
\begin{bmatrix}
01 & 10 & 20 & 40 & 80 \\
81 & 01 & 10 & 20 & 40
\end{bmatrix} \\ \addlinespace
Z_{32} &
\begin{bmatrix}
1 & 2 & 4 & 8 & (16)
\end{bmatrix} \\
\end{longtable}
\end{document}
答案2
我没有一个优雅的答案,但有一个使矩阵等距的解决方法。
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{bbm}
\begin{document}
\begin{longtable}{>{$}l<{$}>{$}l<{$}}
\toprule
\text{Group:} & \text{Matrix:} \\
\midrule
\mathbbm{Z}_{2} \times \mathbbm{Z}_{2} \times \mathbbm{Z}_{2} \times \mathbbm{Z}_{2} \times \mathbbm{Z}_{2} & {\small
\begin{bmatrix}
00001 & 00010 & 00100 & 01000 & 10000 \\
00010 & 00100 & 01000 & 10000 & 00101 \\
00100 & 01000 & 10000 & 00101 & 01010 \\
01000 & 10000 & 00101 & 01010 & 10100 \\
10000 & 00101 & 01010 & 10100 & 01101
\end{bmatrix}} \\
\mathbbm{Z}_{4} \times \mathbbm{Z}_{2} \times \mathbbm{Z}_{2} \times \mathbbm{Z}_{2} & {\small
\begin{bmatrix}
0001 & 0010 & 0100 & 1000 & 2000 \\
0010 & 0100 & 2001 & 0001 & 1000 \\
1001 & 2110 & 0001 & 0010 & 0101
\end{bmatrix}
\vphantom{\begin{bmatrix}~\\ ~\\ ~\\ ~\end{bmatrix}}}\\
\mathbbm{Z}_{4} \times \mathbbm{Z}_{4} \times \mathbbm{Z}_{2} & {\small
\begin{bmatrix}
001 & 010 & 020 & 100 & 200 \\
021 & 001 & 211 & 010 & 100 \\
220 & 101 & 200 & 210 & 320
\end{bmatrix}}\\
\mathbbm{Z}_{8} \times \mathbbm{Z}_{2} \times \mathbbm{Z}_{2} & {\small
\begin{bmatrix}
010 & 100 & 200 & 001 & 400 \\
210 & 010 & 100 & 400 & 401
\end{bmatrix}
\vphantom{\begin{bmatrix}~\\ ~\\ ~\end{bmatrix}}} \\
\mathbbm{Z}_{8} \times \mathbbm{Z}_{4} & {\small
\begin{bmatrix}
01 & 10 & 20 & 02 & 40 \\
21 & 01 & 10 & 40 & 42
\end{bmatrix}} \\
\mathbbm{Z}_{16} \times \mathbbm{Z}_{2} & {\small
\begin{bmatrix}
01 & 10 & 20 & 40 & 80 \\
81 & 01 & 10 & 20 & 40
\end{bmatrix}
\vphantom{\begin{bmatrix}~\\ ~\\ ~\end{bmatrix}}} \\
\mathbbm{Z}_{32} & {\small
\begin{bmatrix}
1 & 2 & 4 & 8 & (16)
\end{bmatrix}} \\
\bottomrule
\end{longtable}
\end{document}
我还惊讶地发现,\\[2em]
产生的矩阵是由不同的垂直距离分隔的。
答案3
将所有更改\end{bmatrix}} \\
为\end{bmatrix}} \\\\
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\begin{document}
\begin{longtable}{>{$}l<{$}>{$}l<{$}}
\toprule
\text{Group:} & \text{Matrix:} \\
\midrule
Z_{2} \times Z_{2} \times Z_{2} \times Z_{2} \times Z_{2} & {\small
\begin{bmatrix}
00001 & 00010 & 00100 & 01000 & 10000 \\
00010 & 00100 & 01000 & 10000 & 00101 \\
00100 & 01000 & 10000 & 00101 & 01010 \\
01000 & 10000 & 00101 & 01010 & 10100 \\
10000 & 00101 & 01010 & 10100 & 01101
\end{bmatrix}} \\\\
Z_{4} \times Z_{2} \times Z_{2} \times Z_{2} & {\small
\begin{bmatrix}
0001 & 0010 & 0100 & 1000 & 2000 \\
0010 & 0100 & 2001 & 0001 & 1000 \\
1001 & 2110 & 0001 & 0010 & 0101
\end{bmatrix}} \\\\
Z_{4} \times Z_{4} \times Z_{2} & {\small
\begin{bmatrix}
001 & 010 & 020 & 100 & 200 \\
021 & 001 & 211 & 010 & 100 \\
220 & 101 & 200 & 210 & 320
\end{bmatrix}}\\\\
Z_{8} \times Z_{2} \times Z_{2} & {\small
\begin{bmatrix}
010 & 100 & 200 & 001 & 400 \\
210 & 010 & 100 & 400 & 401
\end{bmatrix}} \\\\
Z_{8} \times Z_{4} & {\small
\begin{bmatrix}
01 & 10 & 20 & 02 & 40 \\
21 & 01 & 10 & 40 & 42
\end{bmatrix}} \\\\
Z_{16} \times Z_{2} & {\small
\begin{bmatrix}
01 & 10 & 20 & 40 & 80 \\
81 & 01 & 10 & 20 & 40
\end{bmatrix}} \\\\
Z_{32} & {\small
\begin{bmatrix}
1 & 2 & 4 & 8 & (16)
\end{bmatrix}} \\\\
\bottomrule
\end{longtable}
\end{document}
如果差距太大,则改为\end{bmatrix}} \\\\[-5pt]
或类似。