I've been trying to implement author name categories in BibLaTeX based on this answer while using biber. However, I don't seem to be able to catch the author name using \iffieldequalstr in \AtEveryBibItem:


\AtEveryBibitem{\iffieldequalstr{author}{Smith, John}{\addtocategory{authorSmith}{\thefield{entrykey}}{}}}

When I issue the \printbibliography[category=authorSmith] command, nothing is printed from the bibliography.

Here's a MWE showing the issue and all the name combinations I could think of, and how it doesn't happen when with year:




\AtEveryBibitem{\iffieldequalstr{author}{Smith, John}{\addtocategory{authorSmith}{\thefield{entrykey}}{}}}




\AtEveryBibitem{\iffieldequalstr{author}{John Smith}{\addtocategory{authorSmith}{\thefield{entrykey}}{}}}





\section*{Sorted by Author}


\section*{Sorted by Year}




    addendum = {This should show up},
    author = {Smith, John},
    journal = {Test Journal},
    year = {1984},
    title = {Test Paper}


Does anyone know how I can catch the author's name? I have similar issues with source maps.


Name fields are special and can not be tested with \iffieldequalstr. In my opinion the best way to test for a certain name is by testing with name hashes, see Highlight an author in bibliography using biblatex allowing bibliography style to format it. There are some subtleties if we do that, though, we can test for the full author list or just for one name in the author list. It is slightly simpler to test for the full list and your usage example looks like that might be intended anyway, so I will present that solution here.

The downside of this approach is that you have to look up the namehash in the .bbl once. Just open the .bbl, search for the relevant entry and copy the namehash value.


Shows that in my Biber version the hash for Smith, John/John Smith is 5d0ddda3a367ceb26fbaeca02e391c22. So that is what we are going to test against.


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



  addendum = {This should show up},
  author   = {Smith, John},
  journal  = {Test Journal},
  year     = {1984},
  title    = {Test Paper},



\printbibliography[category=authorSmith, title={Smith's Papers}]


Two bibliographies: The first is titled "Smith's Papers" and contains only <code>smith:TestPaper</code>. The second is titled "References" and contains both <code>sigfridsson</code> and <code>smith:TestPaper</code>

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.