# Biblatex and per-year subbibliography

My question is how I can group the bibliographic records using biblatex on per-year-basis. I have tried the approach

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


and then using the command

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


changing the counter value manually, but this yields a result only if the command is called once. In the second calling of \printbibliography, pdflatex announces

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

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


What I want to achieve is that I will have structure of references as

2013

Braham, A., Edrich, B. ...

Ecilie, C., Ietrich, D. ...

2012

.....

If this was done automatically according to entries in .bib file. It would be fine. I have really no idea how to do that.

• You might be able to use biblatex's concept of categories together with the \bibbycategory. – Andrew Swann Jun 27 '13 at 16:14
• \ifnum requires \fi. You may use for example \ifnumequal{\thefield{year}}{\themycounter} – Oleg Domanov Jun 28 '13 at 6:26

In the code below the first \printbibliography composes a list of years which is then used in a loop to print other bibliographies. The sorting option is used to sort the list (thanks to user32884 for suggesting this).

\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}

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

\begin{document}
\nocite{*}
\gdef\yearlist{}%
\begingroup%
\makeatletter%
\def\blx@driver#1{}%
\makeatother%
\endgroup%
\renewcommand*{\do}[1]{%
\setcounter{mycounter}{#1}%
\printbibliography[title=#1

• Thnak you, this helped. I just had to remove double braces {{ }} at my year fields of the bib file to work. I also could solve the sorting problem by declaring my sorting scheme by \DeclareSortingScheme{dyear}{ \sort[direction=descending]{\field{year}} \sort{\field{author}} \sort{ \field{journal} \field{title} } }  and modifying the group \begingroup% \makeatletter% \def\blx@driver#1{}% \printbibliography[env=counting,heading=none,type=article,sorting=dyear]% \makeatother% \endgroup%  – Ikarie XB 1 Jun 28 '13 at 12:34
• Oh, yes, a simple solution, it didn't come to my mind. There is actually a standard sorting scheme ydnt which can be used for that. I added it to the answer. I also removed \AtEveryBibitem while modifying a little the counting environment. – Oleg Domanov Jun 28 '13 at 13:04