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

ฉันต้องการเน้นการจัดกลุ่มของคอลัมน์ดังนั้น @ -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}

ตอนนี้ฉันต้องปรับหลายคอลัมน์อย่างละเอียดเพราะพื้นที่แนวนอนปิดอยู่

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