1

I was just trying to insert a vertical line between columns in a table and I couldn't figure out why it never showed up in my output. So I started from scratch with a minimal setup and added my packages one at a time to see which conflicted. It turns out that colortbl was the culprit. I've always had some issues with xcolor, but I thought colortbl was safer.

Here's a sample of the code (as minimal as I could get it)

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage{dcolumn}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{arydshln}
\usepackage[ragged]{footmisc}
\usepackage{ulem}
\usepackage{booktabs,mathptmx,siunitx,tabto,listliketab}
\usepackage{multirow}
\usepackage{lscape,longtable}
\usepackage[labelfont={bf,it},justification=centering]{caption}
\usepackage{array,color,xcolor,colortbl}
\usepackage{enumerate}
\usepackage{enumitem}
\usepackage{eurosym}
\usepackage{tikz}
\usepackage{lipsum}
\definecolor{yellow}{RGB}{255 255 0}
\newlength{\maxcolorbox}
\settowidth{\maxcolorbox}{28.8}
\newcommand{\cbox}[2]{\colorbox{#1}{\parbox{\maxcolorbox}{\centering #2}}}
 \begin{document}
\begin{table}[!htbp]
\scriptsize
    \begin{center}
      \begin{tabular}{ccccccc|cccccc}
         \toprule
                &\multicolumn{6}{c|}{DRP Executive}&\multicolumn{6}{c}{Optimized Smoothing Models}\\
 Part \#&Jan-17&Feb-17&Mar-17&Apr-17&May-17&Jun-17&Jan-17&Feb-17&Mar-17&Apr-17&May-17&Jun-17\\
         \midrule
200018373   &   \cbox{yellow}{\color{black}SS}  &   \cbox{yellow}{\color{black}SS}  &   SS  &   &   &   \cbox{yellow}{\color{black}SS}  &   DS  &   DS  &   SS  &   CR  &   SS  &   DS  \\
200019547   &   \cbox{yellow}{\color{black}MA}  &   \cbox{yellow}{\color{black}MA}  &   \cbox{yellow}{\color{black}CR}  &   &   &   \cbox{yellow}{\color{black}CR}  &   DS  &   DS  &   DS  &   SS  &   MA  &   DS  \\
200020385   &   \cbox{yellow}{\color{black}MA}  &   \cbox{yellow}{\color{black}MA}  &   \cbox{yellow}{\color{black}DS}  &   &   &   \cbox{yellow}{\color{black}MA}  &   DS  &   DS  &   CR  &   DS  &   CR  &   SS  \\
200023707   &   \cbox{yellow}{\color{black}MA}  &   \cbox{yellow}{\color{black}MA}  &   \cbox{yellow}{\color{black}MA}  &   &   &   \cbox{yellow}{\color{black}MA}  &   DS  &   SS  &   DS  &   DS  &   DS  &   CR  \\
200026052   &   DS  &   DS  &   DS  &   &   &   MA  &   DS  &   DS  &   DS  &   DS  &   CR  &   MA  \\
200028541   &   \cbox{yellow}{\color{black}MA}  &   \cbox{yellow}{\color{black}MA}  &   \cbox{yellow}{\color{black}DS}  &   &   &   \cbox{yellow}{\color{black}DS}  &   DS  &   DS  &   SS  &   MA  &   DS  &   CR  \\
200028623   &   DS  &   DS  &   DS  &   &   &   WA  &   DS  &   DS  &   DS  &   CR  &   CR  &   CR  \\
200030213   &   \cbox{yellow}{\color{black}SS}  &   \cbox{yellow}{\color{black}SS}  &   \cbox{yellow}{\color{black}SS}  &   &   &   WA  &   DS  &   CR  &   CR  &   CR  &   CR  &   DS  \\
\bottomrule
\end{tabular}
\end{center}
\end{table}
\end{document}
  • 2
    Please show us the packages you are loading that are conflicting. xcolor is really stable. It shouldn't cause conflicts. Also, \usepackage[table]{xcolor} loads colortbl. – Phelype Oleinik Oct 4 '18 at 15:10
  • it might be pdf viewers artifact (to not show lines). to confirm this, we need to see small but complete document with your table. – Zarko Oct 4 '18 at 15:20
  • 1
    vertical rules and colour don't go well together (some pdf viewers are better than others) xcolor and colortbl are the same thing here as xcolor just load colortbl for its table support – David Carlisle Oct 4 '18 at 15:27
  • I've adderd a sample of my code above. It only works if I remove colortbl – Angus Oct 4 '18 at 16:01
  • 1
    BTW: you have many redundant packages, for example there is no need to load enumerate when you are overwriting it right away with enumitem – daleif Oct 4 '18 at 16:04

Your Answer

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

Browse other questions tagged or ask your own question.