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 ?

1 Answers1

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

moewe
  • 175,683