0

I am working on a research paper and have recently been getting a "missing \begin{document}" error even though I've included it in what I believe to be the proper place.

\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}

If you could help me identify the problem I would greatly appreciate it.

2
  • 3
    \author doesn't take any optional argument in the article class. And you can't have more than one. You're using the template for another class.
    – egreg
    May 23 '20 at 17:20
  • 1
    Do you really need all those packages? Consider removing them all, seeing what breaks, and adding back only what you really need. It may cause brief pain, but can help understanding in the long run. If you really do them all, kindly disregard this message. May 23 '20 at 19:44
1

The problem is that you're using commands from the authblk package, but you haven't loaded it. Adding

\usepackage{authblk}

anywhere in the preamble will fix the problem.

I'm not sure why the error Missing \begin{document} is thrown. LaTeX does not always have the best error messages, unfortunately.

2
  • 2
    Without authblk the command \author[1]{Auth1} sets the author list to be "[", and then "1]..." is left over and appears like document body text. May 23 '20 at 20:26
  • Ahh, thanks @DonaldArseneau! May 23 '20 at 22:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.