Latex 表多列幫助

Latex 表多列幫助

我無法將我的頭包裹在乳膠中的多柱上。

\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{siunitx}
\usepackage{rotating}
\usepackage[colorlinks]{hyperref}

\sisetup{
 % insert global siunitx settings here
 separate-uncertainty=true,
 group-digits=false,
 round-pad=false,
 table-auto-round=true,
 group-separator={},
}

\newcolumntype{T}{S[table-format=2.1]}
\newcolumntype{U}{S[table-format=1.5(1)]}
\begin{document} 
   \begin{tabular}{ S TT UUUU }
     \toprule
     \multicolumn{2}{c}{\textbf{Mass fraction}, \textbf{Concentration}, \textbf{Density relative to \qty{4}{\degreeCelsius} water}} & \\
     \multicolumn{4}{c}{(\unit{\percent}) Volume (\unit{\percent}) Mass (\unit{\gram}/(\qty{100}{\mL}))
     \qty{10}{\degreeCelsius} \qty{20}{\degreeCelsius} \qty{25}{\degreeCelsius} \qty{30}{\degreeCelsius}} \\
     0    & 0     & 0     & 0.99973(2) & 0.99823(1) & 0.99708(3) & 0.99568(1) \\
     4.0  & 5.00  & 3.97  & 0.99258(1) & 0.99103(2) & 0.98984(2) & 0.98839(2) \\
     10.0 & 12.40 & 9.84  & 0.98393(2) & 0.98187(1) & 0.98043(2) & 0.97875(2) \\
     18.0 & 22.10 & 17.54 & 0.97473(1) & 0.97129(2) & 0.96923(1) & 0.96697(1) \\
     25.0 & 30.40 & 24.12 & 0.96665(2) & 0.96168(3) & 0.95895(2) & 0.95607(3) \\
     28.0 & 33.90 & 26.90 & 0.96268(3) & 0.95710(1) & 0.95410(3) & 0.95098(2) \\
     30.0 & 36.20 & 28.73 & 0.95977(1) & 0.95382(2) & 0.95067(2) & 0.94741(2) \\
   \bottomrule
   \end{tabular}
\end{document}

生成後看起來像這樣: 礦

如何讓表格的前兩行看起來像下面的行?

目標

答案1

設定多列非常簡單,但您的表格不適合頁面。

這裡有兩種解決方案:1)橫向表格或2)在寬度為零的框中超出頁面邊框的表格:

\documentclass{article}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage{array}
\usepackage{siunitx}
\usepackage{rotating}
\usepackage[colorlinks]{hyperref}

\sisetup{
 % insert global siunitx settings here
 separate-uncertainty=true,
 group-digits=false,
 round-pad=false,
 table-auto-round=true,
 group-separator={},
}

\newcolumntype{T}{S[table-format=2.1]}
\newcolumntype{U}{S[table-format=1.5(1)]}

\begin{document}
\begin{sidewaystable}\small\centering
   \begin{tabular}{@{}S TT UUUU@{}}
     \toprule
     \textbf{Mass fraction} &\multicolumn{2}{c}{\textbf{Concentration}}&\multicolumn{4}{c}{\textbf{Density relative to \qty{4}{\degreeCelsius} water}} \\
     \cmidrule(lr){2-3}\cmidrule(l){4-7}
     {(\unit{\percent})} & {Volume (\unit{\percent})} & {Mass (\unit{\gram}/(\qty{100}{\mL}))} &
     {\qty{10}{\degreeCelsius}} & {\qty{20}{\degreeCelsius}} & {\qty{25}{\degreeCelsius}} & {\qty{30}{\degreeCelsius}} \\
     \midrule
     0    & 0     & 0     & 0.99973(2) & 0.99823(1) & 0.99708(3) & 0.99568(1) \\
     4.0  & 5.00  & 3.97  & 0.99258(1) & 0.99103(2) & 0.98984(2) & 0.98839(2) \\
     10.0 & 12.40 & 9.84  & 0.98393(2) & 0.98187(1) & 0.98043(2) & 0.97875(2) \\
     18.0 & 22.10 & 17.54 & 0.97473(1) & 0.97129(2) & 0.96923(1) & 0.96697(1) \\
     25.0 & 30.40 & 24.12 & 0.96665(2) & 0.96168(3) & 0.95895(2) & 0.95607(3) \\
     28.0 & 33.90 & 26.90 & 0.96268(3) & 0.95710(1) & 0.95410(3) & 0.95098(2) \\
     30.0 & 36.20 & 28.73 & 0.95977(1) & 0.95382(2) & 0.95067(2) & 0.94741(2) \\
   \bottomrule
   \end{tabular}
   \caption{Properties of aqueous ethanol solution (Wikipedia)}
\end{sidewaystable}

\begin{table}\small\centering\makebox[0pt]{%
   \begin{tabular}{@{}S TT UUUU@{}}
     \toprule
     \textbf{Mass fraction} &\multicolumn{2}{c}{\textbf{Concentration}}&\multicolumn{4}{c}{\textbf{Density relative to \qty{4}{\degreeCelsius} water}} \\
     \cmidrule(lr){2-3}\cmidrule(l){4-7}
      & {Volume } & {Mass } &
     & & & \\
     {(\unit{\percent})} & {(\unit{\percent})} & {(\unit{\gram}/(\qty{100}{\mL}))} &
     {\qty{10}{\degreeCelsius}} & {\qty{20}{\degreeCelsius}} & {\qty{25}{\degreeCelsius}} & {\qty{30}{\degreeCelsius}} \\
     \midrule
     0    & 0     & 0     & 0.99973(2) & 0.99823(1) & 0.99708(3) & 0.99568(1) \\
     4.0  & 5.00  & 3.97  & 0.99258(1) & 0.99103(2) & 0.98984(2) & 0.98839(2) \\
     10.0 & 12.40 & 9.84  & 0.98393(2) & 0.98187(1) & 0.98043(2) & 0.97875(2) \\
     18.0 & 22.10 & 17.54 & 0.97473(1) & 0.97129(2) & 0.96923(1) & 0.96697(1) \\
     25.0 & 30.40 & 24.12 & 0.96665(2) & 0.96168(3) & 0.95895(2) & 0.95607(3) \\
     28.0 & 33.90 & 26.90 & 0.96268(3) & 0.95710(1) & 0.95410(3) & 0.95098(2) \\
     30.0 & 36.20 & 28.73 & 0.95977(1) & 0.95382(2) & 0.95067(2) & 0.94741(2) \\
   \bottomrule
   \end{tabular}%
   }
   \caption{Properties of aqueous ethanol solution (Wikipedia)}
\end{table}
\end{document}

側身:

在此輸入影像描述

出國界:

在此輸入影像描述

相關內容