TransWikia.com

Complicated table with multirows and multicolumns slashbox

TeX - LaTeX Asked by John_Sharp1318 on February 13, 2021

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

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} 

Correct answer by Roland on February 13, 2021

A similar example with the excellent nicematrix package

enter image description here

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}

Answered by js bibra on February 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP