我有下表,但它不适合这个页面。我已经尝试寻找相关的主题,尝试了所有建议,但没有成功。
这是我的代码:
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\begin{sidewaystable}[]
\centering
\begin{tabular}{|M{1.25cm}|M{1.85cm}|M{3cm}|M{4.0cm}|M{2.5cm}|M{3cm}|M{1.8cm}|M{2cm}|M{3cm}|}
\hline
\textbf{Hazard ID} & {\textbf{Hazard}} & {\textbf{Incident/Event}} & {\textbf{Potential Consequences/Impacts}} & {\textbf{Potential Causes}} & {\textbf{Mitigation and Prevention Measures}} & \textbf{Potential Offsite Impact?} & \textbf{Qualitative Risk} & {\textbf{Comments}} \\ \hline
1.1 & 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]{FE0000}High & Problem can be either the VFH* component, or the estimation of the obstacle position by the COLREGs component. \\ \hline
1.2 & 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]{FE0000}High & A problem possibly rooted within the sensors and/or controllers. \\ \hline
2.1 & 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 & Statedog, Recovery Blocks & Yes & \cellcolor[HTML]{FE0000}High & A problem possibly rooted within the detection algorithm. \\ \hline
2.2 & 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 sensor; Corrupted sensor data & Redundant \& Diverse Sensors & Yes & \cellcolor[HTML]{FE0000}High & A problem possibly rooted within the sensors (Camera, Radar, AIS). \\ \hline
3.1 & Failure to move & USV does not accelerate & USV attempts to navigate in the environment, results in getting stuck on the initial position & Failed llstack initiation priority protocol & Statedog & No & \cellcolor[HTML]{F8FF00}Medium & A problem possibly rooted within the llstack start-up procedure. \\ \hline
3.2 & Failure to arrive to the destination & USV does not stop at the desired goal point & USV skips the destination, stops somewhere else and/or keeps going & Failed preferenceStore data transmission & Redundant Data Diversity & No & \cellcolor[HTML]{F8FF00}Medium & A problem where preferenceStore either gets started too late or transmits corrupted data, leading navigational errors. \\ \hline
3.3 & Failure to sail normally & USV acts abnormally, sails unexpectedly & USV sails abnormally, deviates from the route. & Failed Mediator component & Statedog & Yes & \cellcolor[HTML]{32CB00}Low & A problem where Mediator somehow fails to compare the results from other Mediators, therefore passing the commands without a check. \\ \hline
\end{tabular}
\caption{Preliminary Hazard Analysis for the Software of USV Roboship}
\label{my-label}
\end{sidewaystable}
以下是我的不幸的输出:
正如您所见,它浮出了页面,甚至不包括列标题等。
有人知道这个问题的快速解决方法吗?
答案1
快速而粗略的方法:您可以减小字体大小并缩小列。仍然是一个满框,因此它比文本区域大,但至少适合 (A4) 页面。
\documentclass[a4paper]{article}
\usepackage[table]{xcolor}
\usepackage{array,rotating}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
\begin{sidewaystable}[]
\centering\footnotesize
\begin{tabular}{|M{1cm}|M{1.25cm}|M{2.2cm}|M{3.0cm}|M{2cm}|M{2.5cm}|M{1.5cm}|M{1.7cm}|M{2.5cm}|}
\hline
\textbf{Hazard ID} & {\textbf{Hazard}} & {\textbf{Incident/Event}} & {\textbf{Potential Consequences/Impacts}} & {\textbf{Potential Causes}} & {\textbf{Mitigation and Prevention Measures}} & \textbf{Potential Offsite Impact?} & \textbf{Qualitative Risk} & {\textbf{Comments}} \\ \hline
1.1 & 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]{FE0000}High & Problem can be either the VFH* component, or the estimation of the obstacle position by the COLREGs component. \\ \hline
1.2 & 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]{FE0000}High & A problem possibly rooted within the sensors and/or controllers. \\ \hline
2.1 & 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 & Statedog, Recovery Blocks & Yes & \cellcolor[HTML]{FE0000}High & A problem possibly rooted within the detection algorithm. \\ \hline
2.2 & 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 sensor; Corrupted sensor data & Redundant \& Diverse Sensors & Yes & \cellcolor[HTML]{FE0000}High & A problem possibly rooted within the sensors (Camera, Radar, AIS). \\ \hline
3.1 & Failure to move & USV does not accelerate & USV attempts to navigate in the environment, results in getting stuck on the initial position & Failed llstack initiation priority protocol & Statedog & No & \cellcolor[HTML]{F8FF00}Medium & A problem possibly rooted within the llstack start-up procedure. \\ \hline
3.2 & Failure to arrive to the destination & USV does not stop at the desired goal point & USV skips the destination, stops somewhere else and/or keeps going & Failed preferenceStore data transmission & Redundant Data Diversity & No & \cellcolor[HTML]{F8FF00}Medium & A problem where preferenceStore either gets started too late or transmits corrupted data, leading navigational errors. \\ \hline
3.3 & Failure to sail normally & USV acts abnormally, sails unexpectedly & USV sails abnormally, deviates from the route. & Failed Mediator component & Statedog & Yes & \cellcolor[HTML]{32CB00}Low & A problem where Mediator somehow fails to compare the results from other Mediators, therefore passing the commands without a check. \\ \hline
\end{tabular}
\caption{Preliminary Hazard Analysis for the Software of USV Roboship}
\label{my-label}
\end{sidewaystable}
\end{document}
longtable
ebo 建议longtable
在注释中使用,以允许表格跨页拆分。为此,您还必须从 切换到sidewaystable
,landscape
并且\caption
必须将 移到 内longtable
。
我加载了pdflscape
该landscape
环境的包。
\documentclass[a4paper]{article}
\usepackage[table]{xcolor}
\usepackage{array,pdflscape,longtable}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
\begin{landscape}
\centering\footnotesize
\begin{longtable}{|M{1cm}|M{1.25cm}|M{2.2cm}|M{3.0cm}|M{1.8cm}|M{2.2cm}|M{1.5cm}|M{1.6cm}|M{2.5cm}|}
\caption{Preliminary Hazard Analysis for the Software of USV Roboship\label{my-label}} \\
\hline
\textbf{Hazard ID} & {\textbf{Hazard}} & {\textbf{Incident/Event}} & {\textbf{Potential Consequences/Impacts}} & {\textbf{Potential Causes}} & {\textbf{Mitigation and Prevention Measures}} & \textbf{Potential Offsite Impact?} & \textbf{Qualitative Risk} & {\textbf{Comments}} \\ \hline
1.1 & 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]{FE0000}High & Problem can be either the VFH* component, or the estimation of the obstacle position by the COLREGs component. \\ \hline
1.2 & 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]{FE0000}High & A problem possibly rooted within the sensors and/or controllers. \\ \hline
2.1 & 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 & Statedog, Recovery Blocks & Yes & \cellcolor[HTML]{FE0000}High & A problem possibly rooted within the detection algorithm. \\ \hline
2.2 & 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 sensor; Corrupted sensor data & Redundant \& Diverse Sensors & Yes & \cellcolor[HTML]{FE0000}High & A problem possibly rooted within the sensors (Camera, Radar, AIS). \\ \hline
3.1 & Failure to move & USV does not accelerate & USV attempts to navigate in the environment, results in getting stuck on the initial position & Failed llstack initiation priority protocol & Statedog & No & \cellcolor[HTML]{F8FF00}Medium & A problem possibly rooted within the llstack start-up procedure. \\ \hline
3.2 & Failure to arrive to the destination & USV does not stop at the desired goal point & USV skips the destination, stops somewhere else and/or keeps going & Failed preferenceStore data transmission & Redundant Data Diversity & No & \cellcolor[HTML]{F8FF00}Medium & A problem where preferenceStore either gets started too late or transmits corrupted data, leading navigational errors. \\ \hline
3.3 & Failure to sail normally & USV acts abnormally, sails unexpectedly & USV sails abnormally, deviates from the route. & Failed Mediator component & Statedog & Yes & \cellcolor[HTML]{32CB00}Low & A problem where Mediator somehow fails to compare the results from other Mediators, therefore passing the commands without a check. \\ \hline
\end{longtable}
\end{landscape}
\end{document}