我正在尝试将表格放到页面上,我最终使用\resizebox{\textwidth}{!}
和{sidewaystable}
来完成,现在它适合页面。然而,它甚至不再可读。文本变得如此之小,以至于桌子现在没用了。这是我的表:
\begin{sidewaystable}[]
\centering
\resizebox{\textwidth}{!}{\begin{tabular}{|c|l|l|l|l|l|c|c|l|}
\hline
\textbf{Hazard ID} & \multicolumn{1}{c|}{\textbf{Hazard}} & \multicolumn{1}{c|}{\textbf{Incident/Event}} & \multicolumn{1}{c|}{\textbf{Potential Consequences/Impacts}} & \multicolumn{1}{c|}{\textbf{Potential Causes}} & \multicolumn{1}{c|}{\textbf{Mitigation and Prevention Measures}} & \textbf{Potential Offsite Impact?} & \textbf{Qualitative Risk} & \multicolumn{1}{c|}{\textbf{Comments}} \\ \hline
1.1 & Failure to provide desired manoeuvre & USV does not provide the necessary acceleration & USV attempts to avoid the obstacle, cannot manoeuvre as expected, results in collusion with the obstacle & Failed sensor; Corrupted sensor data & Redundant \& Diverse Sensors & Yes & \cellcolor[HTML]{F8FF00}Medium & A problem possibly rooted within the sensors and/or controllers. \\ \hline
1.2 & Failure to generate safe path & USV does not avoid the obstacle & USV attempts to navigate in the environment, results in collusion with the obstacle & Failed obstacle avoidance module & Statedog, N-Version Programming & Yes & \cellcolor[HTML]{34FF34}Low & Problem can be either the VFH* component, or the estimation of the obstacle position by the COLREGs component. \\ \hline
1.3 & Failure to detect the inbound obstacle & USV does not map the obstacle & USV sails as there was nothing on its way, results in collusion with the obstacle & Failed detection algorithm, Failed sensor; Corrupted sensor data & Statedog, Redundant \& Diverse Sensors, Recovery Blocks & Yes & \cellcolor[HTML]{F56B00}High & A problem possibly rooted within the detection algorithm. \\ \hline
\end{tabular}}
\caption{My caption}
\label{my-label}
\end{sidewaystable}
有没有办法调整表格以适应页面,同时保持文本大小?一个想法是有空格,因为我的表中有句子。如果我给出空格(每行1-2个字),那么我猜它会合适。然而,当我插入\\
时,表格被搞砸了,事情发生了碰撞,一切看起来都更加荒谬。
这是我最终要达到的目标:
不幸的是,这就是我得到的:
有什么想法吗?
答案 0 :(得分:1)
首先,您可以将这些添加到序言中:
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
您不需要\resizebox{\textwidth}{!}
。
您应该将\begin{tabular}{|c|l|l|l|l|l|c|c|l|}
更改为\begin{tabular}{|M{1.5cm}|M{1.85cm}|M{3.5cm}|M{6cm}|M{2.5cm}|M{2cm}|M{2cm}|M{2cm}|M{3cm}|}
最后,请在每个标题单元格中省略\multicolumn{1}{c|}
。结果如下。