0

I want to draw a table with 4 dimensions as shown in the picture below. The bold vertical and horizontal lines demarcate the compartments and each cell annotates a value in the 4 dimensional space.

I already have some knowledge in LaTeX but I have no idea with which approach I should start creating such a table (TikZ, tabular, matrix).

Thanks for any pointers.

enter image description here

lschuetze
  • 111
  • 1
    This is not a “Here's my problem. Solve it for me.” kind of site. Please add to your question a serious attempt from you. – José Carlos Santos Sep 07 '22 at 12:34
  • For the table itself, have a look at tabularray. I am not aware of any other package than TikZ to obtain those diagonal lines. – Celdor Sep 07 '22 at 13:35
  • Welcome to TeX.SX! On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are either "off topic", "too broad", or "unclear". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help. – dexteritas Sep 07 '22 at 13:36
  • @Celdor This has come up on this site before, for example Q156162. Though, putting the cross behind the text while interrupting the lines … – Qrrbrbirlbel Sep 07 '22 at 13:56
  • @Qrrbrbirlbel It doesn't seem to be a trivial task. – Celdor Sep 07 '22 at 16:06

1 Answers1

2

I suggest using nicematrix.

Most of the elements of your matrix are here. I leave it to you to deal with font styles and the remaining cells.

enter image description here

To make the cells with the cross behind the text I made a macro using TikZ to draw two lines with a white rectangular node in the middle. Since this happens with \CodeBefore, the cell contents are placed on top.

The graphicx package is used for \rotatebox.

\documentclass{article}

\usepackage{tikz, nicematrix} \usepackage{graphicx}

\newcommand{\xbox}[5][]{ \draw[#1] ({#2}-|{#3}) --node[fill=white, minimum size=5mm]{} ({#4}-|{#5}); \draw[#1] ({#4}-|{#3}) --node[fill=white, minimum size=5mm]{} ({#2}-|{#5}); }

\begin{document}

\begin{NiceTabular}{{2}{wc{.4cm}}{6}{wc{1cm}}}[corners, hvlines] \CodeBefore \cellcolor{gray!20}{4-3,4-5,6-5} \cellcolor{gray!40}{3-4,3-6,5-6} \cellcolor{gray!60}{4-4,4-6,6-6} \tikz { \xbox[densely dashed, gray]{3}{3}{4}{4} \xbox[densely dashed]{3}{5}{4}{6} \xbox{5}{3}{7}{5} } \Body & & \Block{1-4}{Simultaneous sibling roles} & & & & & \ & & \Block{1-2}{no} & & \Block{1-2}{yes} & & & \ \RowStyle[cell-space-limits=4mm]{}\Block{4-1}{\rotatebox{90}{Multiple Perspectives}} & \Block{2-1}{\rotate no} & A/a & B2/a & A/b & B2/b & X & \Block{4-1}{\rotatebox{-90}{\parbox{4cm}{\centering Dynamic Binding\ with highest priority for...}}} \ \RowStyle[cell-space-limits=4mm]{} & & B1/a & B3/a & B1/b & B3/b & X & \ \RowStyle[cell-space-limits=4mm]{} & \Block{2-1}{\rotate yes} & \Block{2-2}{!d)} & & A/c & B2/c & X & \ \RowStyle[cell-space-limits=4mm]{} & & & & B1/c & B3/c & X & \ & & fixed & variable & fixed & variable & & \ & & \Block{1-4}{Interface\visible through an object reference} & & & & & \ \end{NiceTabular}

\end{document}

Sandy G
  • 42,558