缺少 \begin{document} 错误

缺少 \begin{document} 错误

尽管我的代码中\begin{document}有一个,但我仍然收到缺失错误。\begin{document}

其他文件在这里(https://drive.google.com/drive/folders/0B4GteP8rSaosSGZDLTJrbFJlUWs?usp=sharing)。看来参考书目引起了问题。

\documentclass[11pt]{article}

\usepackage{ifthen}
\newboolean{PrintVersion}
\setboolean{PrintVersion}{false} 
% 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.
\hypersetup{
    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,%
    citecolor=black,%
    filecolor=black,%
    linkcolor=black,%
    urlcolor=black}
}{} % end of ifthenelse (no else)
\bibliography{bibfiles.d/.master,bibfiles.d/.psd,bibfiles.d/.Cook2012}


\begin{document}
fhjh  hjkhj
hohilkj
\end{document}

答案1

我可以想到两种诊断:

  • 您只是未能加载biblatex包。(考虑这种情况的一个原因是您的文档不包含\bibliographystyle指令;BibTeX 需要这样的指令,但 biblatex 不需要。)如果biblatex没有加载,\bibliography指令一定不放在前言中。如果只是加载包失败biblatex,请加载它。您还应该更改指令

    \bibliography{bibfiles.d/.master,bibfiles.d/.psd,bibfiles.d/.Cook2012}
    

    \addbibresource{bibfiles.d/.master.bib,bibfiles.d/.psd.bib,bibfiles.d/.Cook2012.bib}
    

    (在 biblatex 下,\bibliography已弃用。)请注意文件扩展名的添加.bib。您仍计划提供一些\cite说明和\printbibliography说明,对吗?

  • 您确实不打算加载该biblatex包。在这种情况下,\bibliography指令不能放在序言中。相反,它应该放在文档正文中,也就是应该放置格式化参考书目的位置。当然,您还需要提供合适的\bibliographystyle指令。而且,您还会提供一些\cite说明,对吗?

顺便问一下,这三个bib文件真的都以.(点)开头吗?如果它们位于类 Unix 系统上,则将处于“隐藏”状态。

相关内容