
数値表に適したテンプレートを使用しようとしましたが、新しいニーズに適応させようとしてモンスターを作成してしまったのです。これが 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
可能です。