# Highlight selected references with asterisk

I'm using Biblatex/Biber with the phys style. I would like to highlight selected references in the text with an asterisk, i.e. the number should be marked. A \cite{key1,highlightedkey,key2} should result in something like [13,78*,99] in the text.

I found this solution to a similar problem: Is it possible to mark designated entries in a bibliography with an asterisk? But there, the entry is highlighted in the bibliography. Is there a way to achieve what I'm looking for?

• Perhaps you might like to tell us why you're trying to do this, it may affect the answer (I'm thinking especially if you want a footnote). – Chris H Jun 11 '15 at 14:56
• I think you might be able to achieve this with the \cites command. Se page 82 of the biblatex manual, or section 3.7.3 in case the page numbering has changed since my download. You'll need to have a play with it. – Chris H Jun 11 '15 at 15:00
• Thanks, Chris H! That pointed me to an acceptable solution. I will post it in a second. – JSK Jun 11 '15 at 15:27

A solution that works quite well for me:

\renewcommand{\postnotedelim}{}
\DeclareFieldFormat{postnote}{#1}


then use:

\cites{key1}[][$^\ast$]{highlightedkey}{key3}


gives me the output I was looking for.

Please note that this solution may not apply to anyone as the postnote behavior is changed for the entire document. (No problem in my case.)

If we use the category approach we can automate this behaviour.

\DeclareBibliographyCategory{asterisk}


We use a macro to avoid having to type too much

\newcommand*{\addcat}{%
\ifcategory{asterisk}%
{*}%
{}%
}


Then we add the asterisk to the bibliography with

\renewbibmacro*{begentry}{\addcat}


Finally, we patch relevant numeric-comp macros to also include the asterisk if need be (you will need the xpatch package for that). Which macros we need to modify heavily depends on the style, phys is based on numeric-comp. A rule of thumb is that every \printfield{labelnumber} needs an additional \addcat.

\xpatchbibmacro{cite:comp:comp}
{}{\typeout{failed to patch cite:comp:comp macro}}

\xpatchbibmacro{cite:comp:end}
{}{\typeout{failed to patch cite:comp:comp macro}}

\xpatchbibmacro{cite:comp:inset}
{}{\typeout{failed to patch cite:comp:comp macro}}


Works to be marked with an asterisk are handed over to \addtocategory{asterisk}{<citekey>} as in

\addtocategory{asterisk}{geer,knuth:ct:b}


MWE

\documentclass[12pt,a4paper]{article}
\usepackage[style=numeric-comp]{biblatex}
\usepackage{xpatch}
\usepackage{hyperref}

\DeclareBibliographyCategory{asterisk}
\ifcategory{asterisk}%
{*}%
{}%
}

\xpatchbibmacro{cite:comp:comp}
{}{\typeout{failed to patch cite:comp:comp macro}}

\xpatchbibmacro{cite:comp:end}
{}{\typeout{failed to patch cite:comp:comp macro}}

\xpatchbibmacro{cite:comp:inset}
{}{\typeout{failed to patch cite:comp:comp macro}}

\begin{document}
This is just filler text \cite{geer}. This is just filler
text \cite{worman}. This is just filler
text \cite{geer}.

Text \cite{knuth:ct:a} an \cite{knuth:ct:b} again \cite{knuth:ct:a,geer,worman}.

\printbibliography
\end{document}


You can also let the asterisk only appear at the first citation if you enable citetracker=true and change \addcat to

\newcommand*{\addcat}{%
\ifboolexpr{(not test {\ifciteseen} or test {\ifbibliography})
and test {\ifcategory{asterisk}}}
{*}%
{}%
}