@ {\ hskip} e \ multicolumns

Sep 26 2020

Considera la seguente tabella

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

Voglio sottolineare il raggruppamento delle colonne, da cui la costruzione @

\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}

Ora devo mettere a punto la multicolonna perché lo spazio orizzontale è spento

\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}

Perché le sporche costanti? Può essere fatto in modo più automatico?

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}

PS In questa domanda: problemi con l'allineamento quando si utilizzano più colonne e @ {\ hskip}? , La risposta suggerisce di sopprimere \tabcolseputilizzando un vuoto @{}. Si può vedere che questo non ti dà sempre il risultato desiderato.

Risposte

1 DavidCarlisle Sep 26 2020 at 05:06

Le @espressioni fanno parte del bordo destro della colonna pertinente, quindi quando si utilizza \multicolumnripetere l'intero componente per l'intervallo, inclusa l' @espressione della mano destra :

\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}