# Conflict between (cmidrule , hhline) and Alternating row colors in tables

For the table in the MWE shown below I need to use the options below:

• Make rows of alternating colors
• Make horizontal lines from second to fifth column
• Give a single color to the merged cells containing the text (Multiples) & (Submultiples)

I cannot get those 2 options to work at the same time.

• For alternating row colors I am using \rowcolors{2}{white}{gray!25}
• For controlling the extension of the horizontal lines I am trying to use one of the 2 commands:

\hhline{~----}

\cmidrule{2-5}

Both commands cause the alternating row colors to disapear. However, the (hhline) command results in an additional issue, which is the appearence of white spaces in the place of the empty of horizontal lines.


\documentclass[a4paper,12pt,twoside]{book}
\usepackage[a4paper,top=2.5cm,bottom=2.5cm,margin=2.5cm,bindingoffset=0.5cm]{geometry}

\usepackage[bidi=basic,layout=lists.tabular]{babel}
\babelfont[english]{rm}{Times New Roman}

\usepackage[table]{xcolor}
\usepackage{tabu,multirow}
\usepackage{array}
\newcolumntype{?}[1]{!{\vrule width #1}}
\usepackage{booktabs}
\setlength{\belowrulesep}{0pt}
\setlength{\belowbottomsep}{0pt}
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}
\setlength{\abovetopsep}{0pt}
\usepackage{makecell}
\usepackage{boldline}
\usepackage{hhline}
\usepackage{rotating}

\begin{document}
\begin{table}[!tb]
\setlength\arrayrulewidth{1pt}
\begin{center}
\caption{Common multiples and submultiples of SI Units}
\label{Tab:SI}
\rowcolors{2}{white}{gray!25}
\begin{tabular}{?{1mm}c|c|c|c|>{\centering\arraybackslash}m{3cm}?{1mm}}
\rowcolor{white}
\toprule[1mm]
\multicolumn{2}{?{1mm}c|}{\textbf{Multiplication factor}} &\textbf{Exponential Form} & \textbf{Multiple Prefix} & \textbf{Multiple Abbreviation / SI SYmbol} \\
\midrule[1.5pt]
& 1 000 000 000 000 000 000 & $10^{18}$ & exa & E \\
\hhline{~----}
& 1 000 000 000 000 000 & $10^{15}$ & peta & P \\
\hhline{~----}
& 1 000 000 000 000 & $10^{12}$ & tera & T \\
\hhline{~----}
& 1 000 000 000 & $10^{9}$ & giga & G \\
\hhline{~----}
& 1 000 000 & $10^{6}$ & mega & M \\
\cmidrule{2-5}
& 1 000 & $10^{3}$ & kilo & k \\
\cmidrule{2-5}
& 1 00 & $10^{2}$ & hecto & h \\
\cmidrule{2-5}
\multirow{-8}{*}{\rotatebox[origin=c]{90}{\textbf{Multiples}}} & 1 0 & $10^{1}$ & deka & da \\
\midrule[1.5pt]
& 0.1 & $10^{-1}$ & deci & d \\
\hline
& 0.01 & $10^{-2}$ & centi & c \\
\hline
& 0.001 & $10^{-3}$ & milli & m \\
\hline
& 0.000 001 & $10^{-6}$ & micro & μ \\
\hline
& 0.000 000 001 & $10^{-9}$ & nano & n \\
\hline
& 0.000 000 000 001 & $10^{-12}$ & pico & p \\
\hline
& 0.000 000 000 000 001 & $10^{-15}$ & femto & f \\
\hline
\multirow{-8}{*}{\rotatebox[origin=c]{90}{\textbf{submultiples}}} & 0.000 000 000 000 000 001 & $10^{-18}$ & atto & a \\
\bottomrule[1mm]
\end{tabular}
\end{center}
\end{table}
\end{document}


For horizontal lines I would rather use Xhline defined in makecell package. They haven't problems with coloring rows as it has hhline rules. Also I would remove all \cline since then table (at least to my opinion) become more nice.

Edit: Unfortunately any kind of \cline cause your problem. So far temporary solution is not to use them, and (then) ask colortbl package author, how to fix this bug/misfeatures.

\documentclass[a4paper,12pt,twoside]{book}
\usepackage[a4paper,top=2.5cm,bottom=2.5cm,margin=2.5cm,bindingoffset=0.5cm]{geometry}

\usepackage[table]{xcolor}
\newcommand\ccw{\cellcolor{white}}
\usepackage{array, booktabs, makecell, multirow}
\newcolumntype{?}[1]{!{\vrule width #1}}
\usepackage{boldline}
%\usepackage{hhline}
\usepackage{rotating}

\begin{document}
\begin{table}[!tb]
\centering
\renewcommand\arraystretch{1.1}
\caption{Common multiples and submultiples of SI Units}
\label{Tab:SI}
\rowcolors{2}{white}{gray!10}
\begin{tabular}{?{1pt}c|c|c|c|>{\centering\arraybackslash}m{3cm}?{1pt}}
\Xhline{1pt}
&   \textbf{Multiple Abbreviation / SI SYmbol} \\
\Xhline{0.5pt}
\ccw
& 1 000 000 000 000 000 000 & $10^{18}$ & exa & E \\
& 1 000 000 000 000 000 & $10^{15}$ & peta & P \\
\ccw
& 1 000 000 000 000 & $10^{12}$ & tera & T \\
& 1 000 000 000 & $10^{9}$ & giga & G \\
\ccw
& 1 000 000 & $10^{6}$ & mega & M \\
& 1 000 & $10^{3}$ & kilo & k \\
\ccw
& 1 00 & $10^{2}$ & hecto & h \\
\multirow{-8}{*}{\rotatebox[origin=c]{90}{\textbf{Multiples}}}
& 1 0 & $10^{1}$ & deka & da \\
\Xhline{0.5pt}
\ccw
& 0.1 & $10^{-1}$ & deci & d \\
& 0.01 & $10^{-2}$ & centi & c \\
\ccw
& 0.001 & $10^{-3}$ & milli & m \\
& 0.000 001 & $10^{-6}$ & micro & μ \\
\ccw
& 0.000 000 001 & $10^{-9}$ & nano & n \\
& 0.000 000 000 001 & $10^{-12}$ & pico & p \\
\ccw
& 0.000 000 000 000 001 & $10^{-15}$ & femto & f \\
\multirow{-8}{*}{\rotatebox[origin=c]{90}{\textbf{Multiples}}}
& 0.000 000 000 000 000 001 & $10^{-18}$ & atto & a \\
\Xhline{1pt}
\end{tabular}
\end{table}
\end{document}

• @ Zarko, but you removed the middle horizontal lines, and alternating row colors continued till the merged cells (Multiples & Submultiples) – Silva Oct 23 '19 at 1:31
• @Silva, I said how I would make your table. Dropped \clines you can return with \Xcline{2-5}{1pt}. See edited answer – Zarko Oct 23 '19 at 2:16
• the command Xhline causes no issues with alternating row colors, HOWEVER, THE COMMAND Xcline {2-5}{1.5pt} CAUSES A CONFLICT WITH ALTERNATING COLORS, all rows become same color – Silva Oct 23 '19 at 11:05
• @Silva, I test my MWE also with Xcline. It works without any problem. In test I use recent MikTeX. If you can not obtain desired result, than you have outdated LaTeX installation. Upgrade it. I will extend answer with showing, that Xcline works. – Zarko Oct 23 '19 at 11:11
• @Silva, you are right. It seems that should live without \Xcline or \cline or `hhline between rows. With out them your table is -- to my opinion -- look nicer. – Zarko Oct 23 '19 at 11:22