1

Following this question, I would like to embolden specific references in my bibliography. The difference with the previous question is that I would like to use the abbrvnat bibliography style.

The proposed code, to put in the preamble (bellow), does not work when I use the abbrvnat style, while it does with the plain one.

\usepackage{xparse}
\ExplSyntaxOn

\clist_new:N \g_boldcite_list_clist
\cs_new:Npn \boldcite_checkkey:n #1
 {
  \clist_if_in:NnTF \g_boldcite_list_clist { #1 } { \bfseries } { \mdseries } \boldcite_bibitem:n {#1}
 }
\cs_set_eq:NN \boldcite_bibitem:n \bibitem

\RenewDocumentCommand{\bibitem}{m}
 {
  \boldcite_checkkey:n { #1 }
 }
\NewDocumentCommand{\boldreferences}{m}
 {
  \clist_gput_right:Nn \g_boldcite_list_clist { #1 }
 }
\ExplSyntaxOff

Then by using \boldreferences{key1,key2}, the selected references become bold in the bibliography.

(credits: @egreg)

It seems that the above code changes a little the generated .aux file, and it depends on the style. The 'normal' .aux file (without using the custom code) looks like:

...
\bibcite{ref1}{{1}{year1}{{X et~al.}}{{authors}}}
\bibcite{ref2}{{2}{year2}{{Y et~al.}}{{authors}}}
\bibcite{ref3}{{3}{year3}{{Z et~al.}}{{authors}}}
...

Using the custom code with the plain style, I get the following:

...
\bibcite{ref1}{{1}{}{{}}{{}}}
\bibcite{ref2}{{2}{}{{}}{{}}}
\bibcite{ref3}{{3}{}{{}}{{}}}
...

Again with the custom code, and abbrvnat or apalike or (I think) all styles with that need author/year:

...
\bibcite{[}{{1}{}{{}}{{}}}
\bibcite{[}{{2}{}{{}}{{}}}
\bibcite{[}{{3}{}{{}}{{}}}
...

I suspect something related to Latex3 and some special character ([), but I have no idea how to solve it.

I am using natbib and xelatex.

Ewen
  • 11

0 Answers0