Biblatex 和每年子书目

Biblatex 和每年子书目

我的问题是如何使用 biblatex 按年份对书目记录进行分组。我尝试过以下方法

\newcounter{mycounter}
\setcounter{mycounter}{2013}
\defbibcheck{intheyear}{
  \iffieldint{year}
  {\ifnum \thefield{year} = \themycounter
    {\skipentry}
    {} }
  {\skipentry}}

然后使用命令

\printbibliography[title=2013
,heading=subbibliography
,type=article
,check = intheyear
]

手动更改计数器值,但只有调用一次命令才会产生结果。在第二次调用时\printbibliographypdflatex宣布

! Incomplete \ifnum; all text was ignored after line <i>xx</i>.
<inserted text> 
                \fi 
<*> \input lpublications.tex

! Emergency stop.
<*> \input lpublications.tex

我想要实现的是,我将拥有如下引用结构

2013

布拉姆,A.,埃德里克,B.……

Ecilie,C.,Ietrich,D.……

2012

.....

如果这是根据.bib文件中的条目自动完成的,那就好了。我真的不知道该怎么做。

答案1

在下面的代码中,第一个代码\printbibliography组成了一个年份列表,然后在循环中使用它来打印其他书目。该sorting选项用于对列表进行排序(感谢 user32884 的建议)。

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@ARTICLE{a1,
 author = {Author},
 title = {Title},
 journaltitle = {Superjournal},
 year = {2003},
}
@ARTICLE{a2,
 author = {Buthor},
 title = {Ztitle},
 journaltitle = {Superjournal},
 year = {2000},
}
@ARTICLE{a3,
 author = {Duthor},
 title = {Ztitle},
 journaltitle = {Superjournal},
 year = {2002},
}
\end{filecontents*}
\documentclass[a4paper,12pt]{article}
\usepackage[english]{babel}

\usepackage[style=authoryear,]{biblatex}
\addbibresource{\jobname.bib}

\newcounter{mycounter}
\defbibcheck{intheyear}{
  \iffieldint{year}
    {\ifnumequal{\thefield{year}}{\themycounter}
      {}
      {\skipentry}}
    {\skipentry}}
\defbibenvironment{counting}
  {}
  {}
  {\xifinlist{\thefield{year}}{\yearlist}
    {}
    {\listxadd{\yearlist}{\thefield{year}}}}

\begin{document}
\nocite{*}
\gdef\yearlist{}%
\begingroup%
  \makeatletter%
  \def\blx@driver#1{}%
  \printbibliography[env=counting,heading=none,type=article,sorting=ydnt]%
  \makeatother%
\endgroup%
\renewcommand*{\do}[1]{%
  \setcounter{mycounter}{#1}%
  \printbibliography[title=#1
  ,heading=subbibliography
  ,type=article
  ,check = intheyear
  ]}
\dolistloop{\yearlist}
\end{document} 

在此处输入图片描述

相关内容