1

I have a few bibliography entries that are especially important, such as the one by Genius and Vader in the example below. From the example we can see that "Lasers and Death Stars" is clearly an important work, therefore I need to emphasise it both in the text and in the bibliography! I have given the citation a colour approximating that of Lord Vader's light-sabre, but I fear he may crush my larynx if I do not also colour the entry in the text.
how can I colour the Genius02 citation while not colouring Doe01 in the below example?
I hope someone here can help before I feel the wrath of the Sith Lord.

      \RequirePackage{filecontents} 
      \begin{filecontents}{\min.bib}
        @article{Doe01,
        title={Some Title},
        author={Doe, John and Bar, Foo},
        journal={A Journal},
        year={2001}
        }
        @article{Genius02,
        title={Lasers and Death Stars},
        author={Genius, Evil and Vader, Darth},
        journal={Journal of World Domination},
        year={2002}

      }
      \end{filecontents}

      \documentclass[10pt]{article}
      \usepackage[backend=biber]{biblatex}
      \addbibresource{\min.bib}
       \DeclareBibliographyCategory{important}
      \usepackage[dvipsnames]{xcolor}
      %Emphasis in bibliography. Solution by "Jon", link above 
     \AtEveryBibitem{%
        \ifcategory{important}%
          {\bfseries\color{red}}%
          {}%
        }%How can this be inherited by the cite commands?

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


      \begin{document}
        \cite{Doe01,Genius02}. I need the Genius02 citation (Not just the bibliography entry) to be emphasized!

      \printbibliography
      \end{document}
The V
  • 1,401

2 Answers2

1

You saw the error message Category important not declared caused by your code?

Just add \DeclareBibliographyCategory{important} to your code.

Then there are some more little errors, for example you have to add the key of the new books/articles to \addtocategory. At last I changed bold writing to italic writing (to see it better I colored it red).

Please see the following MWE (changed marked with <=============):

\RequirePackage{filecontents} % <=================================
\begin{filecontents}{\jobname.bib}
@article{Doe01,
  title   = {Some Title},
  author  = {Doe, John and Bar, Foo},
  journal = {A Journal},
  year    = {2001},
}
@article{Genius02,
  title   = {Lasers and Death Stars},
  author  = {Genius, Evil and Vader, Darth},
  journal = {Journal of World Domination},
  year    = {2002},
}
\end{filecontents}


\documentclass[10pt]{article}

\usepackage[%
  backend=biber 
]{biblatex} 
\addbibresource{\jobname.bib} %<========================================
\DeclareBibliographyCategory{important} % <=============================
\usepackage[dvipsnames]{xcolor}

%Emphasis in bibliography. Solution by "Jon", link above 
\AtEveryBibitem{%
\ifcategory{important}%
  {\itshape\color{Red}}%\bfseries % <============================
  {}%
}%How can this be inherited by the cite commands?

% Add books to 'important' category in preamble
\addtocategory{important}{%
  Genius02, % <=========================================================
}


\begin{document}
\cite{Doe01,Genius02}.

\printbibliography
\end{document}

and the result:

enter image description here

Mensch
  • 65,388
  • This was an MWE I wrote but did not test. Sorry. Should be better now. However I would like the citation to be emphasised, not just the bibliography entry. – The V Apr 20 '16 at 10:07
1

It should be enough to replicate the code in \AtEveryBibitem in a \AtEveryCitekey block.

Just add

\AtEveryCitekey{%
  \ifcategory{important}%
    {\bfseries\color{red}}%
    {}}
moewe
  • 175,683