我想扫描 bib 文件中的条目类型,将它们分为 3 个类别,并按标题单独显示。我使用以下代码实现了此功能。我想更改两件事:
- 删除脚注处的奇怪输出(blx@hook@citekey@next);
- 将所有三个参考书目放在彼此之下,因此没有新的页面。
我怎样才能做到这一点?
\documentclass{report}
\usepackage[backend=bibtex,citestyle=verbose-ibid,bibstyle=numeric,sorting=nyt]{biblatex}
\DeclareBibliographyCategory{websites}
\DeclareBibliographyCategory{spoken}
\DeclareBibliographyCategory{books}
\AtEveryCitekey{
\ifentrytype{misc}{
\iffieldundef{howpublished}{
\addtocategory{websites}{\thefield{entrykey}}
}{
\addtocategory{spoken}{\thefield{entrykey}}
}
}{
}
}
\AtEveryCitekey{
\ifentrytype{book}{
\addtocategory{books}{\thefield{entrykey}}
}
}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
%books
@book{3,
author = {Menger, Carl},
title = {Grunds{\"a}tze der Volkswirtschaftslehre},
publisher = {Braum{\"u}ller},
year = {1982}
}
%spoken
@misc{4,
author = "Janssen, Jan",
title = "",
month = may,
year = "2014",
howpublished = "Congres"
}
%websites
@misc{5,
author = {The Guardian},
title = {Cyprus banks remain closed to prevent run on deposits},
url = "http://www.theguardian.com/world/2013/mar/26/cyprus-banks-closed-prevent-run-deposits",
urldate = "2014-11-15"
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\tableofcontents
\chapter{Chapter}
Some text
\footcite{3,4,5}
\addcontentsline{toc}{chapter}{Bibliography}
\printbibliography[category=books,title={Books}]
\printbibliography[category=websites,title={Online articles}]
\printbibliography[category=spoken,title={Conferences}]
\end{document}
答案1
感谢 lockstep 对标签的编辑,我自己找到了答案。
\documentclass{report}
\usepackage[backend=bibtex,citestyle=verbose-ibid,bibstyle=numeric,sorting=nyt]{biblatex}
\DeclareBibliographyCategory{websites}
\DeclareBibliographyCategory{spoken}
\DeclareBibliographyCategory{books}
\AtEveryCitekey{
\ifentrytype{misc}{
\iffieldundef{howpublished}{
\addtocategory{websites}{\thefield{entrykey}}
}{
\addtocategory{spoken}{\thefield{entrykey}}
}
}{
}
}
\AtEveryCitekey{
\ifentrytype{book}{
\addtocategory{books}{\thefield{entrykey}}
}
}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
%books
@book{3,
author = {Menger, Carl},
title = {Grunds{\"a}tze der Volkswirtschaftslehre},
publisher = {Braum{\"u}ller},
year = {1982}
}
%spoken
@misc{4,
author = "Janssen, Jan",
title = "",
month = may,
year = "2014",
howpublished = "Congres"
}
%websites
@misc{5,
author = {The Guardian},
title = {Cyprus banks remain closed to prevent run on deposits},
url = "http://www.theguardian.com/world/2013/mar/26/cyprus-banks-closed-prevent-run-deposits",
urldate = "2014-11-15"
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\tableofcontents
\chapter{Chapter}
Some text
\footcite{3,4,5}
\addcontentsline{toc}{chapter}{Bibliography}
\chapter*{Bibliography}
\section*{Books}
\begingroup
\let\clearpage\relax
\printbibliography[category=books,heading=none]
\endgroup
\section*{Online articles}
\begingroup
\let\clearpage\relax
\printbibliography[category=websites,heading=none]
\endgroup
\section*{Conferences}
\begingroup
\let\clearpage\relax
\printbibliography[category=spoken,heading=none]
\endgroup
\end{document}