2

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

1 Answer 1

4

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

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

You must log in to answer this question.

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