셀 내부에 셀/상자가 있는 복잡한 테이블

셀 내부에 셀/상자가 있는 복잡한 테이블

나는 현재 LaTeX 기술을 사용하기 시작했고 이 문제를 우연히 발견했습니다. CTAN에 대한 여러 표 형식의 매뉴얼을 읽었지만 성공하지 못했습니다.

다음과 같은 테이블을 만들려고 합니다.

    +---------+--------+--------+--------+
    |     |114|    |100|    |92 |    |101|
    |     |___|    |___|    |___|    |___|
    |         |        |        |        |
    | 113     | 99     | 84     | 97     |
    +---------+--------+--------+--------+
    |     |114|    |100|    |92 |    |101|
    |     |___|    |___|    |___|    |___|
    |         |        |        |        |
    | 113     | 99     | 84     | 97     |
    +---------+--------+--------+--------+
    |     |114|    |100|    |92 |    |101|
    |     |___|    |___|    |___|    |___|
    |         |        |        |        |
    | 113     | 99     | 84     | 97     |
    +---------+--------+--------+--------+

이 구조를 달성하기 위한 기존 패키지가 있습니까? 그렇지 않은 경우에는 행 중첩 등을 생각하고 있었지만 아직 확실하지는 않습니다.

답변1

재미와 학습을 제공하고 기본 빌딩 블록으로 무엇이 가능한지 보여주는 Plain TeX 솔루션:

\def\widest{000}
\def\uv{\unskip\vrule}
\def\bx#1#2{\vbox{%
  \offinterlineskip%
  \halign{\ \hfil## &##&\ \hfil## \cr
    \hphantom{\widest}&&\hphantom{\widest}\cr
    &\vrule\strut& #2\cr
    \omit&\hrulefill&\omit\hrulefill\cr
    #1&\strut&\cr}
}}
\def\bxx{
  \bx{113}{114} & 
  \bx{99}{100} & 
  \bx{84}{92} & 
  \bx{97}{101}\cr
  \noalign{\hrule}
}

{\offinterlineskip
\halign{\vrule\strut \hfill #\uv & #\uv & #\uv & #\uv\cr
\noalign{\hrule}
\bxx\bxx\bxx
}}\bye

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

답변2

내가 아는 한, 그러한 패키지는 없지만 기본 설정, 사용 \multicolumn\cline매크로를 통해 구현할 수 있습니다.

\documentclass[twoside]{book}

\usepackage{booktabs}
\usepackage{array}

\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}

\usepackage{blindtext}
\begin{document}


\large
\begin{tabular}{|*{8}{L{1cm}|}}
\hline
& 114 & & 100 & & 92 & & 101  \tabularnewline
& & & & & & &   \tabularnewline
\cline{2-2} \cline{4-4} \cline{6-6} \cline{8-8} 
\multicolumn{2}{|l|}{} & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{}\tabularnewline 
\multicolumn{2}{|l|}{113} & \multicolumn{2}{l|}{99} & \multicolumn{2}{l|}{84} & \multicolumn{2}{l|}{97}  \tabularnewline
\hline
& 114 & & 100 & & 92 & & 101  \tabularnewline
& & & & & & &   \tabularnewline
\cline{2-2} \cline{4-4} \cline{6-6} \cline{8-8} 
\multicolumn{2}{|l|}{} & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{}\tabularnewline 
\multicolumn{2}{|l|}{113} & \multicolumn{2}{l|}{99} & \multicolumn{2}{l|}{84} & \multicolumn{2}{l|}{97}  \tabularnewline
\hline
& 114 & & 100 & & 92 & & 101  \tabularnewline
& & & & & & &   \tabularnewline
\cline{2-2} \cline{4-4} \cline{6-6} \cline{8-8} 
\multicolumn{2}{|l|}{} & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{}\tabularnewline 
\multicolumn{2}{|l|}{113} & \multicolumn{2}{l|}{99} & \multicolumn{2}{l|}{84} & \multicolumn{2}{l|}{97}  \tabularnewline
\hline
\end{tabular}

% Now with booktabs features 

