Reputation: 31
Similar post here, but this is not exactly what I'm looking for.
I have a Latex article with some citation. Since last revision I've added new references, and I would like that the new references appears in red in my bibliography.
The idea that I had is to create a new command so I can have 2 citation commands, the classical \citep{} that I'm already using, and another one such as \citepred{} that will make the reference appears in red.
Here is a minimal working exemple :
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
%Import the natbib package and sets a bibliography and citation styles
\usepackage{natbib}
\bibliographystyle{abbrvnat}
\setcitestyle{authoryear,open={((},close={))}} %Citation-related commands
\title{Natbib Example}
\author{Overleaf team}
\begin{document}
\maketitle
\section{First Section}
This document is an example with two cited items: \textit{The \LaTeX\ Companion} book \cite[see][chap 2]{latexcompanion} and Einstein's journal paper \citep{einstein} (that I would like now that the reference appears in red).
%Imports the bibliography file "sample.bib"
\bibliography{sample}
\end{document}
and here is the sample.bib file :
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004"
}
@book{latexcompanion,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The \LaTeX\ Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts"
}
@misc{knuthwebsite,
author = "Donald Knuth",
title = "Knuth: Computers and Typesetting",
url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}
I have no idea how to create this new command to have the \citepred command.
I've tried using makeatletter and etoolbox to create a new command but nothing is working for now.
I could go in my bib text and write \color{red} before and after each new entry but this will be pretty long.
Thanks
Upvotes: 1
Views: 498