Tabelle mit Zelle innerhalb der Zelle (obere Ecke) und seitlichen Anmerkungen

Tabelle mit Zelle innerhalb der Zelle (obere Ecke) und seitlichen Anmerkungen

Ich möchte eine Tabelle oder ein Array mit dem Layout in der folgenden Abbildung erstellen, idealerweise mit dem Nicematrix-Paket, das die Randanmerkungen ermöglicht.

Ich habe die Paketdokumentation gelesen und es gibt vielleicht ein paar Lösungen für meine Frage, eine betrifft tikz und \CodeAfterdie \newcolumntype{x}{!{\OnlyMainNiceMatrix{\vrule somelength}}}andere

Ich weiß nicht genug über Tikz oder wie man das Richtige bekommt somelength. Frage wegen Erschöpfung, keine Limit-Breaks mehr :)

gewünschtes Layout

Einige hässliche Latex mitNiceArray

$\begin{NiceTabular}{| c c| c c| c c | }[columns-width = 0.5cm,
    cell-space-top-limit = 0.15cm, cell-space-bottom-limit= 0.15cm]
 \hline 
 6 &  &  8 &  & 10 & \\ \cline{1-1} \cline{3-3} \cline {5-5}
  & 0 & & 0 & & 150 \\ 
  \hline
  7 &  & 11 &  & 11 & \\  \cline{1-1} \cline{3-3} \cline {5-5}
  & 175 & & 0 & & 0 \\ 
  \hline
  4 & & 5 & & 12 & \\  \cline{1-1} \cline{3-3} \cline {5-5}
  & 25 & & 100 & & 150 \\
  \hline
\end{NiceTabular}$

MitNiceTabular

\begin{table} \label{lab}
\centering
\begin{NiceTabular}{@{}Wl{2.5cm}|Wl{0.5cm}Wr{0.5cm}|Wl{0.5cm}Wr{0.5cm}|Wl{0.5cm}Wr{0.5cm}|Wl{2.5cm}l@{}}
\toprule
& \Block{2-2}{A}  & & \Block{2-2}{B} & &\Block{2-2}{C} & &\Block{2- 2}{D}\\
 & & & & & & & &\\
\midrule
\Block{2- 1}{E} & 6 &  &  8 &  & 10 & &  \Block{2- 1}{5}\\
&  & -- & & -- & & 15 & &\\ \hline
\Block{2- 1}{F} & 7 &  & 11 &  & 11 & & \Block{2- 1}{1}\\
& & 175 & & -- & & -- & &\\ \hline
\Block{2- 1}{G} & 4 & & 5 & & 12 & & \Block{2- 1}{2}\\
& & 25 & & 100 & & 5 & &\\ \hline
\Block{2-1}{Demanda} & \Block{2-2}{200}  & & \Block{2-2}{100} & &\Block{2-2}{300} & &\Block{2- 2}{600}\\
 & & & & & & & &\\
\bottomrule
\end{NiceTabular}
\caption{Cap}
\end{table}

Antwort1

Das geht ganz einfach mit tabular:

\documentclass{article}
\usepackage{array, bigstrut, hhline}
\newcommand{\emptycells}[1]{\multicolumn{#1}{c|}{}}
\newcommand{\mc}[2]{\multicolumn{#1}{c}{#2}}

\begin{document} 

{\setlength{\bigstrutjot}{0.8ex}
\setlength{\extrarowheight}{2pt}
\begin{tabular}{|*{4}{p{7mm}| >{\centering\arraybackslash}p{3mm}|}l }
\cline{1-8}
  & 2 & & 3 & & 5 & & 6 \\ %
 \hhline{|~|-|~|-|~|-|~|-|}
  \multicolumn{2}{|c|}{\bigstrut}& \emptycells{2} & \emptycells{2} & \emptycells{2} & 5 \\
 \cline{1-8}
  & 2 & & 1 & & 3 & & 5 \\ %
 \hhline{|~|-|~|-|~|-|~|-|}
  \multicolumn{2}{|c|}{\bigstrut} & \multicolumn{2}{l|} {8} & \emptycells{2} & \emptycells{2} & 2 \\
 \cline{1-8}
  & 3 & & 8 & & 4 & & 6 \\ %
 \hhline{|~|-|~|-|~|-|~|-|}%
\multicolumn{2}{|c|}{\bigstrut}& \emptycells{2} & \emptycells{2} & \emptycells{2} & 15 \\
 \cline{1-8}\noalign{\vskip 1ex}
 \mc{2}{12} & \mc{2}{$\times$} & \mc{2}{4} & \mc{2}{6}
 \end{tabular}}

\end{document} 

Bildbeschreibung hier eingeben

verwandte Informationen