缺少 \begin{document} 错误的未知原因

缺少 \begin{document} 错误的未知原因

我正在撰写一篇研究论文,最近出现了“缺少 \begin{document}”的错误,尽管我已将其包含在我认为正确的位置。

\documentclass[12pt,notitlepage]{article}

\usepackage[square,numbers,sort&compress]{natbib}
\usepackage{amssymb,latexsym, mathtools,setspace, amsmath, indentfirst,upgreek,multirow,graphicx,verbatim,float,cases}
\usepackage{graphicx, underscore, subcaption, amsmath, wrapfig}

% nicer captions for figures and tables  
%\usepackage[small,bf]{caption}

% making larger margins
\usepackage[margin=1.8cm]{geometry}

% File path to images
\graphicspath{{path}}

%%%%%%%%%%%%%%%%%%%%%
% Custom and Renewed Commands %
%%%%%%%%%%%%%%%%%%%%%

% some additionally defined commands
\newcommand{\id}{\mathrm{d}}
\newcommand{\Dt}[1]{\frac{\id #1}{\id t}}
\newcommand{\dt}[1]{\frac{\id #1}{\id t}}
\newcommand{\fref}[1]{Figure\ \ref{fig:#1}}
\newcommand{\frefs}[2]{Figures\ \ref{fig:#1}\ and\ \ref{fig:#2}}
\newcommand{\tref}[1]{Table\ \ref{tab:#1}}
\newcommand{\trefs}[2]{Tables\ \ref{tab:#1}\ and\ \ref{tab:#2}}
\newcommand{\flab}[1]{\label{fig:#1}}
\newcommand{\eref}[1]{eqn.\ (\ref{eqn:#1})}
\newcommand{\erefs}[2]{eqns.\ (\ref{eqn:#1})--(\ref{eqn:#2}\mbox{)}}
\newcommand{\elab}[1]{\label{eqn:#1}}

\parskip 0.4cm


% style for reference citations in the text. Can be changed to other styles. Given in .bst file
\bibliographystyle{rspublicnat}
\makeatletter \renewcommand{\@biblabel}[1]{#1.}\makeatother 

\title{Mathematical Modeling of Virus Spread in Plants}
\author[1]{Auth1}
\author[2]{Auth2}
\affil[1]{Department of Mathematics, University of Tennessee, Knoxville, TN}
\affil[2]{Department of Microbiology, University of Tennessee, Knoxville, TN}
\date{}
\setcounter{Maxaffil}{0}
\renewcommand\Affilfont{\itshape \small}
%-------------------------------------------------------------------------------------------------------
\begin{document}
\maketitle
% ...
\end{document}

如果您能帮助我找出问题所在我将不胜感激。

答案1

问题是你正在使用来自authblk包,但你还没有加载它。添加

\usepackage{authblk}

序言中的任何地方都可以解决问题。

我不确定为什么会出现错误丢失的\begin{document}被抛出。遗憾的是,LaTeX 并不总是有最好的错误消息。

相关内容