如何消除表格中列线附近的空格?

如何消除表格中列线附近的空格?

我想消除如下所示的表格中的空间:

我的桌子

因此,我尝试制作的表格与下表类似:

样本

请提供建议。这是我的乳胶代码:

\begin{table}

\begin{center}
    \caption{Perspective on HW and SW qualification methods}
    \begin{tabular} 
  {|p{0.3in}|p{.45in}|p{.01in}|p{.45in}|p{.01in}|p{.4in}|p{.01in}|p{.6in}|p{.15in}|}
    
  \hline
\textbf{Failure}&\textbf{Operations}&\textbf{E}&\textbf{Reason}&\textbf{S}&\textbf{Reason}&\textbf{C}&\textbf{Reason}&\textbf{ASIL} \\
\hline
\multirow{16}{em}{Unexpected torque control} & Vehicle moves forward & 4 & Pedestrians in front & 2 & $>$10\% probability of AIS 3-6 & 3 &  $>$90 \% of all traffic participants are able/ barely able to avoid harm & C \\\cline{2-9}
& Vehicle moves forward & 4 & City road & 2 & $>$10\% probability of AIS 3-6 & 2 &  90 \% or more of all traffic participants are able to avoid harm & B
  \\ \cline{2-9}
& Turning; stopping & 4 & Stopping at light & 2 & $>$10\% probability of AIS 3-6 & 2 &  90 \% or more of all traffic participants are able to avoid harm & B
  \\ \cline{2-9}
  & Driving in reverse & 2 & Driving in reverse & 1 & $>$10\% probability of AIS 1-6 & 1 &  90 \% or more of all traffic participants are able to avoid harm & QM
  \\ \cline{2-9}
    &Evasive manoeuvre&2&Evasive manoeuvre& 3 & $>$10\% probability of AIS 5-6 & 2 &  90 \% or more of all traffic participants are able to avoid harm & A
  \\ \cline{2-9}
  
  \hline

    \end{tabular}
    \label{table}
    \end{center}
\end{table}

答案1

对于表格,我会使用tabularray带有列类型的包X来表示第二列。使用\small字体大小可以更好地填充单元格。由于页面布局未知,我使用geometry包:

\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{microtype}

\usepackage{tabularray}
\UseTblrLibrary{siunitx}

\begin{document}
    \begin{table}[ht]
    \caption{Perspective on HW and SW qualification methods}
    \label{tab:table}
    \centering
    \small

\begin{tblr}{hlines, vlines,
             colspec = {*{4}{l X[c, m]} c}, 
              colsep = 4pt,
              row{1} = {font=\bfseries\itshape, c, m}
            }
Failure & Operations & E & Reason & S & Reason  & C & Reason    & ASIL  \\
\SetCell[r=5]{l}    {Unexpected\\ torque\\ control} 
        & Vehicle moves forward 
                    & 4 & Pedestrians in front 
                                  & 2 & \qty{10}{\%} probability of AIS 3-6 
                                                 & 3 &  \qty{> 90}{\%} of all traffic participants are able/ barely able to avoid harm           & C     \\
        & Vehicle moves forward
                    & 4 & City road
                                  & 2 & \qty{> 10}{\%} probability of AIS 3-6
                                                 & 2 &  \qty{90}{\%} or more of all traffic participants are able to avoid harm
                                                            & B         \\
        & Turning; stopping 
                    & 4 & Stopping at light 
                                  & 2 & \qty{> 10}{\%} probability of AIS 3-6 
                                                 & 2 &  \qty{90}{\%} or more of all traffic participants are able to avoid harm 
                                                            & B         \\ 
        & Driving in reverse 
                    & 2 & Driving in reverse 
                                  & 1 & \qty{10}{\%} probability of AIS 1-6 
                                                 & 1 & \qty{90}{\%} or more of all traffic participants are able to avoid harm 
                                                            & QM        \\ 
        & Evasive manoeuvre&2&Evasive manoeuvre
                    & 3 & $>$10\% probability of AIS 5-6 
                                  & 2 & \qty{90}{\%} or more of all traffic participants are able to avoid harm 
                                                            & A         \\
\end{tblr}
    \end{table}
\end{document}

在此处输入图片描述

答案2

这是一个tabularx基于 的解决方案,它试图让表格看起来更吸引人、更“开放”。它通过消除所有垂直线并使用间距合适的水平线来代替\hline和来实现这一点\cline

在此处输入图片描述

\documentclass{article}
\usepackage[a4paper,margin=2.5cm]{geometry} % set page parameters suitably
\usepackage{calc,tabularx,ragged2e,booktabs}
\newcolumntype{L}[1]{>{\RaggedRight\hsize=#1\hsize\hspace{0pt}}X}

\begin{document}
\begin{table}[ht]
\caption{Perspective on HW and SW qualification methods\strut}
\label{stuff}
\begin{tabularx}{\textwidth}{@{} 
   >{\raggedright}p{\widthof{Failure type}} *{3}{L{0.85}@{}c} L{1.45}@{}c  @{}}
\toprule
Failure type &Operations&E &Reason&Sm&Reason&C &Reason&ASIL \\
\midrule
Unexpected torque control
& Vehicle moves forward & 4 & Pedestrians in front & 2 & $>$10\% probability of AIS 3--6 & 3 &  $>$90\% of all traffic participants are able\slash barely able to avoid harm & C \\ 
\cmidrule(l){2-9}
& Vehicle moves forward & 4 & City road & 2 & $>$10\% probability of AIS 3--6 & 2 &  90\% or more of all traffic participants are able to avoid harm & B \\ 
\cmidrule(l){2-9}
& Turning; stopping & 4 & Stopping at light & 2 & $>$10\% probability of AIS 3--6 & 2 &  90\% or more of all traffic participants are able to avoid harm & B \\ 
\cmidrule(l){2-9}
& Driving in reverse & 2 & Driving in reverse & 1 & $>$10\% probability of AIS 1--6 & 1 &  90\% or more of all traffic participants are able to avoid harm & QM \\ 
\cmidrule(l){2-9}
& Evasive manoeuvre&2&Evasive manoeuvre& 3 & $>$10\% probability of AIS 5--6 & 2 &  90\% or more of all traffic participants are able to avoid harm & A \\
\bottomrule
\end{tabularx}
\end{table}

\end{document}

相关内容