longtable、siunitx、多行、多列、textsuperscript 组合问题

longtable、siunitx、多行、多列、textsuperscript 组合问题

下表中有、\multirow\multicolumn调用\textsuperscript。我希望所有条目都居中,并且数字条目另外“科学地”右对齐(就像包所做的那样siunitx)。目前我使用\rlap,但这只会对齐文本上标,而不是数字条目。理想情况下,我应该使用类似siunitx包的东西,原则上它应该会自动对齐文本上标,但我无法将siunitx包与我当前的代码结合起来。有人能帮忙吗?

\begin{center}

\renewcommand{\arraystretch}{1.5}

\begin{tiny}

\begin{longtable}{ccc}
\caption{...}\label{tab:1}\\
\hline
Text & Text & $X$\\
     &      & $\mathrm{\left[\%\right]}$\\
\hline
\endfirsthead
\multicolumn{3}{l}%
{\tablename\ \thetable\ (\emph{continued from previous page})} \\
\hline
Text & Text & $X$\\
     &      & $\mathrm{\left[\%\right]}$\\
\hline
\endhead
\hline 
\multicolumn{3}{r}%
{(\emph{continued on next page})} \\
\endfoot
\hline
\\
\multicolumn{3}{l}%
{\shortstack[l]{\textsuperscript{a}Method 1\\
\textsuperscript{b}Remark}}
\endlastfoot

Text & Text & 70.5\rlap{\textsuperscript{a}}\\
     & Text & 8.8\rlap{\textsuperscript{a}}\\
     & Text & 78.1\rlap{\textsuperscript{a}}\\
     & Text & 7.0\rlap{\textsuperscript{a}}\\
     & Text & 76.5\rlap{\textsuperscript{a}}\\
     & Text & 92.5\rlap{\textsuperscript{a,b}}\\
Text & \multirow{2}{*}{text} & \multirow{2}{*}{8.71\rlap{\textsuperscript{a}}}\\
Text &      &\\

Text & Text & 79.2\rlap{\textsuperscript{a}}\\
     & Text & 69.0\rlap{\textsuperscript{a}}\\
     & Text & 65.2\rlap{\textsuperscript{a}}\\
     & Text & 77.7\rlap{\textsuperscript{a}}\\
     & Text & 69.7\rlap{\textsuperscript{a,b}}\\
     & Text & 67.6\rlap{\textsuperscript{a}}\\
     &      &\\
\cdashline{1-3}
\multicolumn{2}{c}%
{\textbf{Mean}} & 76.35\\
\multicolumn{2}{c}%
{(SD)}          & (7.82)\\

\end{longtable}

\end{tiny}
\end{center}

这里缩短的 MWE 与 相结合\multirow\tablenum以实现相同的对齐,但两行之间的空间比 更大\makecell

\documentclass{article}

\usepackage{longtable}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{arydshln}

\usepackage{makecell}

\usepackage{multirow}


\begin{document}

\renewcommand{\arraystretch}{1.5}


\begin{longtable}{ccc}

\caption{...}\label{tab:1}\\

\hline
Text & Text & $X$\\
     &      & [\%]\\ 
\hline
\endfirsthead
\multicolumn{3}{l}{\tablename\ \thetable\ (\emph{continued from previous page})} \\
\hline
Text & Text &  $X$\\
     &      &  [\%]\\
\hline
\endhead
\hline 
\multicolumn{3}{r}{(\emph{continued on next page})} \\
\endfoot
\hline
\multicolumn{3}{l}%
{\shortstack[l]{\textsuperscript{a}Method 1\\
\textsuperscript{b}Remark 1}}
\endlastfoot

\multirow{ 1}{*}{Ttext} & \multirow{ 1}{*}{Ttext} & \multirow{ 1}{*}{\tablenum[table-format = 2.1]{70.5}\rlap{\textsuperscript{a,b}}}\\
Ttext & \multirow{ 2}{*}{Ttext} & \multirow{ 2}{*}{\tablenum[table-format = 2.1]{8.7}\rlap{\textsuperscript{a}}}\\
Ttext & &\\
\cdashline{1-3}
\multicolumn{2}{c}{\textbf{Mean}} &  \multirow{ 1}{*}{\tablenum[table-format = 2.1]{76.3}}\\
\multicolumn{2}{c}{(SD)}          &  \multirow{ 1}{*}{\tablenum[table-format = 2.1,input-symbols=()]{(7.8)}}\\

\end{longtable}

\end{document}

答案1

也许您正在寻找以下内容:

在此处输入图片描述

\documentclass{article}

\usepackage{longtable}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{arydshln}
\usepackage{threeparttablex}
\usepackage{makecell}

\begin{document}


\renewcommand{\arraystretch}{1.5}

\begin{ThreePartTable}
  \begin{TableNotes}
     \item[a] Method 1
     \item[b] Remark
  \end{TableNotes}
\begin{longtable}{ccS[table-format=2.2,input-symbols=()]}
    \caption{...}\label{tab:1}\\
  \toprule
  Text & Text & $X$\\
       &      & [\%]\\
  \midrule
\endfirsthead
  \multicolumn{3}{l}{\tablename\ \thetable\ (\emph{continued from previous page})} \\
  \hline
  Text & Text &  $X$\\
       &      &  [\%]\\
  \midrule
\endhead
  \hline 
  \multicolumn{3}{r}{(\emph{continued on next page})} \\
\endfoot
  \hline
  \insertTableNotes
\endlastfoot

Text & Text & 70.5\tnote{a}\\
     & Text & 8.8\tnote{a}\\
     & Text & 78.1\tnote{a}\\
     & Text & 7.0\tnote{a}\\
     & Text & 76.5\tnote{a}\\
     & Text & 92.5\tnote{a,b}\\
\makecell{Text \\Text} & text & 8.71\tnote{a}\\

Text & Text & 79.2\tnote{a}\\
     & Text & 69.0\tnote{a}\\
     & Text & 65.2\tnote{a}\\
     & Text & 77.7\tnote{a}\\
     & Text & 69.7\tnote{a}\\
     & Text & 67.6\tnote{a}\\

\cdashline{1-3}
\multicolumn{2}{c}{\textbf{Mean}} & 76.35\\
\multicolumn{2}{c}{(SD)}          & (7.82)\\

\end{longtable}
\end{ThreePartTable}

\end{document}

我已使用带有适当选项siunitx的列来根据小数点分隔符对齐数字。Stable-format

对于注释,我使用了threeparttablex包及其ThreePartTable环境TableNotes,以及\tnote命令。

此外,我已经\hline用包中的规则替换了 s booktabs

\multirow我还用第一列中的命令替换了这些命令makecell,以便在不破坏此特定行的对齐的情况下实现类似的布局。

最后,我删除了center环境,因为longtable默认情况下 s 是居中的。摘自longtable文档:

可选参数longtable控制表格的水平对齐方式。可能的选项有和[c],分别用于居中、右调整和左调整。通常默认为居中,[...][r][l]

相关内容