Tabela complicada com multirows e slashbox multicolunas

Oct 14 2020

Estou tentando fazer uma tabela bastante complicada. A complexidade da minha tabela é que eu quero usar um slashboxque deve ser multicole multirow. Eu quero fazer isso:

Todas as minhas tentativas até agora falharam. Qualquer ajuda ou conselho seria apreciada, agradecemos antecipadamente.

Respostas

2 Roland Oct 14 2020 at 06:18

Como isso:

\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} 

2 jsbibra Oct 14 2020 at 07:13

Um exemplo semelhante com o nicematrixpacote excelente

\documentclass{article}
\usepackage{nicematrix}
\usepackage{makecell}

\begin{document}

\begin{NiceTabular}{wC{5mm}cccc}[hvlines-except-corners]
 & \;\diagbox{A}{B} & \makecell{C \\ D} & \makecell{ E \\ F} & \makecell{ 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}