# how to fix Missing \begin{document}

I have tried everything I can think of. I removed almost everything from my document to give it the most simplest of entries, and I STILL get this error message. What am I doing wrong? How can fix this so that I may see my document in a pdf? See below my MWE:

\documentclass[pdftex,12pt,a4paper]{report}
\usepackage[pdftex]{graphicx}{options}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\begin{document}
\input{./title.tex}
\section{Introduction}
\label{sec:intro)
\subsection
\subsubsection
\subsubsection
\subsubsection
\subsubsubsection
\subsection
\subsubsection
\subsubsection
\subsubsection
\end{document}

-
Without the actual code, there's little we can do. Please reduce your document to a minimal, complete version reproducing the problem and added to your question. –  Gonzalo Medina Oct 22 '12 at 4:11
\documentclass[pdftex,12pt,a4paper]{report} \usepackage[pdftex]{graphicx}{options} \pagestyle{headings} \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} \begin{document} \input{./title.tex} \section{Introduction} \label{sec:intro) \subsection \subsubsection \subsubsection \subsubsection \subsubsubsection \subsection \subsubsection \subsubsection \subsubsection \end{document} –  Keith Oct 22 '12 at 4:14
With the above, I get the error: sample.tex(2): Error: LaTeX Error: Missing \begin{document}. –  Keith Oct 22 '12 at 4:15
But each \section or subsection must carry an argument, right? Like: \section{test}. What is the {options} part for? –  azetina Oct 22 '12 at 4:18
By argument, do you mean additional text? I have reduced my original document (i.e., removed the text) and provided just the basics. I get the error with either presentation. –  Keith Oct 22 '12 at 4:20

There are several errors in the code. There's no need to use the option pdftex; also, there's a typo in \label; you have

\label{sec:intro)


but it should be

\label{sec:intro}


(you had a closing parenthesis instead of the closing brace). \subsection needs an argument and there's no \subsubsubsection command. Also, you are loading the graphicx package like this:

\usepackage[pdftex]{graphicx}{options}


and the right way is

\usepackage{graphicx}


Try this; assuming your bibliographical database is bibfile.bib and that it is in the same directory as the .tex file:

\documentclass[12pt,a4paper]{report}
\usepackage{graphicx}
\usepackage{natbib}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\begin{document}

\section{Introduction}
\label{sec:intro}
\subsection{test}
\cite{<key>}

\bibliographystyle{plainnat}
\bibliography{bibfile}
\end{document}


where <key> is the key used for one of the bibliographical entries of bibfile.bib.

-
did that and inserted text back in. Text without citations, it worked. Text with citations, I get the same error. How do you add both in-text citations. For in text, do you use {\cite [label]} and then do you add to the preamble, like {\usepackage}{natbib}. Must you add to the end of the document, too, such as {\bibliography}{bibfile} and {\bibliography}{plainnat}? Thanks –  Keith Oct 22 '12 at 4:34
@Keith you need to do some reading; see this LaTeX wikibook, specifically the bibliography sections 5.3 and 5.4. Additional problems might be better treated in new questions. Also, don't forget to accept the answer that you consider best solves your problem (see How do you accept an answer?.) –  Gonzalo Medina Oct 22 '12 at 4:50
\documentclass[12pt,a4paper]{report} \usepackage{graphicx}{natbib} \pagestyle{headings} \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} \begin{document} \input{./title.tex} \section{Introduction} \label{sec:intro} \subsection \subsubsection \subsubsection \subsubsection \subsubsubsection \subsection \subsubsection \subsubsection \subsubsection {\bibliography}{plainnat} {\bibliography}{bibfile} \end{document} –  Keith Oct 22 '12 at 4:52
I get the same latex error, missing: \begin{document} when including bibliography. –  Keith Oct 22 '12 at 4:53
@Keith please see my updated answer. –  Gonzalo Medina Oct 22 '12 at 4:56