In order to successfully use BibTeX
, you need to execute the following sequence of commands:
- run
latex
on the .tex
file
- run
bibtex
- run
latex
again
- run
latex
again
The first pass of latex
detects a citation command in your .tex
file, as well as the \bibliographystyle{...}
and \bibliography{...}
commands. Then, running bibtex
formats the citation based on the \bibliographystyle{...}
command. Running latex
the second time makes the appropriate links, and, finally, running latex
the third time puts everything in place.
(In TeXShop, you run latex
by either clicking on Typeset
in the window or by the shortcut COMMAND+T
; bibtex
is run by changing the dropdown menu next to the Typeset
button to BibTeX
and then clicking Typeset
or by using the shortcut SHIFT+COMMAND+B
.)
A couple things you may want to note:
First, if the .bib
file is in the same directory as the .tex
file, you do not need to specify the entire file path.
Second, you probably want to avoid having spaces in the name of your .bib
file. If the name, for example, is my bibliography.bib
, you probably want to change it to my_bibliography.bib
, and you can include it simply with \bibliography{my_bibliography}
, leaving off the file extension.
Third, if these instructions are confusing, there is an engine called pdflatexmk
, which is, I think, a Perl script that was written to execute latex
and bibtex
the correct number of times on a .tex
file. This is available as an engine with any recent version of TeXShop. By default, it is inactive. If you type:
mv ~/Library/TeXShop/Engines/Inactive/Latexmk/pdflatexmk.engine ~/Library/TeXShop/Engines/
into the command line (i.e., Terminal) it will move this script into the active folder for you, and then you can access this from the dropdown menu in TeXShop right next to the Typeset
button, after quitting and reopening TeXShop. (You can also do this by using 'drag & drop' techniques and Finder, though you will probably need to reveal your Library folder, if you're running a recent OS X.)
Finally, a suggestion: you need not make separate .bib
files for each document that you write in LaTeX
. You can make one 'master' file, and put it in the ~\Library\texmf\bibtex\bib
directory (which is a place that will always be found when you run latex
, bibtex
, and/or pdflatexmk
). Only citations that you have cited with a \cite{...}
command will actually show up in the References section of the document. I find that this is a good way to manage citations, rather than having separate files for everything, particularly if there are works that you you end up citing multiple times.
Update (as per some recent comments):
First, make sure that your TeX distribution is up to date.
Then, if you have not already set up the requisite texmf
directory structure for adding your own .sty
files, .bib
files, etc., you can follow the instructions here to do so.
After following those instructions, you can move your .bib
file to the ~\Library\texmf\bibtex\bib
directory. This should take care of any problems that latex
\ bibtex
might have in locating the .bib
file. (Again, doing this might require you to reveal your Library folder.)
Moreover, MWEs for both the .bib
file and .tex
file will look as follows:
.bib
file, which is named master.bib
and located in ~\Library\texmf\bibtex\bib
:
@article{ref_key6,
Author = {Example Author},
Journal = {Example Journal},
Number = {1},
Pages = {1-32},
Title = {Example Title},
Volume = {1},
Year = {2013}}
and the .tex
file:
\documentclass{article}
\usepackage{natbib}
\begin{document}
I am going to cite `ref\_key6' here.\citep{ref_key6}
\bibliographystyle{plain}
\bibliography{master}
\end{document}
There was a problem with the url
field (I suppose direcly copied on the web), which probably had some invisible character in it. I retyped the url, changed the category from @misc
to @article
since it comes from a journal on line, loaded the url
package to break long urls at the end of line.
I also propose to use bblatex
with option natbib
(it emulates the \citet
and citep
commands from natbib
) and style=authoryear
. The advantage, with backend=biber
is you can input accented letters directly on the keyboard, since biber understands utf8
.
I corrected the url, which wasn't exact, and the author's first name, which precisely has an accented letter.
Code with natbib + bibtex:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage[round]{natbib}
\usepackage{url}
\begin{document}
\citet{Perez1}.
\bibliographystyle{plainnat}
\bibliography{Skripsie}
.bib file for bibtex
@article{Perez1,
author = {Perez, Hern\'{a}in David},
journal = {CSCMP's Supply Chain Quarterly},
pages = {4},
title = {{Supply Chain Strategies: Which one hits the mark?}},
url = {{http://www.supplychainquarterly.com/print/20130306-supply-chain-strategies-which-one-hits-the-mark/}},
year = {2013},
}
Code with biblatex + biber:*
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage[english = british]{csquotes}
\usepackage[english]{babel}
\usepackage[natbib, style=authoryear, backend=bibtex]{biblatex}
\addbibresource{Skripsie1.bib}
\begin{document}
A citation: \citet{Perez1}
\printbibliography
\end{document}
\end{document}
.bib file for biber;
@article{Perez1,
author = {Perez, Hernán David},
journal = {CSCMP's Supply Chain Quarterly},
pages = {4},
title = {Supply Chain Strategies: Which one hits the mark?},
url = {http://www.supplychainquarterly.com/print/20130306-supply-chain-strategies-which-one-hits-the-mark/},
year = {2013},
}
Best Answer
Mendeley
From Mendeley website:
From Alternative.to: