LaTeX中minipage编译失败,Overleaf平台表格与图片上下排版报错求助
编译错误修复方案
- 核心错误点:第二个
minipage环境缺少必填的宽度参数,minipage语法要求必须指定宽度属性,你写的第一个minipage指定了{1\textwidth},第二个遗漏了该参数,直接触发编译报错。 - 潜在漏包问题:代码中用到的三线表命令
\toprule/\midrule/\bottomrule需要提前加载booktabs包,\captionof命令需要提前加载caption或capt-of包,插入图片需要加载graphicx包,导言区缺少对应包声明也会导致编译失败。
以下是修正后的完整可编译代码:
% 导言区必要包声明,可直接合并到你原有文档的导言区中 \documentclass{article} \usepackage{booktabs} % 支持三线表命令 \usepackage{graphicx} % 支持图片插入 \usepackage{caption} % 支持captionof命令 \begin{document} \begin{minipage}[b]{1\textwidth} \centering \captionof{table}{Best Case Scenario A IC values when synthesis, desiccation (and algae collection) have been excluded from the system.} \label{tab:BestA_synthANDdesiccation_excluded} \begin{tabular}{@{}llcc@{}} \toprule IC & Unit & Total (no collection) & Total (with collection) \\ \midrule CC & kg CO2 eq & -1.1E+03 & -7.0E+02 \\ Ecotox & CTUe & 2.1E+02 & 1.4E+04 \\ HTnc & CTUh & 6.9E-08 & 1.4E-05 \\ PM & disease inc. & 3.7E-07 & 1.0E-05 \\ RUf & MJ & 9.3E+01 & 5.6E+03 \\ RUm & kg Sb eq & 8.0E-06 & 3.6E-02 \\ \bottomrule \end{tabular} \end{minipage} % 补全第二个minipage的宽度参数 \begin{minipage}[b]{1\textwidth} \centering \includegraphics[width=1\textwidth]{Pictures/A_best_nosynANDnodesiccationANDnocollection.png} \captionof{figure}{Characterisation of the sub-systems in best-case scenario A when synthesis, desiccation and algae collection have been excluded from the system boundaries. Method: EF 3.0 Method (adapted) V1.00} \label{fig:Abest_nosyn_nodesiccation} \end{minipage} \end{document}
如果修复后仍然编译失败,可检查图片路径是否正确,Overleaf上传的图片文件夹名称、文件名大小写是否和代码中完全匹配。
内容的提问来源于stack exchange,提问作者daniel135
相关产品推荐
相关产品推荐

