7

I am using biblatex to cite articles with full reference in the text, and therefore have no references section.

The biblatex setup that I use is the following

\documentclass{article}
\usepackage{filecontents}

\begin{filecontents}{bibliography.bib}
    @article{reference,
    author = {F Author and S Author}, 
    journal = {Obsc. J.},
    title = {Article Title},
    pages = {13},
    volume = {400},
    year = {2013},
    month = {Oct},
    doi = {10.1111/123},
    URL = {http://dx.doi.org/10.1111/123}}
\end{filecontents}

\usepackage[maxnames=1,backend=bibtex,doi=false,isbn=false,url=false,firstinits=true,uniquename=false,useprefix=true]{biblatex}
\addbibresource{bibliography.bib}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
\DeclareFieldFormat[article]{year}{\mkbibparens{#1}}
\DeclareFieldFormat{journaltitle}{\mkbibemph{#1}} % italic journal title 
\DeclareFieldFormat{pages}{#1}
\renewbibmacro{in:}{} % remove "in:"
\renewcommand{\newunitpunct}{, }
\renewcommand{\newblockpunct}{, }
% remove first name
\DeclareNameFormat{first-last}{\usebibmacro{name:last}{#1}{#3}{#5}{#7}\usebibmacro{name:andothers}}
\AtEveryCitekey{\clearfield{title}} % remove title


\begin{document}
Cite the article \fullcite{reference}.
\end{document}

This way, a reference cited with \fullcite gives something like "Author et al., Obsc. J. 400 (2013), 13".

So far so good, but now I would like to make the citation (or at least the first author if thats easier) a hyperlink leading to the URL of the article (each article entry in the bib-file has a URL entry and/or a DOI). Is there a way to do this?

Edit: something similar is used in the reference section of some Journals, see e.g. this open access article.

  • What is it a clickable link to, if you have no bibliography? – Alan Munn Nov 20 '13 at 23:34
  • I mean a hyperlink that opens the URL in a browser – John Smith Nov 20 '13 at 23:51
  • So every item in your .bib file has a URL, and you want biblatex to generate the link from the .bib file itself. – Alan Munn Nov 21 '13 at 0:10
  • yes, at least it might have a DOI from which one could get a URL by using dx.doi.orgDOI – John Smith Nov 21 '13 at 0:37
  • 1
    Can't you load hyperref and remove one of the two options doi=false or url=false? BTW: why do you have both doi and url fields (they point to the same place)? – karlkoeller Nov 21 '13 at 5:45
5

Instead of redefining each and every field format you might like this more general approach to redefine the \fullcite command.

\DeclareCiteCommand{\fullcite}
  {\usebibmacro{prenote}}
  {\iffieldundef{doi}
    {\iffieldundef{url}
      {\usedriver
       {\DeclareNameAlias{sortname}{default}}
       {\thefield{entrytype}}}
      {\href{\thefield{url}}
        {\usedriver
          {\DeclareNameAlias{sortname}{default}}
          {\thefield{entrytype}}}}}
    {\href{http://dx.doi.org/\thefield{doi}}{\usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

This will link the full citation as printed by the bibdriver to the DOI-URL or URL (in that order of precedence).

The MWE

\documentclass{article}
\usepackage{filecontents}

\begin{filecontents}{bibliography.bib}
@article{reference,
  author = {F Author and S Author}, 
  journal = {Obsc. J.},
  title = {Article Title},
  pages = {13},
  volume = {400},
  year = {2013},
  month = {10},
  url = {http://dx.doi.org/10.1111/123},
  doi = {10.1111/123},
}
\end{filecontents}

\usepackage[maxnames=1,backend=bibtex,doi=false,isbn=false,url=false,firstinits=true,uniquename=false,useprefix=true]{biblatex}
\addbibresource{bibliography.bib}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
\DeclareFieldFormat[article]{year}{\mkbibparens{#1}}
\DeclareFieldFormat{journaltitle}{\mkbibemph{#1}} % italic journal title 
\DeclareFieldFormat{pages}{#1}
\renewbibmacro{in:}{} % remove "in:"
\renewcommand{\newunitpunct}{\addcomma\space}
\renewcommand{\newblockpunct}{\addcomma\space}
\DeclareNameFormat{first-last}{\usebibmacro{name:last}{#1}{#3}{#5}{#7}\usebibmacro{name:andothers}}
\AtEveryCitekey{\clearfield{title}} % remove title

\DeclareCiteCommand{\fullcite}
  {\usebibmacro{prenote}}
  {\iffieldundef{doi}
    {\iffieldundef{url}
      {\usedriver
       {\DeclareNameAlias{sortname}{default}}
       {\thefield{entrytype}}}
      {\href{\thefield{url}}
        {\usedriver
          {\DeclareNameAlias{sortname}{default}}
          {\thefield{entrytype}}}}}
    {\href{http://dx.doi.org/\thefield{doi}}{\usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\usepackage{hyperref}

\begin{document}
Cite the article \fullcite{reference}.
\end{document}

yields

enter image description here

  • Note though that I would not wholeheartedly recommend this, as it seems to be better to actually be able to see the doi/url linked somewhere in the document. After all, on paper there is no way to tell where a link is going. – moewe Nov 22 '13 at 20:37
1

I found an intermediate solution: adding the hyperref package and replacing above declarations with

\DeclareFieldFormat[article]{volume}{\href{http://dx.doi.org/\thefield{doi}}{#1}}
\DeclareFieldFormat{date}{\href{http://dx.doi.org/\thefield{doi}}{#1}}
\DeclareFieldFormat{journaltitle}{\mkbibemph{\href{http://dx.doi.org/\thefield{doi}}{#1}}}
\DeclareFieldFormat{pages}{\href{http://dx.doi.org/\thefield{doi}}{#1}}
\DeclareNameFormat{first-last}{\href{http://dx.doi.org/\thefield{doi}}{\usebibmacro{name:last}{#1}{#3}{#5}{#7}\usebibmacro{name:andothers}}}

makes the author name, journal name, year, pages, and volume number individual urls. It's not perfect but it gets the job done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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