我有这张表:
\documentclass[a4paper,12pt]{article}
\usepackage[margin=0.65in]{geometry}
\usepackage{tabularx}
\renewcommand{\arraystretch}{1.5}
\usepackage{booktabs}
\usepackage{float}
\title{}
\author{}
\date{}
\begin{document}
\begin{table}[H]
\centering
\caption{Thin Rod Simulation Results for 2 Material Forwards Euler}
\label{tbl:2}
\begin{tabularx}{\textwidth}{XXXXX}
\toprule
& x & T = 0.01 & T = 0.015 & T = 0.02 \\
\midrule
c2 = 1 & 1/11 & 0.255 & 0.243 & 0.232 \\
& 3/11 & 0.685 & 0.652 & 0.621 \\
& 5/11 & 0.897 & 0.854 & 0.813 \\
& 7/11 & 0.825 & 0.785 & 0.748 \\
& 9/11 & 0.490 & 0.467 & 0.444 \\
\midrule
c2 = 5 & 1/11 & 0.255 & 0.242 & 0.228 \\
& 3/11 & 0.680 & 0.635 & 0.585 \\
& 5/11 & 0.806 & 0.699 & 0.604 \\
& 7/11 & 0.624 & 0.535 & 0.460 \\
& 9/11 & 0.351 & 0.298 & 0.255 \\
\midrule
c2 = 10 & 1/11 & 0.255 & 0.240 & 0.221 \\
& 3/11 & 0.667 & 0.596 & 0.510 \\
& 5/11 & 0.610 & 0.383 & 0.185 \\
& 7/11 & 0.472 & 0.324 & 0.192 \\
& 9/11 & 0.262 & 0.186 & 0.117 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
但问题是它太大了,我需要它很多更小。像这样:
我截取了原始表格的屏幕截图并将其缩小,从而得到了该图像。但这有点作弊。那么我怎样才能像图中那样将其缩小呢?我试过了0.5\textwidth
,但效果不太好。第一列可以有多行吗?
答案1
这是表格的两个版本:我使用了常规字体,tabular
因为表格列中不需要自动换行。为了改善数字的对齐,我使用了siunitx
。在第二个示例中,我另外将字体大小减小为 ,\small
并将\arraystretch
减小为1
。
\documentclass[a4paper,12pt]{article}
\usepackage[margin=0.65in]{geometry}
\renewcommand{\arraystretch}{1.5}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{siunitx}
\usepackage{caption}
\begin{document}
\begin{table}
\centering
\caption{Thin Rod Simulation Results for 2 Material Forwards Euler}
\label{tbl:2}
\begin{tabular}{lcc*{3}{S[table-format=1.3]}}
\toprule
& x & {T = 0.01} & {T = 0.015} & {T = 0.02} \\
\midrule
c2 = 1 & 1/11 & 0.255 & 0.243 & 0.232 \\
& 3/11 & 0.685 & 0.652 & 0.621 \\
& 5/11 & 0.897 & 0.854 & 0.813 \\
& 7/11 & 0.825 & 0.785 & 0.748 \\
& 9/11 & 0.490 & 0.467 & 0.444 \\
\midrule
c2 = 5 & 1/11 & 0.255 & 0.242 & 0.228 \\
& 3/11 & 0.680 & 0.635 & 0.585 \\
& 5/11 & 0.806 & 0.699 & 0.604 \\
& 7/11 & 0.624 & 0.535 & 0.460 \\
& 9/11 & 0.351 & 0.298 & 0.255 \\
\midrule
c2 = 10 & 1/11 & 0.255 & 0.240 & 0.221 \\
& 3/11 & 0.667 & 0.596 & 0.510 \\
& 5/11 & 0.610 & 0.383 & 0.185 \\
& 7/11 & 0.472 & 0.324 & 0.192 \\
& 9/11 & 0.262 & 0.186 & 0.117 \\
\bottomrule
\end{tabular}
\end{table}
\begin{table}
\centering
\renewcommand{\arraystretch}{1}
\small
\caption{Thin Rod Simulation Results for 2 Material Forwards Euler}
\label{tbl:2}
\begin{tabular}{lcc*{3}{S[table-format=1.3]}}
\toprule
& x & {T = 0.01} & {T = 0.015} & {T = 0.02} \\
\midrule
c2 = 1 & 1/11 & 0.255 & 0.243 & 0.232 \\
& 3/11 & 0.685 & 0.652 & 0.621 \\
& 5/11 & 0.897 & 0.854 & 0.813 \\
& 7/11 & 0.825 & 0.785 & 0.748 \\
& 9/11 & 0.490 & 0.467 & 0.444 \\
\midrule
c2 = 5 & 1/11 & 0.255 & 0.242 & 0.228 \\
& 3/11 & 0.680 & 0.635 & 0.585 \\
& 5/11 & 0.806 & 0.699 & 0.604 \\
& 7/11 & 0.624 & 0.535 & 0.460 \\
& 9/11 & 0.351 & 0.298 & 0.255 \\
\midrule
c2 = 10 & 1/11 & 0.255 & 0.240 & 0.221 \\
& 3/11 & 0.667 & 0.596 & 0.510 \\
& 5/11 & 0.610 & 0.383 & 0.185 \\
& 7/11 & 0.472 & 0.324 & 0.192 \\
& 9/11 & 0.262 & 0.186 & 0.117 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
只是为了完整性...使用标准c
列和tabular
表环境:
\documentclass[a4paper,12pt]{article}
\usepackage[margin=0.65in]{geometry}
%\usepackage{tabularx}
%\renewcommand{\arraystretch}{1.5}
\usepackage{booktabs, multirow}
\usepackage[skip=1ex]{caption}
%\usepackage{float}
\title{}
\author{}
\date{}
\begin{document}
\begin{table}[ht]
\centering
\caption{Thin Rod Simulation Results for 2 Material Forwards Euler}
\label{tbl:2}
\begin{tabular}{*{5}{c}}
\toprule
& \multirow{2.4}{*}{x}
& \multicolumn{3}{c}{T} \\
\cmidrule{3-5}
& & 0.01 & 0.015 & 0.02 \\
\midrule
c2 = 1 & 1/11 & 0.255 & 0.243 & 0.232 \\
& 3/11 & 0.685 & 0.652 & 0.621 \\
& 5/11 & 0.897 & 0.854 & 0.813 \\
& 7/11 & 0.825 & 0.785 & 0.748 \\
& 9/11 & 0.490 & 0.467 & 0.444 \\
\midrule
c2 = 5 & 1/11 & 0.255 & 0.242 & 0.228 \\
& 3/11 & 0.680 & 0.635 & 0.585 \\
& 5/11 & 0.806 & 0.699 & 0.604 \\
& 7/11 & 0.624 & 0.535 & 0.460 \\
& 9/11 & 0.351 & 0.298 & 0.255 \\
\midrule
c2 = 10 & 1/11 & 0.255 & 0.240 & 0.221 \\
& 3/11 & 0.667 & 0.596 & 0.510 \\
& 5/11 & 0.610 & 0.383 & 0.185 \\
& 7/11 & 0.472 & 0.324 & 0.192 \\
& 9/11 & 0.262 & 0.186 & 0.117 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}