1

I try to color the in-text citations in my beamer presentations. I use several citations per item, mostly via \parencite. To increase readability I want the references (including brackets) to be printed in grey. Unfortunately all the solutions and workarounds (Citation colour with Beamer + Hyperref + Natbib, Beamer: Biblatex biber, change color of citations globally and Beamer ignores citecolor from hyperref) won't do the trick. Either all the links (sections and subsections) are colored or nothing changes.

\documentclass[presentation]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage[germanb]{babel}
\beamertemplatenavigationsymbolsempty
\setbeamertemplate{footline}[frame number]
\usepackage{csquotes}
\usepackage{xpatch}
\usepackage[backend=biber, uniquename=false, maxbibnames=99, maxcitenames=2, citestyle=authoryear, bibstyle=authoryear]{biblatex}
\DefineBibliographyStrings{german}{andothers = {{et\, al\adddot}},}
\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{default}{last-first}
\renewcommand*{\multinamedelim}{\addslash}
\renewcommand*{\finalnamedelim}{\multinamedelim}
\renewbibmacro*{journal+issuetitle}{\usebibmacro{journal}  \setunit*{\addcomma\space}\iffieldundef{series}{}{\newunit    \printfield{series}\setunit{\addspace}}\usebibmacro{volume+number+eid}  \setunit{\addspace}\usebibmacro{issue+date}\setunit{\addcolon\space}\usebibmacro{issue}\newunit}
\DeclareFieldFormat[article]{pages}{#1}%
\DeclareFieldFormat[incollection]{pages}{#1}%
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}
\renewcommand{\labelnamepunct}{\addcolon\space}
\renewbibmacro*{volume+number+eid}{\printfield{volume}\setunit*{\adddot}\setunit*{\addnbthinspace}\printfield{number}\setunit{\addcomma\space}\printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
\renewcommand*{\bibpagespunct}{\addcolon\space}
\renewbibmacro*{byeditor+others}{\ifnameundef{editor}{}{\setunit{\addspace}\printnames[byeditor]{editor}\clearname{editor}\setunit{\addspace}\usebibmacro{byeditor+othersstrg}\newunit}\usebibmacro{byeditorx}  \usebibmacro{bytranslator+others}}
\DefineBibliographyStrings{german}{byeditor ={\addspace\mkbibparens {Hrsg\adddot}\addcolon},}
\newbibmacro*{byeditor:in}{\ifnameundef{editor}{}{\printnames[editorin]{editor}\addspace\bibsentence    \mkbibparens{\usebibmacro{editorstrg}}\clearname{editor}\printunit{\addcolon\space}}}
\xpatchbibdriver{inbook}{\usebibmacro{in:}\usebibmacro{bybookauthor}\newunit\newblock\usebibmacro{maintitle+booktitle}   \newunit\newblock\usebibmacro{byeditor+others}}{\usebibmacro{in:}\usebibmacro{bybookauthor}\newunit\newblock\usebibmacro{byeditor:in}   \newunit\newblock\usebibmacro{maintitle+booktitle}\newunit\newblock\usebibmacro{byeditor+others}}{}{}
\xpatchbibdriver{incollection}{\usebibmacro{in:}\usebibmacro{maintitle+booktitle}\newunit\newblock  \usebibmacro{byeditor+others}}{\usebibmacro{in:}\usebibmacro{byeditor:in}\setunit{\labelnamepunct}\newblock   \usebibmacro{maintitle+booktitle}\newunit\newblock\usebibmacro{byeditor}}{}{}
\xpatchbibdriver{inproceedings}{\usebibmacro{in:}\usebibmacro{maintitle+booktitle}\newunit\newblock  \usebibmacro{event+venue+date}\newunit\newblock\usebibmacro{byeditor+others}}{\usebibmacro{in:}\usebibmacro{byeditor:in}  \setunit{\labelnamepunct}\newblock\usebibmacro{maintitle+booktitle}\newunit\newblock\usebibmacro{event+venue+date}\newunit\newblock   \usebibmacro{byeditor+others}}{}{}
\DeclareFieldFormat{edition}{\mkbibparens{\ifinteger{#1}{\mkbibordedition{#1}~\bibstring{edition}}{#1\isdot}}}
\renewcommand*{\postnotedelim}{\addcolon\space}
\addbibresource{/home/tassilo/Dokumente/01-Literaturdatenbank/Masterfile/references.bib}
\usetheme{Malmoe}
\usecolortheme{seagull}
\author{Vorname Nachname}
\date{30. Mai 2017}
\title{Titel}

\usepackage{filecontents}
\begin{filecontents}{references.bib}
@Book{bartolini-mair-1990,
  author =    {Bartolini, Stefano AND Mair, Peter},
  title =    {Identity, Competition and Electoral
                  Availability. The Stabilization of European
                  Electorates 1885-1985},
  publisher =    {Cambridge University Press},
  year =    1990,
  address =    {Cambridge},
}
\end{filecontents}

\begin{document}

\maketitle
\begin{frame}{Outline}
\setcounter{tocdepth}{1}
\tableofcontents
\end{frame}


\section{Einleitung}
\label{sec:orgheadline6}
\begin{frame}[label={sec:orgheadline1}]{Einleitung}
Text \cite{bartolini-mair-1990}
\end{frame}
\end{document}
  • 6
    You should put a minimum example: remove all the packages and stuff that are not directly related to the question. That way, it would be easy to somebody to test your example and came up with a solution. – Alejandro DC May 14 '17 at 16:39
1

You could either set the colour for the hyperlinks with

\hypersetup{
    colorlinks,
    citecolor=green,
    linkcolor=black
}

(this will only colour the click-able part of the citation) or add the colour manually to the citation commands:

\documentclass[presentation]{beamer}

\usepackage[backend=biber, uniquename=false, maxbibnames=99, maxcitenames=2, citestyle=authoryear, bibstyle=authoryear]{biblatex}

\addbibresource{references.bib}

\DeclareCiteCommand{\cite}
  {\color{red}\usebibmacro{prenote}}%
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\parencite}[\mkcolorbibparens]
  {\usebibmacro{prenote}}%
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\makeatletter
\newrobustcmd{\mkcolorbibparens}[1]{%
  \begingroup
  \color{red}%
  \blx@blxinit
  \blx@setsfcodes
  \bibopenparen#1\bibcloseparen
  \endgroup}
\makeatother

\usepackage{filecontents}
\begin{filecontents}{references.bib}
@Book{bartolini-mair-1990,
  author = {Bartolini, Stefano AND Mair, Peter},
  title = {Identity, Competition and Electoral Availability. The Stabilization of European Electorates 1885-1985},
  publisher = {Cambridge University Press},
  year =  1990,
  address = {Cambridge},
}
\end{filecontents}

\begin{document}

\begin{frame}
Text \cite{bartolini-mair-1990} text

Text \parencite{bartolini-mair-1990} text
\end{frame}

\begin{frame}
\printbibliography
\end{frame}


\end{document}

enter image description here

  • Thank you for your quick response! That's exactly the solution I'm looking for. However if I copy the code into org-mode (and add #+LATEX_HEADER: to each line) it produces an error and tells me I have a runaway argument. – Tazzism May 16 '17 at 9:01
  • @Tazzism Sorry, I have no idea about org-mode. – samcarter May 16 '17 at 9:02
  • Nevermind, I'm really greatful for your solution. It might have to do with how org-mode processes org-File into tex. – Tazzism May 16 '17 at 9:05

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.