@ {\ hskip} 및 \ multicolumns

Sep 26 2020

다음 표를 고려하십시오.

\begin{tabular}{cccccc}
    \toprule
    N   &       \multicolumn3c{L-family}    &   \multicolumn2c{H-family}    \\
    n   &   large   &   Large   &   LARGE   &       huge    &   Huge        \\
    \bottomrule
\end{tabular}

열 그룹화를 강조하고 싶습니다.

\def\htc#1{ {\hskip#1\tabcolsep} }
\begin{tabular}{c  @\htc4  ccc  @\htc4  cc}
    \toprule
    N   &       \multicolumn3c{L-family}    &   \multicolumn2c{H-family}    \\
    n   &   large   &   Large   &   LARGE   &       huge    &   Huge        \\
    \bottomrule
\end{tabular}

이제 가로 공간이 꺼져 있으므로 여러 열을 미세 조정해야합니다.

\begin{tabular}{c  @\htc4  ccc  @\htc4  cc}
\toprule
N   &   \multicolumn3{@\htc{-3}c}{L-family} &   \multicolumn2{@\htc0c}{H-family}
\\
n   &   large   &   Large   &   LARGE       &       huge        &       Huge    
\\
\bottomrule
\end{tabular}

왜 더티 상수인가? 더 자동적으로 할 수 있습니까?

MWE

\documentclass{article}
\usepackage{booktabs}
\begin{document}

\parskip1em

Consider the following table

\begin{tabular}{cccccc}
    \toprule
    N   &       \multicolumn3c{L-family}    &   \multicolumn2c{H-family}    \\
    n   &   large   &   Large   &   LARGE   &       huge    &   Huge        \\
    \bottomrule
\end{tabular}

~

I want to emphasis the grouping of columns, hence the @-construction

\def\htc#1{ {\hskip#1\tabcolsep} }
\begin{tabular}{c  @\htc4  ccc  @\htc4  cc}
    \toprule
    N   &       \multicolumn3c{L-family}    &   \multicolumn2c{H-family}    \\
    n   &   large   &   Large   &   LARGE   &       huge    &   Huge        \\
    \bottomrule
\end{tabular}

~

Now I have to fine-tune the multicolumn

\begin{tabular}{c  @\htc4  ccc  @\htc4  cc}
\toprule
N   &   \multicolumn3{@\htc{-3}c}{L-family} &   \multicolumn2{@\htc0c}{H-family}
\\
n   &   large   &   Large   &   LARGE       &       huge        &       Huge    
\\
\bottomrule
\end{tabular}

Why the dirty constantss?

\end{document}

추신이 질문에서 : 다중 열 및 @ {\ hskip}를 사용할 때 정렬 문제가 있습니까? , 대답은 \tabcolsep빈 @{}. 이것이 항상 원하는 결과를 제공하지는 않는다는 것을 알 수 있습니다.

답변

1 DavidCarlisle Sep 26 2020 at 05:06

@사용하는 경우 표현은 관련 컬럼의 오른쪽 가장자리의 일부이기 때문에 \multicolumn오른쪽 손을 포함하여 범위에 대한 반복을 전체 구성 요소를 @표현 :

\documentclass{article}
\usepackage{booktabs}
\def\htc#1{ {\hskip#1\tabcolsep} }
\begin{document}

\parskip1em


I want to emphasis the grouping of columns, hence the @-construction


\begin{tabular}{c  @{\htc4}  ccc  @{\htc4}  cc}
    \toprule
    N   &       \multicolumn{3}{c@{\htc4}}{L-family}    &   \multicolumn{2}{c}{H-family}    \\
    n   &   large   &   Large   &   LARGE   &       huge    &   Huge        \\
    \bottomrule
\end{tabular}


\end{document}