표: 다중 열 문제

표: 다중 열 문제

논문을 작성 중인데 다음과 같은 문제가 있습니다.

C, H, N, S, O 값이 포함된 열 중앙 및 위에 "궁극적 분석"이라는 제목이 관찰되고 싶습니다.

"근사 분석"이라는 제목과 유사하며 VM, FC 및 Ash 값이 포함된 열 중앙 및 위에 위치합니다.

\documentclass[preprint,12pt]{elsarticle}
        % !TeX spellcheck = en_US 
        \usepackage{multirow} % para las tablas
        \usepackage{siunitx}% paquete para manejo de números y unidades
        \sisetup{detect-weight, detect-display-math}
        \sisetup{detect-inline-weight=math}
        \sisetup{mode=text,per-mode=symbol}% modo de unidades con barra en lugar de fracción de tamaño reducido
        \usepackage{booktabs}% para tablas
        \usepackage{graphicx}% para gráficos
        \usepackage{pgfplots}% para gráficos
        \usepackage{pdflscape}% para gráficos
        \pgfplotsset{compat=newest}% para gráficos
        \usetikzlibrary{plotmarks}% para gráficos
        \usetikzlibrary{arrows.meta}% para gráficos
        \usepgfplotslibrary{patchplots}% para gráficos
        \newlength\fwidth% definido en el código de Matlab
        \setlength{\fwidth}{0.8\textwidth}% defino valor de parámetro fwidth de gráficos
        \usepackage{tikzscale}% para gráficos
        \pgfplotsset{plot coordinates/math parser=false}% para gráficos
        \usepackage{overpic}% figuras
        \usepackage{tikz}% figuras
        \pgfplotsset{compat=1.15}
        \usepackage{float}
        \usepackage[margin=2.5cm]{geometry}% setea márgenes de hoja
        \usepackage{bicaption}
        \usepackage{makecell}
        \renewcommand\theadfont{\bfseries}
        \renewcommand\theadgape{}
        \usepackage[skip=1ex, labelfont=bf]{caption}
        \usepackage[skip=0.333\baselineskip]{caption}
        \usepackage{amssymb,amsmath}
        \usepackage{tabularx}
        \usepackage{url}
        \def\UrlFont{\normalfont}
        \newcolumntype{C}{>{\centering\arraybackslash}X}
        \setlength{\fwidth}{0.8\textwidth}
        \biboptions{sort&compress}
        \bibliographystyle{unsrt}
        \usepackage{subcaption}

        \journal{Applied Energy}

    \begin{document}
        \begin{table} [H]
            \setlength\tabcolsep{4pt}
            \caption{Characteristics of OS and biomass samples.}
            \label{Chemical properties of OS and the blends}
            \begin{tabularx}{\textwidth}{@{}l *{8}{C} @{}}
                \toprule
                Material
                & \multicolumn{4}{>{\hsize=\dimexpr4\hsize+8\tabcolsep\relax}C}{\textbf{Ultimate analysis}} 
                & \multicolumn{4}{>{\hsize=\dimexpr4\hsize+8\tabcolsep\relax}C}{\textbf{Proximate analysis}}\\ 
                & \multicolumn{4}{c}{(wt. \%)}
                & \multicolumn{4}{c}{(wt. \%)}\\
                \cmidrule(lr){2-6} \cmidrule(lr){7-9}
                & \textbf{C} &\textbf{ H} & \textbf{N} & \textbf{S}& \textbf{O}$^\gamma$ & \textbf{VM} & \textbf{FC} $^{\varphi}$ & \textbf{Ash}\\
                \midrule
                \textbf{OS} &9.3 &2.3 &0.2 &4.0 & 11.6 &24.0 &3.4 &72.6 \\
                \textbf{GP}&48.8 &6.0 &1.9 &0.2& 35.7 &72.7 &19.9 &7.4 \\
                \textbf{RH}&35.3 &4.7 &0.3 &0.1& 37.8 &64.4 & 12.8 &21.8 \\
                \textbf{EG}& 48.2&5.9 & $<$D.L&$<$D.L&45.7 &88.5 &11.3 &0.24\\
                \bottomrule
            \end{tabularx}
            \smallskip\footnotesize
            VM: volatile matter, FC: Fixed carbon, D.L: detention limit. All values are expressed in dry basis.\\ 
            $\varphi$: Determined by difference: $\text{FC}=100\%-\text{VM}\%-\text{Ash}\%$.\\
            All reported values are given with an error of 1\% of the value.\\
            $^\gamma$: Determined by difference: \%O = 100\% - C\% - H\% - N\% - S\% - Ash\%.\\
        \end{table}

\end{document}

답변1

코드의 문제는 코드 4 및 4 열에서와 달리 5 및 3 열을 중앙에 배치하려는 것입니다.

            & \multicolumn{5}{c}{\textbf{Ultimate analysis}} % <========
            & \multicolumn{3}{c@{}}{\textbf{Proximate analysis}}\\ % <=====
            & \multicolumn{5}{c}{(wt. \%)} % <==========================
            & \multicolumn{3}{c@{}}{(wt. \%)}\\ % <========================

