1
  • Maybe this is a stupid question.
  • The simple table uses \multicolumn.
  • But there is an unwanted vertical line (green) although {c} is used (without |).
  • How to get rid of the vertical line (green)?

\documentclass{article}

\usepackage[table]{xcolor}

\begin{document}

\setlength\arrayrulewidth{2pt}

\begin{table}
\centering
\caption{Yada Yada Yada}
\begin{tabular}{|lrrr|r|c|lrrr|r|}
1&2&3&4&5&6&7&8&9&10&11 \\
1&2&3&4&5&6&7&8&9&10&11 \\
\multicolumn{5}{c}{5 Columns \cellcolor{red}}   & 1 Column  &  \multicolumn{5}{c}{5 Columns \cellcolor{red}}   \\ \cline{1-5} \cline{7-11}
1&2&3&4&5&6&7&8&9&10&11 \\
1&2&3&4&5&6&7&8&9&10&11 \\
\end{tabular}
\end{table} 

\end{document}

enter image description here

2
  • 1
    What about \newcolumntype{?}{!{\color{red}\vrule width \arrayrulewidth}} in combination with \multicolumn{5}{c}{5 Columns \cellcolor{red}} & \multicolumn{1}{c?}{1 Column} & \multicolumn{5}{c}{5 Columns \cellcolor{red}}? – leandriis Feb 11 at 19:07
  • @leandriisThanks! – Dr. Manuel Kuehner Feb 11 at 20:09
1

The rule is set as part of the middle 1 Column. You can remove it with \multicolumn{1}{c} and reinsert the appropriate column gap:

enter image description here

\documentclass{article}

\usepackage[table]{xcolor}

\begin{document}

\setlength\arrayrulewidth{2pt}

\begin{tabular}{ | l r r r | r | c | l r r r | r | }
  1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\
  1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\
  \multicolumn{5}{c}{\cellcolor{red}5 Columns} & 
    \multicolumn{1}{c}{1 Column} & 
    \multicolumn{5}{@{\hspace{\dimexpr\arraycolsep-.5\arrayrulewidth}}c}{\cellcolor{red}5 Columns} \\
  \cline{1-5} \cline{7-11}
  1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\
  1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11
\end{tabular}

\end{document}
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.