# How to use .bib file in my own LaTeX file?

I have generated the.bib file of the reference in my paper, but I failed to include it inside my own LaTeX file. I tried to use it like this:

\documentclass[journal]{IEEEtran}
\begin{document}
...
\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,testing} %testing.bib is my .bib file
\end{document}


But it always got an error like this:

Something's wrong--perhaps a missing \item. \end{thebibliography}


And the PDF generated only had the title 'Reference', and failed to display the detailed citations. My .bib files are downloaded from Microsoft Academic and Google Scholar, so they can't be wrong. What's the solution?

• Microsoft Academic and Google Scholar, so they can't be wrong. You wish :) Related : tex.stackexchange.com/questions/99404/… – percusse Jul 12 '15 at 18:19
• Yes, give a minimal working example. Have you tried any troubleshooting? Did you look at the line number that the error message refers you to? Did you inspect the .bbl file to see if anything was wrong there? Have you tried inserting the contents of the .bbl file into your .tex document (in which case you'd delete the \bibliography command) and then running latex (or whatever) on it? – Ruby Jul 12 '15 at 18:56
• See tex.stackexchange.com/questions/253852/… for an example of how Google Scholar produces very wrong results. – egreg Jul 12 '15 at 19:56
• Well it's not a problem from .bib file because I have checked their formats. Thanks to Hol's answer, and now the problem was solved. – Vinnton Yao Jul 13 '15 at 2:02

For citing sources using BibTeX, you should use \cite{...}, and when you don't cite any sources, you get an error message like this:

! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.24 \end{thebibliography}


I hereby provide a working example. Adding \usepackage{cite} is optional, but for having the capability of sorting and compression of references, you will need cite package. I have used a single \cite{...}, but If you don't want to cite any sources in the article, you can use \nocite{*} to include all the sources available in your bib file to be included in the list of references.

\documentclass[journal]{IEEEtran}
\usepackage{cite}
\begin{document}

This is a citation\cite{mycite}

\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,testing} %testing.bib is my .bib file

\end{document}


To compile your file, you should run latex 3 times on your file. Assuming that your file is name document.tex, you should do:

latex document
bibtex document
latex document
latex document


Please note that machine generated bibliography files are sometimes messy, so you may have to edit them manually.

• Ieeetran doesn't use natbib --> tex.stackexchange.com/questions/78108/… And no no no to hand-written bib files while you have JabRef. Hand-written bib files are basically a form of academic torture. – percusse Jul 12 '15 at 19:27
• Thanks, I fixed my answer. And of course we can use JabRef and others, but one should usually tinker the outputs manually to get the best results. I always had to do fix little things in the output from Google Scholar and others. – Ho1 Jul 12 '15 at 19:40
• I don't think the cite package is necessary. – egreg Jul 12 '15 at 19:47
• Yes, it seems so. The problem was the lack of any \cite in the document. – Ho1 Jul 12 '15 at 19:57
• Could you edit your answer by specifying that the necessary step is just having \cite commands (and mayby \nocite{*}), and that loading cite is optional for having sorting and compression of references? – egreg Jul 12 '15 at 20:11