表格中的垂直线

表格中的垂直线

想要在表格中绘制垂直线(附件中红色部分)。以下是我的代码

\documentclass[acmsmall]{acmart}
\acmJournal{CSUR}
\usepackage{longtable}
\usepackage{arydshln}
\usepackage{multirow}

\begin{document}
\begin{table}
\footnotesize   
%\scriptsize
\begin{longtable}{cc||cc}
\footnotesize
    \caption{List of abbreviations}\\
    \hline
        
    \multirow{2}{*}{\textbf{Abbreviation}}                    & \multirow{2}{*}{\textbf{Full-form}}                                                 & \multirow{2}{*}{\textbf{Abbreviation}}                             & \multirow{2}{*}{\textbf{Full-form}}                                                                                                      \\*
    
    \endfirsthead 
\\
    \hline
    
     $1234$     & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa         & $123$  & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\      
    
    \hdashline
    $1234$     & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa          & $123$  & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\  
    \hdashline
    $1234$     & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa          & $123$  & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\  
    \hdashline
    $1234$     & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa          & $123$  & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\    
    \hdashline
    $1234$     & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa          & $123$  & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\    
    \hdashline
    $1234$     & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa          & $123$  & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\    
    \hdashline
    $1234$     & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa          & $123$  & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\   
    \hdashline
    $1234$     & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa          & $123$  & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\              
\hline
\end{longtable}
\end{table}
\end{document} 

在此处输入图片描述

答案1

以下是一些建议tabularray

\documentclass[acmsmall]{acmart}
\acmJournal{CSUR}
\usepackage{tabularray}

\begin{document}
With vertical rule:
\begin{longtblr}[
    caption={List of abbreviations}
    ]{
    colspec={cc|cc},
    columns={font=\footnotesize},
    row{1}={font=\footnotesize\bfseries, rowsep=8pt},
    hline{1,2,Z}={solid},
    hline{3-Y}={dashed}
    }
    Abbreviation & Full-form & Abbreviation & Full-form\\               
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\       
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\  
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\  
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\    
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\    
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\    
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\   
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\
\end{longtblr}
Without vertical rule:
\begin{longtblr}[
    caption={List of abbreviations}
    ]{
    colspec={cccc},
    columns={font=\footnotesize},
    row{1}={font=\footnotesize\bfseries, rowsep=8pt},
    hline{1,Z}={solid},
    hline{2}={1-2}{leftpos = -1, rightpos = -1, endpos},
    hline{3-Y}={1-2}{dashed, leftpos = -1, rightpos = -1, endpos},
    hline{2}={3-4}{leftpos = -1, rightpos = -1, endpos},
    hline{3-Y}={3-4}{dashed, leftpos = -1, rightpos = -1, endpos}
    }
    Abbreviation & Full-form & Abbreviation & Full-form\\               
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\       
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\  
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\  
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\    
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\    
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\    
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\   
    1234 & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & 123 & aaaaaaaaaaaaa aaaaaaa aaaaaaaa\\
\end{longtblr}
\end{document}

在此处输入图片描述

答案2

我认为在没有多行的情况下使用会很奇怪multirow,并且我假设您只是想实现更多的填充。请参阅修改表中单行的 arraystretch,也许这能给你你想要的东西。

必须\footnotesize位于长表之外并被包裹在和中\bgroup\egroup以防止它修改表外的文本。

关于良好风格的评论:让我引用一下这个booktabs包:

  1. 永远不要使用垂直规则。
  2. 切勿使用双重规则。

我擅自使用 添加了您的表格的另一个版本booktabs

在此处输入图片描述

\documentclass[acmsmall]{acmart}
\acmJournal{CSUR}
\usepackage{longtable,arydshln,multirow,booktabs}

\begin{document}
    Text before in normal size.
    
    \bgroup\footnotesize
    \begin{longtable}{cc|cc}
        \caption{List of abbreviations.}\\
        \hline
        \textbf{Abbreviation} & \textbf{Full-form} & \textbf{Abbreviation} & \textbf{Full-form}\\
        \endfirsthead
        \hline
        $1234$ & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & $1234$ & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa \\
        \hdashline
        $1234$ & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & $1234$ & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa \\
        \hline
    \end{longtable}
    \egroup

    Text in between in normal size.
    
    \bgroup\footnotesize
    \begin{longtable}{cccc}
        \caption{List of abbreviations (with \texttt{booktabs}).}\\
        \toprule
        \multicolumn{2}{c}{\textbf{Left part}} & \multicolumn{2}{c}{\textbf{Right part}} \\
        \textbf{Abbreviation} & \textbf{Full-form} & \textbf{Abbreviation} & \textbf{Full-form}\\
        \endfirsthead
        \cmidrule(r){1-2} \cmidrule(l){3-4}
        $1234$ & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & $1234$ & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa \\
        $1234$ & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa & $1234$ & aaaaaa-aaaaaa aaaaaaa aaaaaaaaaa \\
        \bottomrule
    \end{longtable}
    \egroup

    Text at end in normal size.
\end{document}

相关内容