Помощь с несколькими столбцами таблицы 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}

Боком:

введите описание изображения здесь

За пределами границ:

введите описание изображения здесь

Связанный контент