5

Many Biblatex-Styles use \mkbibemph{} to typeset italic parts of an bibliographic entry. By default, \mkbibemph{} is defined as \emph{}.

My Problem: If one redefines \emph{} like \renewcommand{\emph}[1]{\texttt{\color{red} #1}}, this breaks the intended appearance of the selected bib-style.

I tried to use \let\mkbibemph\mkbibitalic to avoid this, but had no success. I read Non-italic \emph, italic biblatex titles. Only setting the affected entries manually with

\DeclareFieldFormat[book]{title}{\mkbibitalic{#1}}
\DeclareFieldFormat[article]{journaltitle}{\mkbibitalic{#1}}

gave me the intended result (bibliographic entry in italic/'emphasized' AND a redefined \emph{} in the text). It looks like biblatex ignores its own \mkbibemph{} and uses \emph{} instead. The only alternative seems to be defining my own \emph{}.

This is not the behaviour I expect, is my understanding of how Biblatex works wrong? Can you point me to my mistake?

MWE below:

\documentclass{scrartcl}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage{xcolor}
\usepackage{filecontents} 
\begin{filecontents*}{\jobname.bib}
@article{small,
author = {Freely, I.P.},
title = {A small paper},
journal = {The journal of small papers},
year = 1997,
volume = {-1},
note = {to appear},
}

@article{big,
author = {Jass, Hugh},
title = {A big paper},
journal = {The journal of big papers},
year = 7991,
volume = {MCMXCVII},
}
\end{filecontents*}

\usepackage[bibstyle=authoryear,backend=bibtex8]{biblatex}
\addbibresource{\jobname.bib}

\usepackage{blindtext}

\renewcommand{\emph}[1]{\texttt{\color{red} #1}}
\let\mkbibemph\mkbibitalic      % overwrites \mkbibemph, but does not give the intended result

%% The only remedy I could find, uncomment to see intended result:
%\DeclareFieldFormat[book]{title}{\mkbibitalic{#1}}
%\DeclareFieldFormat[article]{journaltitle}{\mkbibitalic{#1}}

\begin{document}

\show\mkbibemph
\mkbibemph{\blindtext}\autocite{small}

\show\mkbibitalic
\mkbibitalic{\blindtext}\autocite{big}

\show\emph
\emph{\blindtext}

\printbibliography

\end{document}
Daniel
  • 53
  • 1
    You would never redefine emph to be tt and coloured. Instead, you would define \newcomman{\megaimportant}[1]{\texttt{\color{red} #1}} and ask biblatex to use this for the places you want it. – Johannes_B Feb 26 '16 at 17:44
  • Well that's not my point. I don't want to use \emph{} nor colored text in my refereces. The used markup for emph is just to show how biblatex apparently ignores it own (by me redefined) \mkbibemph, as I did not redefine \blx@imc@mkbibemph too as pointed out by @moewe. In my project intend to use a plain black \textsf{} :-). – Daniel Feb 26 '16 at 18:18

1 Answers1

6

You don't only need to redefine \mkbibemph but also the internal macro \blx@imc@mkbibemph

\makeatletter
\renewrobustcmd*{\mkbibemph}{\mkbibitalic}
\protected\long\def\blx@imc@mkbibemph#1{\blx@imc@mkbibitalic{#1}}
\makeatother

But it is probably nicer to follow Johannes_B's advice and not redefine \emph, but use a really semantic command for your red emphasis.

moewe
  • 175,683
  • Thanks for the answer, this indeed helps me. The red was just for pointing to the unexpected behaviour. – Daniel Feb 26 '16 at 17:58
  • What remains is the point that \emph is just logic markup (and not well definend as italic/textit) and it's weird to see that I have to stick with it. – Daniel Feb 26 '16 at 18:03
  • 1
    @Daniel Mhhh yes, I think \emph is a bit of a bastardised command, it sounds semantic ("put emphasis on this"), but it is used so often as italic -> roman font switch that I would consider it risky to redefine it. – moewe Feb 26 '16 at 18:06
  • \emph is semantic. What it makes so bad for me is that this bastardisation breaks the TeX inherent separation and independence of logic/semantic markup and actual layout, which was one of my very first lessons when I learned TeX. I guess, the cleanest solution is to use a \myemph{}. Thanks for your help. – Daniel Feb 26 '16 at 18:58
  • Is it not reasonable to expect \mkbibemph to be defined as \textitalic instead of \emph? – PatrickT Jun 05 '18 at 10:38
  • 1
    @PatrickT I guess it is too late now. Changing that now would change the behaviour in many documents. People who insist on \textit can use \mkbibitalic or redefine \mkbibemph as above. I for one like the switching between italic and Roman that \emph gives me and can live with not redefining it and accept the weird semi-semantic status of \emph. – moewe Jun 05 '18 at 10:42
  • @moewe, thanks. I'm glad I found your solution, as I'd been puzzled for a while by this behaviour and was having a hard time constructing a MWE! Suddenly I clicked and thought about \emph. – PatrickT Jun 05 '18 at 10:53
  • 1
    @PatrickT Indeed \mkbibemph is just a wrapper around \emph (like \mkbibitalic is around \textit and \mkbibbold around \textbf). They do some additional bookkeeping for punctfont, but other than that just call the standard command. In cases like these it can be handy to look up the commands in the documentation, where this is explained (hopefully clearly enough). – moewe Jun 05 '18 at 10:57
  • Why can‘t you just define \newcommand{bibemph}{emph} and then before putting in the bibliography define it back via \renewcommand{emph}{bibemph}? – Bixxli Jan 02 '23 at 14:13
  • 1
    @Bixxli I'm not quite sure I understand. The command \mkbibemph has (sort of) "two definitions", both need to be changed as discussed in the answer. So just changing \mkbibemph wouldn't be enough. If the idea is to introduce a new command \bibemph and use that, then you'd have to change a lot of style code to use the new command. But maybe you're think of a slightly different use case than the one that is at hand here? – moewe Jan 02 '23 at 14:44
  • 1
    @Bixxli Redefining strings wouldn't cut it (and isn't easily possible with LaTeX anyway, \newcommand{bibemph}{emph} will error), we really need to redefine the commands here. – moewe Jan 02 '23 at 15:10