as you see in the image, I need to make 3 changes to my table.
1. Make 5 lines of table thicker.
2. Make some cells to have their text center-aligned vertically.
3. Put background color on some rows. My MWE code is:
Code: Select all
\documentclass[a4paper]{book}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}%
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}}
\usepackage{multirow}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|>{\centering\arraybackslash} m{4em}|>{\centering\arraybackslash} m{5.5em}|R{2em}m{3em}|>{\centering\arraybackslash} C{5em}|>{\centering\arraybackslash} m{1ex}|>{\centering\arraybackslash} m{5.5em}|>{\centering\arraybackslash} m{5.5em}|}
\cline{1-5} \cline{7-8}
\multicolumn{5}{|c|}{\textbf{Text1}} & & \multicolumn{2}{c|}{\textbf{Text2}} \\ \cline{1-5} \cline{7-8}
\begin{tabular}[c]{@{}c@{}}Text3\\Text4\\Text5\end{tabular} & \begin{tabular}[c]{@{}c@{}}Text6\\Text7\\Text8\end{tabular} & \multicolumn{2}{c|}{\begin{tabular}[c]{@{}c@{}}Text9\\Text10\\Text11\end{tabular}} & \begin{tabular}[c]{@{}c@{}}Text12\\Text13\\Text14\end{tabular} & \multicolumn{1}{c|}{} & \begin{tabular}[c]{@{}c@{}}Text15\\Text16\end{tabular} & \begin{tabular}[c]{@{}c@{}}Text17\\Text18\end{tabular}\\ \cline{1-5} \cline{7-8}\noalign{\vskip.4pt}
1 A & 1 A1 & 1 & A1 & 2 & & A1 text & A text \\ \cline{1-5} \cline{7-8}
\multirow{2}{*}{2 B} & 2 B1 & 2 & B1 & 2 & & B1 text & \multirow{2}{*}{B text} \\ \cline{2-5} \cline{7-7}
& 2 B2 & \textbf{\begin{tabular}[c]{@{}r@{}}1\\ 2\\ 3\end{tabular}} & \begin{tabular}[c]{@{}l@{}}B2a\\ B2b\\ B2c\end{tabular} & \textbf{\begin{tabular}[c]{@{}c@{}}2\\ 2\\ 2\end{tabular}} & & B2 text & \\ \cline{1-5} \cline{7-8}
\multirow{3}{*}{3 C} & 3 C1 & 1 & C1 & 2 & & C1 text & \multirow{3}{*}{C text} \\ \cline{2-5} \cline{7-7}
& 3 C2 & \textbf{\begin{tabular}[c]{@{}r@{}}1\\ 2\\ 3\end{tabular}} & \begin{tabular}[c]{@{}l@{}}C2a\\ C2b\\ C2c\end{tabular} & \textbf{\begin{tabular}[c]{@{}c@{}}2\\ 2\\ 2\end{tabular}} & & C2 text & \\ \cline{2-5} \cline{7-7}
& 3 C3 & \textbf{\begin{tabular}[c]{@{}r@{}}1\\ 2\\ 3\\ 4\\ 5\end{tabular}} & & \textbf{\begin{tabular}[c]{@{}c@{}}2\\ 2\\ 2\\ 2\\ 2\end{tabular}} & & C3 text & \\ \cline{1-5} \cline{7-8}
\multirow{4}{*}{4 D} & 4 D1 & 1 & D1 & 2 & & D1 text & \multirow{4}{*}{D text} \\ \cline{2-5} \cline{7-7}
& 4 D2 & \textbf{\begin{tabular}[c]{@{}r@{}}1\\ 2\\ 3\end{tabular}} & \begin{tabular}[c]{@{}l@{}}D2a\\ D2b\\ D2c\end{tabular} & \textbf{\begin{tabular}[c]{@{}c@{}}2\\ 2\\ 2\end{tabular}} & & D2 text & \\ \cline{2-5} \cline{7-7}
& 4 D3 & \textbf{\begin{tabular}[c]{@{}r@{}}1\\ 2\\ 3\\ 4\\ 5\end{tabular}} & & \textbf{\begin{tabular}[c]{@{}c@{}}2\\ 2\\ 2\\ 2\\ 2\end{tabular}} & & D3 text & \\ \cline{2-5} \cline{7-7}
& 4 D4 & \textbf{\begin{tabular}[c]{@{}r@{}}1\\ 2\\ 3\\ 4\\ 5\\ 6\\ 7\end{tabular}} & & \textbf{\begin{tabular}[c]{@{}c@{}}2\\ 2\\ 2\\ 2\\ 2\\ 2\\ 2\end{tabular}} & & D4 text & \\ \cline{1-5} \cline{7-8}
\end{tabular}
\end{table}
\end{document}