继这个问题,我想在参考书目中选定的条目前面添加一个符号。但我想匹配功能这里根据.bbl
文件中的关键字自动插入符号。
我可以通过取消注释 MWE 中手动完成该作业的两行来实现所需的输出:
如果我可以使用关键字,我的工作流程将会更加高效。
据我所知,尽管我试图遵循上述链接中的逻辑,但这个 MWE 并未承认asterisk
该领域的存在:keywords
\documentclass[american]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber,
bibencoding=utf8]{biblatex-chicago}
\begin{filecontents*}{\jobname.bib}
@book{uthor,
author = {Uthor, Arnold},
title = {A Book},
date = {2013},
location = {Place},
publisher = {P. Ublisher's \& Co.},
keywords = {asterisk}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
%\DeclareBibliographyCategory{asterisk}
\renewbibmacro*{bibindex}{%
\ifbibindex
{\indexnames{labelname}%
\indexfield{indextitle}}
{}
\ifcategory{asterisk}%
{*}%
{}%
}
\begin{document}
% \addtocategory{asterisk}{uthor}
\cite{uthor}
\printbibliography
\end{document}
请问有人能告诉我我哪里错了吗?
答案1
我看到的解决方案是使用测试。在类似情况下\ifkeyword
我更喜欢使用:xpatch
\usepackage{xpatch}
\AtEveryBibitem{\ifkeyword{asterisk}%
{\xapptobibmacro{bibindex}{*}{}{}}
{}}
但如果你愿意,你也可以不用它:
\renewbibmacro*{bibindex}{%
\ifbibindex
{\indexnames{labelname}%
\indexfield{indextitle}}
{}
\ifkeyword{asterisk}{*}{}%
}
平均能量损失
\documentclass[american]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber,
bibencoding=utf8]{biblatex-chicago}
\begin{filecontents*}{\jobname.bib}
@book{uthor,
author = {Uthor, Arnold},
title = {A Book},
date = {2013},
location = {Place},
publisher = {P. Ublisher's \& Co.},
keywords = {asterisk}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\usepackage{xpatch}
\xapptobibmacro{bibindex}{\ifkeyword{asterisk}{*}{}}{}{}
\begin{document}
\paragraph{An entry with “asterisk” keyword}
\cite{uthor}
\paragraph{An entry without “asterisk” keyword}
\cite{knuth:ct}
\printbibliography
\end{document}