如何使用关键字以外的其他字段过滤 BibLaTeX 文件?

如何使用关键字以外的其他字段过滤 BibLaTeX 文件?

经过两天的深入研究,阅读整个 BibLaTeX 文档和所有论坛讨论......我终于没有找到我的问题的答案。

我正在尝试整理我的大.bib文件。为此,我的库中有一些我自己创建的字段:data={},,method={}等等。我正在尝试整理我的大.bib文件。我想按这些字段对我的库进行排序。但我只能找到示例或文档

  • 按关键字(但我创建了这些字段,以便不将它们放在关键字中)
  • 但(如果我理解得没错的话)就需要列出我们放入的所有内容,例如 CTAN:

    \addtocategory{primary{aristotle:anima,aristotle:physics,averroes/bland}
    

    这意味着我们列出了类别的作者姓名。我的问题是我不想.bib通过填充来重写文件keywords,因为我有数百个参考文献,而且按其他键进行排序是一件大事!

下面是我的 中的 3 个引用的示例.bib,我想按 进行method排序data

Article{NGWA2017, 
author = {NGWA white papers}, 
title = {Integrated Surface Water-Groundwater Modeling}, 
journal = {NGWA white papers}, 
year = {2017}, 
data = {Water}, 
problematic = {Modeling}, }.

Article{ABBASZADEH2018192, 
Title = {Enhancing hydrologic data assimilation by evolutionary}, 
Author = {Peyman Abbaszadeh and Hamid Moradkhani and Hongxiang Yan}, Journal = {Advances in Water Resources}, 
Year = {2018}, 
Pages = {192 - 204}, 
Volume = {111}, 
Data = {Hydrology}, 
Keywords = {Particle Filters, Markov Chain Monte Carlo, Genetic algorithm, Hydrologic prediction}, 
method = {Particle filter}, 
problematic = {Assimilation}, }

Article{Adriaanse2017268, 
author = {Paulien I. Adriaanse and Robert}, 
title = {The effect of the runoff size on the pesticide concentration in runoff water}, 
journal = {Science of The Total Environment}, 
year = {2017}, 
volume = {584-585}, 
pages = {268 - 281}, 
data = {Pesticides, runoff}, 
keywords = {Pesticide}, 
problematic = {Modeling}
}.

我想如果我这样做:

\nocite{*} 

\printbibliography[heading=subbibliography,type=article,title=Assimilation},problematic=assimilation]
\printbibliography [heading=subbibliography,type=article,title{Modeling},problematic=modeling]

它可以像keywords、 或article或任何其他经典字段一样工作吗?但是我收到错误“keyval undefined”。

您能帮我提出一些建议吗?

答案1

手册中与您的问题相关的部分biblatex是第 3.7.9 节“参考书目过滤器和检查”。您可以做的是创建特定的checks

\defbibcheck{assimilation}{
 \iffieldequalstr{problematic}{assimilation}{}{\skipentry}
}

进而

\printbibliography[heading=subbibliography,type=article,title=Assimilation,check=assimilation]

假设problematic已定义为字段。biblatex提供了为 bib 条目定义新字段(以及新条目类型)的机会。要定义新的 bib 字段,可以使用命令` \DeclareDatamodelField,因此,对于手头的问题,类似于。

\DeclareDatamodelFields[type=field,datatype=literal]{problematic,data,method}

定义应该出现在配置文件中(或 biblatex 样式文件中)。请参阅手册第 4.5.4 节biblatex(可以texdoc biblatex从终端/命令行调用)。

如果其中一个自定义字段包含以逗号分隔的值列表(请参阅dataOP 中的字段),则检查的定义会稍微复杂一些:

\defbibcheck{runoff}{
    \def\mylist{}
    \def\mycom{\forcsvlist{\listadd\mylist}}
    \usefield{\mycom}{data}
    \ifinlist{runoff}{\mylist}{}{\skipentry}
}

检查项目是否为列表的简单方法是使用\ifinlist来自的命令etoolbox。但是,该命令适用于内部列表。因此前三行是使用\mylist自定义字段的值填充内部data

下面的 MWE 包含两个filecontents环境实例。第一个是动态创建(在工作目录中)文件biblatex-dm.cfg来​​存储自定义书目字段的定义。第二个实例是填充工作书目以使 MWE 自足。

\documentclass{article}

\begin{filecontents}{biblatex-dm.cfg}
\DeclareDatamodelFields[type=field,datatype=literal]{problematic,method,data}
\end{filecontents}

\begin{filecontents}{\jobname.bib}
@Article{NGWA2017, 
author = {NGWA white papers}, 
title = {Integrated Surface Water-Groundwater Modeling}, 
journal = {NGWA white papers}, 
year = {2017}, 
data = {Water}, 
problematic = {Modeling}, }.

@Article{ABBASZADEH2018192, 
Title = {Enhancing hydrologic data assimilation by evolutionary}, 
Author = {Peyman Abbaszadeh and Hamid Moradkhani and Hongxiang Yan}, Journal = {Advances in Water Resources}, 
Year = {2018}, 
Pages = {192 - 204}, 
Volume = {111}, 
Data = {Hydrology}, 
Keywords = {Particle Filters, Markov Chain Monte Carlo, Genetic algorithm, Hydrologic prediction}, 
method = {Particle filter}, 
problematic = {Assimilation}, }

@Article{Adriaanse2017268, 
author = {Paulien I. Adriaanse and Robert}, 
title = {The effect of the runoff size on the pesticide concentration in runoff water}, 
journal = {Science of The Total Environment}, 
year = {2017}, 
volume = {584-585}, 
pages = {268 - 281}, 
data = {Pesticides, runoff}, 
keywords = {Pesticide}, 
problematic = {Modeling}
}. 
\end{filecontents}

\usepackage{biblatex}
\addbibresource{\jobname.bib}


\defbibcheck{assimilation}{
 \iffieldequalstr{problematic}{Assimilation}{}{\skipentry}
}

\defbibcheck{runoff}{
    \def\mylist{}
    \def\mycom{\forcsvlist{\listadd\mylist}}
    \usefield{\mycom}{data}
    \ifinlist{runoff}{\mylist}{}{\skipentry}
}

\begin{document}
\nocite{*}


\printbibliography[heading=subbibliography,type=article,title=Assimilation,check=assimilation]  

\printbibliography[heading=subbibliography,type=article,title=Runoff,check=runoff]  

\printbibliography
%
\end{document}

屈服

在此处输入图片描述

相关内容