# citation in {elsarticle} worked example!

Do you have any worked example showing how we cite and manage references in {elsarticle}. I already tried to use the following. It compiles successfully. Any ideas to get better form?

Here my example

\documentclass[preprint,12pt,authoryear]{elsarticle}
\begin{document}
\section{References}

\cite{Abdullah2011971}

\bibliographystyle{elsarticle-harv}
\bibliography{science}

\end{document}


For example use http://www.sciencedirect.com/science/article/pii/S1877705811003481 for creating a science.bib.

• How is this different from tex.stackexchange.com/questions/290315/…?
– cfr
Jan 31, 2016 at 16:53
• @ cfr This question is trying to form several good worked examples. Look, this question has not been discussed before in a proper manner. Clear, step-by-step and address the points. Jan 31, 2016 at 17:02
• @Mohammad: Requesting step by step is quite bold considering the fact that you did not provide a compilable example (both here and in the other question) ;-)
– user31729
Jan 31, 2016 at 17:50
• Show a complete example (from \documentclass... to \end{document}  and the relevant entry from the .bib file). Without an example that reproduces the problem, we can only guess at what the issue might be. Help us to help you! Jan 31, 2016 at 18:46
• If I follow your link, click Export and choose BibTeX, I get a database entry with the name Abdullah2011971, but your example contains \cite{Abdullah1965}. Jan 31, 2016 at 19:38

Your file almost works. The main problem with it is that you use \bibligraphy{science.bib} so LaTeX looks for a file called science.bib.bib, which is probably not what you want.

The other possible problem is, as Ian Thompson noted, that you are calling for an entry that does not exist in your .bib file. That will fail for obvious reasons.

(Edit for greater clarity.) Assuming a .bib file called science.bib that contains the following entry:---

@Article{smith2000,
author =   {Smith, A. B.},
title =    {Title of Article},
journal =  {Journal Title},
year =     2000,
volume =   22,
pages =    {419--431}}


---you would construct the document in the following way:

\documentclass[preprint,12pt,authoryear]{elsarticle}
\begin{document}
\section{References}

Let us have some lines (sentences) and wanted to cite references. Do I need to manually type (Abdullah 2011 et al.) etc? No, you type:
\cite{smith2000}

If you rely on the style 'elsarticle-harv', it prescriptively determines how citations should look and normally should not be modified.

\bibliographystyle{elsarticle-harv}
% not: \bibliography{science.bib}
\bibliography{science}

\end{document}

• @ jon, can you modify code for couple of references? Jan 31, 2016 at 20:48
• What would you need? It is just a matter of adding another @article{...}(say) to the .bib file, and then \cite-ing it in the document.
– jon
Jan 31, 2016 at 20:50
• @ jon, let us have some lines (sentences) and wanted to cite references. Do I need to manually open .bib file and copy paste @article{ in the citation location in the manuscript? Jan 31, 2016 at 20:58
• @ jon, No I do not want to do this manually. You misunderstood. Look at my previous comment. Jan 31, 2016 at 21:01
• I do not understand. The only "manual" thing you do is type the entrykey in your .tex file. So you type \cite{smith2000} or \cite{abdullah2011} if there is a corresponding entry in the .bib file. If the .bib file is empty, then you cannot \cite anything from it.
– jon
Jan 31, 2016 at 21:24