
tabu
나는 테이블을 생성하기 위한 가장 뛰어난 최신 패키지라고 들었던 패키지를 사용하여 다음과 같은 테이블을 생성하고 싶습니다 .
-------------------------------------
|A | B | C|
| | | |
| | | |
-------------------------------------
| | | |
|A | B | C|
| | | |
-------------------------------------
| | | |
| | | |
|A | B | C|
-------------------------------------
단순한 표이지만 각 셀의 텍스트가 다르게 정렬되어 있습니다. 패키지 문서에는 열을 수직( , , 사용 ) 및 수평( , , , 사용) X
으로 동시에 정렬할 수 있다고 나와 있지만 이 기능을 사용하여 이 테이블을 생성하는 방법을 찾을 수 없습니다. 나는 이 목적과 같은 일부 낮은 수준의 명령을 사용하는 것이 항상 가능하다는 것을 알고 있지만 이를 수행하는 더 좋은 방법이 있는지 알고 싶습니다.p
m
b
l
c
r
j
\parbox
그러한 테이블을 생성하거나 정렬에 도움을 줄 수 있는 다른 패키지가 있는 경우 여기에서 논의하세요.
답변1
tabu
ia는 사용하기에 위험한 패키지입니다. 버그가 많고 유지 관리되지 않습니다. 게다가 새 버전은 현재 버전과 호환되지 않습니다. 이 시점에서 나의 조언은 사용하지 않는 것입니다 tabu
(참조this thread
~에ctt).
당신은 단순히array
패키지를 사용하여 일부 열 유형을 선언한 다음 \multicolumn
한 유형에서 다른 유형으로 전환하는 데 도움이 될 수 있습니다.
\documentclass{article}
\usepackage{array}
\newcolumntype{L}[4]{
>{\vspace{0pt}\minipage[c][#2][#3]{3cm}%
\ifx#4r\relax\raggedright
\else
\ifx#4l\relax\raggedleft
\else
\ifx#4c\relax\centering
\fi\fi\fi
}p{#1}
<{\endminipage\vspace{\tabcolsep}}}
\begin{document}
\noindent\begin{tabular}{|L{3cm}{3cm}{t}{r}|L{3cm}{3cm}{t}{c}|L{3cm}{3cm}{t}{l}|}
\hline
A & B & C \tabularnewline
\hline
\multicolumn{1}{|L{3cm}{3cm}{c}{r}|}{A}
& \multicolumn{1}{L{3cm}{3cm}{c}{c}|}{B}
& \multicolumn{1}{L{3cm}{3cm}{c}{l}|}{C}
\tabularnewline
\hline
\multicolumn{1}{|L{3cm}{3cm}{b}{r}|}{A}
& \multicolumn{1}{L{3cm}{3cm}{b}{c}|}{B}
& \multicolumn{1}{L{3cm}{3cm}{b}{l}|}{C}
\tabularnewline
\hline
\end{tabular}
\end{document}
L
열 유형 의 구문 은 다음과 같습니다.
L{<width>}{<height>}{<v. position>}{<text justification>}
여기서 셀의 너비와 높이를 제어하고 <width>
,<height>
<v. position>
셀 내부 텍스트의 수직 위치(가능한 값: t
위쪽, c
중앙, b
, 아래쪽)를 제어하고 <text justification>
셀 내부 텍스트의 정렬을 제어합니다(가능한 값: l
raggedleft, c
centered, r
raggedright ) ).
답변2
다음은 Roberto Bonvallet(출처:http://www.texample.net/tikz/examples/sudoku/).
% Original author: Roberto Bonvallet
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\newcounter{row}
\newcounter{col}
\newcommand\setrow[9]{
\setcounter{col}{1}
\foreach \n in {#1, #2, #3, #4, #5, #6, #7, #8, #9} {
\edef\x{\value{col} - 0.5}
\edef\y{9.5 - \value{row}}
\node[anchor=center] at (\x, \y) {\n};
\stepcounter{col}
}
\stepcounter{row}
}
\begin{document}
\begin{tikzpicture}
\draw[scale=3] (0, 0) grid (3, 3);
\setcounter{row}{1}
\setrow {A}{ }{ } { }{B}{ } { }{ }{C}
\setrow { }{ }{ } { }{ }{ } { }{ }{ }
\setrow { }{ }{ } { }{ }{ } { }{ }{ }
\setrow { }{ }{ } { }{ }{ } { }{ }{ }
\setrow {A}{ }{ } { }{B}{ } { }{ }{C}
\setrow { }{ }{ } { }{ }{ } { }{ }{ }
\setrow { }{ }{ } { }{ }{ } { }{ }{ }
\setrow { }{ }{ } { }{ }{ } { }{ }{ }
\setrow {A}{ }{ } { }{B}{ } { }{ }{C}
\end{tikzpicture}
\end{document}
답변3
패키지를 추천드리고 싶습니다 cals
. 문서 "사용 예" 3페이지에는 원하는 테이블이 표시됩니다.
\documentclass{article}
\usepackage{xcolor,cals}% http://ctan.org/pkg/{xcolor,cals}
\begin{document}
\makeatletter
\newcommand\bbrow{\brow\setbox\cals@current@row=\hbox{\vbox to 3cm{}}}
\newenvironment{decotable}{\begin{calstable}
\Large\cals@setpadding{Ag}\cals@setcellprevdepth{Al}
\cals@paddingL=0pt \relax
\cals@paddingR=0pt \relax
\def\cals@framecs@width{2pt}
\def\cals@rs@width{8pt}
\def\cals@cs@width{4pt}
}{\end{calstable}}
\begin{decotable}
\colwidths{{3cm}{3cm}{3cm}}
\bbrow
\cell{left,\\top}
\alignC \cell{center,\\top}
\def\cals@borderL{0pt}\def\cals@borderB{0pt}
\alignR \cell{right,\\top} \erow
\let\cals@borderL=\relax \let\cals@borderB=\relax
\bbrow
\alignL \cell{\vfil left,\\middle}
\alignC \cell{\vfil center,\\middle}
\alignR \cell{\vfil right,\\middle} \erow
\bbrow
\def\cals@bgcolor{green}
\alignL \cell{\vfill left,\\bottom}
\def\cals@bgcolor{}
\alignC \cell{\vfill center,\\bottom}
\alignR \cell{\vfill right,\\bottom} \erow
\end{decotable}
\end{document}