Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My strategy to cite papers has been to type all the information in manually within the body of the .tex file. For example:

\begin{thebibliography}{10}

\bibitem{mg} {\sc M. Gockenbach},
{\em Understanding and Implementing the Finite Element Method}, SIAM,
Philadelphia (2006)

...

\end{thebibliography}

When I search for articles on things like google scholar, I notice that I have the option of importing into BibTeX format, but it looks nothing like what I would type in the body of the article. For example:

@article{biot1941general,
  title={General theory of three-dimensional consolidation},
  author={Biot, M.A.},
  journal={Journal of applied physics},
  volume={12},
  number={2},
  pages={155--164},
  year={1941},
  publisher={AIP}
}

So, I suspect there's a faster way to use this code to my advantage. Can I simply put it into my latex file in the bibliography section? Can I put it into a separate file and load the bibliography from that file into my .tex file? How can I do this?

share|improve this question
    
Some related questions: First, to understand the various options, see bibtex vs biber and natbib vs biblatex. For some more detail on how BibTeX and LaTeX interact see What is the interface between LaTeX and BibTeX –  Alan Munn Jan 20 '13 at 22:25
1  
And another: Biblatex for idiots (I'm not responsible for the title!) –  Alan Munn Jan 20 '13 at 22:33
1  
And one more that gives a broader overview along with some links more related questions: What TeX software to write technical papers with. –  Alan Munn Jan 20 '13 at 23:00
add comment

2 Answers

A file named example.tex using BibTeX:

\documentclass{article}
\begin{filecontents}{example.bib}
@article{biot1941general,
  title={General theory of three-dimensional consolidation},
  author={Biot, M.A.},
  journal={Journal of applied physics},
  volume={12},
  number={2},
  pages={155--164},
  year={1941},
  publisher={AIP}
}
\end{filecontents}
\begin{document}
There are a  theory of 3D consolidation 
\cite{biot1941general}  in our references.
\bibliography{example.bib}
\bibliographystyle{plain}
\end{document}

The bibliography must be a separate file as example.bib or included in the document preamble as showed in this example. The file example.tex must be usually compiled in this order:

pdflatex example.tex
bibtex  example
pdflatex example.tex
pdflatex example.tex

The result (example.pdf) must be:

MWE

A great advantage of this method instead of insert \bibitems manually is that you can change the style of all the references simply changing plain with another style as vancouver for example. Then the author is not "M. A. Biot" but "Biot MA.", the journal is not in cursive, etc. There a lot more options (abbrv, acm, etc.)

Another big advantage is that you can manage your references easily with programs as JabRef.

Only when you are comfortable managing .bib files and compiling LaTeX with BibTeX, is time to learn about the natbib and biblatex package.

share|improve this answer
add comment

You cannot put the BibTeX formatted code directly into your LaTeX file. But you put it into a BibTeX-file with extension .bib and include it in a certain way into your LaTeX document. Actually, you can put hundreds of such "@article"s (and there are other types "@book", "@techreport", and also "@inbook", "@inproceedings") into one BibTeX-file. Following file refs.bib is an example:

@ARTICLE{Smith1980,
  author = {Peter Smith},
  title = {A new analytic approach},
  journal = {Artificial Intelligence},
  volume = {14},
  issue = {2},
  pages = {329--334},
  year = {1980}
}
@BOOK{AlwaysCitedRef1999,
  author = {M. Miller},
  title = {The Big Reference},
  publisher = {Prentice-Hall, Inc.},
  year = {1999}
}

Using biblatex (kind of replacement of bibtex), your document myarticle.tex will look like

\documentclass{article}
\usepackage[style=numeric]{biblatex}  %default style
%\usepackage[style=draft]{biblatex}  %maybe useful? difficult in bibtex!
\addbibresource{refs.bib}   %\bibliography{refs} is deprecated
\begin{document}
Hello world! (\cite{Smith1980})
\nocite{AlwaysCitedRef1999}
\printbibliography
\end{document}

You need to compile the document by a sequence of commands.

  1. pdflatex myarticle.tex will generate myarticle.aux that contains the bibtex-keys of all references you \cite'd (or \nocite'd), e.g. Smith1960 and AlwaysCitedRef1999.
  2. bibtex myarticle.aux will process your refs.bib and sort out all the needed references into myarticle.bbl.
  3. pdflatex myarticle.tex includes the bibliography myarticle.bbl into your pdf-output.

