在我的表中添加一条水平线

在我的表中添加一条水平线

我想在第一段的结尾和第二段的开头之间添加一条水平线:

\begin{table}[htb]
    \small % \footnotesize
    \begin{tblr}{hlines={blue}, vlines={blue},
                 colspec = {c X[0.8, l] X[1.2, c]},
                 colsep=3pt,
                 row{1}  = {c, font=\bfseries, fg=white, bg=blue},
                 row{even} = {bg=blue!10}
                 }
X  &   Vulnerabilities   \\
x1   &  \textbf{Vuln 1 :} my first parapgraph... 
% \hline is not working...
\newline\textbf{Vuln 2 :} my first parapgraph...  \\
 \end{tblr}
\end{table}

下面的图片可以帮助我们了解我拥有的东西和我想要的东西:

在此处输入图片描述

答案1

  • 您不能在单元格中间画水平线。
  • 此 MWE 复制了您所展示的期望结果:
\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}

\begin{document}
    \begin{table}[htb]
    \small % \footnotesize
\begin{tblr}{hlines={blue}, vlines={blue},
             colspec = {c X[0.8, l] X[1.2, c]},
             colsep  = 3pt,
             row{1}  = {c, font=\bfseries, fg=white, bg=blue},
             row{2-Z} = {bg=blue!10}
                 }
X   &   Vulnerabilities   \\
\SetCell[r=2]{c}    x1  
    &   \textbf{Vuln 1 :} my first parapgraph...    \\
    &   \textbf{Vuln 2 :} my first parapgraph...    \\
\end{tblr}
    \end{table}
\end{document}

在此处输入图片描述

或者如您所见:

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}

\begin{document}
    \begin{table}[htb]
    \small % \footnotesize
\begin{tblr}{hlines={blue}, vlines={blue},
             colspec = {c X[0.8, l] X[1.2, c]},
             colsep  = 3pt,
             row{1}  = {c, font=\bfseries, fg=white, bg=blue},
             row{2-Z} = {bg=blue!10}
                 }
X   &   Vulnerabilities   \\
\SetCell[r=2]{h}    x1  % <--- observe "h" as type of cell
    &   \textbf{Vuln 1 :} my first parapgraph...    \\
    &   \textbf{Vuln 2 :} my first parapgraph...    \\
\end{tblr}
    \end{table}
\end{document}

在此处输入图片描述

相关内容