# Info boxes in bibliography

I remember seeing a gorgeous review article a while back. Sadly I cannot find it, so I can neither reference it nor get a screenshot. What was unique was in the bibliography. Certain papers that were of particular note were emphasized by making the title of the article cited bold. If memory serves, the page behind the entry was also colored a very light orange. In other entries the text was not bold. Additionally a small box containing one to two sentences was seen in the margin.

Each of these small info-boxes had a heading referencing the bibliography entry and a sentence or two describing the article. All of these boxes were placed on the same page as the reference they described.

I would like to repeat this design for my thesis, as I am free to do so. Is this possible with biblatex?

Edit: I was asked off-line what I meant by this question. To ensure minimal ambiguity I grabbed a screenshot off a random bibliography and drew on it. Obviously I do not want anything nearly this ugly, and I do not intend to use this bibliography style. But the idea should be crystal clear now. Emphasize special bibliography entries and have a brief info-box in the margin.

• I have updated my solution with highlighting. – cslstr May 7 '14 at 15:30
• Apologies for resurrecting an old thread. For those looking, The journal Annual Reviews of x (Physical Chemistry, Marine Science etc.) follow this sort of style. Anything after around 2010, maybe earlier has these annotations in their bibliography. – tmgriffiths Aug 26 '16 at 0:25

## Updated Solution

After some time, I have gotten the bibitem highlighting to work in an acceptable manner. The code below differs from the previous version(s) in that many macro names have changed and the structure of things has been a bit more refined to make this easier for someone else to use in their own work. Specifically,

• The field which contains the infobox text is customizable with \def\notefield{annotation}.
• You must explicitly name the entries for which you would like to have infoboxes appear. If you opt to include an item for which \notefield is empty or nonexistant, the bibitem for that entry will still be highlighted, but no infobox will appear.
• Colors and styles for each aspect can be controlled separately.
• References to "Important" have migrated to "Infobox"

### Result

The example code now runs with biblatex-examples.bib for a bit better look.

### Code

The example bib-file biblatex-examples.bib has many entries; with the annotation field filled for every entry; the vazques-de-parga entry also contains a note field, so you can see what happens when you change the \notefield from annotation to note. Comments related to this are interspersed in the code below.

\documentclass[]{article}

