[Tex/LaTex] Customizing BibDesk’s preview style to include DOIs

bibdeskbibliographiesbibtexdoi

I often use the preview feature of BibDesk to generate citations I can cut & paste into other documents (e.g. for those colleagues of mine who can't let go of their lowly Microsoft word processor). Recent version of BibDesk allow to select different bib style (e.g. apalike, acm, ieeetr), which is fantastic, but I have yet to find one that outputs the DOI of an article, which is what I need it to do. Any clue on how I might customize one of those styles to do that? The previewtemplate.tex provided by BibDesk is very cryptic and I have no idea where to start.
Thanks in advance

Best Answer

From what I gather, previewtemplate.tex is just a skeleton file for BibDesk to call LaTeX.

\documentclass[letterpaper]{article}

%% I cut details

\begin{document}
\nocite{<<CiteKeys>>}          % <<CiteKeys>> is replaced by the selected entries' keys
\bibliography{<<File>>}        % <<File>> by the path to the opened .bib file
\bibliographystyle{<<Style>>}  % <<Style>> is replaced by the style set in the preferences  
\end{document}

It just happens that none of the bibliographystyle listed by BibDesk default prints the DOI. You should either find or write your own TeX bibliography style.

If you already have your own .bst, you can put it where TeX will find it (see LaTeX can't find my .bst file. How do I show it the way?) and set BibDesk’s preferences (Preferences > TeX Preview > BibTeX Style) accordingly. You can also put your .bst whereever you want if you set BibTeX Style to its full path.


An alternative solution: BibDesk templates

You could try to use BibDesk’s own export templates. You can write them within BibDesk (File > New/Open Template) or in plain text, RTF or even .doc, RSS, HTML...

You might want to copy and edit BibDesk default templates (in ~/Library/Application Support/BibDesk/Templates). But they tend to display everything.

Once you have a satisfying template, you add it to BibDesk preferences (File > Preferences > Templates). You can now select the entries your interested in and export them (File > Export...). Your template should appear in the list of File formats.

If you really want to copy/paste, your custom templates should also appear in the menus (Presentation > [Side/Lower] Preview). Text templates don’t, but if you declare them as RTF (File > Preferences > Templates, the Role entry in the table), everything is fine again.

An example

A (very minimal, created within BibDesk) template would be:

<$publications>
<$fields.Title?><$fields.Title/>, </$fields.Title?><$fields.Year?><$fields.Year/>, </$fields.Year?><$urls.Doi.absoluteString/></$publications>

When run on the following .bib file:

@book{Perec:1989,
    Author = {Perec, Georges},
    Doi = {10.978.207/0715237},
    Title = {La Disparition},
    Year = {1989}}

it generates:

La Disparition, 1989, http://dx.doi.org/10.978.207/0715237
Related Question