# Placement of showkeys label

Is it possible to place the labels of the showkeys package for bibliographic items on the right side instead of the default left?

I tried

\patchcmd{\SK@@label}{\llap}{\rlap}{}{}


which indeed changes the location of the label but not very satisfying.

MWE:

\documentclass{article}
\usepackage{showkeys}
\begin{document}
\begin{enumerate}
\item \label{test} test
\item \label{test2} test2
\end{enumerate}
\end{document}

• You mean in the right margin? Jul 10, 2014 at 16:50
• ...and this is specific to showing \bibitems or \items from any list?
– Werner
Jul 10, 2014 at 16:52

## 2 Answers

You can try the package showlabels that solved similar issue for me. It has a number of options to display labels at various sides of the page or in the text.

You need to do a little more to shove entries over to the right of your document. Another patch pushes it over by \textwidth+\marginparsep:

\documentclass{article}
\usepackage{showkeys,etoolbox,showframe}
\newcommand{\fullrlap}[1]{%
\rlap{\kern\dimexpr-\@totalleftmargin+\textwidth+\marginparsep\relax#1}}
\begin{document}

\begin{thebibliography}{x}
\bibitem{abc} test1
\bibitem{def} test2
\end{thebibliography}

\makeatletter
\patchcmd{\SK@@label}{\llap}{\fullrlap}{}{}% Insert appropriate (full)rlap patch
\makeatother

\begin{thebibliography}{x}
\bibitem{ghi} test3
\bibitem{jkl} test4
\end{thebibliography}

\end{document}


The negative \@totalleftmargin moves the label flush with the left margin. To that, we add \textwidth in order to shove the label over to the right margin and then another \marginparsep.