# Adding color and increasing between rows of table

How can I add RGB color (78, 126, 222) to every other row in right half of the table generated below? And how do I increase spacing between these rows? I tried to use \rowcolor but got an error.

\documentclass[11pt]{article}

\usepackage{multirow}
\usepackage{geometry}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{ragged2e}
\begin{document}

\begin{table}[ht]
\centering
\begin{tabularx}{\textwidth}{cc>{\RaggedRight\arraybackslash}X>{\RaggedRight\arraybackslash}X}
\toprule
\multirow{6}{*}{Outer index 1} & Inner index 1.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\\
& Inner index 1.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\\
\midrule
\multirow{6}{*}{Outer index 2} & Inner index 2.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\\
& Inner index 2.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\\
\midrule
\multirow{16}{*}{Outer index 3} &  Inner index 3.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\\
&Inner index 3.2 & \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax\RaggedRight\arraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped.  Text data placeholder. May be long enough that it needs to be wrapped.}\\
&Inner index 3.3 & \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax\RaggedRight\arraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped.  Text data placeholder. May be long enough that it needs to be wrapped.}\\
&Inner index 3.4 & \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax\RaggedRight\arraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped.  Text data placeholder. May be long enough that it needs to be wrapped.}\\
&Inner index 3.5 & \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax\RaggedRight\arraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped.  Text data placeholder. May be long enough that it needs to be wrapped.}\\
&Inner index 3.6 & \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax\RaggedRight\arraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped.  Text data placeholder. May be long enough that it needs to be wrapped.}\\
\bottomrule
\end{tabularx}
\end{table}

\end{document}


## 1 Answer

Is it something like this you want?

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

\definecolor{myblue}{RGB}{78, 126, 222}
\usepackage{multirow}
\usepackage{geometry}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{ragged2e}

\begin{document}

\begin{table}[ht]
\centering\setlength{\extrarowheight}{3pt}
\rowcolors{1}{myblue}{}
\begin{tabularx}{\textwidth}{>{\cellcolor{white}} c >{\cellcolor{white}}c>{\RaggedRight\arraybackslash}X>{\RaggedRight\arraybackslash}X}
\toprule
& Inner index 1.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\\
\multirow{-2}{*}{Outer index 1} & Inner index 1.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\\
\midrule
& Inner index 2.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\\
\multirow{-2}{*}{Outer index 2} & Inner index 2.2 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\\
\midrule& Inner index 3.1 & Text data placeholder. May be long enough that it needs to be wrapped. & Text data placeholder. May be long enough that it needs to be wrapped.\\
&Inner index 3.2 & \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax\RaggedRight\arraybackslash}X}{Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\\
&Inner index 3.3 & \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax\RaggedRight\arraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\\
\multirow{-2}{*}{Outer index 3}&Inner index 3.4 & \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax\RaggedRight\arraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\\
&Inner index 3.5 & \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax\RaggedRight\arraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\\
&Inner index 3.6 & \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax\RaggedRight\arraybackslash}X}{ Text data placeholder. May be long enough that it needs to be wrapped. Text data placeholder. May be long enough that it needs to be wrapped.}\\
\bottomrule
\end{tabularx}
\end{table}

\end{document}


• oWith \cmidrule{2-4} , but I wouldn't recommend it, due to the tartially coloured rows. I think it would be better to add some vertical spacing with \addlinespace. This command can take a length as an optional argument, and it won't be coloured. – Bernard Mar 20 '19 at 22:05
• Thanks, I had figured it out, that's why I deleted the comment. I'm struggling to make this look good, experimenting with a bunch of stuff. – whoami Mar 20 '19 at 22:08