[Tex/LaTex] Undefined control sequence \documentclass

compiling

First of all I would like to thank you because you helped me out a lot with all your answers to the already online questions.

Now, here is my problem. I am trying to do a bibliography file with TeXworks but I get this error when I try to compile (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}

I've been reading some similar questions but I don't find the way to fix it (maybe I am missing something). I found one that says that I am trying to compile a LaTeX file using TeX compiler but I don't know how to change the configuration.

This is the .bib fiel content:

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

Best Answer

Your .bib file should only contain BibTeX entries (and possibly comments). It should not contain \documentclass, \usepackage, \begin{document}, etc.

If your .bib file has "mybiblio" as base name and contains

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

then running pdflatex, then bibtex, then pdflatex twice on the following code should work and produce the expected output:

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

enter image description here

Related Question