셀 내부(상단 모서리) 및 측면 주석이 있는 표

셀 내부(상단 모서리) 및 측면 주석이 있는 표

이상적으로는 한계 주석을 허용하는 nicematrix 패키지를 사용하여 아래 그림의 레이아웃으로 테이블이나 배열을 만들고 싶습니다.

패키지 문서를 읽었으며 내 질문에 대한 몇 가지 해결책이 있을 수 있습니다. 하나는 tikz와 관련된 것이고 \CodeAfter다른 하나 \newcolumntype{x}{!{\OnlyMainNiceMatrix{\vrule somelength}}}

나는 tikz에 대해 충분히 알지 못하며 권리를 얻는 방법도 모릅니다 somelength. 피로 때문에 요청하면 더 이상 제한 위반이 없습니다 :)

원하는 레이아웃

못생긴 라텍스와 함께NiceArray

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

와 함께NiceTabular

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

답변1

간단한 방법으로 그렇게 할 수 있습니다 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} 

여기에 이미지 설명을 입력하세요

관련 정보