booktabs 패키지로 테이블을 만드는 방법은 무엇입니까?

booktabs 패키지로 테이블을 만드는 방법은 무엇입니까?

booktabs 패키지를 사용하여 다음 테이블을 만들고 싶지만 어떻게 해야 할지 잘 모르겠습니다.

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

그리고

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

어떤 도움이라도 대단히 감사하겠습니다!

답변1

Calstable 및 Tabularx 테이블

다음은 두 테이블 모두 calstables로 조판된 것입니다.. 패키지를 사용하여칼로리. 나는 또한 다음을 사용하여 첫 번째 테이블을 조판했습니다.표 형식,hhline,정렬그리고여러 줄. 나는 사용했다표 형식, 해당 패키지는 필요한 모든 변수를 고려하여 열 너비를 계산할 수 있기 때문입니다.

안정된

calstable는 이중 규칙(이중 테두리)을 지원하지 않으므로 좁은 행과 열을 사용하여 이러한 규칙을 위조했습니다.

동일한 문서에서 두 테이블을 모두 조판했기 때문에 테이블 설정 명령과 바로가기 정의를 테이블 서문에서 문서 서문으로 옮겼습니다. 단일 규칙이 이중 이중 규칙을 자르지 않도록 모든 규칙(라인)을 조정했습니다. 따라서 개별 셀에 대한 규칙을 제거하고 켜는 데 여러 위치에서 사용되는 바로가기 \lb가 표시됩니다 . \rb이중 수직선이 이중 수평선에 어떻게 연결되는지는 현지 인쇄 전통에 따라 다르므로 귀하의 관할권에서 선택이 정확할 수 있다고 보장할 수 없습니다.

올바른 행 높이로 테이블을 조판하기 위해 일부 셀 내용을 채웠고 결과적으로 첫 번째 테이블의 행 높이를 늘려서 \baselineskips, 이전 예와 비교. 또한 문서화된 후크를 사용하여 모든 셀의 셀 내용을 세로 중앙에 배치했습니다. 다음 명령을 참조하세요 \def\cals@AtBeginCell{\vfil}.

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

\documentclass{article}
\usepackage{cals}

% Set up the carlstable
\makeatletter
%% All rules of same weight
\def\cals@framers@width{0.3pt}   % Outside frame rules, reduce if the rule is too heavy
\def\cals@framecs@width{0.3pt}
\def\cals@bodyrs@width{0.3pt}
\def\cals@cs@width{0.3pt}             % Inside rules, reduce if the rule is too heavy
\def\cals@rs@width{0.3pt}
\def\cals@AtBeginCell{\vfil}            % All cell contents vertically centred

% Shorthands for spanning cells, table rules and the spece between columns and rows (padding)
\let\nc=\nullcell
\let\sc=\spancontent

\def\rb{\ifx\cals@borderR\relax     % Right Border (rules) switch (off-on)
    \def\cals@borderR{0.0pt}
\else \let\cals@borderR\relax\fi}

\def\lb{\ifx\cals@borderL\relax     % Left Border switch (off-on)
    \def\cals@borderL{0.0pt}
\else \let\cals@borderL\relax\fi}

\def\bb{\ifx\cals@borderB\relax     % Bottom Border switch (off-on)
    \def\cals@borderB{0.0pt}
\else \let\cals@borderB\relax\fi}

\def\tp{\ifdim\cals@paddingT=0.0pt\relax    % Top padding switch (off-on)
\cals@setpadding{Ag}
\else \setlength{\cals@paddingT}{0pt}\fi}

\def\bp{\ifdim\cals@paddingB=0.0pt\relax    % Bottom padding switch (off-on)
\cals@setpadding{Ag}
\else \setlength{\cals@paddingB}{0pt}\fi}
\makeatother

\begin{document}

\begin{calstable}[c]
% Defining 11 columns, 2 are for double vertical rules (col2 and col7)
\colwidths{{\dimexpr(\columnwidth/21*3)}
                   {2pt}
                   {\dimexpr(\columnwidth/21*2)}
                   {\dimexpr(\columnwidth/21*1)}
                   {\dimexpr(\columnwidth/21*2)}
                   {\dimexpr(\columnwidth/21*4)}
                   {2pt}
                   {\dimexpr(\columnwidth/21*2)}
                   {\dimexpr(\columnwidth/21*1)}
                   {\dimexpr(\columnwidth/21*2)}
                   {\dimexpr(\columnwidth/21*4)}
            }

\makeatletter
% R1H1  % This first row is just to ‘fake’ double horizontal lines
\thead{%
\brow
    \rb\tp\cell{}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}\rb
    \cell{}\tp
    \ht\cals@current@row=2pt
\erow
%
%R2H2 % Header
\brow
    \alignC\cell{C}
    \bb\cell{}\bb
    \nc{ltb}
    \nc{tb}
    \nc{tb}
    \nc{rtb}\sc{}
    \bb\cell{}\bb
    \nc{ltb}
    \nc{tb}
    \nc{tb}
    \nc{rtb}\sc{}
\erow
}
\tfoot{\lastrule\strut}
%R3B1
\brow
    \cell{C}
    \bb\cell{}\bb
    \nc{ltb}
    \nc{rtb}\sc{}
    \cell{}
    \cell{}
    \bb\cell{}\bb
    \nc{ltb}
    \nc{rtb}\sc{}
    \cell{}
    \cell{}
\erow
%R4B2
\brow
    \nc{lrt}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \ht\cals@current@row=2\normalbaselineskip
