
LaTeX에서 이런 종류의 테이블을 만들 수 있나요?
나는 이 표에 답을 적용하고 싶습니다:
\documentclass[10pt]{article}
\usepackage[left=1cm,right=1.5cm,top=1cm, bottom=3.5cm]{geometry}
\begin{document}
\begin{tabular}{|l|l|l|}
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
\end{tabular}
\end{document}
답변1
그림과 더 비슷하다고 생각하여 다음과 같이 코딩했습니다 TikZ
.
\documentclass[tikz,border=2pt]{standalone}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture}[tp/.style={minimum height=6cm+2\pgflinewidth,minimum width=1cm,fill=white},line width=1pt]
\node[minimum size=6cm,inner sep=0pt,draw] (big) {};
\draw (big.180)--(big.0)(big.90)--(big.-90);
\node[tp] at ($(big.center)!.5!(big.0)$) {};
\node[tp] at ($(big.center)!.5!(big.180)$) {};
\node[tp,rotate=90] at ($(big.center)!.5!(big.90)$) {};
\node[tp,rotate=90] at ($(big.center)!.5!(big.-90)$) {};
\end{tikzpicture}
\end{document}
또한 텍스트를 추가하는 것이 이보다 더 쉬울 수는 없습니다!
다음 예를 참조하세요.
\documentclass[tikz,border=2pt]{standalone}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture}[BL/.style={draw=blue,line width=1cm,shorten >=-1pt,shorten <=-1pt},line width=1pt]
\node[minimum size=6cm,inner sep=0pt,draw] (big) {};
\draw (big.180)--(big.0)(big.90)--(big.-90);
\draw[BL]($(big.90)!.5!(big.135)$)--($(big.-90)!.5!(big.-135)$);
\draw[BL]($(big.90)!.5!(big.45)$)--($(big.-90)!.5!(big.-45)$);
\draw[BL]($(big.180)!.5!(big.135)$)--node[pos=.25,fill=white]{Cell no. 11}node[pos=.75,fill=white]{Cell no. 12}($(big.0)!.5!(big.45)$);
\draw[BL]($(big.180)!.5!(big.-135)$)--node[pos=.25,fill=white]{Cell no. 21}node[pos=.75,fill=white]{Cell no. 22}($(big.0)!.5!(big.-45)$);
\end{tikzpicture}
\end{document}
업데이트
질문의 최종 편집 버전은 다음과 같습니다. TikZ
모든 테이블 크기를 허용하는 또 다른 구현은 다음과 같습니다.
\documentclass[10pt]{article}
\usepackage{tikz,colortbl}
\usetikzlibrary{positioning,calc}
\begin{document}
\newcommand{\mytable}[1]{\ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
}
\newcolumntype{W}{>{\color{white}}l}
\begin{tikzpicture}[shorten >=-1pt,shorten <=-1pt]
\node[draw,inner sep=0pt](table){%
\begin{tabular}{|W|W|W|}
\mytable{1}
\end{tabular}};
\foreach \x in {1,3,5}
\draw[white,line width=.3cm] ($(table.north west)!\x/6!(table.north east)$)--($(table.south west)!\x/6!(table.south east)$);
\foreach \x in {1,3,...,23}
\draw[white,line width=.1cm] ($(table.north west)!\x/24!(table.south west)$)--($(table.north east)!\x/24!(table.south east)$);
\setlength{\extrarowheight}{.4pt}
\node at (table.center){\noindent%
\begin{tabular}{lll}
\mytable{0}
\end{tabular}};
\end{tikzpicture}
\end{document}
첫 번째 루프는 에서 까지 \foreach
의 홀수에 대해 반복 되고 두 번째는 에서 까지 의 홀수에 대해 루프됩니다 . 또한 는 열 반 너비의 배수이고 행 반 높이의 배수입니다. 테이블 행은 명령에 한 번만 입력됩니다.1
2*#columns-1
\foreach
1
2*#rows-1
\x/6
\x/24
\mytable
답변2
\Dcell[]
여기서는 테이블을 생성하기 위해 TABstack의 구성 요소로 사용되는 나만의 매크로를 만듭니다 . 에 대한 선택적 인수를 사용하여 요소에 텍스트를 추가할 가능성을 인정합니다 \Dcell
. 파일 상단에는 3개의 사용자 매개변수가 있습니다.
\rlwd
코너의 너비 규칙
\rlln
코너 룰의 길이
\cellhgap
두 모퉁이 규칙 사이의 빈 간격(수직 간격은 셀 정사각형을 유지하도록 자동 조정됩니다.
당연히 \cellhgap + 2\rlln
가장 넓은 텍스트 항목을 초과해야 합니다.
약간의 서문 설정이 있지만 실제 사용법은 매우 간단합니다.
\documentclass{article}
\usepackage{tabstackengine}
\def\rlwd{.4pt}
\def\rlln{3ex}
\def\cellhgap{3ex}
\def\cellfield{\dimexpr\cellhgap + 2\dimexpr\rlln}
\def\cellvgap{.5\dimexpr\cellhgap-\ht\strutbox\relax}
\setstackEOL{\cr}
\setstackgap{S}{-\rlwd}
\fixTABwidth{T}
\newcommand\Dcell[1][]{\protect\Dcellraw{#1}}
\newcommand\Dcellraw[1]{%
\stackunder[\cellvgap]{%
\stackon[\cellvgap]{\makebox[\cellfield]{\strut#1}}{%
\rule[\dimexpr-\rlln+\rlwd\relax]{\rlwd}{\rlln}\rule{\rlln}{\rlwd}%
\hspace{\cellhgap}%
\rule{\rlln}{\rlwd}\rule[\dimexpr-\rlln+\rlwd\relax]{\rlwd}{\rlln}}%
}{%
\rule{\rlwd}{\rlln}\rule{\rlln}{\rlwd}%
\hspace{\cellhgap}%
\rule{\rlln}{\rlwd}\rule{\rlwd}{\rlln}%
}\kern-\dimexpr\rlwd%
}
\begin{document}
\tabbedShortstack{
\Dcell[xyz]&\Dcell\cr
\Dcell[z]&\Dcell[abcdefg]
}
\end{document}