# How display marginal labels on bibliography entries with showlabels?

How can I cause marginal labels to appear for entries in the printed bibliography if I am using the showlabels package? (Note that I mean labels in the margin rather than the numbers or names, etc., that are printed within the bibliography.)

(I'm not asking about causing labels to appear where \cite commands appear in the text.)

With the showkeys package instead of showlabels, they appear automatically.

If I merely load the showlabels package and include a \showlabels{bibitem}, that will not produce labels for the actual items in the References section (although it will produce labels at the various \cite locations). For example:

\documentclass[12pt]{article}

\begin{filecontents}{short.bib}
@book{Doe2016,
author = {Doe, Jane},
title = {Theory of everything},
publisher = {YourBooks},
year = {2016}
}
\end{filecontents}

\usepackage[backend=bibtex]{biblatex}
\usepackage[names,dvipsnames,named]{xcolor}

\usepackage{showlabels}
\renewcommand{\showlabelfont}{\small\color{blue}}
\showlabels[\small\color{gray}]{cite}
\showlabels[\small\color{red}]{bibitem}

\begin{document}

\section{A section}\label{sec:one}

\printbibliography

\end{document}


Output:

• Remove the solution from the current question and add it as a self-answer which you can accept. Self-answers are welcome here. Perhaps consider also including a minimal example with some images. That will make the content more readily consumable to future visitors. – Werner Sep 23 '16 at 20:15
• note \usepackage{show labels} should be \usepackage{showlabels} (the space is ignored only by accident, and the package name has no space) – David Carlisle Sep 23 '16 at 20:17
• @David Carlisle: the space in show labels was, alas, an artifact of the OS X's autocorrection that is sometimes very stubborn. – murray Sep 23 '16 at 20:25
• ah, I'm a bit sensitive to that as a lifetime ago I added some code so the space around commas in \usepackage{a , b , c} were ignored, but as a side effect it ignores all space and people manage to take advantage of that in exotic ways that were not planned:-) – David Carlisle Sep 23 '16 at 20:28

The package author, Norman Gray, provided a solution:

\makeatletter
\showlabels{blx@bibitem}
\makeatother


Because i don't directly see \bibitem in the source when I'm using bibtex, I had not realized that the same sort of \showlabels command that is documented to work with cite will also handle \bibitem(once bibtex is used to create the .bbl file).

Added: However, the labels on items within the actual References list no longer appear if one uses an external .bib file. (See addendum to my original post for example.)

Here's an example that illustrates using \showlabels{bibitem}:

\documentclass[12pt]{article}

\usepackage[names,dvipsnames,named]{xcolor}

\usepackage{showlabels}
\renewcommand{\showlabelfont}{\small\color{blue}}
\showlabels[\small\color{gray}]{cite}
\showlabels[\small\color{red}]{bibitem}

\begin{document}

\section{A section}\label{sec:one}

\begin{thebibliography}{1}

\bibitem{Doe2016}
Jane Doe, \emph{Theory of everything}, YourBooks, Somewhere, 2016.

\end{thebibliography}

\end{document}


The output:

• Using biblatex, \showlabels{bibitem} does not seem to work. – jpmath Dec 29 '16 at 21:05
• @jpmath: You are correct in that \showlabels{bib item} no longer produces labels within the actual "References" list if one uses an external .bib file. I'm removing my acceptance on my answer! – murray Dec 30 '16 at 20:24