关于如何将下表中的垂直线居中,有任何建议吗?谢谢,Batu
\begin{table}[!htp]
\begin{center}
\begin{tabular}{|c|c||c||c||c|}
\hline
\multicolumn{ 2}{|c|}{} & Eingestellt & Gemessen & Berechnet \\ \hline \hline
& \multicolumn{ 1}{c||}{Messpunkt Nr} & $f_{0}$ & $u(i)$ & $i$ \\ \cline{ 1- 1}\cline{ 3- 5}
& \multicolumn{ 1}{c||}{} & $Hz$ & $mV$ & $mA$ \\ \hline \hline
\multicolumn{ 1}{|c|}{\rotatebox[origin=c]{90}{$f\textless f^{\prime}$}} & 1 & 400 & 41.9 & 4.19 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 2 & 684 & 79.1 & 7.91 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 3 & 968 & 138 & 13.8 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 4 & 1252 & 252 & 25.2 \\ \hline
$f^{\prime}$ & 5 & 1537.4 & 560.74 & 56.074 \\ \hline
\multicolumn{ 1}{|c|}{\rotatebox[origin=c]{90}{$f^{\prime}\textless f\textless f_{0}$}} & 6 & 1574 & 616 & 61,6 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 7 & 1609 & 672 & 67.2 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 8 & 1644 & 725 & 72.5 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 9 & 1679 & 770 & 77 \\ \hline
$f_{0}$ & 10 & 1714 & 793 & 79,3 \\ \hline
\multicolumn{ 1}{|c|}{\rotatebox[origin=c]{90}{$f_{0}\textless f\textless f^{\prime \prime}$}} & 11 & 1754 & 787 & 78,7 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 12 & 1794 & 748 & 74.8 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 13 & 1844 & 671 & 67.1 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 14 & 1894 & 590 & 59 \\ \hline
$f^{\prime \prime}$ & 15 & 1912 & 569.74 & 56.974 \\ \hline
\multicolumn{ 1}{|c|}{\rotatebox[origin=c]{90}{$f^{\prime \prime}\textless f$}} & 16 & 2912 & 155 & 15,5 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 17 & 3912 & 98.2 & 9.82 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 18 & 4912 & 76.9 & 7.69 \\ \cline{ 2- 5}
\multicolumn{ 1}{|c|}{} & 19 & 5912 & 64.2 & 6.42 \\ \hline
\end{tabular}
\end{center}
\label{}
\end{table}
答案1
根据我的经验,读者非常讨厌为了阅读一些旋转的内容而不得不将脖子伸长 90 度,尤其是当一开始就没有必要旋转内容时。因此,我将省去旋转部分。我还将通过省略所有垂直规则并使用包的宏来booktabs
替换\hline
和\cline
,使表格看起来更加“开放”。
就表格的“外观”而言,读者往往会欣赏的另一件事是,数字是否在各自的小数点标记上对齐,而不是简单地将它们居中显示。
\documentclass{report}
\usepackage[skip=0.25\baselineskip]{caption}
\usepackage[ngerman]{babel}
\usepackage{booktabs,amstext,siunitx}
\sisetup{locale=DE}
\begin{document}
\begin{table}[!htp]
\caption{Zahlen} \label{}
\centering
$\begin{array}{@{} lc S[table-format=4.1]
S[table-format=3.2]
S[table-format=2.3] @{}}
\toprule
& \text{Messpunkt Nr}
& {\text{Eingestellt}}
& {\text{Gemessen}}
& {\text{Berechnet}} \\
& & {f_{0}} & {U(I)} & {I} \\
& & \si{\hertz} & \si{\milli\volt} & \si{\milli\ampere} \\
\midrule
f< f' & 1 & 400 & 41.9 & 4.19 \\
& 2 & 684 & 79.1 & 7.91 \\
& 3 & 968 & 138 & 13.8 \\
& 4 & 1252 & 252 & 25.2 \\ \addlinespace
f' & 5 & 1537.4 & 560.74 & 56.074\\
\addlinespace
f'< f< f_{0} & 6 & 1574 & 616 & 61,6 \\
& 7 & 1609 & 672 & 67.2 \\
& 8 & 1644 & 725 & 72.5 \\
& 9 & 1679 & 770 & 77 \\ \addlinespace
f_{0} & 10 & 1714 & 793 & 79,3 \\ \addlinespace
f_{0}<f<f'' & 11 & 1754 & 787 & 78,7 \\
& 12 & 1794 & 748 & 74.8 \\
& 13 & 1844 & 671 & 67.1 \\
& 14 & 1894 & 590 & 59 \\ \addlinespace
f'' & 15 & 1912 & 569.74 & 56.974 \\ \addlinespace
f''< f & 16 & 2912 & 155 & 15,5 \\
& 17 & 3912 & 98.2 & 9.82 \\
& 18 & 4912 & 76.9 & 7.69 \\
& 19 & 5912 & 64.2 & 6.42 \\
\bottomrule
\end{array}$
\end{table}
\end{document}
答案2
这个秘密叫做multirow
:
\documentclass[]{article}
\usepackage{rotating}
\usepackage{multirow}
\begin{document}
\begin{table}[!htp]
\begin{center}
\begin{tabular}{|c|c||c||c||c|}
\hline
& Eingestellt & Gemessen & Berechnet \\ \hline \hline
& \multirow{2}{*}{Messpunkt Nr} & $f_{0}$ & $u(i)$ & $i$ \\ \cline{ 1- 1}\cline{ 3- 5}
& & $Hz$ & $mV$ & $mA$ \\ \hline \hline
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f\textless f^{\prime}$}} & 1 & 400 & 41.9 & 4.19 \\ \cline{ 2- 5}
& 2 & 684 & 79.1 & 7.91 \\ \cline{ 2- 5}
& 3 & 968 & 138 & 13.8 \\ \cline{ 2- 5}
& 4 & 1252 & 252 & 25.2 \\ \hline
$f^{\prime}$ & 5 & 1537.4 & 560.74 & 56.074 \\ \hline
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f^{\prime}\textless f\textless f_{0}$}} & 6 & 1574 & 616 & 61,6 \\ \cline{ 2- 5}
& 7 & 1609 & 672 & 67.2 \\ \cline{ 2- 5}
& 8 & 1644 & 725 & 72.5 \\ \cline{ 2- 5}
& 9 & 1679 & 770 & 77 \\ \hline
$f_{0}$ & 10 & 1714 & 793 & 79,3 \\ \hline
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f_{0}\textless f\textless f^{\prime \prime}$}} & 11 & 1754 & 787 & 78,7 \\ \cline{ 2- 5}
& 12 & 1794 & 748 & 74.8 \\ \cline{ 2- 5}
& 13 & 1844 & 671 & 67.1 \\ \cline{ 2- 5}
& 14 & 1894 & 590 & 59 \\ \hline
$f^{\prime \prime}$ & 15 & 1912 & 569.74 & 56.974 \\ \hline
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f^{\prime \prime}\textless f$}} & 16 & 2912 & 155 & 15,5 \\ \cline{ 2- 5}
& 17 & 3912 & 98.2 & 9.82 \\ \cline{ 2- 5}
& 18 & 4912 & 76.9 & 7.69 \\ \cline{ 2- 5}
& 19 & 5912 & 64.2 & 6.42 \\ \hline
\end{tabular}
\end{center}
\label{}
\end{table}
\end{document}
但我会将表格排版得更像这样:
\documentclass[]{article}
\usepackage{rotating}
\usepackage{multirow}
\usepackage{booktabs}
\begin{document}
\begin{table}[!htp]
\begin{center}
\begin{tabular}{ccccc}
\toprule
& Eingestellt & Gemessen & Berechnet \\
& Messpunkt Nr. & $f_{0}$ in Hz & $u(i)$ in mV & $i$ in mA \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f\textless f^{\prime}$}} & 1 & 400 & 41.9 & 4.19 \\
& 2 & 684 & 79.1 & 7.91 \\
& 3 & 968 & 138 & 13.8 \\
& 4 & 1252 & 252 & 25.2 \\
\midrule
$f^{\prime}$ & 5 & 1537.4 & 560.74 & 56.074 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f^{\prime}\textless f\textless f_{0}$}} & 6 & 1574 & 616 & 61,6 \\
& 7 & 1609 & 672 & 67.2 \\
& 8 & 1644 & 725 & 72.5 \\
& 9 & 1679 & 770 & 77 \\
\midrule
$f_{0}$ & 10 & 1714 & 793 & 79,3 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f_{0}\textless f\textless f^{\prime \prime}$}} & 11 & 1754 & 787 & 78,7 \\
& 12 & 1794 & 748 & 74.8 \\
& 13 & 1844 & 671 & 67.1 \\
& 14 & 1894 & 590 & 59 \\
\midrule
$f^{\prime \prime}$ & 15 & 1912 & 569.74 & 56.974 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f^{\prime \prime}\textless f$}} & 16 & 2912 & 155 & 15,5 \\
& 17 & 3912 & 98.2 & 9.82 \\
& 18 & 4912 & 76.9 & 7.69 \\
& 19 & 5912 & 64.2 & 6.42 \\
\bottomrule
\end{tabular}
\end{center}
\label{}
\end{table}
\end{document}
最新版本:此外,还可以使用siunitx
来更好地对齐数字。请注意,在此版本中,我还删除了命令\textless
,因为在数学模式下,只需使用>
或<
(中的“文本”\textless
表示文本模式)。我还将^{\prime}
内容更改为'
。请注意,我>
用括号括住 s 以减少间距。
\documentclass[]{article}
\usepackage{rotating}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\begin{table}[!htp]
\begin{center}
\begin{tabular}{cS[table-format=2]S[table-format=4.1]S[table-format=3.2]S[table-format=2.3]}
\toprule
& {Eingestellt} & {Gemessen} & \multicolumn{2}{c}{Berechnet} \\
& {Messpunkt Nr.} & {$f_{0}$ in Hz} & {$u(i)$ in mV} & {$i$ in mA} \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f'{>}f$}} & 1 & 400 & 41.9 & 4.19 \\
& 2 & 684 & 79.1 & 7.91 \\
& 3 & 968 & 138 & 13.8 \\
& 4 & 1252 & 252 & 25.2 \\
\midrule
$f'$ & 5 & 1537.4 & 560.74 & 56.074 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f_{0}{>}f{>}f'$}} & 6 & 1574 & 616 & 61,6 \\
& 7 & 1609 & 672 & 67.2 \\
& 8 & 1644 & 725 & 72.5 \\
& 9 & 1679 & 770 & 77 \\
\midrule
$f_{0}$ & 10 & 1714 & 793 & 79,3 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f''{>}f{>}f_{0}$}} & 11 & 1754 & 787 & 78,7 \\
& 12 & 1794 & 748 & 74.8 \\
& 13 & 1844 & 671 & 67.1 \\
& 14 & 1894 & 590 & 59 \\
\midrule
$f''$ & 15 & 1912 & 569.74 & 56.974 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{$f{>}f''$}} & 16 & 2912 & 155 & 15,5 \\
& 17 & 3912 & 98.2 & 9.82 \\
& 18 & 4912 & 76.9 & 7.69 \\
& 19 & 5912 & 64.2 & 6.42 \\
\bottomrule
\end{tabular}
\end{center}
\label{}
\end{table}
\end{document}