垂直线不完整

垂直线不完整

我在创建表格时遇到问题“垂直线不完整”

\begin{table}[h!]
\caption{Comparison Between The Conventional and The Proposed Design Multipliers.}
\begin{center}
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
& 
\multicolumn{2}{|l|}{\raisebox{-1.50ex}[0cm][0cm]{3$\times$3}}& 
\multicolumn{2}{|l|}{\raisebox{-1.50ex}[0cm][0cm]{6$\times$6}}& 
\multicolumn{2}{|l|}{\raisebox{-1.50ex}[0cm][0cm]{12$\times$12}}
\\
& 
\multicolumn{2}{|l|}{}& 
\\
\hline
AA& 
Conventional& 
Proposed& 
Conven.& 
Proposed& 
Conven.& 
Proposed
\\
\hline
BB& 
1669.45 & 
1669.45& 
396.04&
583.43 &
110.49&
189.79 
\\
\hline
CC& 
4& 
4&
43& 
23& 
290& 
219
\\
\hline
\end{tabular}
\label{tab1}
\end{center}\vs{-4mm}
\end{table}

在此处输入图片描述

答案1

无需填补缺失的垂直线,去掉所有垂直线并抓住机会让您的表格看起来更加开放和吸引人。我建议您加载包booktabs并使用其宏\toprule\bottomrule和绘制较少但间距适当的水平线。\midrule\cmidrule

在此处输入图片描述

\documentclass{article}
\usepackage{siunitx,  % for 'S' column type
            booktabs, % for well-spaced horiz. lines
            caption}  % fine-tune appearance of captions
\begin{document}

\begin{table}[h!]
\captionsetup{skip=0.5\baselineskip}
\caption{Comparison between conventional and proposed design multipliers.} \label{tab1}
\centering
\begin{tabular}{@{} l *{2}{S[table-format=4.2]} *{4}{S[table-format=3.2]} @{}}
\toprule
& \multicolumn{2}{c}{3$\times$3}
& \multicolumn{2}{c}{6$\times$6}
& \multicolumn{2}{c}{12$\times$12}\\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(l){6-7} 
AA & {convent.} & {prop.} & {convent.} & {prop.} & {convent.} & {prop.} \\ 
BB & 1669.45 & 1669.45 & 396.04 & 583.43 & 110.49 & 189.79 \\
CC & 4 & 4 & 43 & 23 & 290 & 219 \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

答案2

在此处输入图片描述

上面的图像是通过使用\Gape包中的宏获得的makecell

\documentclass{article}
\usepackage[skip=1ex]{caption}
\usepackage{makecell}
\newcommand\mcl[1]{\multicolumn{2}{l|}{\Gape[6pt][6pt]{#1}}} % for shorter table code

\begin{document}
    \begin{table}[htb]
\caption{Comparison Between The Conventional and The Proposed Design Multipliers.}
\label{tab1}
    \centering
\begin{tabular}{|*{7}{l|}}
    \hline
    & \mcl{$3\times3$}  & \mcl{$6\times6$}  & \mcl{$12\times12$}    \\
    \hline
AA  & Conv. & Proposed  & Conv. & Proposed  & Conv.     & Proposed  \\
    \hline
BB  & 1669.45 & 1669.45 & 396.04& 583.43    & 110.49    & 189.79    \\
    \hline
CC  & 4       & 4       & 43    & 23        & 290       & 219       \\
    \hline
\end{tabular}
    \end{table}
\end{document}

在此处输入图片描述

答案3

我建议采用一种更易读的设计,将数字垂直组合成一列,前两列包含文本。这种设计自然是从上到下阅读的。此外,请注意两个调整;\setlength{\tabcolsep}{1em}\\[.4em],以增强可读性。

\documentclass{article}
\usepackage{siunitx,  % for 'S' column type
            booktabs, % for well-spaced horiz. lines
            caption}  % fine-tune appearance of captions
\begin{document}

\begin{table}[h!]
\setlength{\tabcolsep}{1em}
\captionsetup{skip=0.5\baselineskip}
\caption{Comparison between conventional and proposed design multipliers.} \label{tab1}
\centering
\begin{tabular}{@{}ll S[table-format=4.2] S[table-format=3]@{}}
    \toprule
                         & AA       & {BB}    & {CC} \\ \midrule
    $3\times3$           & convent. & 1669.45 & 4    \\
                         & prop.    & 1669.45 & 4    \\ [.4em]
    $6\times6$           & convent. & 396.04  & 43   \\
                         & prop.    & 583.43  & 23   \\ [.4em]
    $12\times12$         & convent. & 110.49  & 290  \\
                         & prop.    & 189.79  & 219  \\ \bottomrule
\end{tabular}
\end{table}

\end{document}

在此处输入图片描述

答案4

参加聚会有点晚了。我发现在 excel 中制作表格并使用 excel2latex 插件导出生成的代码要简单得多。当然,没有出现“S”类型的列,这是一个很好的设计,但数字对齐不是问题所在。

\documentclass{article}
\usepackage{booktabs, % for well-spaced horiz. lines
            caption}  % fine-tune appearance of captions
\begin{document}

% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
    \centering
    \captionsetup{skip=0.5\baselineskip}
    \caption{Comparison between conventional and proposed design multipliers from excel2latex.}
    \begin{tabular}{crcccccccc}
        \toprule
        &       & \multicolumn{2}{c}{3×3} &       & \multicolumn{2}{c}{ 6×6 } &       & \multicolumn{2}{c}{ 12×12} \\
        \cmidrule{3-4}\cmidrule{6-7}\cmidrule{9-10} 
        AA    &       & convent. &  prop. &       & convent. &  prop. &       & convent. &  prop. \\
        BB    &       & 1669.45 & 1669.45 &       & 396.04 & 583.43 &       & 110.49 & 189.79 \\
        CC    &       & 4     & 4     &       & 43    & 23    &       & 290   & 219 \\
        \bottomrule
    \end{tabular}%
    \label{tab:addlabel}%
\end{table}%

\end{document}

在此处输入图片描述

相关内容