\erow
%R5B3
\brow
    \nc{lrb}\alignC\sc{C}
    \bb\cell{}\bb
    \cell{C}
    \cell{}
    \cell{}
    \cell{}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}
    \cell{}
\erow
%R6B4
\brow
    \nc{lrt}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \ht\cals@current@row=2\normalbaselineskip
\erow
%R7B5
\brow
    \nc{lrb}\alignC\sc{C}
    \bb\cell{}\bb
    \cell{C}
    \cell{}
    \cell{}
    \cell{}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}
    \cell{}
\erow
%R8B6
\brow
    \nc{lrt}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \ht\cals@current@row=2\normalbaselineskip
\erow
%R9B7
\brow
    \nc{lrb}\alignC\sc{C}
    \bb\cell{}\bb
    \cell{C}
    \cell{}
    \cell{}
    \cell{}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}
    \cell{}
\erow
%R10B9  % This last row is just to ‘fake’ double horizontal lines
\brow
    \rb\bp\cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
    \cell{}\rb
    \cell{}\bp
    \ht\cals@current@row=2pt
\erow
\makeatletter
\end{calstable}\par

\vspace{1cm}

\begin{calstable}[l]
% Defining 5 columns, 1 are for double vertical rules (col2)
\colwidths{{\dimexpr(\columnwidth/15*3)}
                   {2pt}
                   {\dimexpr(\columnwidth/15*2)}
                   {\dimexpr(\columnwidth/15*1)}
                   {\dimexpr(\columnwidth/15*3)}
            }

\makeatletter
% R1H1  % This first row is just to ‘fake’ double horizontal lines
\thead{%
\brow
    \rb\tp\cell{}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}\rb\tp
    \ht\cals@current@row=2pt
\erow
%
%R2H2 % Header
\brow
    \alignC\cell{C}
    \bb\cell{}\bb
    \cell{}
    \cell{}
    \cell{}
\erow
}
\tfoot{\lastrule\strut}
%R4B2
\brow
    \bb\cell{C}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
\erow
%R5B3
\brow
    \cell{C}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
\erow
%R6B4
\brow
    \cell{C}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
\erow
%R7B5
\brow
    \cell{C}
    \cell{}
    \cell{}
    \cell{}
    \cell{}
\erow
%R8B6
\brow
    \bb\cell{C}\bb
    \cell{}
    \bb\cell{}
    \cell{}
    \cell{}\bb
\erow
%R10B9  % This last row is just to ‘fake’ double horizontal lines
\brow
    \bb\rb\bp\cell{}
    \cell{}
    \cell{}
    \cell{}\rb
    \cell{}\bb
    \ht\cals@current@row=2pt
\erow
\makeatletter
\end{calstable}\par
\end{document}

tabularx와 친구들

다음은 첫 번째 테이블 조판입니다.표 형식그리고 친구들. 보시다시피 열과 열 너비의 설정과 정의는 매우 복잡합니다. 올바른 연결 규칙을 갖기 위해 다음을 사용했습니다.hhline패키지.

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

\documentclass{article}
\usepackage{array, tabularx, multirow, hhline}

% Two shorthands to secured equal rowheigth 
\newcommand*{\hz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{1.5\normalbaselineskip}}}}
\newcommand*{\vz}{\vphantom{\parbox[c]{1cm}{\rule{1cm}{2.5\normalbaselineskip}}}}

% Define four new X column types based on width. tabularx takes care of the maths involved
\newcolumntype{A}{>{\centering\arraybackslash\hsize=0.4\hsize\linewidth=\hsize}X}
\newcolumntype{B}{>{\centering\arraybackslash\hsize=0.3\hsize\linewidth=\hsize}X}
\newcolumntype{C}{>{\centering\arraybackslash\hsize=0.2\hsize\linewidth=\hsize}X}
\newcolumntype{D}{>{\centering\arraybackslash\hsize=0.1\hsize\linewidth=\hsize}X}

% Uncomment to see margins etc.
%\usepackage{showframe}
%\renewcommand*\ShowFrameColor{\color{red}}
%\renewcommand*\ShowFrameLinethickness{.15pt}

\setlength{\tabcolsep}{0.5em}
\setlength{\extrarowheight}{4pt} % Push first line of text away from rules above.

\begin{document}

\centering
\begin{tabularx}{\linewidth}{|B||C|D|C|A||C|D|C|A|}

\hhline{|*{9}{=}|}
\hz B   &    \multicolumn{4}{c||}{}   &  \multicolumn{4}{c|}{}\\
\hhline{|-||----||----|}
\hz B   &    \multicolumn{2}{c|}{}   &    &      &   \multicolumn{2}{c|}{} &   & \\
\hhline{|-||--|-|-||--|-|-|}
\vz\multirow[c]{3}{=}{\centering B}     &       &      &    &      &    &   &   & \\
\hhline{|~||--|-|-||--|-|-|}
\hz     &    C  &      &    &      &    &   &   & \\
\hhline{|-||--|-|-||--|-|-|}
\vz\multirow[c]{3}{=}{B}    &       &     &    &      &    &   &   & \\
\hhline{|~||--|-|-||--|-|-|}
\hz     &    C  &      &   &      &    &   &   & \\
\hhline{|-||--|-|-||--|-|-|}
\vz \hz\multirow[c]{3}{=}{B}    &       &      &    &      &    &   &   & \\
\hhline{|~||--|-|-||--|-|-|}
\hz     &    C  &      &    &      &    &   &   &  \\
\hhline{|*{9}{=}|}

\end{tabularx}

\end{document}

관련 정보