완전히 수정된 MWE

\documentclass[preprint,12pt]{elsarticle}
    % !TeX spellcheck = en_US 
    \usepackage{multirow} % para las tablas
    \usepackage{siunitx}% paquete para manejo de números y unidades
    \sisetup{detect-weight, detect-display-math}
    \sisetup{detect-inline-weight=math}
    \sisetup{mode=text,per-mode=symbol}% modo de unidades con barra en lugar de fracción de tamaño reducido
    \usepackage{booktabs}% para tablas
    \usepackage{graphicx}% para gráficos
    \usepackage{pgfplots}% para gráficos
    \usepackage{pdflscape}% para gráficos
    \pgfplotsset{compat=newest}% para gráficos
    \usetikzlibrary{plotmarks}% para gráficos
    \usetikzlibrary{arrows.meta}% para gráficos
    \usepgfplotslibrary{patchplots}% para gráficos
    \newlength\fwidth% definido en el código de Matlab
    \setlength{\fwidth}{0.8\textwidth}% defino valor de parámetro fwidth de gráficos
    \usepackage{tikzscale}% para gráficos
    \pgfplotsset{plot coordinates/math parser=false}% para gráficos
    \usepackage{overpic}% figuras
    \usepackage{tikz}% figuras
    \pgfplotsset{compat=1.15}
    \usepackage{float}
    \usepackage[margin=2.5cm]{geometry}% setea márgenes de hoja
    \usepackage{bicaption}
    \usepackage{makecell}
    \renewcommand\theadfont{\bfseries}
    \renewcommand\theadgape{}
    \usepackage[skip=1ex, labelfont=bf]{caption}
    \usepackage[skip=0.333\baselineskip]{caption}
    \usepackage{amssymb,amsmath}
    \usepackage{tabularx}
    \usepackage{url}
    \def\UrlFont{\normalfont}
    \newcolumntype{C}{>{\centering\arraybackslash}X}
    \setlength{\fwidth}{0.8\textwidth}
    \biboptions{sort&compress}
    \bibliographystyle{unsrt}
    \usepackage{subcaption}

    \journal{Applied Energy}

\begin{document}
\begin{table} [H]
\setlength\tabcolsep{4pt}
\caption{Characteristics of OS and biomass samples.}
\label{Chemical properties of OS and the blends}
\begin{tabularx}{\textwidth}{@{}l *{8}{C} @{}}
            \toprule
            Material
            & \multicolumn{5}{c}{\textbf{Ultimate analysis}} % <========
            & \multicolumn{3}{c@{}}{\textbf{Proximate analysis}}\\ % <=====
            & \multicolumn{5}{c}{(wt. \%)} % <==========================
            & \multicolumn{3}{c@{}}{(wt. \%)}\\ % <========================
            \cmidrule(lr){2-6} \cmidrule(lr){7-9}
            & \textbf{C} &\textbf{ H} & \textbf{N} & \textbf{S}& \textbf{O}$^\gamma$ & \textbf{VM} & \textbf{FC} $^{\varphi}$ & \textbf{Ash}\\
            \midrule
            \textbf{OS} &9.3 &2.3 &0.2 &4.0 & 11.6 &24.0 &3.4 &72.6 \\
            \textbf{GP}&48.8 &6.0 &1.9 &0.2& 35.7 &72.7 &19.9 &7.4 \\
            \textbf{RH}&35.3 &4.7 &0.3 &0.1& 37.8 &64.4 & 12.8 &21.8 \\
            \textbf{EG}& 48.2&5.9 & $<$D.L&$<$D.L&45.7 &88.5 &11.3 &0.24\\
            \bottomrule
        \end{tabularx}
        \smallskip\footnotesize
        VM: volatile matter, FC: Fixed carbon, D.L: detention limit. All values are expressed in dry basis.\\ 
        $\varphi$: Determined by difference: $\text{FC}=100\%-\text{VM}\%-\text{Ash}\%$.\\
        All reported values are given with an error of 1\% of the value.\\
        $^\gamma$: Determined by difference: \%O = 100\% - C\% - H\% - N\% - S\% - Ash\%.\\
\end{table}

결과는 다음과 같습니다.

결과 테이블

답변2

헤더는 각각 5열과 3열에 걸쳐 있어야 하고 헤더 셀에는 줄 바꿈이 허용되지 않으므로

& \multicolumn{4}{>{\hsize=\dimexpr4\hsize+8\tabcolsep\relax}C}{\textbf{Ultimate analysis}} 
& \multicolumn{4}{>{\hsize=\dimexpr4\hsize+8\tabcolsep\relax}C}{\textbf{Proximate analysis}}\\ 
& \multicolumn{4}{c}{(wt. \%)}
& \multicolumn{4}{c}{(wt. \%)}\\

~와 함께

& \multicolumn{5}{c}{\textbf{Ultimate analysis}}
& \multicolumn{3}{c@{}}{\textbf{Proximate analysis}}\\
& \multicolumn{5}{c}{(wt. \%)}
& \multicolumn{3}{c@{}}{(wt. \%)}\\

