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.

I'm using biblatex with the standard bibliography style. How or what should I modify so that the title is turned into a link pointing to a suitable doi url? (of course only if the doi is available)

share|improve this question

1 Answer 1

up vote 24 down vote accepted

I used the default example bib from the current biblatex documentation which is available on every TeX distribution. The two entries have both a doi entry in the bib file:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber]{biblatex} 
\usepackage[colorlinks]{hyperref}
\bibliography{biblatex-examples}
\ExecuteBibliographyOptions{doi=false}
\newbibmacro{string+doi}[1]{%
  \iffieldundef{doi}{#1}{\href{http://dx.doi.org/\thefield{doi}}{#1}}}
\DeclareFieldFormat{title}{\usebibmacro{string+doi}{\mkbibemph{#1}}}
\DeclareFieldFormat[article]{title}{\usebibmacro{string+doi}{\mkbibquote{#1}}}
\begin{document}
A reference to~\cite{kastenholz} and~\cite{sigfridsson}. 
\printbibliography
\end{document}

With the latest biblatex update there is also a star version for \DeclareFieldFormat which refers to all entry types.

enter image description here

share|improve this answer
    
Fantastic! Thanks! –  Paulo Cereda Jul 22 '11 at 17:40
1  
@Herbert, would it be possible to make the hyperlinks conditional? What I mean is, if both URL and DOI are available, use DOI, if only URL is available, use URL. Also, you mentioned that there must (should?) be a star version for \DeclareFieldFormat to capture all entry types. Do you know the command for that? –  Jörg Mar 16 '12 at 14:28
    
I added a follow up question here: tex.stackexchange.com/questions/48400/… –  Jörg Mar 17 '12 at 20:11

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.