% Set page geometry - this adds a bit more room for the marginpars to live comfortably
\usepackage[includemp,marginparwidth=4cm,reversemarginpar]{geometry}
\newlength{\innermarginparwidth}
\setlength{\innermarginparwidth}{\marginparwidth}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tikz} % Tikz basic
\usetikzlibrary{tikzmark} % Gives \tikzmark for markers
\usetikzlibrary{calc} % Node position calculations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% User Customizable Options
%
% Some basic options for biblatex
\usepackage[backend=biber,sorting=nyt,style=ieee]{biblatex}
%
\def\notefield{annotation} % Set the bibentry-field that contains your notes---could also be "note"
%
% Set colors & style
\definecolor{InfoboxBackground}{HTML}{F6F6FF}
\definecolor{InfoboxFrame}{HTML}{000077} % Remove frame by making this the same as background
\definecolor{InfoboxText}{HTML}{4444FF}
\definecolor{BibitemText}{HTML}{000077}
\definecolor{BibitemHighlight}{HTML}{FFFF00}
\def\bibitemstyle{\bfseries\color{BibitemText}}
\def\infoboxstyle{\slshape}
\def\infoboxsep{6pt} % inner margins of box
\def\infoboxrule{1pt} % width of rule around box

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Setup Infobox
\DeclareBibliographyCategory{UseInfobox} % Make a category for entries that should have infoboxes
\newbibmacro*{infoboxnote}{\printfield[infoboxnote]{\notefield}} % New bibmacro to print out the infoboxnote-styled note
\DeclareFieldFormat{\notefield}{} % Disable printing of \notefield in other ordinary circumstances
\DeclareFieldFormat{infoboxnote}{\marginpar{\fboxsep\infoboxsep\fboxrule\infoboxrule\fcolorbox{InfoboxFrame}{InfoboxBackground}{\parbox[t]{\innermarginparwidth}{\color{InfoboxText}\infoboxstyle\printfield[labelnumberwidth]{labelnumber} #1}}}} % Insert \marginpar with note

% New \highlight command for bibitem highlighting
% Takes parameter {entrykey} to make \tikzmark pairs unique
% \highlight command should appear before the text to highlight so it is set behind
\newcommand{\highlight}[1]{%
\begin{tikzpicture}[remember picture, overlay]
\coordinate (begin) at ($(pic cs:#1beg) + (-.5ex,2ex)$);
\coordinate (end) at ($(pic cs:#1end) + (0,-.8ex)$);
\coordinate (penult) at ($(begin |- end) + (0,-.5ex)$);
\coordinate (right) at ($(begin) + (\linewidth+1ex,0)$);
\fill[BibitemHighlight] (begin) -- (right |- begin) -- (right |- end) -- ( begin |- end) -- cycle;
\end{tikzpicture}}

% Set the \tikzmarks ; Place the infoboxnote ; set style for bibitem
\AtEveryBibitem{%
\ifcategory{UseInfobox}%
{\highlight{\thefield{entrykey}}\tikzmark{\thefield{entrykey}beg}\usebibmacro{infoboxnote}\bibitemstyle}%
{}}
\renewbibmacro*{finentry}{\finentry\tikzmark{\thefield{entrykey}end}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

% Identify the entries you want to have an infobox
\nocite{bertram,sarfraz,companion,knuth:ct,kullback,wilde,vazques-de-parga}

% Example of \highlight command with regular text to demonstrate how things work
% Note that command highlights with rectangle starting where text starts; indentation not supported
\noindent\highlight{UNIQUE}\tikzmark{UNIQUEbeg}This is a line that goes all the way to the end and has a tikzmark that marks the ultimate end on the next line.\tikzmark{UNIQUEend}

\printbibliography

\end{document}


## Original Post

This does everything you want using biblatex... except for the (background) highlighting of the bib-entry (this is particularly hard to accomplish while keeping the ability to have multi-line entries).

The solution uses \marginpar to set the note field of an entry in the margin. As written, you just need to add a note field to an entry; when the note field would normally be set (you must be using a style that wants to use the note), the note is placed in a \marginpar and the entry itself is added to the important category. Every important entry is then typeset in a special font (here, bold and colored).

The other way you could approach this would be to manually specify which entries you'd like to highlight (with \addtocategory{important}{paperA,...}) and removing the corresponding code from \DeclareFieldFormat{note}{...}. Then you could maintain notes with all important papers, but only include the most important ones (or those for which you have space).

The solution appears as:

\documentclass[]{article}
\begin{filecontents}{\jobname.bib}
@inproceedings{paperA,
booktitle = {Proceedings},
year = {2003},
author = {Alpha, Author},
title = {AAA Title of Paper},
note={This paper is of special significance},
}
@inproceedings{paperB,
booktitle = {Proceedings},
year = {2002},
author = {Bravo, Author},
title = {BBB Title of Paper},
note={This paper is also of special significance},
}
@inproceedings{paperC,
booktitle = {Proceedings},
year = {2004},
author = {Charlie, Author},
title = {CCC Title of Paper},
}
@inproceedings{paperD,
booktitle = {Proceedings},
year = {2001},
author = {Bravo, Author},
title = {DDD Title of Paper},
}
@inproceedings{paperE,
booktitle = {Proceedings},
year = {2001},
author = {Bravo, Author},
title = {BEE Title of Paper},
}
\end{filecontents}

\usepackage[svgnames]{xcolor}
\usepackage[includemp,marginparwidth=4cm,reversemarginpar]{geometry}

% Some basic options for biblatex
\usepackage[backend=biber,sorting=nyt,style=ieee]{biblatex}
%% Highlight entries
\DeclareBibliographyCategory{important}

\AtEveryBibitem{%
\ifcategory{important}%
{\bfseries\color{Maroon}}%
{}%
}

\begin{document}

\nocite{*}
~ % Type something....
\printbibliography

\end{document}


## Edit for More Color:

You could add a bit more color by using a \colorbox for the note itself:

\usepackage{xcolor}
\definecolor{ImportantBackground}{HTML}{FFE3D6}
\definecolor{Important}{HTML}{A13506}
\usepackage[includemp,marginparwidth=4cm,reversemarginpar]{geometry}
\newlength{\innermarginparwidth}
\setlength{\innermarginparwidth}{\marginparwidth}

% Some basic options for biblatex
\usepackage[backend=biber,sorting=nyt,style=ieee]{biblatex}

%% Highlight entries
\DeclareBibliographyCategory{important}

• This is very fine, but I do not understand the tikzmarks-example: where does the blue text in the boxes come from? ;) – cis Jun 14 '14 at 1:44
• So, \tikzmark{...} allows a coordinate to be set with regard to the surrounding typesetting, and made available within tikz. It is somewhat of a "global" tikz coordinate marker that can be called even outside of tikz. The blue text is typeset using \marginpar in the newly defined (with \DeclareFieldFormat{infoboxnote}...) format of the \notefield field; this is actually displayed with the call to \usebibmacro{infoboxnote} in \AtEveryBibitem. – cslstr Jun 14 '14 at 1:57
• @cis I realize now you may have meant the blue text over the highlighting background (bibitem text itself)... this color is introduced with the color bibitemtext, as used by \bibitemstyle when it is called just after \usebibmacro{infoboxnote} in \AtEveryBibitem. – cslstr Jun 14 '14 at 2:03
• @cis OK, I understand now. Yes, all text is coming from the bib-file, in this case biblatex-examples.bib. The note text comes from the field of the bib entry specified by \def\notefield{...}. – cslstr Jun 15 '14 at 0:54