\begin{tabular}{|*{8}{L{0.5cm}|}}
\toprule
& 114 & & 100 & & 92 & & 101  \tabularnewline
&  & &  & &  & &   \tabularnewline
\cmidrule{2-2} \cmidrule{4-4} \cmidrule{6-6} \cmidrule{8-8} 
\multicolumn{2}{|l|}{} & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{}\tabularnewline 
\multicolumn{2}{|l|}{113} & \multicolumn{2}{l|}{99} & \multicolumn{2}{l|}{84} & \multicolumn{2}{l|}{97}  \tabularnewline
\hline
& 114 & & 100 & & 92 & & 101  \tabularnewline
&  & &  & &  & &   \tabularnewline
\cmidrule{2-2} \cmidrule{4-4} \cmidrule{6-6} \cmidrule{8-8} 
\multicolumn{2}{|l|}{} & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{}\tabularnewline 
\multicolumn{2}{|l|}{113} & \multicolumn{2}{l|}{99} & \multicolumn{2}{l|}{84} & \multicolumn{2}{l|}{97}  \tabularnewline
\hline
& 114 & & 100 & & 92 & & 101  \tabularnewline
&  & &  & &  & &   \tabularnewline
\cmidrule{2-2} \cmidrule{4-4} \cmidrule{6-6} \cmidrule{8-8} 
\multicolumn{2}{|l|}{} & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{}\tabularnewline 
\multicolumn{2}{|l|}{113} & \multicolumn{2}{l|}{99} & \multicolumn{2}{l|}{84} & \multicolumn{2}{l|}{97}  \tabularnewline
\hline
\end{tabular}

\normalsize
\end{document}

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

답변3

\documentclass{scrartcl}
\usepackage{tikz}

\tikzset{/bowlinggrid/.cd,
  box width/.store in=\bgridlargewidth,box width=3cm,
  box height/.store in=\bgridlargeheight,box height=2.5cm,
  small width/.store in=\bgridsmallwidth,small width=1.2cm,
  small height/.store in=\bgridsmallheight,small height=1cm,
  columns/.store in=\bgridcolnumber,columns=4} % I cannot get /.initial= to work
\newcommand*\bowlinggrind[2][]
  {%
   \begin{tikzpicture}
   \tikzset{/bowlinggrid/.cd,#1}
   \foreach \N/\n [count=\cnt] in {#2}
     {
      \pgfmathsetmacro\currcolnumber{int(mod(\cnt-1,\bgridcolnumber))}
      \pgfmathsetmacro\currrownumber{int(ceil(\cnt/\bgridcolnumber))}
      \draw
       ({\currcolnumber*\bgridlargewidth},{-\currrownumber*\bgridlargeheight})
        node [above right] {\N}
        rectangle ++(\bgridlargewidth,\bgridlargeheight)
        rectangle ++(-\bgridsmallwidth,-\bgridsmallheight)
        node [above right] {\n};
     }
   \end{tikzpicture}%
  }

\begin{document}
\begin{center}
\bowlinggrind
  {113/114,99/100,84/92,97/101,
   113/114,99/100,84/92,97/101,
   113/114,99/100,84/92,97/101,
   113/114,99/100,84/92,97/101}
\end{center}
\begin{center}
\bowlinggrind[box width=1.8cm,box height=1.3cm,small width=.9cm,small height=.5cm]
  {113/114,99/100,84/92,97/101,
   113/114,99/100,84/92,97/101,
   113/114,99/100,84/92,97/101,
   113/114,99/100,84/92,97/101}
\end{center}
\end{document}

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

답변4

FWIW, 이 효과는 ConTeXt에서 비교적 쉽게 얻을 수 있습니다. 내용과 표현이 매우 깔끔하게 분리되어 있음을 주목하세요.

\startsetups[cellular]
  \setupTABLE[frame=off, align={middle,lohi}, offset=0.5em]
  \setupTABLE[even] [odd][frame=on, offset=0.25em]
  \setupTABLE[even][even][rightframe=on, bottomframe=on]
  \setupTABLE[odd] [even][leftframe=on,  bottomframe=on]
  \setupTABLE[odd]  [odd][leftframe=on,  topframe=on]
\stopsetups

\starttext
\startTABLE[setups=cellular]
   \NC     \NC 114 \NC    \NC 100 \NC    \NC 92 \NC    \NC 101 \NC \NR
   \NC 113 \NC     \NC 99 \NC     \NC 84 \NC    \NC 97 \NC     \NC \NR
   \NC     \NC 114 \NC    \NC 100 \NC    \NC 92 \NC    \NC 101 \NC \NR
   \NC 113 \NC     \NC 99 \NC     \NC 84 \NC    \NC 97 \NC     \NC \NR
   \NC     \NC 114 \NC    \NC 100 \NC    \NC 92 \NC    \NC 101 \NC \NR
   \NC 113 \NC     \NC 99 \NC     \NC 84 \NC    \NC 97 \NC     \NC \NR
\stopTABLE
\stoptext

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

관련 정보