1

I'm using the authoryear-comp citestyle of biblatex and I'd like the author and year to appear in italics in in-text citations. After some research, I've found the following command, but it only italicizes the author:

\renewcommand{\mkbibnamelast}[1]{\mkbibemph{#1}}

Does anyone know, on the basis of the following example, how to get the year italicized as well?

\documentclass{scrbook}

\usepackage[backend=biber, bibstyle=authoryear, citestyle=authoryear-comp,sorting=nyt]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
    @book{Knu86,
        author = {Knuth, Donald E.},
        year = {1986},
        title = {The \TeX book},
    }
\end{filecontents*}

Many thanks for having a look at this and best wishes,

1 Answer 1

4

One way to make citation italic is to inject a \mkbibemph into the wrapper code of \DeclareCiteCommand for the relevant \...cite commands you want to be in italic.

You can find the \DeclareCiteCommand declarations in <citestyle>.cbx (in your case authoryear-comp.cbx). Note that these definitions can differ between styles, so you need to make sure you have got the correct ones.

In the example we show how to make \cite/\cite* and \parencite/\parencite* italic. The original definitions can be found in authoryear-comp.cbx, ll. 160-190 in v3.16: For \cite we just add \mkbibemph as wrapper command (because \cite does not have a wrapper). For \parencite we combine \mkbibemph with the wrapper \mkbibparens (change the order of \mkbibemph and \mkbibparens in \mkbibemphparens to make the parentheses italic too).

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear-comp]{biblatex}

\DeclareCiteCommand{\cite}[\mkbibemph]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\cite}[\mkbibemph]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{citeyear}}
  {}
  {\usebibmacro{postnote}}

\newcommand*{\mkbibemphparens}[1]{\mkbibparens{\mkbibemph{#1}}}

\DeclareCiteCommand{\parencite}[\mkbibemphparens]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\parencite}[\mkbibemphparens]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{citeyear}}
  {}
  {\usebibmacro{postnote}}

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{sigfridsson}
ipsum \parencite{nussbaum}
dolor \cite{worman}

\printbibliography
\end{document}

Lorem (Sigfridsson and Ryde 1998) ipsum (Nussbaum 1978) dolor Worman 2002 [the citation labels are in italics]

1
  • Dear moewe, I'm very impressed!! Thank you very much for your answer - it perfectly works exactly the way you put it. Have a wonderful day and thanks again.
    – Daniela
    Aug 4, 2021 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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