If you compile your document for the first time you might need to repeat step 2 and 3 until all page numbers are correct (actually, LaTeX will tell you to do so). This is because the 'insertion' of new text (the bibliography and the citations) into the pdf-output will change the page numbering.

Note: Only the \cite'd and \nocite'd papers will appear in your bibliography of your PDF file, not your entire collection!


My typical work flow using JabRef (and sometimes Zotero)

(1) Downloading/Naming/Saving of files. After searching the web and finding a paper that has some useful information for me, I download the paper and also the biliographic data. For the latter, some webpages provide a bibtex-file for download as you have discovered. Others do not. In general, the bibliograpic data can be still found on the webpage. Hence, I have used the Addon Zotero for Firefox just to extract this information from the webpage and save it to a bibtex-file.

  • I create a bibtex-key BIBTEXKEY for this paper. This key should to be unique among all papers you have now and in future! So choose wisely! ;-) That depends on your subject. For example, how many authors does a typical paper have? 2 or 10? Here are two examples for patterns for the bibtex-keys,

    • <AuthorsEtAl><YEAR>-<InitTitle> where <AuthorsEtAl> stands for the first 2 or 3 author names and "etal" appended for more authors, and <InitTitle> for first 3 initials of title;
    • <YEAR>-<AuthorsShort>-<InitTitle> where <AuthorsShort> stands for the first 3 letters of each author name;
  • I save the PDF-paper as BIBTEXKEY.pdf and the bibliograpic data as BIBTEXKEY.bib in a folder for my not-yet-read papers. (Extending the filename is also possible, e.g. appending the title of the paper BIBTEXKEY_ShortendPaperTitleHere.pdf.)

(2) Integration into the BibTeX-file. I have one folder that contains all my read papers and a BibTeX-file refs.bib as a database about them. The BibTeX-file is managed by the program JabRef. For the integration of the paper BIBTEXKEY.pdf, I move BIBTEXKEY.pdf into that folder for my read papers and import the file BIBTEXKEY.bib into refs.bib by JabRef (BIBTEXKEY.bib can be deleted afterwards).

(3) Writing an own article. If "doc" is the folder with all the (LaTeX) files for my own article then I create a soft link to refs.bib in it. (You can also copy refs.bib to "doc" with the disadvantage that updates of the original file are missing in the copy.) In any case, after finalizing the article, I make sure that I have a permanent copy of refs.bib in folder "doc" for preservation purpose. Compilation of the LaTeX document works as shown above. (Actually, I am using LyX as editor to generate LaTeX.)

In sum, I have one folder with read papers and one BibTeX-file, which is managed by JabRef and used in all my works. The identification of papers is handled by BibTeX-keys.

share|improve this answer
    
you can depend only on Zotero to automatically generate citation keys, I use zotero+biblatex+biber+TexStudio to do this job, if interested you may have a look here. Let me know, if JabRef can be totally left out to get the job done. –  doctorate May 18 '13 at 21:04
    
@doctorate Thx. JabRef can automatically generate custom BibTeX keys, too. I guess you can leave out JabRef. But for me, JabRef is easier to use and I hardly use Zotero: * In JabRef tags can be organized in a tree-like structure; * JabRef uses .bib file as its database (no need for import / export of .bib file); all PDF and PS files can be stored in one folder and JabRef can link entries of the ".bib" file automatically to them. (I like this simple structure with little overhead.) * JabRef has always been a standalone application, but nowadays Zotero can be used standalone, too. –  e-birk May 19 '13 at 11:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.