title and keyword are optional arguments to the Biblatex command, printbibliography.
Is it possible to pass a title and keyword as variables to printbibliography?
The use case is the production of a complex bibliography that I would like to separate into sections based on keyword and by applying an appropriate title to that bibliography section.
This non-working example gives:
Package biblatex Warning: Keyword '\keyword ' not found on input line 37.
This is an MWE and its output:
\documentclass[a4paper,10pt]{article}
%
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{article1,
title={Title 1},
author={Author1},
journal={Journal1},
year={2019},
keywords={Red}
}
@article{article2,
title={Title 2},
author={Author2},
journal={Journal 2},
year={2019},
keywords={Blue}
}
\end{filecontents}
%
\usepackage[backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{tikz}
% Setup a list of keywords
\newcommand*{\myKeywords}{Red,Blue}
\begin{document}
\nocite{*}
\printbibliography
\printbibliography[title=Red,keyword=Red]
\printbibliography[title=Blue,keyword=Blue]
% How to pass \keyword to \printbibliography as an optional argument?
\foreach \keyword in \myKeywords {
\printbibliography[title=\keyword,keyword=\keyword]
}
\end{document}

