LaTeX - fix overlapping showlabels with efbox

I find the showlabels package to be extremely useful when writing papers in LaTeX as it will put the label names next to wherever you use \label, making it easy to find and cross-reference figures, tables, etc.

When writing twocolumn papers, the default behavior of placing the labels in the margin can make the document output a bit messy, so I’ll use the inline option:

\usepackage[inline]{showlabels}
\renewcommand{\showlabelfont}{\sffamily \color{blue}}

This sometimes leads to label overlapping the underlying text, obscuring the label’s legibility:

an output
paragraph written with LaTeX, showing an overlapping label

After attempting different ways to adjust the margins and spacing of the label to no avail, the best solution I’ve found is to use the efbox package and redefine \showlabelsetlabel:

\usepackage{efbox}
\renewcommand{\showlabelsetlabel}[1]
  {\efbox{\showlabelfont #1}}

The resulting output shows the label much more clearly:

an output
paragraph written with LaTeX, showing a label inside a
framed box for better readability

Although the underlying text is obscured, I can identify and cross-reference labels much more quickly.

The full code to include in your LaTeX:

%%% boxed showlabels %%%%
\usepackage{efbox}

\usepackage[inline]{showlabels}
\renewcommand{\showlabelfont}{\sffamily \color{blue}}
\renewcommand{\showlabelsetlabel}[1]
  {\efbox{\showlabelfont #1}}

Sample LaTeX can also be found in a GitHub gist.