我正在尝试在乳胶中创建下表:
我无法将这个表格放到 A4 纸上。我的想法是让文本在列标题中换行,但在网上搜索了一个多小时并看到了很多解决方案后,我还是无法让它工作。
这是我现在拥有的乳胶代码(注意:我删掉了除前两行之外的所有代码,以减少代码量,提高可读性。
\documentclass[a4paper, oneside]{discothesis}
\usepackage{tabulary}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{array}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{makecell}
\usepackage{ragged2e}
\begin{document}
\begin{table}[h!]
\setlength\tabcolsep{6pt}
\centering
\caption{Flushing efficiencies.}
\resizebox{\textwidth}{!}{\begin{tabular}{cp{0.082\textwidth} cp{0.082\textwidth} cp{0.082\textwidth} cp{0.082\textwidth}
cp{0.082\textwidth} cp{0.082\textwidth} cp{0.082\textwidth} cp{0.082\textwidth} cp{0.082\textwidth} cp{0.082\textwidth} cp{0.082\textwidth} cp{0.082\textwidth}}
\toprule
\multirow{2}{*}{\makecell{Loca- \\ tion}} & \multirow{2}{*}{\makecell{Reser- \\ voir}} &
\multirow{2}{*}{\makecell{Flushing \\ type}} & \multirow{2}{*}{\makecell{Flushing \\ Year(s)}} &
\multirow{2}{*}{\makecell{$V_{s,out}$ \\ $[m^3]$}} & \multirow{2}{*}{$V_{w,out} [m^3]$} &
\multirow{2}{*}{\makecell{Volumetric \\ mixture \\ concentra- \\ tion $\sigma$ \\ $[ml/l]$}} &
\multirow{2}{*}{Mean volumetric mixture concentration $\sigma_{,m} [ml/l]$} & \multirow{2}{*}{$V_{s,m,out} (FL) [m^3/a]$} & \multirow{2}{*}{$MAS (=V_{s,m,in}) [10^3 m^3/a]$} &
\multicolumn{2}{*}{Flushing efficiencies $\eta_{f} [\%]$} \\
& & & & & & & & & & $\eta_{\sigma}$ & $\eta_v$ \\
\multirow{5}{*}{CH} & \multirow{5}{*}{Ferden} & E & 2018 & 96,000 & 2,285,000 & 42.01 & \multirow{5}{*}{47.97} & \multirow{5}{*}{112,667} & \multirow{5}{*}{50} & 4.20 & \multirow{5}{*}{225.3} \\
& & E & 2016 & 120,000 & 4,030,000 & 29.78 & & & & 2.98 & \\
& & E & 2014 & 60,000 & 2,803,000 & 21.41 & & & & 2.14 & \\
& & E & 2013 & 160,000 & 3,796,000 & 42.15 & & & & 4.22 & \\
& & E & 2012 & 240,000 & 2,297,000 & 104.48 & & & & 10.45 & \\
\bottomrule
\end{tabular}}
\label{tab3:cp_values}
\end{table}
\end{document}
现在,它给了我下表(由于某种原因,\eta_sigma
和\eta_v
被推到最右边而不是放在“冲洗效率”单元格下):
另外,正如您所看到的,包含 E 的多行被推到列标题中。
谢谢你!
编辑 1:删除不必要的包
编辑 2:从 cp{0.082\textwidth} 中删除“c”后的新表格
答案1
在下表中,我将第 1 列和第 2 列合并为一列以节省一些空间。此外,我还从列标题中删除了冗长的说明文字,并将其放在表格下方。对于单位,为了改善列内数字的对齐,我使用了siunitx
。最后,由于表格对于纵向页面来说仍然太宽,我使用了包landscape
中的pdflscape
。
由于最初使用的 documentclass 不可用,我article
结合使用了常规和geometry
较小的边距。根据文本块的实际大小以及文档中的字体和字体大小,您可能需要进行一些进一步的调整,以确保表格适合可用空间。
\documentclass[a4paper, oneside]{article}
\usepackage{geometry}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{siunitx}
\sisetup{per-mode=symbol}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\begin{table}[h!]
\centering
\caption{Flushing efficiencies.}
\begin{tabular}{c
c
c
S[table-format=3]
S[table-format=4]
S[table-format=3.2]
c
c
c
S[table-format=2.2]
c}
\toprule
\makecell{Reservior\\ (Location)}
& \makecell{Flushing \\ type}
& \makecell{Flushing \\ Year(s)}
& {\makecell{$V_{s,out}$ \\ {[\SI{E3}{\cubic\m}]}}}
& {\makecell{$V_{w,out}$ \\ {[\SI{E3}{\cubic\m}]}}}
& {\makecell{$\sigma_{s}$ \\ {[\si{\mL\per\L}]}}}
& {\makecell{$\sigma_{s,m}$ \\ {[\si{\mL\per\L}]}}}
& \makecell{$V_{s,m,out}$ (FL)\\ {[\si{\cubic\m\per a}]}}
& \makecell{MAS $(=V_{s,m,in})$\\ {[\SI{E3}{\cubic\m\per a}]}}
& \multicolumn{2}{c}{\makecell{Flushing\\ efficiencies $\eta_{f}$ {[\si{\percent}]}}} \\
\cmidrule{10-11}
& & & & & & & & & {$\eta_{\sigma}$} & {$\eta_v$} \\
\midrule
\multirow{5}{*}{Ferden (CH)} & E & 2018 & 96 & 2285 & 42.01 & \multirow{5}{*}{47.97} & \multirow{5}{*}{112,667} & \multirow{5}{*}{50} & 4.20 & \multirow{5}{*}{225.3} \\
& E & 2016 & 120 & 4030 & 29.78 & & & & 2.98 & \\
& E & 2014 & 60 & 2800 & 21.41 & & & & 2.14 & \\
& E & 2013 & 160 & 3796 & 42.15 & & & & 4.22 & \\
& E & 2012 & 240 & 2297 & 104.48 & & & & 10.45 & \\
\midrule
& E & 2016 & 120 & 4030 & 29.78 & & & & 2.98 & \\
& E & 2014 & 60 & 2803 & 21.41 & & & & 2.14 & \\
& E & 2013 & 160 & 3796 & 42.15 & & & & 4.22 & \\
\midrule
& E & 2012 & 240 & 2297 & 104.48 & & & & 10.45 & \\
\midrule
& E & 2016 & 120 & 4030 & 29.78 & & & & 2.98 & \\
& E & 2014 & 60 & 2803 & 21.41 & & & & 2.14 & \\
\midrule
& E & 2013 & 160 & 3796 & 42.15 & & & & 4.22 & \\
\midrule
& E & 2012 & 240 & 2297 & 104.48 & & & & 10.45 & \\
& E & 2016 & 120 & 4030 & 29.78 & & & & 2.98 & \\
\midrule
& E & 2014 & 60 & 2803 & 21.41 & & & & 2.14 & \\
& E & 2013 & 160 & 3796 & 42.15 & & & & 4.22 & \\
& E & 2012 & 240 & 2297 & 104.48 & & & & 10.45 & \\
& E & 2016 & 120 & 4030 & 29.78 & & & & 2.98 & \\
\midrule
& E & 2014 & 60 & 2803 & 21.41 & & & & 2.14 & \\
& E & 2013 & 160 & 3796 & 42.15 & & & & 4.22 & \\
& E & 2012 & 240 & 2297 & 104.48 & & & & 10.45 & \\
& E & 2013 & 160 & 3796 & 42.15 & & & & 4.22 & \\
\midrule
& E & 2012 & 240 & 2297 & 104.48 & & & & 10.45 & \\
\bottomrule
\multicolumn{11}{l}{\small $\sigma_{s}$ = volumetric mixture concentration, $\sigma_{sm}$ = mean volumetric mixture concentration}\\
\end{tabular}
\label{tab3:cp_values}
\end{table}
\end{landscape}
\end{document}
答案2
避免缩放表格,它会产生不一致的字体大小和规则宽度,我\small
在这里使用(虽然我不知道你的实际文本宽度,但我假设与文章类 A4 纸相同)
\documentclass[a4paper]{article}
\usepackage{booktabs,makecell}
\begin{document}
\begin{table}\small\centering
\setlength\tabcolsep{1.3pt}
\begin{tabular}{@{}cccrrrrrrrrr@{}}
\toprule
\makecell[t]{Loca- \\ tion}&
\makecell[t]{Reser- \\ voir} &
\makecell[t]{type} &
\makecell[t]{Year} &
\makecell[t]{$V_{s,\mathrm{out}}$ \\ $[m^3]$} &
$V_{w,\mathrm{out}} [m^3]$ &
\makecell[t]{$\sigma$ \\ $[ml/l]$} &
\makecell[t]{$\sigma_{,m}$\\ $[ml/l]$} &
\makecell[t]{$V_{s,m,\mathrm{out}}$\\ $[m^3/a]$} &
\makecell[t]{$\mathrm{MAS} $\\ $\![10^3\!m^3/\!a]\!$} &
\makecell[t]{$\eta_{f}$\\ $[\%]$} \\
& & & & & & & & & & $\eta_{\sigma}$ & $\eta_v$ \\
CH & Ferden & E & 2018 & 96,000 & 2,285,000 & 42.01 & 47.97 & 112,667 & 50 & 4.20 & 225.3 \\
& & E & 2016 & 120,000 & 4,030,000 & 29.78 & & & & 2.98 & \\
& & E & 2014 & 60,000 & 2,803,000 & 21.41 & & & & 2.14 & \\
& & E & 2013 & 160,000 & 3,796,000 & 42.15 & & & & 4.22 & \\
& & E & 2012 & 240,000 & 2,297,000 & 104.48 & & & & 10.45 & \\
\bottomrule
\end{tabular}
\label{tab3:cp_values}
\raggedright
$\sigma$ = Volumetric mixture concentration
$\sigma_{,m}$ = Mean volumetric mixture concentration
$\mathrm{MAS} = V_{s,m,in}$
$\eta_f$ = Flushing efficiencies
\end{table}
\end{document}