表格边框错误

表格边框错误

为什么我没有得到该表的正确边框?

在此处输入图片描述

这是我的代码:

    \begin{table}[htbp]
    %\extrarowsep=_3pt^3pt
    \begin{tabu}to\linewidth{|[2pt gray]l|c|c|c|[1.5pt gray]}
    \tabucline[1.5pt gray]-

            \bfseries something & \multicolumn{3}{c|}{something} \\

            \tabucline[1.5pt gray]-
            \textbf{something} & \textbf{something} & \textbf{something} & \textbf{something} \\
            \hline

            \tabucline[1.5pt gray]-
            something & something & something & something \\
            \hline

            \tabucline[1.5pt gray]-
            something & something & something & something \\
            \hline

            \tabucline[1.5pt gray]-
            something & something & something & something \\
            \hline

            \tabucline[1.5pt gray]-
            something & something & something & something \\
            \hline

            \tabucline[1.5pt gray]-
            \end{tabu}%
    \caption{something}
    \label{tab:something}%
    \end{table}%

答案1

你需要 \multicolumn{3}{c|[1.5pt gray]}{something}

|即您必须在命令中重复最后一条语句的宽度,否则将使用\multicolumn标准宽度!|

\multicolumntabu是一个“特殊”命令,它否决了(或)中所做的列规范——如果没有明确强制这样做,tabular它就不会使用该规范。|[1.5pt gray]

另外:线条实在是太多了!

完整示例:

\documentclass{article}

\usepackage[table]{xcolor}

\usepackage{tabu}

\begin{document}

\begin{table}[htbp]
  \centering
    %\extrarowsep=_3pt^3pt
    \begin{tabu}to\linewidth{|[2pt gray]l|c|c|c|[1.5pt gray]}
    \tabucline[1.5pt gray]-

    \bfseries something & \multicolumn{3}{c|[1.5pt gray]}{something} \\

    \tabucline[1.5pt gray]-
    \textbf{something} & \textbf{something} & \textbf{something} & \textbf{something} \\
    \hline

    \tabucline[1.5pt gray]-
    something & something & something & something \\
    \hline

    \tabucline[1.5pt gray]-
    something & something & something & something \\
    \hline

    \tabucline[1.5pt gray]-
    something & something & something & something \\
    \hline

    \tabucline[1.5pt gray]-
    something & something & something & something \\
    \hline

    \tabucline[1.5pt gray]-
  \end{tabu}%
  \caption{something}
  \label{tab:something}%
\end{table}%

\end{document}

在此处输入图片描述

相关内容