帮忙修桌子

帮忙修桌子

我尝试使用一个适用于数字表格的模板,但我创建了一个怪物,试图使其适应新的需求。这是 mwe:

\documentclass[a4paper, 11pt]{scrreprt}
\usepackage{amsmath,booktabs,siunitx}
\usepackage[version=4]{mhchem}  
\sisetup{separate-uncertainty}

\newcommand{\tabhead}[1]{%
    \smash[b]{%
        \begin{tabular}[t]{@{}c@{}}#1\end{tabular}%
    }%
}

\begin{document}

\begin{table}[h]

    \caption{Caption here.}\label{whatever}

    \setlength{\tabcolsep}{0pt}

    \begin{tabular*}{\linewidth}{
            @{\extracolsep{\fill}}
            r
            S[table-format=2.1]
            r
            S[table-format=1.2]
            r
            S[table-format=4.0]
            r
            r
        }
        \toprule
        {\textbf{Material} } &
        {\tabhead{ \textbf{Mean Pore Radius} \\ \textbf{(\si{\nano\meter})}}} &
        { \textbf{Model}} &
        {\tabhead{\textbf{Salt Concentration} \\ \textbf{({M} \ce{NaCl})}}} &
        {\textbf{pH}} &
        {\textbf{Buffer}} &
        {\tabhead{Range of Dextrans \\ \textbf{(kDa)}}} &
        {\tabhead{Reference \\ \textbf{(--)}}} \\
        &&&  \\
        \midrule
        LongName AA         &   18.4 & Simple model   &   0   & 20 mM Bis-Tris          &   6.5     &   0.18 to 500      &  [1,2]   \\ 
        LongName AA         &   25.8 & complex model  & 0.12  &  10 mM Tris-\ce{HCl}    &   7.2     & 0.18 to 20000      &  [3] \\  
        AA LongName  AA     &   15.0 & complex model  & 1     &  10 mM phosphate        &   8.0     &  4 to 400          &  [4,2]\\ 

        \bottomrule
    \end{tabular*}
    \label{}

\end{table}

\end{document}

它编译时没有错误,但一方面它不适合页面,所以我看不到整个表格,还有许多其他错误,例如:

  • 页眉重叠。标题之间没有适当的距离。
  • 如何使元素右对齐但使标题居中?
  • 在这种情况下我应该使用 tabularx 吗?

任何帮助都将不胜感激!

答案1

让这些长标题符合页数限制的可能性很小。我建议使用在表格下方(或者在标题中)有解释的缩写词。

\documentclass[a4paper, 11pt]{scrreprt}
\usepackage{amsmath,booktabs,siunitx}
\usepackage[version=4]{mhchem}  
\sisetup{separate-uncertainty}

\begin{document}

\begin{table}[htp]

\caption{Caption here.}\label{whatever}

\setlength{\tabcolsep}{0pt}

\footnotesize

\begin{tabular*}{\linewidth}{
  @{\extracolsep{\fill}}
  l
  S[table-format=2.1]
  l
  S[table-format=1.2]
  l
  S[table-format=1.1]
  l
  r
}
\toprule
\textbf{Material} & {\textbf{MPR}} & \multicolumn{1}{c}{\textbf{Model}} & {\textbf{SC}} &
\multicolumn{1}{c}{\textbf{pH}} & {\textbf{B}} & \textbf{RD} & \textbf{Ref.} \\
\midrule
LongName AA    & 18.4 & Simple model  & 0    & 20 mM Bis-Tris      & 6.5 & 0.18 to 500   &  [1,2] \\ 
LongName AA    & 25.8 & complex model & 0.12 & 10 mM Tris-\ce{HCl} & 7.2 & 0.18 to 20000 &  [3] \\  
AA LongName AA & 15.0 & complex model & 1    & 10 mM phosphate     & 8.0 & 4 to 400      &  [4,2] \\ 
\midrule[\heavyrulewidth]
\end{tabular*}
\begin{tabular*}{\textwidth}[t]{@{\extracolsep{\fill}}lll}
MPR: Mean Pore Radius (\si{\nano\meter}) &
SC: Salt Concentration (M \ce{NaCl}) &
B: Buffer \\
RD: Range of Dextrans (kDa) & Ref.: Reference
\end{tabular*}

\end{table}

\end{document}

如果没有\footnotesize列,则会太挤。这取决于您的文本宽度,\small可以这样做。

在此处输入图片描述

相关内容