1 % \iffalse meta-comment
5 % The LaTeX3 Project and any individual authors listed elsewhere
8 % This file is part of the Standard LaTeX `Tools Bundle'.
9 % -------------------------------------------------------
11 % It may be distributed and/or modified under the
12 % conditions of the LaTeX Project Public License, either version 1.3c
13 % of this license or (at your option) any later version.
14 % The latest version of this license is in
15 % http://www.latex-project.org/lppl.txt
16 % and version 1.3c or later is part of all distributions of LaTeX
17 % version 2005/12/01 or later.
19 % The list of all files belonging to the LaTeX `Tools Bundle' is
20 % given in the file `manifest.txt'.
24 %% File: showkeys.dtx Copyright (C) 1992-1997 David Carlisle
25 %% File: showkeys.dtx Copyright (C) 2006-2014 David Carlisle, LaTeX3 Project
28 \ProvidesFile{showkeys.dtx}
30 %<package>\NeedsTeXFormat{LaTeX2e}
31 %<package>\ProvidesPackage{showkeys}
32 %<driver> \ProvidesFile{showkeys.drv}
34 % \ProvidesFile{showkeys.dtx}
35 [2014/10/28 v3.17 Show cite and label keys (DPC, MH)]
39 \documentclass{ltxdoc}
41 % [notcite,notref,color]
43 \setlength{\belowcaptionskip}{\baselineskip}
44 \setlength{\abovecaptionskip}{0pt}
46 \DocInput{showkeys.dtx}
51 % \GetFileInfo{showkeys.dtx}
52 % \title{The \textsf{showkeys} package\thanks{This file
53 % has version number \fileversion, last
54 % revised \filedate.}}
55 % \author{David Carlisle \and Morten H\o gholm}
57 % \MaintainedByLaTeXTeam{tools}
60 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 % \changes{v1.01}{1992/08/25}{Initial version}
65 % \changes{v1.02}{1994/01/05}
66 % {Fix incorrect initialisation (FGBDA19@CC1.KULEUVEN.AC.BE)}
67 % \changes{v2.00}{1994/01/31}{new version for LaTeX2e}
68 % \changes{v2.01}{1994/06/30}{Fix \cs{ProvidesPackage} usage.}
69 % \changes{v3.00}{1994/09/07}
70 % {Support harvard, varioref and natbib packages,}
71 % \changes{v3.02}{1995/03/17}
72 % {Support new AMS files}
74 % \section{Introduction}\label{sec:intro}
76 % |showkeys.sty| modifies the |\label|, |\ref|, |\pageref|, |\cite|, and
77 % |\bibitem| commands so that the `internal' key is printed. The package
78 % tries hard to position these labels so that the formatting of the rest
79 % of the document is unchanged. |\label| and |\bibitem| cause the
80 % key to appear in a box either in the margin, or in a \TeX\ box of zero
81 % width, which may possibly over-print other text. The |\ref|,
82 % |\pageref| and |\cite| commands print their arguments in small type,
83 % raised just above the line, like this: \ref{sec:intro}.
84 % This package works with the \textsf{fleqn} option, the packages
85 % in the AMS-\LaTeX\ collection, and the \textsf{varioref},
86 % \textsf{natbib} and \textsf{harvard} packages.
88 % \changes{v2.00}{1992/01/31}
89 % {leqno or ams* may now be loaded after showkeys}
91 % \section{Package Options}\label{options}
92 % Some people have commented that the printing of the |\ref| and
93 % |\cite| keys is less useful than the printing of the |\label| keys
94 % and so \textsf{showkeys} now supports two options that can be given
95 % in the |\usepackage| command:
97 % \item[notref] to stop the redefinition of |\ref| and |\pageref|,
98 % and related commands from the \textsf{varioref} package.
99 % \item[notcite] to stop the redefinition of |\cite| and related
100 % commands from the \textsf{harvard} and \textsf{natbib} packages.
102 % So if the package is loaded with |\usepackage[notref]{showkeys}|
103 % then |\ref| will have its standard definition, but |\label| will
104 % print its key argument (usually in the margin).
106 % If you find the printed keys distracting, but don't want to use the
107 % above options to stop them altogether you may use:
108 % \begin{description}
109 % \item[color] Print the keys in a distinguishing colour. The default
110 % value is a light grey.
112 % The colours may be changed by redefining the following two colours
113 % after the package is loaded.
114 % |refkey| (also used for |\cite|) and
115 % |labelkey| (also used for |\bibitem|).
118 % \definecolor{refkey}{gray}{.75}
119 % \definecolor{labelkey}{gray}{.75}
122 % If this option is used the \textsf{color} package will be loaded.
124 % The package accepts two further options.
125 % \begin{description}
126 % \item[final] to suporess the action of this package, for `final'
128 % \item[draft] the normal behaviour of this package.
130 % Clearly there is not much point in entering the |final| option
131 % directly in the |\usepackage| command, as just not loading this
132 % package would have the same effect, and execute more quickly,
133 % however the |final| option may be useful as it may be used once in
134 % the |documentclass| command to affect any number of packages that
135 % may be loaded. The |draft| option does not do anything, but is there
136 % to honour an informal convention that packages have these options in
139 % You can also control the appearance of the typeset label with the
140 % command |\showkeyslabelformat|, which takes one argument. The default is
142 % \providecommand*\showkeyslabelformat[1]{%
143 % \fbox{\normalfont\small\ttfamily#1}}
145 % The command is called inside a group so you can put in local
146 % modifications of |\fboxsep|, for instance, without them leaking to
147 % the rest of the document.
150 % \section{More Examples}\label{examples}
151 % The only other similar package that I could find in the macro index,
152 % \cite{DMJ:mi}, was |showlabels.sty|, \cite{GN:sl}. After the first
153 % draft of this package was written, I found \cite{anon:sk} on my local
154 % installation! I think the current package is more robust than
155 % \cite{anon:sk}, but I thought that |showkeys| was rather a good name,
156 % so I have stolen it for this file.
159 % \item \label{e^1}This has |\label| immediately after |\item|.
160 % \item This has the |\label| at the end.\label{e^2}
164 % \mbox{A minipage :- }\left\{
165 % \begin{minipage}{3in}
166 % Within environments like this |minipage|, we cannot use
167 % |\marginpar|\footnotemark,
168 % so the appearance is slightly different. Here is that |enumerate|
172 % \item \label{m&e^1}This has |\label| immediately after |\item|.
173 % \item This has the |\label| at the end.\label{m&e^2}
179 % Displayed math (without |equation| counter).
180 % \[0=0\label{disp}\]
182 % Some text referring to the maths on page~\pageref{disp}, and the
183 % item~\ref{e^1}.\footnotetext{Actually \texttt{\string\marginpar} is
184 % not used at all in this package now.}
186 % If |showkeys| thinks that the current environment is going to produce
187 % an ``equation number'', then it does not show the label where the
188 % |\label| command occurs, but tries to put it in the margin, as shown
189 % with equation~\ref{eq:xx}.
190 % The package `knows' about the standard |equation| and |eqnarray|
191 % environments, and also all the numbered alignment environments offered
192 % by the AMS\LaTeX\ package, |amsmath|.
194 % ^^A (|amstex.sty| must be loaded before |showkeys.sty|
195 % ^^A for this to work.)
196 % \changes{v2.00}{1992/01/31}
197 % {leqno or ams* may now be loaded after showkeys}
204 % 2&=&2\label{eqnar:a}\\
206 % 4&=&4\label{eqnar:b}
211 % Within a |figure| environment, the |\label| must not come before the
212 % |\caption| command. If you place |\label| inside the argument of
213 % |\caption| the label will be shown like this:
215 % \caption{Within the caption argument.\label{cap:a}}
217 % If you place |\label| immediately after the |\caption| command it will
218 % be shown like this:
220 % \caption{Immediately after the caption argument.}\label{cap:b}
222 % If you place the |\label| command at some random point after the
223 % |\caption| command, it may be shown like:
225 % \caption{In vertical mode not immediately after a box.}
232 % \begin{thebibliography}{9}
235 % Gil Neiger, \emph{showlabels.sty},
236 % Undated package, similar to this one, but shows labels
237 % inline, affecting the formatting of the document.
240 % Anonymous, \emph{showkeys.sty},
241 % Package, dated 14 May 1988. Very similar to this one,
242 % also uses |\marginpar| in outer vertical mode.
245 % David M. Jones, \emph{\TeX\ Macro Index},
246 % A catalogue of \TeX\ macros, including \LaTeX\ packages,
247 % available from all good \TeX\ archives.
249 % \end{thebibliography}
253 % \section{The Macros}
260 % First we handle the options. Normally all related commands are
261 % defined to show their `keys'. But since v3.03 one can specify:
263 % \texttt{notref} to stop the redefinition of |\ref| (and |\pageref|,
264 % and related commands from \textsf{varioref} package),
266 % \texttt{notcite} to stop the redefinition of |\cite| and related
267 % commands from the \textsf{harvard} and \textsf{natbib} packages.
269 % \changes{v3.03}{1995/04/25}
270 % {Add option handling.}
272 \DeclareOption{notref}{\let\SK@ref\@empty}
273 \DeclareOption{notcite}{\let\SK@cite\@empty}
276 % \begin{macro}{\SK@refcolor}
277 % \begin{macro}{\SK@labelcolor}
278 % Colour commands. Normally no-op.
280 \let\SK@refcolor\relax
281 \let\SK@labelcolor\relax
286 % \changes{v3.11}{1996/11/01}
287 % {Colour support added, inspired by tools/2297}
288 % |color| option loads the \textsf{color} package and defines the
289 % colours. Delayed to the end of the package as package loading not
290 % allowed in this option section.
292 \DeclareOption{color}{\AtEndOfPackage{%
293 \RequirePackage{color}%
294 \definecolor{refkey}{gray}{.75}%
295 \definecolor{labelkey}{gray}{.75}%
296 \def\SK@refcolor{\color{refkey}}%
297 \def\SK@labelcolor{\color{labelkey}}}}
300 % \changes{v3.04}{1995/10/30}
301 % {final and draft options handling.}
302 % \changes{v3.15}{2007/08/07}
303 % {Fix \cs{showkeyslabelformat} for final option PR/3918.}
304 % Allow |final| to be specified in the document class options
305 % to suppress the loading of this package.
307 \DeclareOption{final}{%
308 \providecommand*\showkeyslabelformat[1]{}%
310 \DeclareOption{draft}{}
317 % \changes{v2.00}{1992/01/31}
318 % {\cmd{reset@font} is now standard}
320 % \begin{macro}{\SK@label}
321 % \begin{macro}{\SK@bibitem}
322 % \begin{macro}{\SK@lbibitem}
323 % The saved original definitions
326 \let\SK@bibitem\@bibitem
327 \let\SK@lbibitem\@lbibitem
334 % \begin{macro}{\label}
335 % \changes{v3.09}{1996/08/30}
336 % {Add extra group so brace hack works. Donald Arseneau tools/2147}
337 % The new definition, print the argument, and then do the old
350 % \begin{macro}{\@bibitem}
351 % \begin{macro}{\@lbibitem}
352 % \changes{v3.02}{1995/03/17}
354 % For |\bibitem|, position the \textsf{showkeys} code as for a standard
355 % list with |\item| and |\label|.
358 \SK@bibitem{#1}\SK@\SK@@label{#1}\ignorespaces}
362 \def\@lbibitem[#1]#2{%
363 \SK@lbibitem[{#1}]{#2}\SK@\SK@@label{#2}\ignorespaces}
368 % \begin{macro}{\SK@}
369 % \changes{v3.07}{1996/05/17}
370 % {use \cs{protected@edef} for tools/2147}
371 % Grab hold of |#2| via |\meaning| so characters like |&| and
372 % |^| do not cause problems later, and pass the result on to the command
376 \protected@edef\@tempa{#2}%
377 \expandafter#1\meaning\@tempa\SK@}
383 % \begin{macro}{\showkeyslabelformat}
384 % \changes{v3.13}{2006/01/09}{Added command}
386 \providecommand*\showkeyslabelformat[1]{%
387 \fbox{\normalfont\small\ttfamily#1}}
390 % \begin{macro}{\SK@@label}
391 % \changes{v3.13}{2006/01/09}{Do not hardwire label format}
392 % Strip off the initial segment of the |\meaning| output, and then put
393 % the rest either in a |\marginpar| or in a box of size 0pt,
394 % hopefully not disturbing the surrounding text.
396 \def\SK@@label#1>#2\SK@{%
398 % Need to work globally as in some cases like alignments, and |fleqn|,
399 % the counter will be printed in a different group to the |\label|
402 \gdef\SK@lab{\smash{\SK@labelcolor\showkeyslabelformat{#2}}}%
406 % \changes{v3.02}{1995/03/17}
407 % {New code for `in label' case.}
408 % If the |\label| is straight after |\item| (|\bibitem| is handled by
409 % this case as well) then the item label has not been added to the page
410 % yet. It is hanging around in the box |\@labels| waiting for the
411 % paragraph to start. So just need to attach the label to this box.
413 \global\setbox\@labels\hbox{%
414 \llap{\SK@lab\SK@lab@relax
415 \kern\@totalleftmargin\kern\marginparsep}%
422 % \changes{v3.10}{1996/09/06}
423 % {Save prevdepth and restore later}
424 % If we insert a box into the main vertical list, do not want to
425 % change |\prevdepth| as that would affect vertical spacing in the
426 % document. (The box itself should not cause any difference in break
427 % points as there is a node there anyway coming from the |\write| to
433 % The inner vertical mode cases are mainly designed to do the right
434 % thing with float captions, but seem to work OK in other cases as well.
437 \skip@\lastskip\unskip
439 % In inner vertical mode, attach the label to the right of the
440 % immediately preceding box, if it is a box before the current point.
441 % Otherwise just put it in a box of zero dimensions, with no interline
442 % skip. (This may slightly move the surrounding text (but perhaps not
443 % now that |\prevdepth| is restored.)
444 % \changes{v3.00}{1994/09/07}
445 % {Back up over a previous skip because of the new
446 % \cs{belowcaptionskip}}
447 % \changes{v3.04}{1995/10/30}
448 % {\cs{advance} added, to total two successive skips.}
449 % \changes{v3.04}{1995/10/30}
450 % {\cs{nointerlineskip} called before \cs{ifvoid} test, not just
452 % \changes{v3.04}{1995/10/30}
453 % {\cs{marginparskip} added in inner vmode case}
455 \advance\skip@\lastskip\unskip
458 % \changes{v3.10}{1996/09/06}
459 % {Inner vertical mode case, put it in the margin.}
460 % \changes{v3.14}{2006/09/25}
461 % {The label put in the margin shouldn't make box 255 wider (PR/3884).}
464 \llap{\SK@lab\SK@lab@relax\kern\marginparsep}%
466 \hbox{\box\z@\rlap{\kern\marginparsep\SK@labx}}%
471 % In outer vertical mode, previously used a |\vadjust| at the start of
472 % the next paragraph (and before that used |\marginpar|). These
473 % methods sometimes cause extra space, eg if paragraph starts with a
474 % math display, so now just insert the box directly, taking care not
475 % to change |\prevdepth|.
476 % \changes{v3.02}{1995/03/17}
477 % {Use \cs{vadjust} instead of \cs{marginpar}}
478 % \changes{v3.10}{1996/09/06}
479 % {Insert the box directly}
481 \llap{\SK@lab\SK@lab@relax\kern\marginparsep}%
484 % Restore |\prevdepth|.
493 % If we are in an numbered equation-style environment, do nothing as the
494 % code to print the number will also print the label, otherwise just
495 % stick the label at the current point, in a box of zero dimensions.
496 % \changes{v3.02}{1995/03/17}
497 % {Add \cs{ifmmode} test}
499 \csname SK@\@currenvir\endcsname
505 % Inner horizontal mode. Not much we can do, just stick it here.
506 % \changes{v3.03}{1995/04/25}
507 % {Fix inner horizontal mode case (broken in 3.02)}
513 % In outer horizontal mode use |\vadjust| to get to the margin.
514 % \changes{v3.02}{1995/03/17}
515 % {Use \cs{vadjust} in horizontal mode}
517 \vadjust{\llap{\SK@lab\kern\marginparsep}}%
526 % \begin{macro}{\tagform@}
527 % \changes{v2.00}{1992/01/31}
528 % {Defer tests to begin document}
529 % \changes{v3.02}{1995/03/17}
530 % {Support new AMS files}
531 % \begin{macro}{\@eqnnum}
532 % \changes{v3.13}{2006/01/09}
533 % {Change to also work correctly for \texttt{leqno} option.}
534 % \begin{macro}{\maketag@@@}
535 % \changes{v3.13}{2006/01/09}
536 % {Support for \cs{tag*} tools/3693.}
537 % Firstly we grab |\@eqnnum|.
540 \let\SK@eqnnum\@eqnnum
542 % Then check for \textsf{amsmath} where we grab the internal commands
543 % |\tagform@| and |\maketag@@@|. Redefine them and redefine |\@eqnnum|
546 \@ifpackageloaded{amsmath}{%
547 \let\SK@tagform@\tagform@
548 \let\SK@maketag@@@\maketag@@@
554 \expandafter\SK@@label\meaning\df@label\SK@
556 \llap{\SK@lab\kern\marginparsep}%
557 \SK@lab@relax\SK@tagform@{#1}}%
562 \expandafter\SK@@label\meaning\df@label\SK@
564 \llap{\SK@lab\kern\marginparsep}\SK@lab@relax
568 \llap{\SK@lab\kern\displaywidth\kern\marginparsep}%
569 \SK@lab@relax\SK@eqnnum}%
572 % Almost the same for tags on the right, except we use |\rlap| and
573 % typeset it after the tag.
579 \expandafter\SK@@label\meaning\df@label\SK@
582 % \changes{v3.08}{1996/07/10}{Missing percent added. /2215}
585 \rlap{\kern\marginparsep\SK@lab}\SK@lab@relax}%
590 \expandafter\SK@@label\meaning\df@label\SK@
593 \rlap{\kern\marginparsep\SK@lab}\SK@lab@relax
595 \def\@eqnnum{\SK@eqnnum\rlap{\kern\marginparsep\SK@lab}%
600 % If \textsf{amsmath} wasn't loaded we check explicitly if the
601 % \texttt{leqno} option was used in |\documentclass| and redefine
605 \@ifundefined{ver@leqno.clo}{%
606 \def\@eqnnum{\SK@eqnnum\rlap{\kern\marginparsep\SK@lab}%
610 \llap{\SK@lab\kern\displaywidth\kern\marginparsep}%
611 \SK@lab@relax\SK@eqnnum}%
620 % \begin{macro}{\SK@labx}
621 % Print the label, and then globally reset the print command to
624 \def\SK@labx{\rlap\SK@lab\global\let\SK@lab\relax}
628 % \begin{macro}{\SK@lab@relax}
630 % \changes{v1.02}{1994/01/05}{Execute to initialise correctly}
632 \def\SK@lab@relax{\global\let\SK@lab\relax}\SK@lab@relax
636 % \begin{macro}{\SK@equation}
637 % \begin{macro}{\SK@eqnarray}
638 % The following environments print an equation number, so |\label|
639 % should not print its argument at the point where it appears.
640 % Note this will fail to show the label if you are in an |eqnarray|
641 % environment, and use |\label| together with |\nonumber| This might
642 % just about make sense if you are going to use |\pageref|, but that is
646 \let\SK@equation\SK@equationtrue
647 \let\SK@eqnarray\SK@equationtrue
652 % \begin{macro}{\eqnarray}
653 % \changes{v3.09}{1996/08/30}
654 % {Fix eqnarray AMS incompatibility. tools/2252}
655 % When the AMS packages are loaded |showkeys| assumes environments
656 % work `The AMS way' However |eqnarray| (unlike |equation|) is not
657 % redefined, so here we need to remove some of the AMS hacks.
659 \toks@\expandafter{\eqnarray}
660 \edef\eqnarray{\let\noexpand\tagform@\noexpand\SK@tagform@\the\toks@}
664 % \begin{macro}{\SK@align}
665 % \begin{macro}{\SK@alignat}
666 % \begin{macro}{\SK@xalignat}
667 % \begin{macro}{\SK@xxalignat}
668 % \begin{macro}{\SK@gather}
669 % \begin{macro}{\SK@multline}
670 % \begin{macro}{\SK@flalign}
671 % \changes{v3.02}{1995/03/17}
672 % {Add \cs{SK@flalign}}
673 % The AMS environments
675 \let\SK@align\SK@equationtrue
676 \let\SK@alignat\SK@equationtrue
677 \let\SK@xalignat\SK@equationtrue
678 \let\SK@xxalignat\SK@equationtrue
679 \let\SK@gather\SK@equationtrue
680 \let\SK@multline\SK@equationtrue
681 \let\SK@flalign\SK@equationtrue
691 % \begin{macro}{\SK@align*}
692 % \begin{macro}{\SK@alignat*}
693 % \begin{macro}{\SK@flalign*}
694 % \begin{macro}{\SK@gather*}
695 % \begin{macro}{\SK@multline*}
696 % \begin{macro}{\SK@equation*}
697 % \changes{v3.13}{2006/01/09}
698 % {Add the starred AMS environments for tools/3697.}
699 % Starred versions of the AMS environments.
701 \expandafter\let\csname SK@align*\endcsname\SK@equationtrue
702 \expandafter\let\csname SK@alignat*\endcsname\SK@equationtrue
703 \expandafter\let\csname SK@flalign*\endcsname\SK@equationtrue
704 \expandafter\let\csname SK@gather*\endcsname\SK@equationtrue
705 \expandafter\let\csname SK@multline*\endcsname\SK@equationtrue
706 \expandafter\let\csname SK@equation*\endcsname\SK@equationtrue
715 % \begin{macro}{\SK@def}
716 % \changes{v3.05}{1995/11/09}
718 % This macro redefines a command |#1|. The new definition can make use
719 % of the old definition as |\SK@|\emph{old name}. If |#1| is really a
720 % |\protect|'ed command with the real definition in a `\emph{space}'
721 % command then the `space' version is used as the old definition.
722 % Need to test this for each command as some package may have changed
723 % the status of a command to being `protected'.
724 % The new definition is made as if with |\DeclareRobustCommand|, but
725 % with |\def| syntax for the argument specification.
728 \edef\@tempa{\expandafter\@gobble\string#1}%
729 \@ifundefined{\@tempa\space}%
730 {\expandafter\let\csname SK@\@tempa\endcsname#1}%
731 {\expandafter\let\csname SK@\@tempa\expandafter\endcsname
732 \csname\@tempa\space\endcsname}%
733 \expandafter\def\expandafter#1\expandafter{%
734 \expandafter\protect\csname\@tempa\space\endcsname}%
735 \expandafter\def\csname\@tempa\space\endcsname}
739 % The next section redefines |\ref| and |\pageref| (unless the
740 % \texttt{notref} option was given).
744 % Even if \texttt{notref} option is used, need to fudge the
745 % \textsf{varioref} commands as they use |\label| internally.
746 % \changes{v3.04}{1995/10/30}
747 % {improve varioref support in notref option case, for
749 % \changes{v3.13}{2006/01/09}{Updated varioref support, for latex/3373}
750 % \changes{v3.15}{2006/06/19}
751 % {Prevent loss of brackets}
754 \@ifpackageloaded{varioref}{%
755 \SK@def\@@vpageref#1[#2]#3{{%
757 \SK@@@vpageref{#1}[{#2}]{#3}}}%
759 \leavevmode\unskip\vref@space
762 \vpageref[\unskip]{#1}}}%
767 % \begin{macro}{\ref}
768 % \begin{macro}{\pageref}
769 % Save the redefinition to |\begin{document}| so that this package can
770 % work with packages that redefine |\cite|. Tested with harvard and
771 % natbib packages. Also add code at this point to support varioref.
772 % \changes{v3.00}{1994/09/07}
773 % {Delay \cs{ref} redefinition.}
774 % \changes{v3.03}{1995/04/25}
775 % {Make redefinition conditional on notref option}
776 % \changes{v3.15}{2006/06/19}
777 % {Prevent loss of brackets}
780 \SK@def\ref#1{\SK@\SK@@ref{#1}\SK@ref{#1}}%
781 \SK@def\pageref#1{\SK@\SK@@ref{#1}\SK@pageref{#1}}%
785 \@ifpackageloaded{varioref}{%
786 \SK@def\@@vpageref#1[#2]#3{{%
787 \let\label\SK@label\let\ref\SK@ref\let\pageref\SK@pageref
788 \leavevmode\unskip\SK@\SK@@ref{#3}\SK@@@vpageref{#1}[{#2}]{#3}}}%
790 \leavevmode\unskip\vref@space
792 \let\label\SK@label\let\ref\SK@ref\let\pageref\SK@pageref
793 \vpageref[\unskip]{#1}}%
803 % Now redefine |\cite| unless \texttt{notcite} option given.
807 % \changes{v3.06}{1995/11/22}
808 % {Fix \cs{harvarditem} support}
811 \ifx\HAR@checkdef\@undefined\else
812 \expandafter\let\expandafter
813 \SK@HAR@bi\csname\string\harvarditem\endcsname
814 \expandafter\def\csname\string\harvarditem\endcsname[#1]#2#3#4{%
815 \SK@HAR@bi[{#1}]{#2}{#3}{#4}\SK@\SK@@label{#4}}%
820 % \begin{macro}{\cite}
821 % \changes{v3.00}{1994/09/07}
822 % {Delay \cs{cite} redefinition.}
823 % \changes{v3.03}{1995/04/25}
824 % {Make redefinition conditional on notcite option}
827 \ifx\HAR@checkdef\@undefined
829 % Standard (non-harvard) support, including extra cite commands from
830 % \textsf{natbib} and \textsf{cite}.
831 % \changes{v3.01}{1994/09/09}
832 % {Add \cs{citefullauthor}}
833 % \changes{v3.12}{1997/06/12}
834 % {Support cite package. tools/2490}
835 % \changes{v3.17}{2014/04/24}
836 % {redefine \cs{@citex} rather than \cs{cite} for tools/4162}
838 % If \textsf{cite} or \textsf{overcite} is being used, redefine |\citen|
839 % rather than |\cite| so as not to spoil the space and punctuation
840 % calculations done by those packages.
842 \ifx\citen\@undefined
843 \SK@def\@citex[#1]#2{\SK@citex[{#1}]{#2}}%
845 \SK@def\citen#1{\SK@\SK@@ref{#1}\SK@citen{#1}}%
847 \SK@def\citeauthor#1{\SK@\SK@@ref{#1}\SK@citeauthor{#1}}%
848 \SK@def\citefullauthor#1{\SK@\SK@@ref{#1}\SK@citefullauthor{#1}}%
849 \SK@def\citeyear#1{\SK@\SK@@ref{#1}\SK@citeyear{#1}}%
852 % In the \textsf{harvard} style do \emph{not} redefine individual cite
853 % commands. Just redefine one internal command that is used in all the
856 \SK@def\HAR@checkdef#1#2{%
857 \expandafter\SK@\expandafter\SK@@ref\expandafter{#1}%
858 \SK@HAR@checkdef{#1}{#2}}%
859 \expandafter\let\expandafter
860 \SK@HAR@bi\csname\string\harvarditem\endcsname
862 % \changes{v3.06}{1995/11/22}
863 % {Fix \cs{harvarditem} support}
865 \expandafter\def\csname\string\harvarditem\endcsname[#1]#2#3#4{%
866 \SK@HAR@bi[{#1}]{#2}{#3}{#4}\SK@\SK@@label{#4}}%
870 % \changes{v3.17}{2014/04/24}
871 % {Change name, redefine \cs{@citex} rather than \cs{cite} for tools/4162}
873 \def\SK@citex[#1]#2{%
874 \SK@\SK@@ref{#2}\SK@@citex[{#1}]{#2}}
882 % \begin{macro}{\SK@@ref}
883 % This is much simpler than the printing of the label, as we know
884 % that we can be in horizontal mode.
885 % Note extra group for colour safety.
886 % \changes{v3.14}{2006/09/25}
887 % {Add fix for pdf\TeX.}
888 % \changes{v3.16}{2011/11/24}
889 % {revert change made at v3.14 because of tools/4173}
891 \def\SK@@ref#1>#2\SK@{%
892 \leavevmode\vbox to\z@{{%
895 \rlap{\vrule\raise .75em%
896 \hbox{\underbar{\normalfont\footnotesize\ttfamily#2}}}}}}