Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I found that useful command \addlinespace[3pt] to create an extra white border around the rows. See example:

\documentclass[a4paper]{report}

\usepackage{multirow,booktabs}
\usepackage[table]{xcolor}
\begin{document}

\begin{table}
\rowcolors{1}{gray!15}{gray!15}
\begin{tabular}{rrrrr}
\rowcolor{gray!50}
Header & 1     & 2     & 3     & 4 \\ \addlinespace[3pt]
Row1  & a     & b     & c     & d \\
\multicolumn{1}{c}{} & a1    & b1    & c1    & d1 \\ \addlinespace[3pt]
\multicolumn{1}{c}{\multirow{-2}[0]{*}{Multirow1}} & a2    & b2    & c2    & d2 \\
Row2  & aa    & ab    & ac    & ad \\ 
\end{tabular}
\end{table}

\end{document}

I also found commands like:

\setlength\extrarowheight{7pt}
\renewcommand\arraystretch{1.2}

here: vertical align and color in table with multirow

But these two commands seem to just expand the whole row rather than that white border thing. However, you call it ;)

As I have a lot of tables with loads of rows, my question is how to make the command \addlinespace[3pt] globally so that I do not have to add it at the end of each single row for all tables.

share|improve this question
    
\renewcommand\arraystretch{1.2} increases the whitespace above and below the row. \setlength\extrarowheight{7pt} only above! –  Herbert Jan 8 '13 at 13:18
add comment

1 Answer 1

I'm not so sure you want this additional space between all rows, particularly those where a \multirow is involved.

However, stating \global\everycr{\addlinespace[3pt]} in the first cell will do; remember to restore \everycr to its empty usual value at the end.

\documentclass[a4paper]{report}

\usepackage{multirow,booktabs}
\usepackage[table]{xcolor}
\begin{document}
\begin{table}
\rowcolors{1}{gray!15}{gray!15}
\begin{tabular}{rrrrr}
\rowcolor{gray!50}
\global\everycr{\addlinespace[3pt]}%
Header & 1     & 2     & 3     & 4 \\
Row1  & a     & b     & c     & d \\
\multicolumn{1}{c}{} & a1    & b1    & c1    & d1 \\\addlinespace[-3pt]
\multicolumn{1}{c}{\multirow{-2}[0]{*}{Multirow1}} & a2    & b2    & c2    & d2 \\
Row2  & aa    & ab    & ac    & ad \\
\end{tabular}
\global\everycr{}
\end{table}

\end{document}

Notice that I put a countermanding \addlinespace between the two rows sharing their label.

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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