我可以知道如何将第一个标题列与顶部对齐吗?
\documentclass{article}
\usepackage{tabularx,booktabs}
\usepackage{array}
\usepackage{makecell}
\begin{document}
\begin{table}[htbp]
\centering
\caption{Anaerobic treatment of antibiotic wastewater}
\label{anaerob}
\vspace{0.2cm}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{p{0.25cm}P{2.2cm}P{2.4cm}P{2.4cm}P{2.5cm}P{2.5cm}}
\hline
No&\makecell{Influent\\COD\\(mg L)}&\makecell{Influent\\antibiotics\\(mg L)}&\makecell{COD\\removal\\efficiency (\%)}&\makecell{Antibiotics\\removal\\efficiency (\%)}&Reference\\
\hline
1&9~736 to 19~862& Ampicillin 3; aureomycin 1&91&Ampicillin 67; aureomycin 51&(Zhou, 2006)\\
2&3~000 to 43~000&Penicillin&97&N/A&(Degirmentas, 2004)\\
3&127~000&Erythromycin 1 to 200&94&N/A&(Amin, 2006)\\
4&3~000&Sulfamerazine 10 to 90&69 to 89&76 to 100&(Sponza, 2007)\\
\hline
\end{tabular}
\end{table}
\end{document}
答案1
可以使用 全局设置列标题的垂直对齐方式\renewcommand{\cellalign}{tc}
。此外,我建议使用此代码来改进您的表格。它依靠 来booktabs
获得专业水平线,并带有一些垂直填充,tabularx
以精确适应文本宽度,siunitx
从而格式化单位、数字和范围。
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{tabularx ,booktabs, caption, siunitx}
\usepackage{array}
\usepackage{makecell}
\newcommand{\nl}{\newline}
\begin{document}
\begin{table}[htbp]
\centering\setlength{\tabcolsep}{2.9pt}
\renewcommand{\cellalign}{tc}
\sisetup{group-four-digits}
\caption{Anaerobic treatment of antibiotic wastewater}
\label{anaerob}
\vspace{0.2cm}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\linewidth}{@{}cc>{\centering\arraybackslash}Xc*{2}{>{\centering\arraybackslash}X}@{}}
\toprule
No&\makecell{Influent COD\\(\si{\mg\L})}&\makecell{Influent antibiotics\\(\si{\mg\L})}&\makecell{COD removal\\efficiency (\%)}&\makecell{Antibiotics removal\\efficiency (\%)}&Reference\\%
\midrule
1&\numrange{9736}{19862} & Ampicillin 3; aureomycin 1&91&Ampicillin 67; aureomycin 51&(Zhou, 2006)\\
2&\numrange{3000}{43000}&Penicillin&97&N/A&(Degirmentas, 2004)\\
3&\num{127000}&Erythromycin\nl \numrange{1}{200}&94&N/A&(Amin, 2006)\\
4&\num{3000}&Sulfamerazine\nl \numrange{10}{90} & 69 to 89&\numrange{76}{100}&(Sponza, 2007)\\
\bottomrule
\end{tabularx}
\end{table}
\end{document}