Assuming your .bib
file contains url
fields: Use the alphaurl
style instead of alpha
.
\documentclass{article}
\usepackage{url}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
url = {www.tex.stackexchange.com},
}
\end{filecontents}
\begin{document}
\nocite{*}
\bibliographystyle{alphaurl}
\bibliography{\jobname}
\end{document}
(The filecontents environment is only used to include some external files directly into the example, so that it compiles. It is not necessary for the solution.)
Bibtool can do a lot of the work for you. Take this .bib
file:
% masterfile.bib
@InProceedings{a,
crossref = {z},
author = {Author, A.},
year = {2001},
title = {Alpha},
}
@InProceedings{b,
crossref = {z},
author = {Buthor, B.},
year = {2002},
title = {Bravo},
}
@Proceedings{z,
editor = {Zuthor, Z.},
year = {1999},
title = {Zulu},
publisher = {Publisher},
address = {Address},
}
@Book{book,
author = {Smith, John},
title = {A Book Title},
publisher = {Publisher},
year = 2000,
address = {Address}}
@Article{article,
author = {Smythe, Jon},
title = {An Artitle Title},
journal = {Journal of Journals},
year = 2000,
volume = 10,
number = 2,
pages = {100--125}}
@Book{notcited,
author = {Schmit, Jean},
title = {An Uncited Book},
publisher = {Publisher},
year = 2001,
address = {Address}}
Now imagine two different input files:
% file1.tex
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{natbib}
\begin{document}
\cite{a,b,book}
\bibliographystyle{plain}
\bibliography{masterfile}
\end{document}
and
% file2.tex
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{natbib}
\begin{document}
\cite{article,book}
\bibliographystyle{plain}
\bibliography{masterfile}
\end{document}
We want to construct a new .bib
(say: newbibfile.bib
) that contains the following bib entries: a
, b
, z
, article
, and book
(but not notcited
). Run latex
(or lua|pdf|xelatex
) on your two .tex
files. This produces the all-important .aux
file that bibtool
can read. The bibtool
command is:
bibtool -x file1.aux -o newbibfile.bib && bibtool -x file2.aux >> newbibfile.bib
This command extracts from file1
and creates the new .bib
file, then the second call uses >>
to append its output to the already-created newbibfile.bib
. (If you have more than two files you need to extract from, modify the above command accordingly.)
... Now, many will note that both files cited the entry book
, which means there will be two book
entries in newbibfile.bib
; this is no good. Good BibTeX-aware editors can help you find and deal with them [Emacs plug!], but bibtool
can also detect entry key duplicates:
bibtool -d newbibfile.bib
If you want to combine all this into a one-liner, you could do:
bibtool -x file1.aux -o temp.bib && bibtool -x file2.aux >> temp.bib && bibtool -d temp.bib -o newbibfile.bib
In our use case, bibtool
helpfully warns:
*** BibTool WARNING: Possible double entries discovered:
*** book =?= book
*** book
and the second book
entry in newbibfile.bib
is marked by ###
. Just find your duplicate entries and delete them.
Best Answer
As mentioned in my comment:
You can use the "group field" menu in BibDesk (see the official documentation). It will create folders in which you can drag and drop entries at will. The data will be stored within the BibTeX entry itself. Say, if you set it to "keywords", you could then tell BibTeX to use the "keywords" field and print only the relevant entries (note: I am not sure about that, haven't used pure BibTeX in a while, but it can definitely be done in BibLaTeX).