[Tex/LaTex] How to create a nested multirow table

multirowtables

I have a table that looks like below.

enter image description here

I want to create the same table in latex. I found that this can be done using multirow.

e.g.,

\documentclass[11pt]{article}
\usepackage{multirow}
\begin{document}

\begin{table}[ht]
\caption{Multi-row table}
\begin{center}
\begin{tabular}{cc}
    \hline
    \multirow{2}{*}{Multirow}&X\\
    &X\\
    \hline
\end{tabular}
\end{center}
\label{tab:multicol}
\end{table}
\end{document}

However, since I have nested multirows I am confused how to do it. Is there any easy way of doing this? How to draw \hline as shown in the image above in nested multirow?

I am happy to provide more details if needed.

Best Answer

See, if the following solution work for you (without multirow):

\documentclass[11pt]{article}
\begin{document}

\begin{table}[ht]
\caption{Multi-row table}
    \centering
\begin{tabular}{|*{5}{c|}}
    \hline
Column 1    & Column 2  & Column 3  & Column 4  & Column 5  \\
    \hline
1           & Item 1    & 3         & 4         & 5         \\  \cline{3-5}
            &           &           &           &           \\  \cline{3-5}
            &           &           &           &           \\  \cline{2-5}
            & Item 2    &           &           &           \\  \cline{3-5}
            &           &           &           &           \\  \cline{3-5}
            &           &           &           &           \\
    \hline
\end{tabular}
\label{tab:multicol}
\end{table}
\end{document}

enter image description here

with multirow:

\documentclass[11pt]{article}
\usepackage{multirow}
\begin{document}

\begin{table}[ht]
\caption{Multi-row table}
    \centering
\begin{tabular}{|*{5}{c|}}
    \hline
Column 1    & Column 2  & Column 3  & Column 4  & Column 5  \\
    \hline
\multirow[t]{6}{*}{1}           
            & \multirow[t]{3}{*}{Item 1}
                        & 3         & 4         & 5         \\  \cline{3-5}
            &           &           &           &           \\  \cline{3-5}
            &           &           &           &           \\  \cline{2-5}
            & \multirow[t]{3}{*}{Item 2}
                        &           &           &           \\  \cline{3-5}
            &           &           &           &           \\  \cline{3-5}
            &           &           &           &           \\
    \hline
\end{tabular}
\label{tab:multicol}
\end{table}
\end{document}

Result is the same as before.