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}
9

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

  • Seems not to work for \cref{A,B} – user4514 Apr 1 '14 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}}% – David Carlisle Apr 1 '14 at 0:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.