%%
%% This is file `showkeys.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% showkeys.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% The source is maintained by the LaTeX Project team and bug
%% reports for it can be opened at https://latex-project.org/bugs/
%% (but please observe conditions on bug reports sent to that address!)
%% 
%% 
%% Copyright (C) 1993-2025
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%% 
%% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
%% --------------------------------------------------------------------------
%% 
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%    https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%% This file may only be distributed together with a copy of the LaTeX
%% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
%% without such generated files.
%% 
%% The list of all files belonging to the LaTeX `Tools Bundle' is
%% given in the file `manifest.txt'.
%% 
%% File: showkeys.dtx Copyright (C) 1992-1997 David Carlisle
%% File: showkeys.dtx Copyright (C) 2006-2025 David Carlisle, LaTeX Project
\NeedsTeXFormat{LaTeX2e}

\DeclareRelease{}{1994-06-01}{showkeys-2014-10-28.sty}
\DeclareRelease{}{2014-10-28}{showkeys-2014-10-28.sty}
\DeclareCurrentRelease{}{2022-06-01}

\ProvidesPackage{showkeys}
          [2024/05/23 v3.21 Show cite and label keys (DPC, MH)]
\DeclareOption{notref}{\let\SK@ref\@empty}
\DeclareOption{notcite}{\let\SK@cite\@empty}
\let\SK@refcolor\relax
\let\SK@labelcolor\relax
\DeclareOption{color}{\AtEndOfPackage{%
  \RequirePackage{color}%
  \definecolor{refkey}{gray}{.75}%
  \definecolor{labelkey}{gray}{.75}%
  \def\SK@refcolor{\color{refkey}}%
  \def\SK@labelcolor{\color{labelkey}}}}
\DeclareOption{final}{%
  \providecommand*\showkeyslabelformat[1]{}%
  \endinput}
\DeclareOption{draft}{}
\ProcessOptions
\let\SK@label\label
\let\SK@bibitem\@bibitem
\let\SK@lbibitem\@lbibitem
\@ifl@t@r\fmtversion{2023-06-01}
 {\AddToHookWithArguments{label}{\SK@\SK@@label{#1}}}
 {\def\label#1{%
  \@bsphack
  \SK@\SK@@label{#1}%
  \begingroup
    \SK@label{#1}%
  \endgroup
  \@esphack}}
\def\@bibitem#1{%
  \SK@bibitem{#1}\SK@\SK@@label{#1}\ignorespaces}
\def\@lbibitem[#1]#2{%
  \SK@lbibitem[{#1}]{#2}\SK@\SK@@label{#2}\ignorespaces}
\def\SK@#1#2{%
  \protected@edef\@tempa{#2}%
  \expandafter#1\meaning\@tempa\SK@}
\providecommand*\showkeyslabelformat[1]{%
  \fbox{\normalfont\small\ttfamily#1}}
\def\SK@@label#1>#2\SK@{%
  \gdef\SK@lab{\smash{\SK@labelcolor\showkeyslabelformat{#2}}}%
  \ifvmode
    \if@inlabel
      \global\setbox\@labels\hbox{%
        \llap{\SK@lab\SK@lab@relax
              \kern\@totalleftmargin\kern\marginparsep}%
        \unhbox\@labels}%
    \else
      \dimen@\prevdepth
      \nointerlineskip
      \ifinner
        \skip@\lastskip\unskip
        \advance\skip@\lastskip\unskip
        \setbox\z@\lastbox
        \ifvoid\z@
          \llap{\SK@lab\SK@lab@relax\kern\marginparsep}%
        \else
          \hbox{\box\z@\rlap{\kern\marginparsep\SK@labx}}%
        \fi
        \vskip\skip@
      \else
        \llap{\SK@lab\SK@lab@relax\kern\marginparsep}%
      \fi
      \prevdepth\dimen@
    \fi
  \else
    \csname SK@\@currenvir\endcsname
    \ifSK@equation\else
      \ifmmode
        \SK@labx
      \else
        \ifinner
          \rlap\SK@lab
      \else
          \vadjust{\llap{\SK@lab\kern\marginparsep}}%
        \fi
        \SK@lab@relax
      \fi
    \fi
  \fi}
\AtBeginDocument{%
  \let\SK@eqnnum\@eqnnum
  \@ifpackageloaded{amsmath}{%
    \let\SK@tagform@\tagform@
    \let\SK@maketag@@@\maketag@@@
    \iftagsleft@
      \def\tagform@#1{%
        \ifx\df@label\@empty
          \SK@lab@relax
        \else
          \expandafter\SK@@label\meaning\df@label\SK@
        \fi
        \llap{\SK@lab\kern\marginparsep}%
        \SK@lab@relax\SK@tagform@{#1}}%
      \def\maketag@@@#1{%
        \ifx\df@label\@empty
          \SK@lab@relax
        \else
          \expandafter\SK@@label\meaning\df@label\SK@
        \fi
        \llap{\SK@lab\kern\marginparsep}\SK@lab@relax
        \SK@maketag@@@{#1}%
      }%
      \def\@eqnnum{%
        \llap{\SK@lab\kern\displaywidth\kern\marginparsep}%
        \SK@lab@relax\SK@eqnnum}%
    \else
      \def\tagform@#1{%
        \ifx\df@label\@empty
          \SK@lab@relax
        \else
          \expandafter\SK@@label\meaning\df@label\SK@
        \fi
        \SK@tagform@{#1}%
        \rlap{\kern\marginparsep\SK@lab}\SK@lab@relax}%
      \def\maketag@@@#1{%
        \ifx\df@label\@empty
          \SK@lab@relax
        \else
          \expandafter\SK@@label\meaning\df@label\SK@
        \fi
        \SK@maketag@@@{#1}%
        \rlap{\kern\marginparsep\SK@lab}\SK@lab@relax
      }%
      \def\@eqnnum{\SK@eqnnum\rlap{\kern\marginparsep\SK@lab}%
        \SK@lab@relax}%
    \fi
  }%
  {%
    \@ifundefined{ver@leqno.clo}{%
      \def\@eqnnum{\SK@eqnnum\rlap{\kern\marginparsep\SK@lab}%
        \SK@lab@relax}%
    }{%
      \def\@eqnnum{%
        \llap{\SK@lab\kern\displaywidth\kern\marginparsep}%
        \SK@lab@relax\SK@eqnnum}%
    }%
  }%
}
\def\SK@labx{\rlap\SK@lab\global\let\SK@lab\relax}
\def\SK@lab@relax{\global\let\SK@lab\relax}\SK@lab@relax
\newif\ifSK@equation
\let\SK@equation\SK@equationtrue
\let\SK@eqnarray\SK@equationtrue
\toks@\expandafter{\eqnarray}
\edef\eqnarray{\let\noexpand\tagform@\noexpand\SK@tagform@\the\toks@}
\let\SK@align\SK@equationtrue
\let\SK@alignat\SK@equationtrue
\let\SK@xalignat\SK@equationtrue
\let\SK@xxalignat\SK@equationtrue
\let\SK@gather\SK@equationtrue
\let\SK@multline\SK@equationtrue
\let\SK@flalign\SK@equationtrue
\expandafter\let\csname SK@align*\endcsname\SK@equationtrue
\expandafter\let\csname SK@alignat*\endcsname\SK@equationtrue
\expandafter\let\csname SK@flalign*\endcsname\SK@equationtrue
\expandafter\let\csname SK@gather*\endcsname\SK@equationtrue
\expandafter\let\csname SK@multline*\endcsname\SK@equationtrue
\expandafter\let\csname SK@equation*\endcsname\SK@equationtrue
\def\SK@def#1{%
  \edef\@tempa{\expandafter\@gobble\string#1}%
  \@ifundefined{\@tempa\space}%
    {\expandafter\let\csname SK@\@tempa\endcsname#1}%
    {\expandafter\let\csname SK@\@tempa\expandafter\endcsname
                         \csname\@tempa\space\endcsname}%
  \expandafter\def\expandafter#1\expandafter{%
        \expandafter\protect\csname\@tempa\space\endcsname}%
  \expandafter\def\csname\@tempa\space\endcsname}
\ifx\SK@ref\@empty
\else
\AtBeginDocument{%
  \let\@kernel@ref@\@kernel@ref
  \let\@kernel@sref@\@kernel@sref
  \SK@def\@kernel@ref#1{\SK@\SK@@ref{#1}\SK@@kernel@ref{#1}}%
  \SK@def\@kernel@sref#1{\SK@\SK@@ref{#1}\SK@@kernel@sref{#1}}%
  \SK@def\@kernel@pageref#1{\SK@\SK@@ref{#1}\SK@@kernel@pageref{#1}}%
  \SK@def\@kernel@spageref#1{\SK@\SK@@ref{#1}\SK@@kernel@spageref{#1}}%
  \SK@def\@kernel@Ref#1{{\let\@kernel@ref\@kernel@ref@\SK@\SK@@ref{#1}\SK@@kernel@Ref{#1}}}%
  \SK@def\@kernel@sRef#1{\let\@kernel@sref\@kernel@sref@\SK@\SK@@ref{#1}\SK@@kernel@sRef{#1}}%
  \@ifpackageloaded{varioref}{%
    \SK@def\@@vpageref#1[#2]#3{{%
      \leavevmode\unskip\SK@\SK@@ref{#3}\SK@@@vpageref{#1}[{#2}]{#3}}}%%
  }{}}
\fi
\ifx\SK@cite\@empty
\AtBeginDocument{%
  \ifx\HAR@checkdef\@undefined\else
      \expandafter\let\expandafter
         \SK@HAR@bi\csname\string\harvarditem\endcsname
      \expandafter\def\csname\string\harvarditem\endcsname[#1]#2#3#4{%
        \SK@HAR@bi[{#1}]{#2}{#3}{#4}\SK@\SK@@label{#4}}%
  \fi}
\else
\AtBeginDocument{%
  \ifx\HAR@checkdef\@undefined
    \ifx\citen\@undefined
      \SK@def\@citex[#1]#2{\SK@citex[{#1}]{#2}}%
    \else
      \SK@def\citen#1{\SK@\SK@@ref{#1}\SK@citen{#1}}%
    \fi
    \SK@def\citeauthor#1{\SK@\SK@@ref{#1}\SK@citeauthor{#1}}%
    \SK@def\citefullauthor#1{\SK@\SK@@ref{#1}\SK@citefullauthor{#1}}%
    \SK@def\citeyear#1{\SK@\SK@@ref{#1}\SK@citeyear{#1}}%
  \else
    \SK@def\HAR@checkdef#1#2{%
      \expandafter\SK@\expandafter\SK@@ref\expandafter{#1}%
      \SK@HAR@checkdef{#1}{#2}}%
      \expandafter\let\expandafter
         \SK@HAR@bi\csname\string\harvarditem\endcsname
      \expandafter\def\csname\string\harvarditem\endcsname[#1]#2#3#4{%
        \SK@HAR@bi[{#1}]{#2}{#3}{#4}\SK@\SK@@label{#4}}%
  \fi}
\def\SK@citex[#1]#2{%
  \SK@\SK@@ref{#2}\SK@@citex[{#1}]{#2}}
\fi
\def\SK@@ref#1>#2\SK@{%
  \leavevmode\vbox to\z@{{%
    \vss
    \SK@refcolor
    \rlap{\vrule\raise .75em%
       \hbox{\underbar{\normalfont\footnotesize\ttfamily#2}}}}}}
\endinput
%%
%% End of file `showkeys.sty'.
