As you can see in the example below, the partial horizontal lines, for which I have used "\cline", are overwritten by the gray shading with "\cellcolor".
I have seen several proposals to get around this problem but none have been satisfactory. My last attempt with "\hhline" cuts the vertical lines by a white stripe ...
Nor have I gotten the line that should close the table on the right. In this case, I think the problem is caused by the "\multirow" command.
\documentclass[a4paper,14pt,twoside,reqno]{extbook}
\usepackage{amsmath, amsfonts,amssymb,epsfig,amstext,amsthm,mathpazo}
\usepackage{array}
\usepackage{xcolor}
\usepackage{colortbl} %Color en celdas
\usepackage{nicematrix} %Dibuja las lineas \hline de las tablas después del coloreado de celdas
\usepackage{float}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{booktabs} %\cmidrule[espesor](recorte) {cola-colb}. Parámetro recorte: especifica si la línea se recorta a la izquierda y/o a la derecha y en que proporción. Parámetros cola y colb: indican de qué columna a qué columna va la línea.
\begin{document}
\extrarowheight = -0.25ex %Ajusta espacio superior entre filas para centrado vertical
\renewcommand{\arraystretch}{2} %Ajusta alto de filas
\renewcommand {\tabcolsep}{6pt} %Ajusta espacio interior entre columnas
\renewcommand{\arrayrulewidth}{2pt} %Ajusta el grueso de línea
\begin{center}
\begin{tabular} {| w{c}{1.4em} | {12}{|w{c}{1.4em}}|} %Celdas de ancho fijo con alineación horizontal y vertical
\hline
\centering
{\large $ \lambda $} & \multicolumn{12}{c}{{\large \textbf{Generator Pairs $ (\beta_i, \gamma_i) $}}} \vline\
\hline \hline
\multirow{2}{}
{\large \textbf{1}} & \cellcolor[gray]{0.9} $ \beta_6 $ & \cellcolor[gray]{0.9} $ \beta_5 $ & \cellcolor[gray]{0.9} $ \beta_4 $ & \cellcolor[gray]{0.9} $ \beta_3 $ & \cellcolor[gray]{0.9} $ \beta_2 $ & \cellcolor[gray]{0.9} $ \beta_1 $ & \cellcolor[gray]{0.9} $ \gamma_1 $ & \cellcolor[gray]{0.9} $ \gamma_2 $ & \cellcolor[gray]{0.9} $ \gamma_3 $ & \cellcolor[gray]{0.9} $ \gamma_4 $ & \cellcolor[gray]{0.9} $ \gamma_5 $ & \cellcolor[gray]{0.9} $ \gamma_6 $ \
\cline{2-13}
& 1 & 2 & 3 & 6 & 7 & 9 & 14 & 18 & 21 & 42 & 63 & 126 \
\hline
\multirow{2}{}
{\large \textbf{2}} & \cellcolor[gray]{0.9} $ \beta_3 $ & \cellcolor[gray]{0.9} $ \beta_2 $ & \cellcolor[gray]{0.9} $ \beta_1 $ & \cellcolor[gray]{0.9} $ \gamma_1 $ & \cellcolor[gray]{0.9} $ \gamma_2 $ & \cellcolor[gray]{0.9} $ \gamma_3 $ \multirow{2}{}{} \
\cline{2-7}
\multirow{2}{}
& 1 & 3 & 7 & 9 & 21 & 63 \
\cline{1-9}
\multirow{2}{}
{\large \textbf{3}} & \cellcolor[gray]{0.9} $ \beta_4 $ & \cellcolor[gray]{0.9} $ \beta_3 $ & \cellcolor[gray]{0.9} $ \beta_2 $ & \cellcolor[gray]{0.9} $ \beta_1 $ & \cellcolor[gray]{0.9} $ \gamma_1 $ & \cellcolor[gray]{0.9} $ \gamma_2 $ & \cellcolor[gray]{0.9} $ \gamma_3 $ & \cellcolor[gray]{0.9} $ \gamma_4 $ \multirow{2}{}{} \
\cline{2-9}
& 1 & 2 & 3 & 6 & 7 & 14 & 21 & 42 \
\cline{1-9}
\multirow{2}{}
{\large \textbf{6}} & \cellcolor[gray]{0.9} $ \beta_2 $ & \cellcolor[gray]{0.9} $ \beta_1 $ & \cellcolor[gray]{0.9} $ \gamma_1 $ & \cellcolor[gray]{0.9} $ \gamma_2 $ \multirow{2}{}{} \
\cline{2-5}
\multirow{2}{}
& 1 & 3 & 7 & 21 \
\cline{1-7}
\multirow{2}{}
{\large \textbf{7}} & \cellcolor[gray]{0.9} $ \beta_3 $ & \cellcolor[gray]{0.9} $ \beta_2 $ & \cellcolor[gray]{0.9} $ \beta_1 $ & \cellcolor[gray]{0.9} $ \gamma_1 $ & \cellcolor[gray]{0.9} $ \gamma_2 $ & \cellcolor[gray]{0.9} $ \gamma_3 $ \multirow{2}{}{} \
\cline{2-7}
\multirow{2}{}
& 1 & 2 & 3 & 6 & 9 & 18 \
\cline{1-7}
\multirow{2}{}
{\large {\textbf{14}}} & \cellcolor[gray]{0.9} $ \beta_1 $ & \cellcolor[gray]{0.9} $ \boxdot^2 $ & \cellcolor[gray]{0.9} $ \gamma_1 $ \multirow{2}{}{} \
\cline{2-4}
\multirow{2}{}
& 1 & 3 & 9 \
\cline{1-5}
\multirow{2}{}
{\large {\textbf{21}}} & \cellcolor[gray]{0.9} $ \beta_2 $ & \cellcolor[gray]{0.9} $ \beta_1 $ & \cellcolor[gray]{0.9} $ \gamma_1 $ & \cellcolor[gray]{0.9} $ \gamma_2 $ \multirow{2}{}{} \
%\cline{2-5}
\hhline{~ {4}{-}}
& 1 & 2 & 3 & 6 \
%\cline{1-5}
\hhline{{5}{-}}
\multirow{2}{}
{\large {\textbf{42}}} & \cellcolor[gray]{0.9} $ \beta_1 $ & \cellcolor[gray]{0.9} $ \gamma_1 $ \multirow{2}{}{} \
\cline{2-3}
& 1 & 3\
\hline
\end{tabular}
\end{center}
\end{document}



colortblpackage documentation explicitly states that\clinedoes not work with that package. that really is not fixable, sorry. – David Carlisle Mar 27 '21 at 22:48\extrarowheight = -0.25exI have never seen that set negative and I can't see how it can produce reasonable results, especially if you have coloured rows. – David Carlisle Mar 27 '21 at 22:57\extrarowheight = -0.25exis an adjustment so that the text is perfectly centered vertically (I had noticed that it was slightly below the center of the cell). – Jesús Álvarez Lobo Mar 27 '21 at 23:13