[Tex/LaTex] Table row & column spacing (not padding!)

spacingtables

I need space between rows and remove white lines between the columns. All the answers I found only referenced array stretch and \tabcolsep, which I use and like, however, these only change the cell-padding, not the spacing.

My Table

There are little white lines everywhere. I need to get rid of the ones between the columns and make them wider between the rows.

(Also since im already here. How can i vertically center the stuff in my cells? Seems row 1 is a little weird, while the others are vcentered?

\begin{table}[h]
\centering
\caption{My caption}
\vspace{10pt}
\label{my-label}

\def\arraystretch{2}
\setlength\tabcolsep{20pt}

\begin{tabular}{ L{5cm} c c }

 & \color{THIblue} {\bf something} 
 & \color{THIblue} {\bf anotherThing} \\

\rowcolor{THIlight}
Feature 1
 & \checkmark
 & \checkmark \\

\rowcolor{THIlight}
Feature 2
 & \checkmark
 & \checkmark \\

\rowcolor{THIlight}
Feature 3
 & \checkmark
 & \checkmark \\

\rowcolor{THIlight}
Feature 4
 &
 & \checkmark \\

\rowcolor{THIlight}
Feature 5
 & 
 & \checkmark \\

\rowcolor{THIlight}
Feature 6
 & 
 & \checkmark \\

\end{tabular}

\end{table}

EDIT: I defined my L Table column like this:

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

Because I wanted a left-aligned cell that is a certain size. What do I need to add to make that vertically centered?

Best Answer

enter image description here

Here is what I did:

  • To center the text vertically within the cell, I used the cellspace package as Bernard did because it is the simplest. You could use any other method like \newcolumntype or \raisebox (See this question for example), but this is easy and accurate
  • To make the horizontal lines thicker, I used \setlength\arrayrulewidth{1.5pt}, besides using \arrayrulecolor{white} to make it white instead of the default black
  • I picked the colors from the css code of the page and used it to color rows and text after defining the colors in HTML by \definecolor{THIblue}{HTML}{C3CFF4} or in RGB by \definecolor{THIblue}{RGB}{195,207,244}

Finally, here is the full code

\documentclass[12pt,a4paper]{article}
\usepackage{amssymb,array,cellspace}
\usepackage[table]{xcolor}
\setlength\cellspacetoplimit{10pt}
\setlength\cellspacebottomlimit{10pt}
\definecolor{THIblue}{HTML}{C3CFF4} %{RGB}{195,207,244}
\definecolor{blueHD}{HTML}{000B6C}  %{RGB}{0,11,108}

\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\arrayrulecolor{white}
\setlength\arrayrulewidth{1.5pt}

\begin{document}
\begin{table}[h] \sffamily
\centering
\caption{My caption}
\vspace{10pt}
\label{my-label}
\setlength\tabcolsep{20pt}
\rowcolors{2}{THIblue}{THIblue}
\begin{tabular}{L{5cm} Sc Sc}
   &\color{blueHD}\textbf{Something}&\color{blueHD}\textbf{Another thing}\\ 
   \textbf{Feature 1} & \checkmark & \checkmark \\ \hline
   \textbf{Feature 2} & \checkmark & \checkmark \\ \hline
   \textbf{Feature 3} & \checkmark & \checkmark \\ \hline 
   \textbf{Feature 4} &            & \checkmark \\ \hline
   \textbf{Feature 5} &            & \checkmark \\ \hline
   \textbf{Feature 6} &            & \checkmark \\ \hline
\end{tabular}
\end{table}
\end{document}

Edit:

Using a \newcolumntype would be more beneficial if the cell content is longer than one line. To achieve this, we define \newcolumntype{B}{>{\begin{minipage}{5cm}\raggedright\vspace{10pt}}c<{\vspace{10pt}\end{minipage}}} instead of cellspace. The values 5cm and 10pt should be adjusted as needed. Take care though not to leave a cell in the first column empty. Use \phantom{Word} to get the right calculation of cell height.

enter image description here

\documentclass[12pt,a4paper]{article}
\usepackage{amssymb,array}
\usepackage[table]{xcolor}
\definecolor{THIblue}{HTML}{C3CFF4} %{RGB}{195,207,244}
\definecolor{blueHD}{HTML}{000B6C}  %{RGB}{0,11,108}

\newcolumntype{B}{>{\begin{minipage}{5cm}\raggedright\vspace{10pt}}c<{\vspace{10pt}\end{minipage}}}
\arrayrulecolor{white}
\setlength\arrayrulewidth{1.5pt}

\begin{document}
\begin{table}[h]\sffamily
\centering
\caption{My caption}
\vspace{10pt}
\label{my-label}
\setlength\tabcolsep{20pt}
\rowcolors{2}{THIblue}{THIblue}
\begin{tabular}{Bcc}\hline
   \phantom{F}&\color{blueHD}\textbf{Something}&\color{blueHD}\textbf{Another thing}\\ \hline
   \textbf{Feature 1 Feature 1 Feature 1 Feature 1 Feature 1 Feature 1 Feature 1 Feature 1} 
    & \checkmark & \checkmark \\ \hline
   \textbf{Feature 2} & \checkmark & \checkmark \\ \hline
   \textbf{Feature 3} & \checkmark & \checkmark \\ \hline 
   \textbf{Feature 4} &            & \checkmark \\ \hline
   \textbf{Feature 5} &            & \checkmark \\ \hline
   \textbf{Feature 6} &            & \checkmark \\ \hline
\end{tabular}
\end{table}
\end{document}
Related Question