4

I have a list of publications I need to include in a document. For some of the publications authors are ordered alphabetically while for the others, this order depends on their contribution in the cited work. This list of publications looks like that:

@book{keyA,
  author = {Author, A.},
  year = {2001},
  title = {Title},
  publisher = {Publisher},
  keywords = { conf },
}

@book{keyB,
  author = {Author, B.},
  year = {2001},
  title = {Title},
  publisher = {Publisher},
  keywords = { journal },
}

@book{keyC,
  author = {Author, C.},
  year = {2001},
  title = {Title},
  publisher = {Publisher},
  keywords = { conf },
}

@book{keyD,
  author = {Author, D.},
  year = {2001},
  title = {Title},
  publisher = {Publisher},
  keywords = { conf },
}

And the .tex file is something like:

\documentclass{article}
\usepackage[sorting=none, style=ieee]{biblatex}
\addbibresource{biblio.bib}

\begin{document}

\nocite{*}

\section{Bibliography}
\printbibliography[keyword={conf},heading=none]

\end{document}

The file as output looks like the screenshot below.

What I'm trying to do is to add a small image I created (abc.png) at the beginning of the alphabetically ordered entries. Let's say entry "keyC" has a list of authors alphabetically ordered, the results would be like that:

I have no idea how to figure this out. I am not even sure whether it's doable... Maybe something with a \renewcommand and a way to identify the affected entries (Is it possible to have multiple keywords and filter the \printbibliography with just one of them?).

Any idea? Suggestion?

3
  • 1
    Welcome to TeX.SX! You mean at the beginning of each entry, at each set of entries, or at the beginning of the bibliography as a whole? Also, it would increase the chance of you receiving a good answer if you provided a minimal working example with bibliography (MWEB), beginning with \documentclass, ending with \end{document} and including some sample bib entries.
    – gusbrs
    Jan 18 '18 at 19:31
  • Thanks! The challenge is I would like to add this image at the beginning of a subset of the entries. Let's say my "intconf" list contains 10 entries, I would like to add an image at the beginning of maybe 3 entries that have the authors alphabetically ordered. I'm gonna work on a more complete example.
    – Francois
    Jan 18 '18 at 19:35
  • Please try to be specific about the desired result. For that and for the MWE you can edit your question (link available on the bottom left).
    – gusbrs
    Jan 18 '18 at 19:37
8

You can create a category and include the selected entries with \addtocategory. Biblatex's standard styles provide the macro begentry as an easy hook into the beginning of the bibdriver, biblatex-ieee does too. So, you can redefine begentry to conditionally include the images for every entry of the category:

\documentclass{article}
\usepackage[sorting=none, style=ieee]{biblatex}
\usepackage{graphicx}

\addbibresource{biblio.bib}

\DeclareBibliographyCategory{intconf}

\addtocategory{intconf}{keyC}

\renewbibmacro*{begentry}{\ifcategory{intconf}{%
    \raisebox{-2pt}{\includegraphics[height=\baselineskip]{abc.png}}\addspace}%
}

\begin{document}

\nocite{*}

\section{Bibliography}
\printbibliography[keyword={conf},heading=none]

\end{document}

enter image description here

5
  • That's exactly what I was looking for! Thanks a lot!
    – Francois
    Jan 18 '18 at 20:13
  • 1
    FWIW I would prefer \renewbibmacro*{begentry}{} over \AtEveryBibitem{} in this case, but that is probably a matter of taste.
    – moewe
    Jan 18 '18 at 21:33
  • @moewe Because it would then be executed within the driver rather than before it? I agree that it would be more proper. But I didn't think of that then.
    – gusbrs
    Jan 18 '18 at 21:58
  • Indeed. I feel that \AtEveryBibitem should not print anything, but begentry is a good place to print text. As I say it's a matter of taste.
    – moewe
    Jan 18 '18 at 22:01
  • On the other hand, \AtEveryBibitem is a sort of \xapptobibmacro{begentry} so I usually recur to it first without having to worry what's in there (even though, I know it is empty in the standard styles). But you are right, I will update the answer.
    – gusbrs
    Jan 18 '18 at 22:03

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.