4

In my current document I have quite a lot \section commands containing \cite commands. Using hyperref or bookmark (as shown in the mwe below), the pdf bookmarks just print the corresponding key rather than the number.

Output: chapter titleFirst

Desired output: chapter title [1]

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{First,
author = {First, A.},
journal = {Journal},
pages = {1762--1776},
volume = {27},
year = {2017}
}
\end{filecontents*}

\documentclass{scrreprt}
\usepackage{hyperref}
\usepackage{bookmark}
\usepackage[style=numeric]{biblatex}
\addbibresource{\jobname.bib}

\begin{document}
\chapter{chapter title\cite{First}}
\cite{First}
\end{document}

As the \cite command is not expandable, the desired output is not obtained. Is there instead any possibility to get access to the counter that corresponds to the key, so that one can use the \texorpdfstring method to print the number to the pdf bookmarks while using the normal \cite command in the .tex file?

Finally, I as well found the following possibility (by egreg) that ensures, that the keys are not printed in the bookmarks, but as stated above, I would prefer to have the numbers in the bookmarks as well.

\makeatletter
\pdfstringdefDisableCommands{\let\cite\@gobble}
\makeatother
4
  • I find cites in the bookmarks, in the table of contents and in chapter titles (do you really have a citation there?) quite unusual, even more if there are numeric. Imho it would be much better to suppress them in all these places. Commented Sep 11, 2017 at 9:37
  • 1
    @Ulrike Fischer: Due to the guidelines that I have to stick to, thouse citations in chapter titles and in the table of contents are definitely required.
    – leandriis
    Commented Sep 11, 2017 at 9:46
  • No guideline can force you to add a citation reference to a text that isn't a citation. So why don't you change the chapter titles so that this isn't needed? It seems odd anyway that you use citations as titles. Commented Sep 11, 2017 at 9:55
  • 1
    @Ulrike Fischer: As this guideline is strickly mandatory I can not simply ignore it. Changing chapter (or sectioning...) titles is not an option either as I have to follow certain rules for them as well. The citation itself does as well not refer to the title itself, but tells the reader that the experiment that is described in this chapter/section was done exactly as described by the reference that is cited. Although that may seem strange or wrong I have to keep this kind of format.
    – leandriis
    Commented Sep 11, 2017 at 10:36

1 Answer 1

5

Assuming that you are printing the bibliography you can add labels and then use \ref in the chapter titles:

\documentclass{scrreprt}
\usepackage{hyperref}
\usepackage{bookmark}
\usepackage[style=numeric]{biblatex}
\addbibresource{biblatex-examples.bib}
\makeatletter
\AtEveryBibitem{\def\@currentlabel{\thefield{labelnumber}}\label{labelnumber-\thefield{entrykey}}}
\makeatother

\begin{document}
\chapter{chapter title [\ref{labelnumber-herrmann}]}

\cite{doody}  \cite{herrmann}


\printbibliography
\end{document}

enter image description here

You must log in to answer this question.

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