Debian Codegraph @

texmf-dist/tex/latex/cite/drftcite.sty

raw
1 % D R F T C I T E . S T Y
2 %
3 % version 3.5 (Jan 1995)
4 %
5 % Print the tags instead of the numbers for \cite.
6 % See also CITE.STY and OVERCITE.STY.
7 %
8 % Copyright (C) 1989,1991-1995 by Donald Arseneau
9 % These macros may be freely transmitted, reproduced, or modified
10 % provided that this notice is left intact.
11 %
12 % Instructions are below, after \endinput.
13 % ........................
14 %
15 % Handle formatting hooks:
16 % \citeform,\citeleft,\citeright,\citemid,\citepunct
17 %
18 % Set defaults:
19
20 % [ on the left.
21 \@ifundefined{citeleft}{\let\citeleft=[}{}
22
23 % ] on the right:
24 \@ifundefined{citeright}{\let\citeright=]}{}
25
26 % , (comma space) before note
27 \@ifundefined{citemid}{\def\citemid{,\penalty\@lowpenalty\ }}{}
28
29 % , (comma space) between entries
30 \@ifundefined{citepunct}{
31 % Default: To put space after the comma. [nospace] eliminates the space
32 \def\citepunct{,\penalty\@lowpenalty\ }%
33 }{}
34
35 % Each citation tag left as-is:
36 \@ifundefined{citeform}{\def\citeform{}}{}
37
38 % Do not repeat warnings. [verbose] reverses
39 \let\oc@verbo\relax
40
41 % \citen gives the citation tag in the text and writes the aux file entry.
42 % Use \citen to give citation name without the other formatting; e.g.,
43 % "See also ref.~\citen{junk}" gives "See also ref. junk".
44 %
45 \edef\citen{\noexpand\protect \expandafter\noexpand\csname citen \endcsname}
46
47 \@namedef{citen }#1{%
48 \edef\@tempa{\@ignspaftercomma,#1, \@end, }% ignore spaces in parameter list.
49 \edef\@tempa{\expandafter\@ignendcommas\@tempa\@end}%
50 \if@filesw \immediate\write \@auxout {\string\citation {\@tempa}}\fi
51 \def\@citea{}%
52 \@for \@citeb:=\@tempa\do {\@citea
53 \@ifundefined {b@\@citeb\@extra@b@citeb}%
54 {{\bf \@citeverb{\@citeb}?}%% issue warning only for first mis-use:
55 \@dftc@ifund {DCN@\@citeb\@extra@b@citeb}{% delete to warn always
56 \@warning {Citation `\@citeb' on page \thepage\space undefined}%
57 }{}% delete to warn always
58 }% else, defined
59 {\@dftc@hbox{\@citeverb{\@citeb}}}%
60 \let\@citea\citepunct\@advancecitecount
61 }}
62
63 % for ignoring spaces in the input:
64 \def\@ignspaftercomma#1, {\ifx\@end#1\@empty\else
65 #1,\expandafter\@ignspaftercomma\fi}
66 \def\@ignendcommas,#1,\@end{#1}
67
68 % Make \cite robust.
69 %
70 \edef\cite{\noexpand\protect\expandafter\noexpand\csname cite \endcsname}
71
72 \@namedef{cite }{\@ifnextchar [{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}}
73
74 % Make \@citex refer to \citen:
75 % (Put a single space before the output)
76 %
77 \def\@citex[#1]#2{\@cite{\citen{#2}}{#1}}%
78
79 % Replacement for \@cite which defines the formatting normally done
80 % around the citation list. Adjust the spacing before the citation:
81 % if no space or if there is extra space due to some punctuation, then
82 % change to one inter-word space. The way to change this is by changing
83 % \citeleft, \citemid, and \citeright; but in extreme cases it might be
84 % necessary to redefine the whole macro.
85 %
86 \def\@cite#1#2{\leavevmode
87 \@tempskipa\lastskip \edef\@tempa{\the\@tempskipa}\unskip
88 \ifx\@tempa\@zero@skip \spacefactor1001 \fi % if no space before, set flag
89 \ifnum\spacefactor>\@m \ \else \hskip\@tempskipa \fi
90 \citeleft{#1\if@tempswa \citemid #2\fi}\citeright
91 \spacefactor\@m % punctuation in note doesn't affect outside
92 }
93 \edef\@zero@skip{\the\z@skip}
94 %
95 % Give the citation tag as the label (even if another label is specified)
96 %
97 \def\@lbibitem[#1]#2{\global\@HighCite\z@
98 \item[\@biblabel{\@ifundefined{DCN@#2\@extra@b@citeb}{\@warning
99 {Reference `#2' on page \thepage\space was never cited}}{}%
100 \DC@llap{$^{\@nameuse{DCN@#2\@extra@b@citeb}}$\ \ }%%o
101 \@citeverb{#2}}\hfil]\if@filesw{\def\protect##1{\string ##1\space}%
102 \immediate\write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces}
103
104 \def\@bibitem#1{\refstepcounter{\@listctr}\@lbibitem[\the\value{\@listctr}]{#1}}
105
106 % make the special characters in the citation tag printable
107 %
108 \def\@citeverb#1{%
109 {\citeform{% to get characters <>_|{}: \citeform->\tt
110 \expandafter \expandafter \expandafter \@gobblethree % do \csname, \string,
111 \expandafter \string\csname b@#1\endcsname}% % \@gobble, in that order.
112 }}%
113
114 \def\@gobblethree#1#2#3{}
115
116 % \@extra@b@citeb is a hook for other style files to further specify
117 % citations; for example, to number by chapter.
118 % In case no fancy bib package (chapterbib) defines it:
119
120 \@ifundefined{@extra@b@citeb}{\def\@extra@b@citeb{}}{}
121
122 %------------------------------------
123 % Handle optional variations:
124
125 \def\nocitecount{%
126 \def\@advancecitecount{\global\@namedef{DCN@\@citeb\@extra@b@citeb}{}}%
127 \let\DC@llap\@gobble}
128 \nocitecount % in case what follows gets removed
129
130 \newcount\@HighCite \global\@HighCite\z@
131 \let\@dftc@ifund\@ifundefined
132 \let\@dftc@hbox\hbox
133
134 \@ifundefined{DeclareOption}{}%
135 { \DeclareOption{nocitecount}{\endinput}
136 \toks@={\def\@dftc@ifund#1#2#3{#2}}
137 \DeclareOption{verbose}{\the\toks@}
138 \DeclareOption{tt}{\def\citeform{\tt}}
139 \DeclareOption{nospace}{\def\citepunct{,\penalty\z@}}
140 \DeclareOption{space}{\def\citepunct{,\ }}
141 \DeclareOption{breakcites}{\let\@dftc@hbox\relax}
142 \ProvidesPackage{drftcite}[1995/01/23 \space v 3.5]
143 \ProcessOptions }
144
145 % The rest deals only with counting, and can be removed if counting is never
146 % desired.
147
148 \let\DC@llap=\llap
149 %
150 % count the citations as they appear in the text
151 %
152 \def\@advancecitecount{\@ifundefined {DCN@\@citeb\@extra@b@citeb}%
153 {\global\advance\@HighCite\@ne
154 \expandafter\xdef\csname DCN@\@citeb\@extra@b@citeb\endcsname{\the\@HighCite}}%
155 {}}
156 %
157 % The remainder handles (counting over) input files skipped by \includeonly.
158 % It adds code to LaTeX's \include to re-read the .aux file checking the
159 % \citation commands.
160 %
161 % For included files that are skipped (not listed by \includeonly)
162 % input the .aux file ignoring all commands but \citation, which
163 % does \@advancecitecount (keeps count of the citations). This adds
164 % a requirement for other style files that add commands to the .aux
165 % file: the commands must be safe to execute an extra time.
166 %
167 \let\@dftc@include\include
168 \def\include#1{\relax
169 \ifx\DC@llap\llap \begingroup % do counting only if wanted
170 \@ifundefined{cp@#1}{}% don't do if .aux file not there!
171 {\toks@\expandafter\expandafter\expandafter{\csname cp@#1\endcsname}%
172 \expandafter\xdef\csname cp@#1\endcsname{\the\toks@
173 \noexpand\@dftc@auxcite{#1}}}%
174 \endgroup\fi \@dftc@include{#1}}
175 %
176 \def\@dftc@auxcite#1{\begingroup % disable everything but \citation
177 \let\bibcite\@gobbletwo \let\newlabel\@gobbletwo \let\@writefile\@gobbletwo
178 \let\bibdata\@gobble \let\bibstyle\@gobble % already \@gobble normally
179 \def\citation##1{\@for\@citeb:=##1\do {\@advancecitecount}}%
180 \makeatletter\@input{#1.aux}\endgroup
181 }
182 \endinput
183
184
185 % D R F T C I T E . S T Y
186 %
187 % version 3.5 (Jan 1995)
188 %
189 % This package makes LaTeX use the identifying label instead of the number
190 % for citations, as if the bibliography had entries like \bibitem[name]{name}
191 % but LaTeX writes the proper citation number to the aux file for later runs.
192 % Spaces before the \cite command are ignored, and an ordinary interword
193 % space is used. This package is particularly useful for draft (draught)
194 % versions of documents.
195 %
196 % The \citen command is provided, as in cite.sty, to print just the citation
197 % or list of citations without the brackets and other formatting.
198 %
199 % Drftcite keeps track of which references were cited, and issues warnings
200 % for bibliography items that were never cited in the text.
201 %
202 % This package also keeps track of the order of first-citations in the text
203 % for easy sorting (in lieu of BibTeX). To omit this counting...
204 % LaTeX 2.09: declare \nocitecount before the first \cite; or, for
205 % a more permanent removal, comment-out the lines ending with %%o
206 % below, and omit everything following the line that begins with %%o.
207 % LaTeX2e: specify \usepackage[nocitecount]{drftcite}, or perform the
208 % editing described above.
209 %
210 % The characters <>|_{}\ are not present in the cm roman fonts, so if you use
211 % them in identifiers, they will have to be typeset in typewriter style.
212 % To do this,...
213 % LaTeX 2.09: insert \renewcommand\citeform{\tt} in your preamble
214 % LaTeX2e: specify \usepackage[tt]{drftcite}
215 %
216 % `Citation...undefined' warnings are only given once per undefined
217 % citation name. In the text, missing numbers are represented with a
218 % bold `name?'. To restore multiple warnings...
219 % LaTex 2.09: edit this file, removing the lines with the comments:
220 % "delete to warn always"
221 % LaTeX2e: specify \usepackage[verbose]{drftcite}
222 %
223 % Other options for \usepackage are:
224 % [space] - Separate printed names with comma-space (Default).
225 % [nospace] - Print just a comma (not comma-space) after each name.
226 % [breakcites] - Allow each printed name to be broken (hyphenated).
227 %
228 % There are several commands that you may redefine (using \renewcommand)
229 % to change the formatting of citation lists:
230 %
231 % command function default
232 % ---------- ----------------------- ----------------------------
233 % \citeform reformats every entry nothing
234 % \citepunct printed between numbers comma + space
235 % \citeleft left delimiter of list [
236 % \citeright right delimeter of list ]
237 % \citemid printed before note comma + space
238 %
239 % This version of drftcite can co-exist with chapterbib.sty (version 1.4
240 % or later).
241 %
242 % [This file is named "drftcite" because "draftcite" is too long a name for
243 % some computers. Sorry to those who use the spelling "draught." I could
244 % have abbreviated the name by selecting the shared letters in "draft" and
245 % "draught," but "dratcite" somehow conveys the wrong meaning.]
246 %
247 % Version 1991: Ignore spaces after commas in the parameter list. Create
248 % \nocitecount to turn off counting the order of citations.
249 % Version 3.1 (1992): protect \cite and \citen. (There is no version 3.0)
250 % Version 3.2 (1993): Supress repetitions of warning messages. Include
251 % \@extra@b@citeb hook for chapterbib.sty. Make \include handle case that
252 % \cp@FOO was not defined.
253 % Version 3.3 (1993): Fix \nocitecount. Change printing of undefined refs.
254 % Version 3.4 (1994): LaTex2e support, including spaces in protected command
255 % names; better chapterbib support.
256 % Version 3.5 (1995): Add tests before removing space + options from cite.sty.
257 % change \@citeverb to not eat hash space.
258 %
259 % Send problem reports to [email protected]
260 %
261 % Test integrity of file:
262 % brackets: round, square, curly, angle: () [] {} <>
263 % backslash, slash, vertical, at, dollar, and: \ / | @ $ &
264 % hat, grave, acute (apostrophe), quote, tilde, under: ^ ` ' " ~ _