在这两个表的第二列后面放一条竖线?

在这两个表的第二列后面放一条竖线?

考虑:

 \documentclass{article}
    
    \usepackage{tabularray}
    \UseTblrLibrary{booktabs, siunitx}
    
    \begin{document}    
    \begin{table}[!htb]
    \noindent\begin{tblr}{
                          colspec = {*{4}{Q[c,$]}},
                           row{1} = {mode=text},
                         row{2-Y} = {belowsep+=2pt}
                         }
            \toprule
        Parameter & Sensitivity index & Parameter & Sensitivity index\\
            \midrule
        x     & +1.000 
                    & x  & -0.328  \\
       x & -0.788 
                    & x       & -0.344    \\
        x & +0.231 
                    & x       & -0.518      \\
        x & +0.124 
                    & x & -0.023      \\
        x       & -5.785 
                    & \xi & +0.364      \\
        x       & -0.731 
                    & x       & -0.004                    \\
        
            \bottomrule
        \end{tblr}
    \caption{x}
    \end{table}
and
\begin{table}[!htb]
\small
\noindent\begin{tblr}{colspec = {| Q[c,$] X[l] |
                                   Q[c,$] X[l] |},
                       row{1} = {mode=text},
                     row{2-Y} = {belowsep+=2pt},
cells = {font=\fontsize{10}{11}}
                     }  
    \toprule
Parameter & Description & Parameter & Description\\
    \midrule
x     & Influx rate of the population 
            & x  & Progression rate of  asymptomatic to symptomatic compartment  \\
x & Natural death rate 
            & x       & Self-recovery rate of asymptomatic individuals \\
x & Transmission rate of the asymptomatic compartment 
            & x       & Self-recovery rate of symptomatic individuals      \\
x & Transmission rate of the symptomatic compartment 
            & x & Treatment rate of symptomatic individuals      \\
x       & Vaccination proportion of newborns
            & x     & Immunity loss rate     \\
x       & Vaccination rate of susceptibles 
            & x       & Disease induced death rate                    \\

    \bottomrule
\end{tblr}
\caption{Description of parameters}
\end{table}
    \end{document}
  1. 我们如何在 MWE 中第一个表的第二列后插入一条垂直线?
  2. 我们如何才能使第二个表格看起来像第一个表格(线条粗细相同并删除外边框线)但在第二列后插入一条垂直线?

编辑:

对于2),我做了:

\documentclass{article}
        
        \usepackage{tabularray}
        \UseTblrLibrary{booktabs, siunitx}
        
        \begin{document}  


 \begin{table}[!htb]
    \small
    \noindent\begin{tblr}{colspec = { Q[c,$] X[l] |
                                       Q[c,$] X[l] },
                           row{1} = {mode=text},
                         row{2-Y} = {belowsep+=2pt},
    cells = {font=\fontsize{10}{11}}
                         }  
        \toprule
    Parameter & Description & Parameter & Description\\
        \midrule
    x     & Influx rate of the population 
                & x  & Progression rate of  asymptomatic to symptomatic compartment  \\
    x & Natural death rate 
                & x       & Self-recovery rate of asymptomatic individuals \\
    x & Transmission rate of the asymptomatic compartment 
                & x       & Self-recovery rate of symptomatic individuals      \\
    x & Transmission rate of the symptomatic compartment 
                & x & Treatment rate of symptomatic individuals      \\
    x      & Vaccination proportion of newborns
                & x     & Immunity loss rate     \\
   x       & Vaccination rate of susceptibles 
                & x       & Disease induced death rate                    \\
    
        \bottomrule
    \end{tblr}
    \caption{x}
    \end{table}
    \end{document}

但是顶部规则和底部规则是否与 MWE 中的第一个表格相同?对我来说,它看起来比 MWE 中的第一个表格“更薄”,但我可能错了?

答案1

(我只会回答您的第一个问题,您应该将其他问题移至新帖子)

您可以使用vline{3}={solid}在第二列后添加垂直线。然而,这会使您原本漂亮的表格看起来不那么专业。

相反,我建议分割第二条水平线来表示划分:

\documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}    
\begin{table}[!htb]
\noindent\begin{tblr}{
                    colspec = {*{4}{Q[c,$]}},
                    vline{3}={solid},
                     row{1} = {mode=text},
                   row{2-Y} = {belowsep+=2pt}
                   }
      \toprule
  Parameter & Sensitivity index & Parameter & Sensitivity index\\
      \midrule
  x     & +1.000 
              & x  & -0.328  \\
 x & -0.788 
              & x       & -0.344    \\
  x & +0.231 
              & x       & -0.518      \\
  x & +0.124 
              & x & -0.023      \\
  x       & -5.785 
              & \xi & +0.364      \\
  x       & -0.731 
              & x       & -0.004                    \\
  
      \bottomrule
  \end{tblr}
