[Tex/LaTex] Highlighting particular bibliography entries

biberbiblatex

I'm trying to create a bibliography in which certain items are highlighted as being more important. Ideally this would put an asterisk at the front of that particular item while leaving the sorting unchanged. I'm using biblatex-chicago with Biber as the backend.

Say I have these two entries in my .bib file:

@article{cite1,
  author = {Knuth, Donald},
  title = {{Title One}},
  journal = {Some Journal},
  year = {2005},
  volume = {1},
  pages = {1--42},
}

@book{cite2,
  author = {Knuth, Donald},
  title = {{A Way More Important Title}},
  publisher = {Oxford},
  year = {2009},
  address = {New York}
}

What I'd like to do is highlight the second one so that the sort order and repeated name dash stays unchanged. Ideally it would produce something like this:


Knuth, Donald. 2005. "Title One." Some Journal 1: 1-42.

*———. 2009. A Way More Important Title. Oxford: New York.


Is there some way to achieve this? Some additional key I could put in the important entries, perhaps? I've tried faking the name (like name = {*Knuth, Donald}, sortname = {Knuth, Donald}), but that breaks the 3-em dash replacement.

Best Answer

Here's an easy way:

\documentclass[12pt]{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{cite1,
  author = {Knuth, Donald},
  title = {{Title One}},
  journal = {Some Journal},
  year = {2005},
  volume = {1},
  pages = {1--42},
}

@book{cite2,
  author = {Knuth, Donald},
  title = {{A Way More Important Title}},
  publisher = {Oxford},
  year = {2009},
  address = {New York}
}
\end{filecontents}

\usepackage[T1]{fontenc}
\usepackage{biblatex-chicago}
\addbibresource{\jobname.bib}

%% Highlight entries
\usepackage[svgnames]{xcolor}
\DeclareBibliographyCategory{important}
% the colour definition
\colorlet{impentry}{Maroon}% let 'impentry' = Maroon

% Inform biblatex that all books in the 'important' category deserve
% special treatment, while all others do not
\AtEveryBibitem{%
  \ifcategory{important}%
    {\bfseries\color{impentry}}%
    {}%
  }

% Add books to 'important' category in preamble
\addtocategory{important}{%
 cite2,
}


\begin{document}

\nocite{*}
\printbibliography

\end{document}

A trickier way would be to use biber's \DecareSourcemap command (documented in biblatex manual) to essentially grep for a keyword in the keywords field and then act accordingly. One advantage of this method is that it means the 'initialization' is put in the .bib file rather that needing to declare new bibliography categories and so on. (You also get to re-write the bibliography output on the fly, so you could have only [say] an addendum field that is highlighted.)

There might also be reason to create other useful commands like an \addncite, which \cites the entry and adds it at the same time to this new 'important' category. Not sure what your overall needs are, however.

Related Question