반면에 헤더 셀에 대해 자동 줄바꿈 기능이 유지되어야 한다고 생각하는 경우 문제의 네 줄에 대해 다음 코드를 사용해야 합니다.

& \multicolumn{5}{>{\hsize=\dimexpr5\hsize+8\tabcolsep\relax}C}{\textbf{Ultimate analysis}}
& \multicolumn{3}{>{\hsize=\dimexpr3\hsize+4\tabcolsep\relax}C@{}}{\textbf{Proximate analysis}}\\
& \multicolumn{5}{c}{(wt. \%)}
& \multicolumn{3}{c@{}}{(wt. \%)}\\

@{}어느 쪽이든 전체 tabularx사양에서는 테이블 오른쪽 가장자리의 공백을 억제하므로 열 정의에 입자를 추가해야 합니다 .



부록- 만약 이랬다면나의테이블, 나는 할 것이다~ 아니다tabularx어떤 셀에서도 자동 줄 바꿈을 허용할 필요도 없고 정당성도 없기 때문에 환경을 사용합니다 . 대신 tabular*너비가 \textwidth. 또한 헤더에 더 많은 구조를 제공하고 모든 헤더를 제거하겠습니다.굵은 글씨독자들에게 소리를 지르는 인상을 주지 않기 위해서입니다. 중요한 점은 8개 데이터 열 모두에 대해 S열 유형(패키지에서 제공 siunitx)을 사용하여 해당 소수점 표시의 숫자를 정렬할 수 있다는 것입니다.

여기에 이미지 설명을 입력하세요

\documentclass[preprint,12pt,numbers]{elsarticle}
% !TeX spellcheck = en_US
\journal{Applied Energy}

%% Commented out instructions of no relevance to the table at hand. 
%\usepackage{multirow}

\usepackage{siunitx}
\sisetup{detect-weight,
         detect-display-math,
         detect-inline-weight=math,
         mode=text,
         per-mode=symbol}
\usepackage{booktabs}
\usepackage{graphicx}

%\usepackage{pdflscape}
%\usepackage{pgfplots}
%\pgfplotsset{compat=newest}
%\usetikzlibrary{plotmarks}
%\usetikzlibrary{arrows.meta}
%\usepgfplotslibrary{patchplots}
%\usepackage{tikzscale}
%\pgfplotsset{plot coordinates/math parser=false}
%\usepackage{overpic}
%\usepackage{tikz}
%\pgfplotsset{compat=1.15}
%\newlength\fwidth
%\setlength{\fwidth}{0.8\textwidth}

\usepackage{float}
\usepackage[margin=2.5cm]{geometry}

%\usepackage{makecell}
%\renewcommand\theadfont{\bfseries}
%\renewcommand\theadgape{}

\usepackage{caption,subcaption}
\captionsetup{skip=1ex,labelfont=bf}
\usepackage{amssymb,amsmath,tabularx,url}
\def\UrlFont{\normalfont}

\biboptions{sort&compress}
\bibliographystyle{elsarticle-num} % or "unsrtnat"

\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro

\begin{document}

\begin{table}[H]
\setlength\tabcolsep{0pt}  %
\caption{Characteristics of OS and biomass samples.}
\label{tab:characteristics}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
             l
             S[table-format=2.1]
        *{3}{S[table-format=1.1]}
        *{3}{S[table-format=2.1]}
             S[table-format=2.2] }
\toprule
Material & \multicolumn{8}{c}{Type of Analysis}\\
\cmidrule{2-9}
& \multicolumn{5}{c}{Ultimate}
& \multicolumn{3}{c}{Proximate}\\
& \multicolumn{5}{c}{(wt.\ \%)}
& \multicolumn{3}{c}{(wt.\ \%)}\\
\cmidrule{2-6} \cmidrule{7-9}
& \mc{C} & \mc{H} & \mc{N} & \mc{S} & \mc{O$^\gamma$} 
& \mc{VM} & \mc{FC$^{\varphi}$} & \mc{Ash}\\
\midrule
OS & 9.3 &2.3 &0.2 &4.0 &11.6 &24.0 &3.4  &72.6 \\
GP &48.8 &6.0 &1.9 &0.2 &35.7 &72.7 &19.9 & 7.4 \\
RH &35.3 &4.7 &0.3 &0.1 &37.8 &64.4 &12.8 &21.8 \\
EG & 48.2&5.9 &{$<$D.L} &{$<$D.L}&45.7 &88.5 &11.3 &0.24\\
\bottomrule
\end{tabular*}

\medskip
\footnotesize
VM: volatile matter, FC: Fixed carbon, D.L: detention limit. All values are expressed in dry basis.

All reported values are given with an error of 1\% of the value.

$^\gamma$: Determined by difference: \%O = 100\% $-$ C\% $-$ H\% $-$ N\% $-$ S\% $-$ Ash\%.

$^\varphi$: Determined by difference: FC = 100\% $-$ VM\% $-$ Ash\%.

\end{table}

\end{document}

관련 정보