Creating a table with merged cells in RevTex 4.2 template

formattingrevtextables

I'm trying to create a table that looks like this:

enter image description here

I'm using the RevTex 4.2 Template. I've been reading this thread but am a beginner with Latex and am not sure how to modify it to make the table I want.

Best Answer

With tabularray:

\documentclass{revtex4-2}
\usepackage{geometry}
\usepackage{tabularray}
\usepackage{caption}

\usepackage{lipsum}

\begin{document}
\lipsum[66]
    \begin{table}[ht]
    \centering
\begin{tblr}{width=0.8\linewidth,
            hlines=0.4pt, vlines=0.4pt,
            colspec = {l *{5}{X[c,m]}},
             colsep = 4pt,
             row{1} = {font=\small\bfseries},
             rowsep = 3pt
            }
Assumption  &   & \SetCell[c=2]{c} Double slit  
                        &   & Right slit    & Left slit \\
$a=\#$ mm   & \SetCell[r=2]{c} $\lambda$ [nm] = 
                & \#    & \SetCell[r=2]{c} \#   
                            & \#            & \#        \\
$d=\#$ mm   &   & \#    &   & \SetCell[c=2]{c} n/a  
                                            &           \\
$\lambda = \#$ mm 
            & $a$ [mm] =& \SetCell[c=2]{c} n/a
                            &   & \#        & \#        \\
\end{tblr}
    \end{table}
\end{document}

enter image description here