我正在努力去除桌子底部的这两条额外的垂直线。我将非常感谢任何帮助!
\begin{table}[H]%
\renewcommand*{\arraystretch}{1.2}
\centering
\caption{Environmental impact of the production of 1kg CaCO\textsubscript{3} through different metabolic pathways {\citep{Porter}}.}
\begin{tabularx}{15,5cm}{|l|l|l|l|}
\hline
\multicolumn{1}{|c|}{\textbf{Pathway}} & \multicolumn{1}{c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Carbon footprint\\ (CO\textsubscript{2}/FU)\end{tabular}}} & \multicolumn{1}{|c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Eutrophication Potential\\ (SO\textsubscript{4}/FU)\end{tabular}}} & \multicolumn{1}{|c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Embodied Energy\\ (MJ)\end{tabular}}} \\ \hline
Carbonation & 2,37 & 7,35e-4 & 7,2 \\ \hline
Ureolytic bacteria & 1,51 & 2,4e-1 & 16,1 \\ \hline
Carbonic anhydrase & 0,555 & 2,09e-4 & 0,619 \\\hline
\end{tabularx}
\end{table}
答案1
- 请始终提供完整的小文档(MWE:最小工作示例),它可以重现您的问题并且我们可以按原样编译。
- 将您的代码片段扩展至 MWE,我无法重现您的问题,但看到代码中存在许多其他问题:
- tabularx 中至少应该有一
X
列X
或其派生列类型(参见@Bernard 评论),由于您没有,垂直线对齐不正确 - 为什么不使用
mhchem
化学公式包? - 相反,使用列标题嵌套表格更简单,使用
makecell
包及其指令;例如
- tabularx 中至少应该有一
\thead{Carbon footprint\\ (\ce{CO2}/FU)}
- 通过使用
X
列类型,您可以将单元格内容拆分为 LaTeX
\documentclass{article}
\usepackage[left=30mm, right=25mm]{geometry}
\usepackage[version=4]{mhchem}
\usepackage{natbib}
\usepackage{makecell, tabularx}
\renewcommand\theadfont{\bfseries}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\begin{table}[ht]
\renewcommand*{\arraystretch}{1.2}
\centering
\caption{Environmental impact of the production of 1kg \ce{CaCO3} through different metabolic pathways \citep{Porter}.}
\begin{tabularx}{\linewidth}{|l|>{\hsize=0.9\hsize}C|
>{\hsize=1.2\hsize}C|
>{\hsize=0.9\hsize}C|}
\hline
\textbf{Pathway} & \bfseries Carbon footprint (\ce{CO2}/FU)
& \bfseries Eutrophication Potential (\ce{SO4}/FU)
& \bfseries Embodied Energy (MJ) \\
\hline
Carbonation & 2,37 & 7,35e-4 & 7,2 \\ \hline
Ureolytic bacteria & 1,51 & 2,4e-1 & 16,1 \\ \hline
Carbonic anhydrase & 0,555 & 2,09e-4 & 0,619 \\\hline
\end{tabularx}
\end{table}
\end{document}
但是,使用tabularray
和siunitx
包你可以得到更简单的代码和(在我看来)更漂亮的表格:
\documentclass{article}
\usepackage[left=30mm, right=25mm]{geometry}
\usepackage[version=4]{mhchem}
\usepackage{natbib}
\usepackage[skip=1ex,
font=small, labelfont=bf]{caption}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\begin{document}
\begin{table}[ht]
\centering
\caption{Environmental impact of the production of \qty{1}{kg} \ce{CaCO3} through different metabolic pathways \citep{Porter}.}
\label{tab:metabolic?}
\begin{tblr}{colsep=4pt,
colspec = {@{} l X[0.9, c, si]
X[1.2, c, si={table-format=1.2e1}]
X[0.9, c, si]
@{}},
row{1} = {font=\bfseries, guard}
}
\toprule
Pathway & Carbon footprint (\ce{CO2}/FU)
& Eutrophication Potential (\ce{SO4}/FU)
& Embodied Energy (MJ) \\
\midrule
Carbonation & 2,37 & 7,35e-4 & 7,2 \\
Ureolytic bacteria & 1,51 & 2,4e-1 & 16,1 \\
Carbonic anhydrase & 0,555 & 2,09e-4 & 0,619 \\
\bottomrule
\end{tblr}
\end{table}
\end{document}