我的 BibTeX 条目有一个keywords
字段,其中包含描述内容的关键字。我还有一个名为的字段,tags
其中包含元信息,例如讲话,手稿,自己的等。例如:
@inproceedings{MalsburgVasishth2007ECEM,
author = {von der Malsburg, Titus and Vasishth, Shravan},
title = {A Time-Sensitive Similarity Measure for Scanpaths},
crossref = {ECEM2007},
keywords = {eyetracking, scanpaths, method},
tags = {poster, own}
}
使用printbibliography
,我可以用某些关键字过滤条目
`\printbibliography[keyword=eyetracking]
但我还想用某些标签来分类条目。例如,我想在我的简历中有一个部分列出我的海报。我该如何实现?
我认为一个解决方案是使用一个装置将字段的内容附加tags
到该字段。 keywords
DeclareSourcemap
之前曾给出过这样的解决方案但它并没有像预期的那样工作。这是一个 MWE:
\RequirePackage{filecontents}
\begin{filecontents*}{bibliography.bib}
@article{MalsburgEtAl2014,
author = {von der Malsburg, Titus and Kliegl, Reinhold and Vasishth, Shravan},
title = {Determinants of Scanpath Regularity in Reading},
journal = {Cognitive Science},
year = {2014},
keywords = {eyemovements, method, parsing, scanpaths, corpus},
tags = {article, own}
}
\end{filecontents*}
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{bibliography.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=tags, fieldtarget=keywords]
}
}
}
\begin{document}
\section{Publications}
\nocite{MalsburgEtAl2014}
\printbibliography[keyword=article,notkeyword=submitted,keyword=own,heading=none]
\end{document}
当我编译该程序时,出现以下错误消息:
Package biblatex Warning: Keyword 'article' not found on input line 34.
Package biblatex Warning: Keyword 'own' not found on input line 34.
LaTeX Warning: Empty bibliography on input line 34.
此外,PDF 中未显示参考资料。
答案1
(这是一个修改后的解决方案。感谢@moewe 指出如何简化它。)
基本上,你想要做的是将你的tags
字段复制到该keywords
字段,但是后还添加逗号,以便最后的关键字不会与标签字段中的第一个单词一起运行。
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{MalsburgEtAl2014,
author = {von der Malsburg, Titus and Kliegl, Reinhold and Vasishth, Shravan},
title = {Determinants of Scanpath Regularity in Reading},
journal = {Cognitive Science},
year = {2014},
keywords = {eyemovements, method, parsing, scanpaths, corpus},
tags = {article, own},
}
\end{filecontents*}
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{\jobname.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\step[fieldsource=tags,]
\step[fieldset=keywords, fieldvalue={,}, append]
\step[fieldset=keywords, origfieldval, append]
}
}
}
\begin{document}
\section{Publications}
\nocite{MalsburgEtAl2014}
\printbibliography[keyword=article, notkeyword=submitted, keyword=own,
heading=none]
\end{document}
请注意,Biber 和 BibTeX 将忽略它们无法识别的字段。因此,您的tags
字段被复制,但随后“丢失”。(您可以明智地使用该\DeclareDatamodelFields
命令“保存”它,但此应用程序不需要它。)