1

I have currently a table with the below code and i want to get it in the form of the image ive posted below.

\begin{table}[ht]
  \caption{####}\label{table:####}
  \begin{tabular}{|l|l|l|l|l|l|l|}
    \hline
    \multirow{2}{*}{A} &
      \multicolumn{2}{c}{B} &
      \multicolumn{2}{c}{C} &
      \multicolumn{2}{c|}{D} \\
    & 
    Modell& A& A& A& A& A\\
    \hline
    Modell& A& A& 11461   & A& A& A\\
    \hline
    Modell & A & A& A& A&  A&  A\\
    \hline
    Modell & A & A& A& A&  A&  A\\
    \hline
    Modell & A & A& A& A&  A&  A\\
    \hline
  \end{tabular}
\end{tab}

The image represents the anticipated endresult, i just need multiple multirows to resprent my data.

anticipated table

7
  • Welcome to TeX SX! Your code does not correspond to the image, and I can't really understand what you try to obtain, and what you're missing.
    – Bernard
    Jul 1, 2020 at 11:42
  • @Bernard iam sry i edited my post! The image is the end result i want
    – voltage
    Jul 1, 2020 at 11:52
  • You don't need to use \multirow  for this table. Just replace the relevant \hlines with \cline{2-7}.
    – Bernard
    Jul 1, 2020 at 11:56
  • I didnt managed it, what i did was to replace the hlines with clines but doesnt that just change the vertical lines into horizontal ones?
    – voltage
    Jul 1, 2020 at 12:27
  • No, it makes horizontal lines start at the second column. B.t.w., you declare 7 columns and your image has 8
    – Bernard
    Jul 1, 2020 at 12:33

1 Answer 1

0

You can use \cline instead of \hline, to only cover the columns from the second one on.

However, caged tables are really ugly, so I also propose a different realization.

\documentclass{article}
\usepackage{booktabs} % for the second realization

\begin{document}

\begin{table}
\centering

\caption{A caged table}\label{caged}

\begin{tabular}{|l|l|c|c|c|c|c|c|}
\hline
Model   & A  & \multicolumn{2}{l|}{B} & \multicolumn{2}{l|}{C} & \multicolumn{2}{l|}{D} \\
\hline
Model 1 & A1 & B1.1 & B1.2 & C1.1 & C1.2 & D1.1 & D1.2 \\
\cline{2-8}
        & A2 & B2.1 & B2.2 & C2.1 & C2.2 & D2.1 & D2.2 \\
\cline{2-8}
        & A3 & B3.1 & B3.2 & C3.1 & C3.2 & D3.1 & D3.2 \\
\cline{2-8}
        & A4 & B4.1 & B4.2 & C4.1 & C4.2 & D4.1 & D4.2 \\
\hline
Model 2 & A1 & B1.1 & B1.2 & C1.1 & C1.2 & D1.1 & D1.2 \\
\cline{2-8}
        & A2 & B2.1 & B2.2 & C2.1 & C2.2 & D2.1 & D2.2 \\
\hline
Model 3 & A1 & B1.1 & B1.2 & C1.1 & C1.2 & D1.1 & D1.2 \\
\cline{2-8}
        & A2 & B2.1 & B2.2 & C2.1 & C2.2 & D2.1 & D2.2 \\
\hline
\end{tabular}

\end{table}

\begin{table}
\centering

\caption{A better table}\label{better}

\begin{tabular}{@{}lccccccc@{}}
\toprule
Model   & A  & \multicolumn{2}{c}{B} & \multicolumn{2}{c}{C} & \multicolumn{2}{c}{D} \\
\cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(l){7-8}
        &    & B1 & B2 & C1 & C2 & D1 & D2 \\
\midrule
Model 1 & A1 & B1.1 & B1.2 & C1.1 & C1.2 & D1.1 & D1.2 \\
        & A2 & B2.1 & B2.2 & C2.1 & C2.2 & D2.1 & D2.2 \\
        & A3 & B3.1 & B3.2 & C3.1 & C3.2 & D3.1 & D3.2 \\
        & A4 & B4.1 & B4.2 & C4.1 & C4.2 & D4.1 & D4.2 \\
\midrule
Model 2 & A1 & B1.1 & B1.2 & C1.1 & C1.2 & D1.1 & D1.2 \\
        & A2 & B2.1 & B2.2 & C2.1 & C2.2 & D2.1 & D2.2 \\
\midrule
Model 3 & A1 & B1.1 & B1.2 & C1.1 & C1.2 & D1.1 & D1.2 \\
        & A2 & B2.1 & B2.2 & C2.1 & C2.2 & D2.1 & D2.2 \\
\midrule
\end{tabular}

\end{table}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .