适合表格单元格的内容

适合表格单元格的内容

我正在尝试使下表适合放在一页上。

我尝试使用 rotatebox 选项将表格旋转 90 度,但我希望表格保持水平/规则。

我想知道如何利用最右侧列的垂直空间,使第二列的文本适合页面。我使用的语法是:

\begin{table}[h!]
\centering
\begin{tabular}{c|l}
Parameter & unit/description \\\hline
time & timestamp [sec]\\ \hline
icao24 & ICAO 24-bit address to identify a single airframe\\
lat/lon & 2D position\\
velocity & Ground speed [m/s]\\
heading & [degrees]\\
vertrate & vertical speed of the aircraft [m/s]\\
callsign & callsign broadcasted by the aircraft (may be the flight number, but not necessarily the case\\
onground & indicates whether the aircraft is on the ground or airborne (True/False respectively)\\
squawk & A four digit number used for identification of an aircraft, or signalling that an emergency is taking place\\
baroaltitude/geoaltitude & baroalitude as measured by the on-board barometer - dependent on the atmospheric conditions. Geoaltitude is determined through GPS [m]\\
lastposupdate & last time since the position was updated [s]\\
lastcontact & indicator on when OpenSky has last received a signal from the aircraft. Highly dependent on the coverage of OS receivers [s]. Note that the state vectors are generated up to 300 seconds after the last signal has been received\\
\end{tabular}
\caption{\label{tab:opensky}OpenSky database - parameters and units}
\end{table}

这会产生以下错误:

Overfull \hbox (671.47899pt too wide) in paragraph at lines 48--63

答案1

我认为将表格内容切换为横向格式不是一个好主意。相反,我认为你应该允许在第二列自动换行。这可以借助环境来完成tabularx;我建议你将其宽度设置为\textwidth。在这样做的同时,你还可以告诉 LaTeX 提供连续行的悬挂缩进。

在此处输入图片描述

\documentclass{article} % or some other suitable document class

\usepackage{tabularx,ragged2e}
% suspend full justification, arrange for hanging indentation:
\newcolumntype{L}{>{\RaggedRight\hangafter=1\hangindent=1em}X}

% measure desired width of first column:
\newlength\mylen
\settowidth\mylen{lastposupdate} % longest word in first column

\begin{document}

\begin{table}[h!]
\begin{tabularx}{\textwidth}{@{} p{\mylen} L @{}}
Parameter & unit/description \\ \hline
time      & timestamp [sec] \\  \hline
icao24    & ICAO 24-bit address to identify a single airframe\\
lat/lon   & 2D position\\
velocity  & Ground speed [m/s]\\
heading   & [degrees]\\
vertrate  & Vertical speed of the aircraft [m/s]\\
callsign  & Callsign broadcasted by the aircraft (may be the flight number, but not necessarily the case\\
onground  & Indicates whether the aircraft is on the ground or airborne (True/False respectively)\\
squawk    & A four digit number used for identification of an aircraft, or signalling that an emergency is taking place\\
baroaltitude\slash geoaltitude & Baroalitude as measured by the onboard barometer---dependent on the atmospheric conditions. Geoaltitude is determined through GPS [m]\\
lastposupdate & Last time since the position was updated [s]\\
lastcontact   & Indicator on when OpenSky has last received a signal from the aircraft. Highly dependent on the coverage of OS receivers [s]. Note that the state vectors are generated up to 300 seconds after the last signal has been received
\end{tabularx}

\caption{OpenSky database, parameters and units} \label{tab:opensky}

\end{table}

\end{document}

相关内容