12

I'd like to use showkeys to show me the labels of my definitions (this works) and the labels of the used references (this does not work). The reason for the latter problem is that I use the cleveref package, i.e. \Cref{thm:something} instead of \ref{thm:something}. Changing all \Cref to \ref helps, but I'd like to stick to \Cref.

\documentclass[12pt,a4paper]{scrbook}
\usepackage[]{showkeys}
\usepackage{cleveref}
\begin{document}
\chapter{A}
\label{cha:A}
\chapter{B}
In \Cref{cha:A} something was done.
In \ref{cha:A} something was done.
\end{document}

1 Answer 1

10

showkeys defines \SK@def to hook itself on to other commands, I think you want

\makeatletter
  \SK@def\Cref#1{\SK@\SK@@ref{#1}\SK@Cref{#1}}%
\makeatother

in the preamble after loading both packages.

enter image description here

2
  • Seems not to work for \cref{A,B}
    – user4514
    Commented Apr 1, 2014 at 0:15
  • 1
    @user4514 I just tried the analogous definition for cref and it worked for me: \SK@def\cref#1{\SK@\SK@@ref{#1}\SK@cref{#1}}% Commented Apr 1, 2014 at 0:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .