0

Currently \footfullcite{jdoe2014} for

@inproceedings{jdoe2014,
   author = {John Doe},
   title = {Some paper},
   url = {http://somelink.com/file.pdf},
   year = {2014},
   note = {Rarecon}
}

renders into:

John Doe (2014). "Some paper". In: Rarecon. URL: http://somelink.com/file.pdf

How I can change standard output of this into the

John Doe (2014). "Some paper". In: Rarecon.

where "Some paper" also is PDF link/url to http://somelink.com/file.pdf ?

5
  • What about the bibliography (if you have any)? Do you want the title to link to the paper there as well, or do you prefer to have the link actually displayed with its URL?
    – moewe
    Sep 9, 2014 at 17:08
  • Yes, same for bibliography too. Sep 9, 2014 at 17:26
  • Well, OK then this question is just a duplicate of biblatex: Make title hyperlink to doi url (if available) or maybe rather biblatex: make title hyperlink to DOIs, URL or ISBN, don't you think? (I impatiently answered for the case in which one might not want this change to apply to the bibliography.)
    – moewe
    Sep 9, 2014 at 17:27
  • Indeed, sorry, didn't found that one while searching first time. Sep 9, 2014 at 17:31
  • You can still use my answer below though, just discard everything in the \AtBeginBibliography block.
    – moewe
    Sep 9, 2014 at 17:37

1 Answer 1

2

The following is borrowed from Herbert in biblatex: Make title hyperlink to doi url (if available)

We use doi=false and url=false at load time to suppress DOIs and URLs, but that wont cut it for @online entries, so if we want to get rid of the URL there, we also need

\renewbibmacro*{url+urldate}{}

Then we use Herbert's macro to typeset the title with the link (DOI is preferred to URL)

\newbibmacro{string+doiurl}[1]{%
  \iffieldundef{doi}{%
    \iffieldundef{url}{%
          #1%
    }{%
      \href{\thefield{url}}{#1}%
    }%
  }{%
    \href{http://dx.doi.org/\thefield{doi}}{#1}%
  }%
}

The format is applied to the title field

\DeclareFieldFormat{title}{\usebibmacro{string+doiurl}{\mkbibemph{#1}}}
\DeclareFieldFormat[article,incollection]{title}{\usebibmacro{string+doiurl}{\mkbibquote{#1}}}

To get bibliography back to normal, we then issue

\AtBeginBibliography{
  \DeclareFieldFormat{title}{\mkbibemph{#1}}
  \DeclareFieldFormat[article,incollection]{title}{\mkbibquote{#1}}
  \settoggle{bbx:url}{true}
  \settoggle{bbx:doi}{true}
  \renewbibmacro*{url+urldate}{%
    \usebibmacro{url}%
    \iffieldundef{urlyear}
      {}
      {\setunit*{\addspace}%
       \usebibmacro{urldate}}}
}

To toggle on URLs and DOIs (and revert the old url macro) and return to the old title formatting without hyperlinks.

MWE

\documentclass{article}
\usepackage[style=authoryear,doi=false,url=false]{biblatex}
\usepackage[colorlinks]{hyperref}

\renewbibmacro*{url+urldate}{}

\newbibmacro{string+doiurl}[1]{%
  \iffieldundef{doi}{%
    \iffieldundef{url}{%
          #1%
    }{%
      \href{\thefield{url}}{#1}%
    }%
  }{%
    \href{http://dx.doi.org/\thefield{doi}}{#1}%
  }%
}


\DeclareFieldFormat{title}{\usebibmacro{string+doiurl}{\mkbibemph{#1}}}
\DeclareFieldFormat[article,incollection]{title}{\usebibmacro{string+doiurl}{\mkbibquote{#1}}}

\AtBeginBibliography{
  \DeclareFieldFormat{title}{\mkbibemph{#1}}
  \DeclareFieldFormat[article,incollection]{title}{\mkbibquote{#1}}
  \settoggle{bbx:url}{true}
  \settoggle{bbx:doi}{true}
  \renewbibmacro*{url+urldate}{%
    \usebibmacro{url}%
    \iffieldundef{urlyear}
      {}
      {\setunit*{\addspace}%
       \usebibmacro{urldate}}}
}

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem\footfullcite{sigfridsson} ipsum\footfullcite{markey} dolor sit\footfullcite{cicero} amet.


\printbibliography

\end{document}

enter image description here

Not the answer you're looking for? Browse other questions tagged .