# Split row distance between two colored table rows

I would like to add some space between the lines the improve the readability of my booktabs table. I already colored every second line therefore but I cannot achieve equal rows and the centered text of the columns. I added a 3pt distance after the new line but that doesn't seem to be the proper solution.

Here is my code:

\documentclass[a4paper, 12pt]{article}
\usepackage{color}
\usepackage{longtable}
\usepackage{colortbl}
\usepackage{booktabs}
\definecolor{hellgrau}{gray}{0.9}

\begin{document}
\begin{longtable}[c]{>{\kern-\tabcolsep}lll<{\kern-\tabcolsep}}\toprule
\ra{1.3}
A & B & C \\
\midrule
A & B & C \\[3pt]
\rowcolor{hellgrau}
A & B & C \\[3pt]
A & B & C \\[3pt]
\rowcolor{hellgrau}
A & B & C \\[3pt]
A & B & C \\[3pt]
\bottomrule
\end{longtable}
\end{document}


• The instruction \ra{1.3} should be issued before \begin{longtable}. – Mico Sep 12 '15 at 23:29
• thanks for the hint, that solved another pronlem I had (y) – flp Sep 12 '15 at 23:32

You should issue the instruction \ra{1.3} before \begin{longtable}. Use \begingroup and \endgroup, if needed, to localize the scope of \ra{1.3}.

\documentclass[a4paper, 12pt]{article}
\usepackage[table]{xcolor}
\usepackage{longtable}
\usepackage{booktabs}
\definecolor{hellgrau}{gray}{0.9}

\begin{document}
\begingroup % localize effect of the following instruction
\ra{1.3}
\begin{longtable}{>{\kern-\tabcolsep}lll<{\kern-\tabcolsep}}
\toprule
A & B & C \\
\midrule
\bottomrule
\endfoot

A & B & C \\
\rowcolor{hellgrau}
A & B & C \\
A & B & C \\
\rowcolor{hellgrau}
A & B & C \\
A & B & C \\
\end{longtable}
\endgroup
\end{document}


I suggest you use the cellspace package instead; it defines a minimal vertical padding at the top and the bottom of cells in columns with qualifiers prefixed by the letter S. This results in a slightly simpler code (needless to load color since colortbl does it):

\documentclass[a4paper, 12pt]{article}

\usepackage{longtable}
\usepackage{colortbl}
\usepackage{booktabs}
\definecolor{hellgrau}{gray}{0.9}

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

\begin{document}

\begin{longtable}[c]{>{\kern-\tabcolsep}*{3}{Sl}<{\kern-\tabcolsep}}\toprule
A & B & C \\
A & B & C \\
\rowcolor{hellgrau}
A & B & C \\
A & B & C \\
\rowcolor{hellgrau}
A & B & C \\
A & B & C \\
\bottomrule
\end{longtable}

\end{document}


• I believe your solution would also work, but @Mico found the underlying problem so that I accepted his answer – flp Sep 13 '15 at 0:23
• That's perfectly OK with me. – Bernard Sep 13 '15 at 0:26
• @Mico: Once again, I messed up with my clipboard manager! I replaced the code. Thanks for pointing it! – Bernard Sep 13 '15 at 11:19