@ {\ hskip} y \ multicolumns
Considere la siguiente tabla
\begin{tabular}{cccccc}
\toprule
N & \multicolumn3c{L-family} & \multicolumn2c{H-family} \\
n & large & Large & LARGE & huge & Huge \\
\bottomrule
\end{tabular}
Quiero enfatizar la agrupación de columnas, de ahí la construcción @
\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}
Ahora tengo que afinar la multicolumna porque el espacio horizontal está apagado
\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}
¿Por qué las constantes sucias? ¿Se puede hacer de forma más automática?
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}
PD En esta pregunta: ¿ Problema con la alineación al usar varias columnas y @ {\ hskip}? , La respuesta sugiere suprimir \tabcolsepusando un vacío @{}. Se puede ver que esto no siempre le da el resultado deseado.
Respuestas
Las @expresiones son parte del borde derecho de la columna relevante, por lo que cuando use, \multicolumnrepita el componente completo para el tramo, incluida su @expresión a la derecha :
\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}