长表和表格标题垂直和水平对齐

长表和表格标题垂直和水平对齐

我的问题类似这个问题,表格表和长表的标题对齐方式不同。我希望标题与表格形式一致,顶部边缘有一些白色填充,并与顶部规则的左侧对齐。我尝试按照建议使用 [singlelinecheck=off],但它没有改变任何东西。然后我想尝试按照建议以另一种方式重新定义 \LT@caption,但我不知道如何重新定义它以使其成为表格形式。

我猜部分问题可能与我的预设边距有关,但即使我删除了 a4paper 设置,它也无法正确对齐。任何帮助或见解都将不胜感激。提前谢谢您!

\documentclass{article}

\usepackage{array}
\usepackage{changepage}
\usepackage[a4paper, vmargin=0.05cm, hmargin=0.1cm, marginparwidth=0.1cm,total={210mm,297mm}]{geometry}
\usepackage{rotating}
\usepackage[singlelinecheck=off]{caption}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{multirow, makecell, xcolor}
\usepackage[separate-uncertainty=true]{siunitx}
\usepackage{threeparttable}
\usepackage{threeparttablex} 
\usepackage{longtable}


\newlength{\mylength} \settowidth{\mylength}{$-55.55\pm0.55$}
\makeatletter
\newcommand\notsotiny{\@setfontsize\notsotiny{6.5}{7.5}}
\makeatother
\newcommand{\ts}[1]{\textsubscript{#1}}

\begin{document}    
\begin{landscape}
    \sisetup{
        table-number-alignment=center,
        separate-uncertainty=true,
        table-column-width = 2cm,
        table-format =-2.2,
        separate-uncertainty,
        table-figures-uncertainty=1, table-space-text-post=(16)}
    \begin{ThreePartTable} 
        \notsotiny
        \setlength{\tabcolsep}{2.3pt}
        \setlength{\extrarowheight}{2.2pt}
        \begin{longtable}{>{\itshape}p{2cm}p{0.8cm}@{}*{12}{S}@{}}%
            \caption{Taxon}\\
                \toprule
        \multicolumn{2}{c}{Site} & \multicolumn{2}{c}{WI} & \multicolumn{2}{c}{WO} & \multicolumn{2}{c}{SL} & \multicolumn{2}{c}{SE} & \multicolumn{2}{c}{EO} & \multicolumn{2}{c}{EI} \\
        \cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(lr){7-8} \cmidrule(lr){9-10} \cmidrule(lr){11-12} \cmidrule(lr){13-14}
        \multicolumn{2}{c}{Season}& {Wet} &{Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {\makebox[\mylength]{Dry}} \\
        \midrule
        \multicolumn{1}{c}{{Species}}   & Tracer & {Mean $ \pm$ SD $_{(n)}$} & {Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} \\
        \midrule
            \endfirsthead
    \multirow{2}{*}{\shortstack[l]{{Genus}\\ { Species}}}& $\delta{^{15}}$N &       &       &       &       &       & 12.82\pm0.36\ts{(4)} &       &       & 13.83\pm0.99\ts{(8)} & 14.25\pm0.49\ts{(2)} & 14.60\pm0.23\ts{(4)} &  \\
& $\delta{^{13}}$C &       &       &       &       &       & -16.73\pm0.29\ts{(4)} &       &       & -16.62\pm0.27\ts{(8)} & -17.30\pm0.14\ts{(2)} & -16.65\pm0.31\ts{(4)} &  \\
            \bottomrule
        \end{longtable}
        \end{ThreePartTable}
    \end{landscape}
    \begin{landscape}
        \sisetup{
        table-number-alignment=center,
        separate-uncertainty=true,
        table-column-width = 2cm,
        table-format =-2.2,
        separate-uncertainty,
        table-figures-uncertainty=1, table-space-text-post=(16)}
        \centering
        \begin{threeparttable} 
        \notsotiny
        \setlength{\tabcolsep}{2.3pt}
        \setlength{\extrarowheight}{2.2pt}
        \caption{Taxon}
        \begin{tabular}{>{\itshape}p{2cm}p{0.8cm}@{}*{12}{S}@{}}%
        \toprule
        \multicolumn{2}{c}{Site} & \multicolumn{2}{c}{WI} & \multicolumn{2}{c}{WO} & \multicolumn{2}{c}{SL} & \multicolumn{2}{c}{SE} & \multicolumn{2}{c}{EO} & \multicolumn{2}{c}{EI} \\
        \cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(lr){7-8} \cmidrule(lr){9-10} \cmidrule(lr){11-12} \cmidrule(lr){13-14}
        \multicolumn{2}{c}{Season}& {Wet} &{Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {\makebox[\mylength]{Dry}} \\
        \midrule
        \multicolumn{1}{c}{{Species}}   & Tracer & {Mean $ \pm$ SD $_{(n)}$} & {Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} \\
        \midrule
        \multirow{2}{*}{\shortstack[l]{{Genus}\\ { Species}}}& $\delta{^{15}}$N &       &       &       &       &       & 12.82\pm0.36\ts{(4)} &       &       & 13.83\pm0.99\ts{(8)} & 14.25\pm0.49\ts{(2)} & 14.60\pm0.23\ts{(4)} &  \\
        & $\delta{^{13}}$C &       &       &       &       &       & -16.73\pm0.29\ts{(4)} &       &       & -16.62\pm0.27\ts{(8)} & -17.30\pm0.14\ts{(2)} & -16.65\pm0.31\ts{(4)} &  \\
        \bottomrule
    \end{tabular}
    \end{threeparttable}
\end{landscape}

\end{document}

答案1

除了使用该threeparttableex包之外,您还可以尝试该floatrow包及其 longtable 选项:LTcapwidth=content

\documentclass{article}

\usepackage{array}
\usepackage{changepage}
\usepackage[a4paper, vmargin=0.05cm, hmargin=0.1cm, marginparwidth=0.1cm,total={210mm,297mm}]{geometry}
\usepackage{rotating}
\usepackage[singlelinecheck=off]{caption}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{multirow, makecell, xcolor}
\usepackage[separate-uncertainty=true]{siunitx}
\usepackage{threeparttable}
%\usepackage{threeparttablex} 
\usepackage{longtable}

\usepackage{floatrow}
\floatsetup[longtable]{LTcapwidth=contents}


\newlength{\mylength} \settowidth{\mylength}{$-55.55\pm0.55$}
\makeatletter
\newcommand\notsotiny{\@setfontsize\notsotiny{6.5}{7.5}}
\makeatother
\newcommand{\ts}[1]{\textsubscript{#1}}

\begin{document}    
\begin{landscape}
    \sisetup{
        table-number-alignment=center,
        separate-uncertainty=true,
        table-column-width = 2cm,
        table-format =-2.2,
        separate-uncertainty,
        table-figures-uncertainty=1, table-space-text-post=(16)}
%    \begin{ThreePartTable} 
        \notsotiny
        \setlength{\tabcolsep}{2.3pt}
        \setlength{\extrarowheight}{2.2pt}
        \begin{longtable}[c]{>{\itshape}p{2cm}p{0.8cm}@{}*{12}{S}@{}}%
            \caption{Taxon}\\
                \toprule
        \multicolumn{2}{c}{Site} & \multicolumn{2}{c}{WI} & \multicolumn{2}{c}{WO} & \multicolumn{2}{c}{SL} & \multicolumn{2}{c}{SE} & \multicolumn{2}{c}{EO} & \multicolumn{2}{c}{EI} \\
        \cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(lr){7-8} \cmidrule(lr){9-10} \cmidrule(lr){11-12} \cmidrule(lr){13-14}
        \multicolumn{2}{c}{Season}& {Wet} &{Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {\makebox[\mylength]{Dry}} \\
        \midrule
        \multicolumn{1}{c}{{Species}}   & Tracer & {Mean $ \pm$ SD $_{(n)}$} & {Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} \\
        \midrule
            \endfirsthead
    \multirow{2}{*}{\shortstack[l]{{Genus}\\ { Species}}}& $\delta{^{15}}$N &       &       &       &       &       & 12.82\pm0.36\ts{(4)} &       &       & 13.83\pm0.99\ts{(8)} & 14.25\pm0.49\ts{(2)} & 14.60\pm0.23\ts{(4)} &  \\
& $\delta{^{13}}$C &       &       &       &       &       & -16.73\pm0.29\ts{(4)} &       &       & -16.62\pm0.27\ts{(8)} & -17.30\pm0.14\ts{(2)} & -16.65\pm0.31\ts{(4)} &  \\
            \bottomrule
        \end{longtable}
%        \end{ThreePartTable}
    \end{landscape}
    \begin{landscape}
        \sisetup{
        table-number-alignment=center,
        separate-uncertainty=true,
        table-column-width = 2cm,
        table-format =-2.2,
        separate-uncertainty,
        table-figures-uncertainty=1, table-space-text-post=(16)}
        \centering
        \begin{threeparttable} 
        \notsotiny
        \setlength{\tabcolsep}{2.3pt}
        \setlength{\extrarowheight}{2.2pt}
        \caption{Taxon}
        \begin{tabular}{>{\itshape}p{2cm}p{0.8cm}@{}*{12}{S}@{}}%
        \toprule
        \multicolumn{2}{c}{Site} & \multicolumn{2}{c}{WI} & \multicolumn{2}{c}{WO} & \multicolumn{2}{c}{SL} & \multicolumn{2}{c}{SE} & \multicolumn{2}{c}{EO} & \multicolumn{2}{c}{EI} \\
        \cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(lr){7-8} \cmidrule(lr){9-10} \cmidrule(lr){11-12} \cmidrule(lr){13-14}
        \multicolumn{2}{c}{Season}& {Wet} &{Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {Dry} & {Wet} & {\makebox[\mylength]{Dry}} \\
        \midrule
        \multicolumn{1}{c}{{Species}}   & Tracer & {Mean $ \pm$ SD $_{(n)}$} & {Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} &{Mean $ \pm$ SD $_{(n)}$} \\
        \midrule
        \multirow{2}{*}{\shortstack[l]{{Genus}\\ { Species}}}& $\delta{^{15}}$N &       &       &       &       &       & 12.82\pm0.36\ts{(4)} &       &       & 13.83\pm0.99\ts{(8)} & 14.25\pm0.49\ts{(2)} & 14.60\pm0.23\ts{(4)} &  \\
        & $\delta{^{13}}$C &       &       &       &       &       & -16.73\pm0.29\ts{(4)} &       &       & -16.62\pm0.27\ts{(8)} & -17.30\pm0.14\ts{(2)} & -16.65\pm0.31\ts{(4)} &  \\
        \bottomrule
    \end{tabular}
    \end{threeparttable}
\end{landscape}

\end{document}

相关内容