I'm trying to set up my CV to automatically include links to papers. I have a reasonable amount of other infrastructure set up that automatically populates a website with publication information based of bib files, so I have a URL that is relatively easy to construct, but I can't figure out how to use the entry key (label? name? this is a surprisingly hard thing to find out what it is called) in the field format definition:

conferences.bib

@inproceedings{BIBENTRY_KEY,
 title = {This is a paper title},
 ...

biblatex.cfg

\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{\href{https://patpannuto.com/pubs/BIBENTRY_KEY.pdf}{#1}\isdot}

Related question that seeded my biblatex hacking: Guidelines for customizing biblatex styles

up vote 4 down vote accepted

You can access the entry key as a normal field called entrykey, so usually \thefield{entrykey} should be enough when you want to use the raw data and \printfield{entrykey} when you actually want to display it.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear, backend=biber]{biblatex}
\usepackage{hyperref}
\addbibresource{biblatex-examples.bib}

\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{\href{https://example.com/pubs/\thefield{entrykey}.pdf}{#1}\isdot}

\begin{document}
\cite{sigfridsson}
\printbibliography
\end{document}

screenshot of the resulting PDF in a PDF viewer, the mouse hovers over the linked title to show that the URL it links to is https://example.com/pubs/sigfridsson.pdf as expected

  • That was exactly what I needed, thanks for the super fast reply! – Pat Oct 29 at 8:26

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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