许多 Biblatex 样式用于\mkbibemph{}
排版书目条目的斜体部分。默认情况下,\mkbibemph{}
定义为\emph{}
。
我的问题:如果重新定义\emph{}
这样的\renewcommand{\emph}[1]{\texttt{\color{red} #1}}
,这会破坏所选围兜样式的预期外观。
我尝试过\let\mkbibemph\mkbibitalic
避免这种情况,但没有成功。我读过非斜体 \emph,斜体 biblatex 标题. 仅手动设置受影响的条目
\DeclareFieldFormat[book]{title}{\mkbibitalic{#1}}
\DeclareFieldFormat[article]{journaltitle}{\mkbibitalic{#1}}
给了我预期的结果(斜体/“强调”的书目条目和\emph{}
文本中的重新定义)。看起来 biblatex 忽略了它自己的 \mkbibemph{}
并改用\emph{}
。唯一的选择似乎是定义我自己的\emph{}
。
这不是我期望的行为,我对 Biblatex 工作原理的理解有误吗?你能指出我的错误吗?
MWE 如下:
\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}
答案1
您不仅需要重新定义\mkbibemph
,还需要重新定义内部宏\blx@imc@mkbibemph
\makeatletter
\renewrobustcmd*{\mkbibemph}{\mkbibitalic}
\protected\long\def\blx@imc@mkbibemph#1{\blx@imc@mkbibitalic{#1}}
\makeatother
但最好还是遵循Johannes_B 的建议并且不重新定义\emph
,而是使用真正语义的命令来强调红色。