[Tex/LaTex] Can not add bibtex reference

bibliographiesieeetran

I am new to latex and I have a problem in refrencing other papers in my work, I downloade the latex template from here:

get template

Also I want to for example cite this paper:
a paper

so for example I copied the bibtex from this website and copy it in the bibography section so I have:enter image description here

But nothing happens I really do not know how to add it then can anyone help?

Best Answer

The problem you're encountering arises because you are mixing-and-(mis)matching two different methods for creating a bibliography. First, the template you're using (from http://thesai.org/Home/Downloads/) provides the following, already-compiled thebibliography environment:

\begin{thebibliography}{1}

\bibitem{IEEEhowto:kopka}
H.~Kopka and P.~W. Daly, \emph{A Guide to \LaTeX}, 3rd~ed.\hskip 1em plus
  0.5em minus 0.4em\relax Harlow, England: Addison-Wesley, 1999.

\end{thebibliography}

(The blank lines are essential, by the way, for LaTeX to be able to compile this part correctly.) Second, you've found the following, BibTeX-formatted entry online:

@inproceedings{Kwak:2010:TSN:1772690.1772751,
 author = {Kwak, Haewoon and Lee, Changhyun and Park, Hosung and Moon, Sue},
 title = {What is Twitter, a Social Network or a News Media?},
 booktitle = {Proceedings of the 19th International Conference on World Wide Web},
 series = {WWW '10},
 year = {2010},
 isbn = {978-1-60558-799-8},
 location = {Raleigh, North Carolina, USA},
 pages = {591--600},
 numpages = {10},
 url = {http://doi.acm.org/10.1145/1772690.1772751},
 doi = {10.1145/1772690.1772751},
 acmid = {1772751},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {Twitter, degree of separation, homophily, influential, information diffusion, online social network, pagerank, reciprocity, retweet},
} 

As you've discovered, simply dumping this entry into the existing thebibliography environment does not work.

Assuming you don't need to reference the Kopka and Daly book, and assuming further that you don't want to format by hand the Kwak et al piece, here's what you need to do:

  • Replace the entire existing thebibliography environment with a single statement:

    \bibliography{myreferences}
    
  • Create a new file called myreferences.bib (the extension bib is essential), and place the BibTeX-formatted entry shown above in that file. All further bibtex-style entries should also be placed in this file. Save the bib file in the directory where your main tex file is located.

  • Back in your main tex file, be sure to have one or more \cite{Kwak:2010:TSN:1772690.1772751} instructions in the appropriate locations. Note the string "Kwak:2010:TSN:1772690.1772751" -- it's the very first string of the entry you placed in the file references.bib. The string is called the "key" to the corresponding entry.

  • Run LaTeX, BibTeX, and LaTeX twice more.

By the end of this, there should a citation call-out in the body of the document as well as a correctly formatted bibliography.


Here's the screenshot of the result of assembling these instructions. The example code uses the filecontents package to make the code self-contained and compilable. In practice, you should have separate .tex and .bib files.

enter image description here

\RequirePackage{filecontents}  
\begin{filecontents}{myreferences.bib}
@inproceedings{Kwak:2010:TSN:1772690.1772751,
 author = {Kwak, Haewoon and Lee, Changhyun and Park, Hosung and Moon, Sue},
 title = {What is Twitter, a Social Network or a News Media?},
 booktitle = {Proceedings of the 19th International Conference on World Wide Web},
 series = {WWW '10},
 year = {2010},
 isbn = {978-1-60558-799-8},
 location = {Raleigh, North Carolina, USA},
 pages = {591--600},
 numpages = {10},
 url = {http://doi.acm.org/10.1145/1772690.1772751},
 doi = {10.1145/1772690.1772751},
 acmid = {1772751},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {Twitter, degree of separation, homophily, influential, information diffusion, online social network, pagerank, reciprocity, retweet},
} 
\end{filecontents}

\documentclass[conference, letterpaper]{IEEEtran}
%% the following preamble is a compressed version of the template's material
\hyphenation{op-tical net-works semi-conduc-tor}
\usepackage{subcaption}
\ifCLASSINFOpdf
   \usepackage[pdftex]{graphicx}
\else
\fi
\usepackage[cmex10]{amsmath}
\usepackage{color}
\usepackage{fancyhdr}
\renewcommand{\thispagestyle}[2]{} 
\fancypagestyle{plain}{
        \fancyhead{}
        \fancyhead[C]{first page center header}
        \fancyfoot{}
        \fancyfoot[C]{first page center footer}
}
\pagestyle{fancy}
\headheight 20pt
\footskip 20pt
\rhead{}
\setcounter{page}{1}
\fancyhead[R]{\textit{(IJACSA) International Journal of Advanced Computer Science and Applications, \\ Vol. XXX, No. XXX, 3001}}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{www.ijacsa.thesai.org}
\renewcommand{\footrulewidth}{0.5pt}
\fancyfoot[R]{\thepage \  $|$ P a g e }

\bibliographystyle{IEEEtran}
\begin{document}
\cite{Kwak:2010:TSN:1772690.1772751}

\bibliography{myreferences}
\end{document}
Related Question