使用多列时缺少粗垂直线

使用多列时缺少粗垂直线

由于某种原因,第一行缺少几条粗垂直线(但仍然有一条细线):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{bigstrut}
\usepackage{adjustbox}
\usepackage{makecell}
\usepackage{amssymb}
\usepackage{array}
\newcolumntype{?}{!{\vrule width 2pt}}
\newcolumntype{M}[1]{>{\raggedleft\arraybackslash}m{#1}}

\begin{document}
\renewcommand{\arraystretch}{0.66}
\begin{table}[htbp]
  \centering
  \caption{Review of methods and ...}
  \begin{adjustbox}{center}
  \setlength\tabcolsep{2pt}
    \begin{tabular}{|c?c|c?c|c|c|c|c?c|c|c|}
    \hline
       & \multicolumn{2}{c|}{\linespread{1}\selectfont{}\centering Bugs' info} & \multicolumn{5}{c|}{Expertise info}         & \multicolumn{3}{c|}{Based on} \\
    \hline
    Method & \parbox{1.7cm}{\linespread{1}\selectfont{}\centering Title + description} & \parbox{0.8cm}{\linespread{1}\selectfont{}\centering Meta} & \parbox{1.9cm}{\linespread{0}\selectfont{}\centering Bug fixing; title / description} & \parbox{1.6cm}{\linespread{1}\selectfont{}\centering Being a committer} & \parbox{1.1cm}{\linespread{1}\selectfont{}\centering Tossing history} & \parbox{0.8cm}{\linespread{1}\selectfont{}\centering Meta} & \parbox{1.3cm}{\linespread{1}\selectfont{}\centering Changed code} & \parbox{1.6cm}{\linespread{1}\selectfont{}\centering Final committer} & \parbox{1.3cm}{\linespread{1}\selectfont{}\centering Closer / resolver} & \parbox{1.3cm}{\linespread{1}\selectfont{}\centering Drafted assignee} \\
    \hline
    AA & \checkmark & & \checkmark & & & & & \checkmark & \checkmark & \\\hline
    BB & \checkmark & & \checkmark & & & & & \checkmark & \checkmark & \\\hline
    CC & \checkmark & \checkmark & \checkmark & & \checkmark & \checkmark &  & \checkmark & \checkmark & \\\hline
    \end{tabular}%
    \end{adjustbox}
  \label{tab:previousMethods}%
\end{table}%
\end{document}

在此处输入图片描述

答案1

我建议使用另一种布局,行和列互换,水平和垂直规则较少。caption加载包以确保上面的表格和标题之间有适当的垂直间距:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{bigstrut}
\usepackage{makecell, booktabs, caption}
\usepackage{amssymb}
\usepackage{array}
\usepackage[table, svgnames]{xcolor}
\newcolumntype{M}[1]{>{\raggedleft\arraybackslash}m{#1}}
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.3pt}

\begin{document}

\begin{table}[htbp]
  \centering
  \renewcommand{\arraystretch}{0.66}
  \caption{Review of methods and ...}
  \setcellgapes{3pt}\makegapedcells
  \arrayrulecolor{Gainsboro}
  \begin{tabular}{!{\color{Gainsboro}\vrule width2pt}llccc!{\color{Gainsboro}\vrule width2pt}}
    \specialrule{2pt}{0pt}{0pt}
    \multicolumn{2}{!{\color{Gainsboro}\vrule width2pt}c}{Method} & AA & BB & CC \\
    \specialrule{0.6pt}{0pt}{0pt}
    \multicolumn{5}{!{\color{Gainsboro}\vrule width2pt}l !{\color{Gainsboro}\vrule width2pt}}{\bigstrut\em Bugs info} \\
      & Title +description & \checkmark & \checkmark & \checkmark \\
      & Meta & & & \checkmark \\
    \specialrule{0.6pt}{0pt}{0pt}
    \multicolumn{5}{!{\color{Gainsboro}\vrule width2pt}l !{\color{Gainsboro}\vrule width2pt}}{\em Expertise info}\\
    & \makecell[l]{Bug fixing;\\ title/description} & \checkmark & \checkmark & \checkmark \\
      & Being a committer & & & \\
      & Tossing history & & & \checkmark \\
      & Meta & & & \checkmark \\
      & Changed code & & & \\
    \specialrule{0.6pt}{0pt}{0pt}
    \multicolumn{5}{!{\color{Gainsboro}\vrule width2pt}l !{\color{Gainsboro}\vrule width2pt}}{\bigstrut\em Based on} \\
      & Final committer & \checkmark & \checkmark & \checkmark \\
      & Closer/resolver & \checkmark & \checkmark & \checkmark \\
      & Drafted assignee & & & \\
    \specialrule{2pt}{0pt}{0pt}
  \end{tabular}%
  \label{tab:previousMethods1}%
\end{table}

\end{document} 

在此处输入图片描述

答案2

要在单元格内容周围留出更多空间,请使用包中的cellspace列标题:makecellmakecell

在 MWE 的序言中添加:

\usepackage{cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}

并将列定义和列标题更改为:

   \begin{tabular}{|Sc?c|c?c|Sc|c|c|c?c|c|c|}
    \hline
       & \multicolumn{2}{Sc?}{Bugs' info}
       & \multicolumn{5}{c?}{Expertise info}
       & \multicolumn{3}{c|}{Based on} \\
    \hline
    Method & \makecell{Title +\\ description} & Meta
           & \makecell{Bug fixing;\\ title /\\ description}
           & \makecell{Being a\\ committer}
           & \makecell{Tossing\\ history}
           & Meta
           & \makecell{Changed\\ code}
           & \makecell{Final\\ committer}
           & \makecell{Closer /\\ resolver}
           & \makecell{Drafted\\ assignee} \\

结果:

在此处输入图片描述

答案3

感谢@David_Carlisle 的建设性意见:

\multicolumn{2}{c|}改成\multicolumn{2}{c?}\multicolumn{5}{c|}\multicolumn{5}{c?}

这是答案(请注意,为了更清楚我还添加了一条垂直粗线):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{bigstrut}
\usepackage{adjustbox}
\usepackage{makecell}
\usepackage{amssymb}
\usepackage{array}
\newcolumntype{?}{!{\vrule width 2pt}}
\newcolumntype{M}[1]{>{\raggedleft\arraybackslash}m{#1}}

\begin{document}
\renewcommand{\arraystretch}{0.66}
\begin{table}[htbp]
  \centering
  \caption{Review of methods and ...}
  \begin{adjustbox}{center}
  \setlength\tabcolsep{2pt}
    \begin{tabular}{|c?c|c?c|c|c|c|c?c|c|c|}
    \hline
       & \multicolumn{2}{c?}{\centering Bugs' info} & \multicolumn{5}{c?}{Expertise info}         & \multicolumn{3}{c|}{Based on} \\
    \hline
    Method & \parbox{1.7cm}{\linespread{1}\selectfont{}\centering Title + description} & \parbox{0.8cm}{\linespread{1}\selectfont{}\centering Meta} & \parbox{1.9cm}{\linespread{0}\selectfont{}\centering Bug fixing; title / description} & \parbox{1.6cm}{\linespread{1}\selectfont{}\centering Being a committer} & \parbox{1.1cm}{\linespread{1}\selectfont{}\centering Tossing history} & \parbox{0.8cm}{\linespread{1}\selectfont{}\centering Meta} & \parbox{1.3cm}{\linespread{1}\selectfont{}\centering Changed code} & \parbox{1.6cm}{\linespread{1}\selectfont{}\centering Final committer} & \parbox{1.3cm}{\linespread{1}\selectfont{}\centering Closer / resolver} & \parbox{1.3cm}{\linespread{1}\selectfont{}\centering Drafted assignee} \\
%     \hline
    \Xhline{6\arrayrulewidth}
    AA & \checkmark & & \checkmark & & & & & \checkmark & \checkmark & \\\hline
    BB & \checkmark & & \checkmark & & & & & \checkmark & \checkmark & \\\hline
    CC & \checkmark & \checkmark & \checkmark & & \checkmark & \checkmark &  & \checkmark & \checkmark & \\\hline
    \end{tabular}%
    \end{adjustbox}
  \label{tab:previousMethods}%
\end{table}%
\end{document}

在此处输入图片描述

相关内容