使用 \begin{figure} 时 Overleaf 无法编译

使用 \begin{figure} 时 Overleaf 无法编译

我无法将图表包含到我的 Overleaf 文档中,我不知道为什么会这样......这是我正在做的事情:

\documentclass[a4paper]{article}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\graphicspath{ {./Images/} }
\usepackage{caption}
\usepackage{subcaption}
\usepackage{wrapfig,lipsum,booktabs}
\usepackage{enumitem}
\usepackage[left=3cm,right=3cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{lscape}
\usepackage{comment}
\usepackage{rotating}
\usepackage{graphicx,caption,varwidth}
\usepackage{tabularx}
\usepackage{setspace}
\usepackage{pbox}
\usepackage{tikz}
\usetikzlibrary{calc,matrix,decorations.markings,decorations.pathreplacing}
\usepackage{multirow}
\usepackage{csvsimple}
\usepackage{array,booktabs}
\usepackage{pgfplots}
\usepackage{multicol}
\usepackage{wrapfig}
\usepackage[official]{eurosym}
\usepackage[stable]{footmisc}

\usepackage{natbib}
\bibliographystyle{apalike}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}

%% Sets page size and margins
%\usepackage[a4paper,top=2cm,bottom=2cm,left=3cm,right=2cm,marginparwidth=1.75cm]{geometry}

%% Other useful packages
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{breqn}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\setlength {\marginparwidth }{0cm}
\usepackage{pdfpages}
\usepackage[toc]{glossaries}
\makeglossaries

\newglossaryentry{ate}{name=ATE,description={Average treatment effect}}
...

\begin{document}
\pagenumbering{roman}
\setcounter{page}{1}
\includepdf[pages={1}]{front_page.pdf}

\newpage
\pagenumbering{roman}
\setcounter{page}{2}

\begin{table}
...
\end{table}

\clearpage
\input{01_abstract}
\newpage

\doublespacing

\newpage
\tableofcontents

\newpage
\addcontentsline{toc}{section}{\listfigurename}
\listoffigures
\addcontentsline{toc}{section}{\listtablename}
\listoftables
\setglossarystyle{long}
\renewenvironment{theglossary}%
 {\begin{longtable}[l]{lp{\glsdescwidth}}}%
 {\end{longtable}}
\printglossary[title= Abbreviations, toctitle=Abbreviations,nonumberlist]

\newpage

\pagenumbering{arabic}
\setcounter{page}{1}
\setcounter{table}{0}
\input{02_introduction}
\input{03_theory}
\input{04_data}
\input{05_methodology}
\input{06_results}
\input{09_robust}

\newpage
\bibliography{Ref}
\newpage
\pagenumbering{Roman}
\setcounter{page}{1}

\input{appendix}

\end{document}

在附录中我尝试使用以下方式添加一个图表:

\begin{figure}[h!]{\textwidth}
\centering
\begin{subfigure}[h!]{0.5\textwidth} 
\includegraphics[width=\textwidth]{lfp.png}
\caption{...}\label{lfp}
\end{subfigure}
\begin{subfigure}[h!]{0.5\textwidth}
\includegraphics[width=\textwidth]{flfp.png}
\caption{...}\label{flfp}
\end{subfigure}
\caption{...}
\end{figure}

请注意,当我省略附录中的图表时,它会编译。

现在已经感谢您的帮助。

相关内容