未定义控制序列 \documentclass

未定义控制序列 \documentclass

首先我要感谢您,因为您对所有在线问题的回答都给了我很大的帮助。

现在,我的问题来了。我尝试使用 TeXworks 制作参考书目文件,但在尝试编译(pdfLaTeX+MakeIndex+bibTeX)时出现此错误:

    This is pdfTeX, Version 3.1415926-2.4-1.40.13 (MiKTeX 2.9 64-bit)
    entering extended mode
    ****PATH here******
    ! Undefined control sequence.
    l.1 \documentclass
        [a4paper,11pt]{report}

我已经阅读了一些类似的问题,但我找不到解决方法(也许我遗漏了一些东西)。我发现一个问题说我正在尝试使用 TeX 编译器编译 LaTeX 文件,但我不知道如何更改配置。

这是.bib 文件的内容:

    \documentclass[a4paper,11pt]{report}
    \usepackage[english]{babel}     % faire de l'anglais
    \usepackage[latin1]{inputenc}   % accents dans le source
    \usepackage[T1]{fontenc}        % accents dans le DVI
    \usepackage{url}
    \begin{document}

    @Article{ref11,
author={Danihelka, Jiri and Kencl, Lukas},
journal={Cloud Futures Workshop 2012 },
title={Colaborative 3D Environments over Windows Azure},
year={2012},
month={May},
pages={},
note={}
    }

    @book{ref12,
author = {Lee, Henry and Chuvyrov, Eugene},
    title = {Beginning Windows Phone 7 Development},
    publisher = {Apress},
    volume = {},
    number = {},
    series = {},
    address = {},
    edition = {Second edition},
    year = {2011},
    month = {July},
    note = {}
    }

    @Article{ref13,
author={},
journal={},
title={Cloud computing},
year={},
month={},
pages={},
url={\url{http://en.wikipedia.org/wiki/Cloud_computing}}
    }

    \end{document}

答案1

你的 .bib 文件应该仅有的包含 BibTeX 条目(可能还有注释)。它应该不是含有\documentclass、、、等等\usepackage\begin{document}

如果你的 .bib 文件以“mybiblio”作为基本名称,并且包含

@Article{ref11,
    author  = {Danihelka, Jiri and Kencl, Lukas},
    journal = {Cloud Futures Workshop 2012 },
    title   = {Colaborative 3D Environments over Windows Azure},
    year    = {2012},
    month   = {May},
    pages   = {},
    note    = {}
}

@book{ref12,
    author      = {Lee, Henry and Chuvyrov, Eugene},
    title       = {Beginning Windows Phone 7 Development},
    publisher   = {Apress},
    volume      = {},
    number      = {},
    series      = {},
    address     = {},
    edition     = {Second edition},
    year        = {2011},
    month       = {July},
    note        = {}
}

@Article{ref13,
    author  = {},
    journal = {},
    title   = {Cloud computing},
    year    = {},
    month   = {},
    pages   = {},   
    url = {\url{http://en.wikipedia.org/wiki/Cloud_computing}}
}

然后对以下代码运行pdflatex,然后bibtex,然后两次应该可以工作并产生预期的输出:pdflatex

\documentclass[a4paper,11pt]{report}
\usepackage[english]{babel}     % faire de l'anglais
\usepackage[latin1]{inputenc}   % accents dans le source
\usepackage[T1]{fontenc}        % accents dans le DVI
\usepackage{url}
\begin{document}

As seen in \cite{ref11}, blah blah blah.

\bibliographystyle{plain}
\bibliography{mybiblio}
\end{document}

在此处输入图片描述

相关内容