2

I am currently using biblatex for creating my document. I want to know if it is possible to split the bibliography with only the bibkeys.

The idea will be to use

\printbibliography[title=Primal,key={KEY1,KEY2}]
\printbibliography[title=Complementary,notkey={KEY1,KEY2}]

KEY1 and KEY2 designate here the bibkeys associated to references. I know I can use keywords in references for filtering but I want to avoid it if possible.

5

The approach of filtering by entry keys is quite non-semantic and it might be possible to find a more elegant solution based on keywords, entry types or other fixed criteria instead of the arbitrary entry key. That is not to say, however, that in some cases splitting or grouping by entry key is not the best or most sensible solution.

A quite elegant solution is to use categories. Bibliography categories were meant to categorise/group entries on the fly from within the .tex document and not in the (more static) .bib data (where keywords would be the right approach).

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}

\DeclareBibliographyCategory{keys}
\addtocategory{keys}{sigfridsson,nussbaum}

\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{sigfridsson,worman,nussbaum,geer}
\printbibliography[category=keys]
\printbibliography[notcategory=keys]
\end{document}

Two bibliographies with two entries each: <code>nussbaum</code> and <code>sigfridsson</code> in the first, <code>geer</code> and <code>worman</code> in the second


The less elegant brute-force methods uses bibchecks, which gets a bit messy as the lists grow, but can be more easily combined with other sorts of test.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}

\defbibcheck{keys}{%
  \iffieldequalstr{entrykey}{sigfridsson}
    {}
    {\iffieldequalstr{entrykey}{nussbaum}
       {}
       {\skipentry}}}

\defbibcheck{notkeys}{%
  \iffieldequalstr{entrykey}{sigfridsson}
    {\skipentry}
    {\iffieldequalstr{entrykey}{nussbaum}
       {\skipentry}
       {}}}

\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{sigfridsson,worman,nussbaum,geer}
\printbibliography[check=keys]
\printbibliography[check=notkeys]
\end{document}

The output would be the same.

  • Awesome!! I really like your first proposition. Thank you !! :-) – Guuk Jan 14 '19 at 10:21
  • @Guuk Glad I could help. In almost all cases the first solution with categories is preferable, I guess. I only included the second solution, because that's what came into my mind when I read the title of the question and because it can be slightly more flexible in some cases. (Though the fact that one has to code all keys separately is a nuisance, one could of course try to implement a category like list, but then one could take categories directly.) – moewe Jan 14 '19 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.