2

I would like to color these empty columns, but I couldn't find a way to do it. I tried already defining my own column type, however, inserting it destroys the normal look of empty columns.

Here my minimal working example:

\documentclass{article}
\usepackage[table]{xcolor}

\begin{document}
\begin{center}
    \begin{tabular}{||l c||} 
        \hline
        \rowcolor{black!10}
        Column 1 & Column 2 \\ [0.7ex] 
        \hline\hline
        \rowcolor{green!20}
        Entry 1 & Entry 2 \\ 
        \hline
        \rowcolor{green!25}
        Entry 3 & Entry 4 \\
        \hline
    \end{tabular}
\end{center}
\end{document}

Result

I would like to color the outer columns black.
Thank you!

Solution: For black coloring, thick border lines are enough. For other colors, see my colortbl solution.

  • Take a look at the hhline package, if I remember correctly, it does support coloured double lines. – Skillmon Mar 7 '18 at 22:52
  • Which outer columns? Maybe you mean the space between the rules of double rules? – Bernard Mar 7 '18 at 22:52
  • @Bernard exactly, I mean the space between the outer double rules. – mightymicha Mar 7 '18 at 22:54
  • @Skillmon Thank you, I will look into that. – mightymicha Mar 7 '18 at 22:54
  • 1
    If it's to be black, this simply means a very thick vertical rule. – Bernard Mar 7 '18 at 22:57
2

enter image description here

\documentclass{article}
\usepackage[table]{xcolor}

\begin{document}
\begin{center}
    \begin{tabular}{!{\vrule width 5pt}l c!{\vrule width 5pt}} 
        \hline
        \rowcolor{black!10}
        Column 1 & Column 2 \\ [0.7ex] 
        \hline\hline
        \rowcolor{green!20}
        Entry 1 & Entry 2 \\ 
        \hline
        \rowcolor{green!25}
        Entry 3 & Entry 4 \\
        \hline
    \end{tabular}
\end{center}
\end{document}
2

Here is a solution, if I've well understood what you want:

\documentclass{article}
\usepackage[table]{xcolor}

\begin{document}

\begin{center}
\setlength{\extrarowheight}{2pt}
    \begin{tabular}{!{\vrule width \dimexpr\doublerulesep+2\arrayrulewidth\relax}l c!{\vrule width \dimexpr\doublerulesep+2arrayrulewidth\relax}}
        \hline
        \rowcolor{black!10}
        Column 1 & Column 2 \\ [0.7ex]
        \hline\hline
        \rowcolor{green!20}
        Entry 1 & Entry 2 \\
        \hline
        \rowcolor{green!25}
        Entry 3 & Entry 4 \\
        \hline
    \end{tabular}
\end{center}

\end{document} 

enter image description here

A variant:

\begin{center}
\setlength{\extrarowheight}{2pt}\begin{tabular}{{@{\vrule width \dimexpr\doublerulesep+2\arrayrulewidth\relax}c@{\vrule width \dimexpr\doublerulesep+2\arrayrulewidth\relax}}}
    \begin{tabular}{!{}l c!{}}
        \hline
        \rowcolor{black!10}
        Column 1 & Column 2 \\ [0.7ex]
        \hline\hline
        \rowcolor{green!20}
        Entry 1 & Entry 2 \\
        \hline
        \rowcolor{green!25}
        Entry 3 & Entry 4 \\
        \hline
    \end{tabular}
\end{tabular}
\end{center}

enter image description here

0

Ok after @Skillmon's tip I looked into that package and found a reference to the colortbl package, which solved it:

        \doublerulesepcolor{black}
        \begin{tabular}{||l c||}
        \doublerulesepcolor{white}
            \hline
            \rowcolor{black!10}
            Column 1 & Column 2 \\ [0.7ex] 
            \hline\hline
            \rowcolor{green!20}
            Entry 1 & Entry 2 \\ 
            \hline
            \rowcolor{green!25}
            Entry 3 & Entry 4 \\
            \hline
        \end{tabular}

Result

You can have quite some fun with this:

    \setlength\arrayrulewidth{2pt}\arrayrulecolor{blue}
    \setlength\doublerulesep{2pt}\doublerulesepcolor{yellow}
    \begin{tabular}{||l c||}
        \hline
        \rowcolor{black!10}
        Column 1 & Column 2 \\ [0.7ex] 
        \hline\hline
        \rowcolor{green!20}
        Entry 1 & Entry 2 \\ 
        \hline
        \rowcolor{green!25}
        Entry 3 & Entry 4 \\
        \hline
    \end{tabular}

Result

For further reference: link

  • 1
    note you had already loaded colortbl (that's the main effect of the [table] option to xcolor) – David Carlisle Mar 7 '18 at 23:37

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.