\caption{x}
\end{table}

  \begin{table}[!htb]
  \noindent\begin{tblr}{
                        colspec = {*{4}{Q[c,$]}},
                         row{1} = {mode=text},
                       row{2-Y} = {belowsep+=2pt}
                       }
          \toprule
      Parameter & Sensitivity index & Parameter & Sensitivity index\\
         \cmidrule[r]{1-2} \cmidrule[l]{3-4}
      x     & +1.000 
                  & x  & -0.328  \\
     x & -0.788 
                  & x       & -0.344    \\
      x & +0.231 
                  & x       & -0.518      \\
      x & +0.124 
                  & x & -0.023      \\
      x       & -5.785 
                  & \xi & +0.364      \\
      x       & -0.731 
                  & x       & -0.004                    \\
      
          \bottomrule
      \end{tblr}
  \caption{x}
  \end{table}

\end{document}

在此处输入图片描述

答案2

使用siunitx库和分组行,仅需第一个表:

documentclass{article}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
    \begin{table}[!htb]
    \centering
\begin{tblr}{vline{3} = solid,   % <---
             colspec = {*{2}{Q[c,mode=math]Q[c, si={table-format=-1.3}]}},
              row{1} = {guard, mode=text},
            row{2-Z} = {rowsep=0pt},
            row{even[4-Z]} = {abovesep=3pt},
             }
    \toprule
Parameter & Sensitivity index & Parameter & Sensitivity index\\
    \midrule
x   &  1.000    & x     & -0.328    \\
x   & -0.788    & x     & -0.344    \\
x   &  0.231    & x     & -0.518    \\
x   &  0.124    & x     & -0.023    \\
x   & -5.785    & \xi   &  0.364    \\
x   & -0.731    & x     & -0.004    \\
    \bottomrule
\end{tblr}
\caption{Caption of the first table}
    \end{table}
\end{document}

在此处输入图片描述

附录(1):
第二张表:

\documentclass{article}
\usepackage{ragged2e}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
    \begin{table}[!htb]
\small
\begin{tblr}{vline{3},
             colspec = {*{2}{Q[c,mode=math] X[cmd=\RaggedRight]}},
              colsep = 4pt,
             row{1}  = {mode=text},
            row{2-Z} = {font=\linespread{0.9}\relax},
             }
    \toprule
Parameter & Description & Parameter & Description\\
    \midrule
x   & Influx rate of the population
        & x & Progression rate of  asymptomatic to symptomatic compartment  \\
x   & Natural death rate
        & x & Self-recovery rate of asymptomatic individuals \\
x   & Transmission rate of the asymptomatic compartment
        & x & Self-recovery rate of symptomatic individuals      \\
x   & Transmission rate of the symptomatic compartment
        & x & Treatment rate of symptomatic individuals      \\
x   & Vaccination proportion of newborns
        & x & Immunity loss rate     \\
x   & Vaccination rate of susceptibles
        & x & Disease induced death rate                    \\
    \bottomrule
\end{tblr}
\caption{Description of parameters}
    \end{table}
\end{document}

在此处输入图片描述

附录(2):
很多人不喜欢垂直线:

\documentclass{article}
\usepackage{ragged2e}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
    \begin{table}[!htb]
\small
\begin{tblr}{colspec = {*{2}{Q[c,mode=math] X[cmd=\RaggedRight]}},
              colsep = 4pt,
             row{1}  = {mode=text},
            row{2-Z} = {font=\linespread{0.9}\relax},
             }
    \toprule
Parameter & Description & Parameter & Description\\
    \cmidrule[r]{1-2}   \cmidrule[l]{3-4}
x   & Influx rate of the population
        & x & Progression rate of  asymptomatic to symptomatic compartment  \\
x   & Natural death rate
        & x & Self-recovery rate of asymptomatic individuals \\
x   & Transmission rate of the asymptomatic compartment
        & x & Self-recovery rate of symptomatic individuals      \\
x   & Transmission rate of the symptomatic compartment
        & x & Treatment rate of symptomatic individuals      \\
x   & Vaccination proportion of newborns
        & x & Immunity loss rate     \\
x   & Vaccination rate of susceptibles
        & x & Disease induced death rate                    \\

    \bottomrule
\end{tblr}
\caption{Description of parameters}
    \end{table}
\end{document}

在此处输入图片描述

相关内容