I'm trying to create subcategories for my bibliography with headings by year (using biblatex). I found I can use defbibcheck to check by year like so:
\defbibcheck{2013}{
\iffieldint{origyear}
{\ifnumequal{\thefield{origyear}}{2013}
{}
{\skipentry}
}
{\iffieldint{2013}
{\ifnumequal{\thefield{year}}{2013}
{}
{\skipentry}
}
{\skipentry}
}
}
However because there's a lot of years I don't want to have a copy of this for every year. I thought I could use \foreach from the pgffor package like this:
\foreach \year in {2012,2013}{%
\defbibcheck{\year}{
\iffieldint{origyear}
{\ifnumequal{\thefield{origyear}}{\year}
{}
{\skipentry}
}
{\iffieldint{\year}
{\ifnumequal{\thefield{year}}{\year}
{}
{\skipentry}
}
{\skipentry}
}
}
}
However, the \prinbibliography[check=2013] results in a Check '2013' not found. Is there another way to do this?
Edit: Minimal not working example below:
\documentclass{article}
\usepackage{filecontents}
\usepackage{pgffor}
\usepackage{biblatex}
\foreach \year in {2012,2013}{%
\defbibcheck{\year}{
\iffieldint{origyear}
{\ifnumequal{\thefield{origyear}}{\year}
{}
{\skipentry}
}
{\iffieldint{\year}
{\ifnumequal{\thefield{year}}{\year}
{}
{\skipentry}
}
{\skipentry}
}
}
}
\begin{filecontents*}{\jobname.bib}
@inproceedings{Bar2013,
author = {F. Bar and B. Foo},
booktitle = {The conference on nothing},
pages = {1--2},
title = {{A meaningless title}},
year = {2013}
}
@inproceedings{Bar2012,
author = {F. Bar},
booktitle = {International Conference on Information},
pages = {3--4},
title = {{Advanced functionality and performance or nothing }},
year = {2012}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography[check=2013]
\end{document}

