![在表格中,如何将数字放在每列的中间?](https://linux22.com/image/386724/%E5%9C%A8%E8%A1%A8%E6%A0%BC%E4%B8%AD%EF%BC%8C%E5%A6%82%E4%BD%95%E5%B0%86%E6%95%B0%E5%AD%97%E6%94%BE%E5%9C%A8%E6%AF%8F%E5%88%97%E7%9A%84%E4%B8%AD%E9%97%B4%EF%BC%9F.png)
\documentclass[10pt]{beamer}
\begin{document}
\begin{tabular}{ |p{1.1cm}||p{1.1cm}|p{1.1cm}|p{1.1cm}| |p{1.1cm}| |p{1.1cm}| |p{1.1cm}| }
\hline
\multicolumn{7}{|c|}{\textbf{W1011daily}} \\
\hline
\textbf{1}& \textbf{2}&\textbf{3}& \textbf{\dots \dots} & \textbf{150}& \textbf{\dots \dots} & \textbf{252} \\
\hline
1000.182 & 996.4293 &993.6557 & \dots \dots & 992.7738& \dots \dots & 987.8528 \\
996.6344& 990.0872 & 990.881 & \dots \dots & 999.3244& \dots \dots & 989.349\\
990.2731 & 987.3196 & 988.7692& \dots \dots & 1030.053& \dots \dots & 961.9883\\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
1013.578 &1023.227& 1071.947 & \dots \dots & 832.6109 & \dots \dots & 1143.922\\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
734.5305 &821.8897 & 825.8748 & \dots \dots & 947.0167 & \dots \dots & 1356.77\\
\hline
\end{tabular}
\end{document}
答案1
要使列标题居中,您可以使用\makecell[c]{...}
或\thead
从makecell
包中
\documentclass[10pt]{beamer}
\usepackage{makecell}
\renewcommand\theadfont{\bfseries\normalsize}
\begin{document}
\begin{tabular}{ |p{1.1cm}||p{1.1cm}|p{1.1cm}|p{1.1cm}| |p{1.1cm}| |p{1.1cm}| |p{1.1cm}| }
\hline
\multicolumn{7}{|c|}{\thead{W1011daily}} \\
\hline
\thead{1}& \thead{2}&\thead{3}& \thead{\dots \dots} & \thead{150}& \thead{\dots \dots} & \thead{252} \\
\hline
1000.182 & 996.4293 &993.6557 & \dots \dots & 992.7738& \dots \dots & 987.8528 \\
996.6344& 990.0872 & 990.881 & \dots \dots & 999.3244& \dots \dots & 989.349\\
990.2731 & 987.3196 & 988.7692& \dots \dots & 1030.053& \dots \dots & 961.9883\\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
1013.578 &1023.227& 1071.947 & \dots \dots & 832.6109 & \dots \dots & 1143.922\\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
734.5305 &821.8897 & 825.8748 & \dots \dots & 947.0167 & \dots \dots & 1356.77\\
\hline
\end{tabular}
\end{document}
就我个人而言,我更喜欢更干净的表格,没有所有的垂直线和按小数点对齐的数字:
\documentclass[10pt]{beamer}
\usepackage{makecell}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{siunitx}
\renewcommand\theadfont{\bfseries\normalsize}
\begin{document}
\begin{frame}
\begin{tabularx}{\linewidth}{%
@{}
S[table-format=4.4]
S[table-format=4.4]
S[table-format=4.4]
X
S[table-format=4.4]
X
S[table-format=4.4]
@{}
}
\toprule
\multicolumn{7}{c}{\textbf{W1011daily}}\\
\midrule
{\thead{1}} & {\thead{2}} & {\thead{3}}& {\dots} & {\thead{150}}& {\dots} & {\thead{252}}\\
\midrule
1000.182 & 996.4293 & 993.6557 & \dots & 992.7738 & \dots & 987.8528 \\
996.6344& 990.0872 & 990.881 & \dots & 999.3244& \dots & 989.349\\
990.2731 & 987.3196 & 988.7692& \dots & 1030.053& \dots & 961.9883\\
{\vdots} & {\vdots} & {\vdots} & & {\vdots} & & {\vdots} \\
1013.578 &1023.227& 1071.947 & \dots & 832.6109 & \dots & 1143.922\\
{\vdots} & {\vdots} & {\vdots} & & {\vdots} & & {\vdots} \\
734.5305 &821.8897 & 825.8748 & \dots & 947.0167 & \dots & 1356.77\\
\bottomrule
\end{tabularx}
\end{frame}
\end{document}
答案2
我相信这个问题已经得到解答了,这里。
为了使其与我所知道的数学 Latex 最相似,我会使用
\documentclass[conference]{IEEEtran}
\begin{document}
\begin{table}
\centering
\begin{tabular}{|c|c|c|}
\hline
Reconstruction strategy & aa & bb( \%) \\ \hline
Classic & 3342 voxels & 68 \% \\ \hline
VC & 4296 voxels & 87 \% \\ \hline
V m=7 & 4745 voxels & 96 \% \\ \hline
\end{tabular}
\newline\newline
\caption{title}\label{tab1}
\end{table}
\end{document}
归功于桑多瓦尔31对于这段代码。