\begin{table}
\begin{center}
\caption{An environmental details for the experiment.}
\begin{tabular}{ | c | c | }
\hline
Room & Living room \\ \hline
Sensors and camera position & Ceiling \\ \hline
Sensor and camera Distance from floor & 2.6 m \\ \hline
Room Temperature & $24^{\circ}$C \\ \hline
Subject & Human \\ \hline
Position of subject to sensor & All positions possible \\ \hline
Activities & Walking, Sitting, Standing, Falling, Lying, Action change \\ \hline
Subject & 5 person \\ \hline
\end{tabular}
\label{exp}
\end{center}
\end{table}
答案1
- 您需要将表格中的单元格内容分成两行。例如,使用表格
tabularx
(在同名包中定义)。 - 对于单位我会使用
siunitx
。 - 有关更好的表格设计,请参阅@mico 答案。
- 我将按如下方式输入您的表格:
\documentclass{ieeetran}
\usepackage{lipsum}
\usepackage{makecell, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{siunitx}
\begin{document}
\lipsum[1]
\begin{table}[ht]
\setcellgapes{2pt}
\makegapedcells
\centering
\caption{An environmental details for the experiment.}
\label{exp}
\begin{tabularx}{\linewidth}{ |l | L | }
\hline
Room & Living room \\ \hline
Sensors and camera position & Ceiling \\ \hline
Sensor and camera Distance from floor & \SI{2.6}{m} \\ \hline
Room Temperature & \SI{24}{\celsius} \\ \hline
Subject & Human \\ \hline
Position of subject to sensor & All positions possible \\ \hline
Activities & Walking, Sitting, Standing, Falling, Lying, Action change \\ \hline
Subject & 5 person \\ \hline
\end{tabularx}
\end{table}
\lipsum[2-7]
\end{document}
答案2
由于未启用换行功能,因此表格不适合列的宽度。
我建议您从 a 环境切换tabular
到 atabularx
环境,将其宽度设置为\columnwidth
,并使用X
-type columns 允许在单元格内换行。在下面显示的解决方案中,我定义了一种新的列类型,称为L
,它基于X
列类型并执行悬挂缩进。我建议左对齐而不是将两列居中。我还建议您通过省略所有垂直线并使用更少但间距适当的水平线来使表格具有更开放的“外观”。最后,要排版数字及其相关单位,请使用包\SI
的宏siunitx
。
\documentclass[conference]{IEEEtran}
\usepackage{booktabs,siunitx}
\usepackage{tabularx,ragged2e}
\newcolumntype{L}{>{\RaggedRight\hangafter=1\hangindent=1em}X}
\begin{document}
\begin{table}
\caption{Environmental details for experiment.}
\label{exp}
\begin{tabularx}{\columnwidth}{ @{} LL @{} }
\toprule
Room & Living room \\
\midrule % optional, feel free to omit
Sensors and camera position & Ceiling \\
Sensor and camera distance from floor & \SI{2.6}{\meter} \\
Room Temperature & \SI{24}{\celsius} \\
Subject & Human \\
Position of subject to sensor & All positions possible \\
Activities & Walking, sitting, standing, falling, lying, action change \\
Subject & 5 persons \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}