summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tools/showkeys.sty
blob: d9ab40914c203a8aa170e24f93ac8fc5352634e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
%%
%% 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 http://latex-project.org/bugs.html
%% (but please observe conditions on bug reports sent to that address!)
%% 
%% 
%% Copyright 1993-2015
%% The LaTeX3 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
%%    http://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-2014 David Carlisle, LaTeX3 Project
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{showkeys}
          [2014/10/28 v3.17 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
\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}%
        \box\@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
\AtBeginDocument{%
  \@ifpackageloaded{varioref}{%
    \SK@def\@@vpageref#1[#2]#3{{%
      \let\label\SK@label
      \SK@@@vpageref{#1}[{#2}]{#3}}}%
    \def\vr@f#1{%
      \leavevmode\unskip\vref@space
      \ref{#1}%
      {\let\label\SK@label
      \vpageref[\unskip]{#1}}}%
  }{}}
\else
\AtBeginDocument{%
  \SK@def\ref#1{\SK@\SK@@ref{#1}\SK@ref{#1}}%
  \SK@def\pageref#1{\SK@\SK@@ref{#1}\SK@pageref{#1}}%
  \@ifpackageloaded{varioref}{%
    \SK@def\@@vpageref#1[#2]#3{{%
      \let\label\SK@label\let\ref\SK@ref\let\pageref\SK@pageref
      \leavevmode\unskip\SK@\SK@@ref{#3}\SK@@@vpageref{#1}[{#2}]{#3}}}%
    \def\vr@f#1{%
      \leavevmode\unskip\vref@space
      \ref{#1}%
      \let\label\SK@label\let\ref\SK@ref\let\pageref\SK@pageref
      \vpageref[\unskip]{#1}}%
  }{}}
\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'.