2

I am trying to do a quite complicated table. The complexity of my table is that I want to use a slashbox that should be both multicol and multirow. I want to do this:

enter image description here

All my attempts until now have failed. Any help or advice would be appreciated, thanks in advance.

2 Answers 2

2

Like This:

\documentclass{article}
\usepackage{slashbox}
\usepackage{multirow}

\begin{document}
    
\begin{table}[]

    \begin{tabular}{|c|c|c|c|c|c|}
        \hline

        \multicolumn{2}{|c|}{\multirow{2}{*}{\backslashbox{B}{9}}} & \multicolumn{2}{c|}{J} & \multicolumn{2}{c|}{M} \\ \cline{3-6} 
        \multicolumn{2}{|c|}{}                   & K          & L         & M          & O         \\ \hline
        \multirow{2}{*}{A}          & B          &            &           &            &           \\ \cline{2-6} 
        & C          &            &           &            &           \\ \hline
        \multirow{2}{*}{O}          & E          &            &           &            &           \\ \cline{2-6} 
        & F          &            &           &            &           \\ \hline
    \end{tabular}
\end{table}

    
\end{document} 

1
  • It is exactly that. Thank you very much for your help. Oct 13, 2020 at 23:41
2

A similar example with the excellent nicematrix package

enter image description here

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabular}{wc{5mm}cccc}[hvlines,corners=NW]
 & \;\diagbox{A}{B} & \Block{}{C \\ D} & \Block{}{ E \\ F} & \Block{}{ G \\ longer} \\
\Block{4-1}{H1} & I & text 1    &      & text \\
                & J & text 2    &      & text \\
                & K & text      &      & other text \\
                & L & text      &      & text \\
\Block{4-1}{H2} & M & text      & smth & text \\
                & N & text      &      & text \\
                & O & text      &      & text \\
                & P & text text &      & text \\
\end{NiceTabular}

\end{document}

You must log in to answer this question.

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