0

I want to make a table like the figure attached.

The table has multiple rows and columns with color, and the lines between some cells are in white color.

Here is my code:

\documentclass{article}
\usepackage[table, svgnames, dvipsnames]{xcolor}
\usepackage{makecell, cellspace, caption}
\usepackage[table]{xcolor}
\usepackage{multirow} 
\usepackage{booktabs}
\usepackage[tableposition=above]{caption}
\usepackage{pifont}
\usepackage{multirow} %for multirow
\setlength\cellspacetoplimit{2pt}
\setlength\cellspacebottomlimit{5pt}

\begin{document}

\begin{table} \centering\captionsetup{justification = centering} \caption{Different quantum number combinations} %{\centering} \label{tabla-numeros} \begin{tabular}{|Sc|Sc|Sc|Sc|Sc|} \hline \rowcolor{Gainsboro!60} \makecell{\textbf{Level}\ $n$} & \makecell{\textbf{Sub-level}\ $l = 0, 1, ...., n - 1$} & \makecell{\textbf{Orbital} ($2l+1$)\ $m_l = -l,...,0,...,+l $} & \makecell{\textbf{Spín} \ $m_s$} & \makecell{\textbf{No. of electrons} \ $2n^2$}\ \hline \rowcolor{blue!20} \multirow{2}{}{1} & \multirow{2}{}{0} & \multirow{2}{}{0 (s)} & $+\frac{1}{2}$ & \multirow{2}{}{2} \ \rowcolor{blue!20} & & & $-\frac{1}{2}$ & \
\rowcolor{green!20} \makecell{\multirow{3}{}{2}} & \makecell{\multirow{2}{}{0}} & \makecell{\multirow{2}{}{0 (s)}} & $+\frac{1}{2}$ & \makecell{\multirow{8}{}{8}} \ \rowcolor{green!20} & & & $-\frac{1}{2}$ & \ \rowcolor{green!20} & \multirow{2}{}{} & \multirow{2}{}{-1 ($p_x$)} & $+\frac{1}{2}$ & \multirow{8}{}{8} \ \rowcolor{green!20} & & & $-\frac{1}{2}$ & \ \rowcolor{green!20} & \multirow{2}{}{1} & \multirow{2}{}{0 ($p_y$)} & $+\frac{1}{2}$ & \multirow{8}{}{8} \ \rowcolor{green!20} & & & $-\frac{1}{2}$ & \ \rowcolor{green!20} & \multirow{2}{}{} & \multirow{2}{}{+1 ($p_z$)} & $+\frac{1}{2}$ & \multirow{8}{*}{8} \ \rowcolor{green!20} & & & $-\frac{1}{2}$ & \
\rowcolor{yellow!20} & & & & \ \rowcolor{pink!20} & & & &\ \hline \end{tabular} \end{table}

\end{document}

I have problems with the multirow command, because in the first column I can't write the number 2 in the midle parte of the cells coulored with green. I have the same problem with the cells in yellow and pink.
I will appreciate your help.

cabohah
  • 11,455
fap
  • 1
  • 1
    Also related: https://tex.stackexchange.com/q/596036 https://tex.stackexchange.com/q/543945 https://tex.stackexchange.com/q/665016 and several more. – cabohah Jun 27 '23 at 07:05

0 Answers0