8

Multimedia entry types, i.e. artwork, audio, image, movie, music, performance, video, software, are not well supported by biblatex yet, although there are already fields defined for their unique identifiers: isan (audiovisual), ismn (music), iswc (musical work); cf. isbn (book), isrn (report) and issn (serial).

Many of these, like some books, are quickly identified by their cover image(s). Therefore a bibliography that only or mostly contains such entries (instead of online resources, journal articles and technical reports) could benefit from thumbnail pictures being displayed next to the text.

Are there any biblatex styles that support such a thing? Otherwise, how could one best achieve that?

I assume one should start with a custom field in the .bib file like cover, coverimage, coverpicture, coverfile, coverurl or more generic thumbnail, screenshot, logo, icon, photo, picture or image.

PS: Let’s put copyright considerations aside for a moment and assume that it’s fair use or covered by citation rules.

Crissov
  • 1,866

1 Answers1

4

You might see this as a proof-of-concept, I will gladly take any input and comments on this idea.

We define a new field thumbnail to hold the path to the cover image, thumbnail, ... what have you

\DeclareDatamodelFields[type=field, datatype=verbatim]{thumbnail}
\DeclareDatamodelEntryfields{thumbnail}

An entry might look like this

@book{uthor,
  author    = {Uthor, Arnold},
  title     = {A Big Book},
  publisher = {P. Ublisher \& Co.},
  location  = {Someplace},
  thumbnail = {coverimage.png},
}

Where, of course, coverimage.png is in the same folder as the master .tex file.

We define a helper function

\newcommand*{\insertbibimage}[1]{\includegraphics[width=50px, keepaspectratio]{#1}}

Here you can use all the graphics formatting of \includegraphics.

Finally, the image will be printed after the entry in a new line.

\renewbibmacro*{finentry}{\finentry
  \iffieldundef{thumbnail}
    {}
    {\\\usefield{\insertbibimage}{thumbnail}}}

The following redefinition prints the image in the margin and does not disturb the rest of the bibliography in such a brisk manner as the definition above

\renewbibmacro*{finentry}{\finentry
  \iffieldundef{thumbnail}
    {}
    {\marginpar{\usefield{\insertbibimage}{thumbnail}}}}

MWE

\documentclass[british,a4paper]{scrartcl}
\usepackage{filecontents}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[autostyle=true]{csquotes}
\usepackage[style=authoryear, backend=biber]{biblatex}
\usepackage{graphicx}
\usepackage{hyperref}

\DeclareDatamodelFields[type=field, datatype=verbatim]{thumbnail}
\DeclareDatamodelEntryfields{thumbnail}

\newcommand*{\insertbibimage}[1]{\includegraphics[width=50px, keepaspectratio]{#1}}
\renewbibmacro*{finentry}{\finentry
  \iffieldundef{thumbnail}
    {}
    {\\\usefield{\insertbibimage}{thumbnail}}}

\begin{filecontents*}{\jobname.bib}
@book{uthor,
  author    = {Uthor, Arnold},
  title     = {A Big Book},
  publisher = {P. Ublisher \& Co.},
  location  = {Someplace},
  thumbnail = {coverimage.png},
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\begin{document}
  \nocite{*}
  \printbibliography
\end{document}

enter image description here

The wonderful sample image is

enter image description here

save it as coverimage.png

moewe
  • 175,683
  • 1
    Cool! Btw, for dummy pictures, you can use the mwe package. – doncherry Mar 19 '14 at 13:43
  • One might want to put the graphics inside a column of their own instead of \marginpar or a separate line at the end. – Crissov Mar 21 '14 at 14:55
  • @Crissov That is indeed a nice idea, but requires some (quite heavy) rewriting. – moewe Mar 22 '14 at 06:49
  • @moewe I get this error with your MWE: ! Undefined control sequence. l.12 \DeclareDatamodelFields [type=field, datatype=verbatim]{thumbnail} I then tried http://tex.stackexchange.com/a/238560/4992 and I get the error `! Package keyval Error: datamodel undefined.

    See the keyval package documentation for explanation. Type H for immediate help. ...

    l.10299 \blx@processoptionsI am onThis is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/W32TeX)`

    – Alessandro Jacopson Oct 16 '15 at 12:47
  • 1
    @AlessandroJacopson You use TeX Live 2012 which ships an ancient biblatex version. It probably doesn't even allow for data models. You will have to update. Note that this solution can only be used if you use Biber as back-end, BibTeX doesn't cut it. – moewe Oct 16 '15 at 15:00
  • @moewe OK, now I am on This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) and with your MWE I get a document without the picture; in order to get the picture I need to use an external .dbx file as explained in http://tex.stackexchange.com/a/238560/4992 Tnahk you! – Alessandro Jacopson Oct 16 '15 at 17:56