For a research report I want to embed some of the cited papers as PDFs (with \includepdf
). As all related metadata is available in the bibtex database and also the PDF filenames can be computed out of the bibtex key. So I would like to have an \IncludePaper{<bibtex key>}
command that (a) creates an entry with the paper's title in the ToC and (b) includes the PDF:
\documentclass{book}
\usepackage{filecontents}
\usepackage[defernums=true, hyperref, backref, refsegment=chapter]{biblatex}
\usepackage{hyperref}
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {The Alpha Paper},
}
@misc{B02,
author = {Buthor, B.},
year = {2002},
title = {The Bravo Paper},
}
@misc{C03,
author = {Cuthor, C.},
year = {2003},
title = {The Charlie Paper},
}
\end{filecontents}
% The bibtex database to use (\bibliography{bibliotest} in your case)
\bibliography{\jobname}
\newcommand{\IncludePaper}[1]{%
\phantomsection{}
\addcontentsline{toc}{section}{\citeyear{#1}: \citetitle{#1}}
% \includepdf[pages=-,pagecommand={}]{#1.pdf}
}
\begin{document}
\tableofcontents
\nocite{*}
\printbibliography
\chapter{Papers}
\IncludePaper{A01}
\IncludePaper{B02}
\end{document}
This works relatively well, including nice entries in the ToC. In the PDF ToC (the tree view on the lefthand side of the PDF viewer), however, only the citation keys appear.
I guess this is caused by the fact that \citeyear
and \citetitle
are protected commands that are not expanded when the PDF ToC is created.
Is there any way to get just the plain text result of these commands and pass it to \addcontentsline
in a way, so that the PDF ToC contains the paper's year and title?