
주석 기능을 사용하여 biblatex의 특정 저자를 강조 표시하고 있습니다.
\documentclass{article}
\usepackage{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@MISC{test,
AUTHOR = {Last1, First1 and Last2, First2 and Last3, First3},
AUTHOR+an = {2=highlight},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\renewcommand*{\mkbibnamegiven}[1]{%
\ifitemannotation{highlight}
{\textbf{#1}}
{#1}}
\renewcommand*{\mkbibnamefamily}[1]{%
\ifitemannotation{highlight}
{\textbf{#1}}
{#1}}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
highlightB
이미 존재하는 주석 대신 사용할 수 있는 굵은 글씨와 빨간색으로 강조 표시되는 또 다른 주석을 추가하고 싶습니다 highlight
.
나는 두 가지 모두 \ifitemannotation{highlightB}
에 추가 기능을 적용했지만 제대로 작동하지 못했습니다. 이 문제를 어떻게 해결하나요?\mkbibnamegiven
\mkbibnamefamily
답변1
주석에 대한 테스트를 중첩해야 합니다. \mkbibcompletename
모든 이름 부분에 대한 매크로를 다시 정의하는 대신 전체 이름의 형식을 한 번에 지정하는 데 사용합니다 .
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{xcolor}
\usepackage[style=authoryear, backend=biber]{biblatex}
\renewcommand*{\mkbibcompletename}[1]{%
\ifitemannotation{highlight}
{\textbf{#1}}
{\ifitemannotation{highlightB}
{\textcolor{red}{#1}}
{#1}}}
\begin{filecontents}{\jobname.bib}
@misc{example1,
title = {Mock Title},
author = {Albert Einstein},
author+an = {1=highlight},
year = {2019},
}
@misc{example2,
title = {Mock Turtle},
author = {Anne Elk},
author+an = {1=highlightB},
year = {2020},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{sigfridsson,example1,example2}
\printbibliography
\end{document}