I'm getting a missing \begin{document} error despite having a \begin{document} in my code.

Other files here (https://drive.google.com/drive/folders/0B4GteP8rSaosSGZDLTJrbFJlUWs?usp=sharing). It appears the bibliography causes problems.


% CHANGE THIS VALUE TO "true" as necessary, to improve printed results for hard copies
% by overriding some options of the hyperref package below.

%\usepackage{nomencl} % For a nomenclature (optional; available from ctan.org)
\usepackage{amsmath,amssymb,amstext} % Lots of math symbols and environments
\usepackage[pdftex]{graphicx} % For including graphics N.B. pdftex graphics driver 

\usepackage[pdftex,letterpaper=true,pagebackref=false]{hyperref} % with basic options
        % N.B. pagebackref=true provides links back from the References to the body text. This can cause trouble for printing.
    plainpages=false,       % needed if Roman numbers in frontpages
    pdfpagelabels=true,     % adds page number as label in Acrobat's page count
    bookmarks=true,         % show bookmarks bar?
    unicode=false,          % non-Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,        % show Acrobat’s toolbar?
    pdfmenubar=true,        % show Acrobat’s menu?
    pdffitwindow=false,     % window fit to page when opened
    pdfstartview={FitH},    % fits the width of the page to the window
    pdftitle={uWaterloo\ LaTeX\ Thesis\ Template},    % title: CHANGE THIS TEXT!
    pdfnewwindow=true,      % links in new window
    colorlinks=true,        % false: boxed links; true: colored links
    linkcolor=blue,         % color of internal links
    citecolor=green,        % color of links to bibliography
    filecolor=magenta,      % color of file links
    urlcolor=cyan           % color of external links
\ifthenelse{\boolean{PrintVersion}}{   % for improved print quality, change some hyperref options
\hypersetup{    % override some previously defined hyperref options
%    colorlinks,%
}{} % end of ifthenelse (no else)

fhjh  hjkhj
  • I changed the tag from biblatex to bibtex because it doesn't seem like you're using the former.. Feel free to revert if I've misunderstood
    – Troy
    May 1, 2017 at 5:05
  • Your example compiles fine for me with no errors. May 1, 2017 at 5:05
  • \bibliography tries to typeset the bibliography using \thebibliography. This is bound to fail. Maybe the template used to load package biblatex? In that case, it would work, but the tempalte would still be deprecated syntax. On the other hand, looking at that hyperref madness the template provides, i would put it in the bin,
    – Johannes_B
    May 1, 2017 at 5:12
  • @Troy - Deleting the biblatex tag may have been a bit premature: It could well be that the OP's template simply failed to provide the instruction \usepackage[<various options>]{biblatex}.
    – Mico
    May 1, 2017 at 5:56

1 Answer 1


I can think of two diagnoses:

  • You simply failed to load the biblatex package. (A reason for contemplating this scenario is that your document doesn't include a \bibliographystyle instruction; such an instruction is required by BibTeX, but not by biblatex.) If biblatex isn't loaded, the \bibliography instruction must not be placed in the preamble. If it's simple failure of loading the biblatex package, do load it. You should also change the instruction




    (Under biblatex, \bibliography is deprectated.) Note the addition of the .bib filename extensions. You're still planning on providing a few \cite instructions and a \printbibliography instruction too, right?

  • You really do not intend to load the biblatex package. In that case, the \bibliography directive mustn't be placed in the preamble. Instead, it should be placed in the body of the document, in the location where the formatted bibliography should be placed. You will also need to provide a suitable \bibliographystyle directive, of course. And, you'll also be providing a few \cite instructions, right?

Incidentally, do the three bib files really all start with a . (dot)? This would make the "hidden" if they are located on a unix-like system.

  • Maybe worthy to note that no bib style was provided as well.
    – Troy
    May 1, 2017 at 6:09
  • @Troy - Good observation! I'll add it to the body of the answer. :-)
    – Mico
    May 1, 2017 at 6:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .