我想创建一个包含两个独立部分的参考书目。虽然参考文献在文本中正确显示,但参考书目为空。没有警告,但 biber 日志显示:
INFO - Sorting list 'apa/global/' of type 'entry' with scheme 'apa' and locale 'en-GB'
INFO - No sort tailoring available for locale 'en-GB'
这似乎与我的问题有关。我该如何解决?
以下 mwe 复制了我的问题:
\documentclass{book}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=apa]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
\usepackage{filecontents}
\begin{filecontents}{\bibname.bib}
@book{B1,
author = {Name1, Surname1},
title = {Title of the first book in the First category},
publisher = {Name of the Publisher},
year = {2017},
keywords = {firstcategory}
}
@book{B2,
author = {Name2, Surname2},
title = {Title of the second book in the First category},
publisher = {Name of the Publisher},
year = {2016},
keywords = {firstcategory}
}
@article{A1,
author = {Name3, Surname3},
title = {This is the title of first article in the Second category},
journal = {Name of the Journal},
year = {2017},
volume = {01},
number = {12},
pages = {1-20},
keywords = {secondcategory}
}
\end{filecontents}
\DeclareBibliographyCategory{one}
\DeclareBibliographyCategory{two}
\addtocategory{one}{firstcategory}
\addtocategory{two}{secondcategory}
\addbibresource{\bibname.bib}
\begin{document}
I would like to split my bibliography in two section. Authors \parencite{B1,B2} with the keyword "firstcategory" in the bib. file should appear in the First Category and author \parencite{A1} with the keyword "secondcategory" should appear in the Second Category.
\printbibliography[category=one,category=two]
\end{document}
我已经尝试过了sorting=anyt
,\newrefcontext[sorting=ydnt]
但是没有效果。
答案1
要按类别打印参考书目,您必须将 添加到类别中bibtex keys
,而不是keywords
(但您也可以\printbibliography
通过关键字过滤命令)。要打印所有类别,请使用命令\bibbycategory
。要打印部分类别,您当然可以使用\printbibliography[category=…]
。
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=apa]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
\usepackage{filecontents}
\begin{filecontents}{bibliography.bib}
@book{B1,
author = {Name1, Surname1},
title = {Title of the first book in the First category},
publisher = {Name of the Publisher},
year = {2017},
keywords = {firstcategory}
}
@book{B2,
author = {Name2, Surname2},
title = {Title of the second book in the First category},
publisher = {Name of the Publisher},
year = {2016},
keywords = {firstcategory}
}
@article{A1,
author = {Name3, Surname3},
title = {This is the title of first article in the Second category},
journal = {Name of the Journal},
year = {2017},
volume = {01},
number = {12},
pages = {1-20},
keywords = {secondcategory}
}
\end{filecontents}
\DeclareBibliographyCategory{one}
\DeclareBibliographyCategory{two}
\addtocategory{one}{B1,B2}
\addtocategory{two}{A1}
\defbibheading{one}{\section*{First category}}
\defbibheading{two}{\section*{Second category}}
\addbibresource{bibliography.bib}
\begin{document}
\nocite{*}
I would like to split my bibliography in two section. Authors \parencite{B1,B2} with the keyword "firstcategory" in the bib. file should appear in the First Category and author \parencite{A1} with the keyword "secondcategory" should appear in the Second Category.
%\printbibliography[category=one]%
%\printbibliography[category=two]%
\bibbycategory
\end{document}
答案2
您的参考书目为空,因为\printbibliography[category=one,category=two]
只会打印同时属于“一”和“二”类别的条目。我建议改用过滤器:
\documentclass{book}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=apa]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
\usepackage{filecontents}
\begin{filecontents}{\bibname.bib}
@book{B1,
author = {Name1, Surname1},
title = {Title of the first book in the First category},
publisher = {Name of the Publisher},
year = {2017},
keywords = {firstcategory}
}
@book{B2,
author = {Name2, Surname2},
title = {Title of the second book in the First category},
publisher = {Name of the Publisher},
year = {2016},
keywords = {firstcategory}
}
@article{A1,
author = {Name3, Surname3},
title = {This is the title of first article in the Second category},
journal = {Name of the Journal},
year = {2017},
volume = {01},
number = {12},
pages = {1-20},
keywords = {secondcategory}
}
\end{filecontents}
\defbibfilter{myfilter}{%
keyword=firstcategory or keyword=secondcategory
}
\addbibresource{\bibname.bib}
\begin{document}
I would like to split my bibliography in two section. Authors \cite{B1,B2} with the keyword "firstcategory" in the bib. file should appear in the First Category and author \cite{A1} with the keyword "secondcategory" should appear in the Second Category.
\printbibliography[filter=myfilter]
\end{document}
(如果您需要类别,它们应该也可以做到,但是您的示例看起来关键字是更自然的选择)