diff options
author | Karl Berry <karl@freefriends.org> | 2010-09-13 19:16:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-09-13 19:16:35 +0000 |
commit | 8ac4866fb38af45e87b21dff99b0d56b506721a6 (patch) | |
tree | ca1b1afa5303dd8db10076f8046bef5b82ac5fe1 /Master/texmf-dist/tex/latex/cite/drftcite.sty | |
parent | 815cea44e9f0f8cdc1b7b8d69dcd507d010301c2 (diff) |
cite update (12sep10)
git-svn-id: svn://tug.org/texlive/trunk@19710 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/cite/drftcite.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/cite/drftcite.sty | 258 |
1 files changed, 81 insertions, 177 deletions
diff --git a/Master/texmf-dist/tex/latex/cite/drftcite.sty b/Master/texmf-dist/tex/latex/cite/drftcite.sty index bc20deac0a3..21b557efbd5 100644 --- a/Master/texmf-dist/tex/latex/cite/drftcite.sty +++ b/Master/texmf-dist/tex/latex/cite/drftcite.sty @@ -1,27 +1,17 @@ % D R F T C I T E . S T Y % -% version 3.91 (Dec 2007) +% version 3.5 (Jan 1995) % -% Print the tags instead of the numbers for \cite. This is meant as a -% companion to cite.sty and overcite.sty, when used without bibtex, -% and is not fully general. +% Print the tags instead of the numbers for \cite. +% See also CITE.STY and OVERCITE.STY. % -% Copyright (C) 1989,1991-1997,2001,2007 by Donald Arseneau +% Copyright (C) 1989,1991-1995 by Donald Arseneau % These macros may be freely transmitted, reproduced, or modified % provided that this notice is left intact. % % Instructions are below, after \endinput. % ........................ % -% First, ensure that some catcodes have the expected values -\edef\citenum{% to restore funny codes - \catcode\string`\string ` \the\catcode\string`\` - \catcode\string`\string ' \the\catcode\string`\' - \catcode\string`\string = \the\catcode\string`\= - \catcode\string`\string _ \the\catcode\string`\_ - \catcode\string`\string : \the\catcode\string`\:} -\catcode\string`\`12 \catcode`\'12 \catcode`\=12 \catcode`\_8 \catcode`\:12 - % Handle formatting hooks: % \citeform,\citeleft,\citeright,\citemid,\citepunct % @@ -48,14 +38,32 @@ % Do not repeat warnings. [verbose] reverses \let\oc@verbo\relax -% Use \citen to give citation name without the other formatting. +% \citen gives the citation tag in the text and writes the aux file entry. +% Use \citen to give citation name without the other formatting; e.g., +% "See also ref.~\citen{junk}" gives "See also ref. junk". % \edef\citen{\noexpand\protect \expandafter\noexpand\csname citen \endcsname} \@namedef{citen }#1{% -\begingroup -\@docite{#1}% do everything -\endgroup} +\edef\@tempa{\@ignspaftercomma,#1, \@end, }% ignore spaces in parameter list. +\edef\@tempa{\expandafter\@ignendcommas\@tempa\@end}% +\if@filesw \immediate\write \@auxout {\string\citation {\@tempa}}\fi +\def\@citea{}% +\@for \@citeb:=\@tempa\do {\@citea + \@ifundefined {b@\@citeb\@extra@b@citeb}% + {{\bf \@citeverb{\@citeb}?}%% issue warning only for first mis-use: + \@dftc@ifund {DCN@\@citeb\@extra@b@citeb}{% delete to warn always + \@warning {Citation `\@citeb' on page \thepage\space undefined}% + }{}% delete to warn always + }% else, defined + {\@dftc@hbox{\@citeverb{\@citeb}}}% + \let\@citea\citepunct\@advancecitecount + }} + +% for ignoring spaces in the input: +\def\@ignspaftercomma#1, {\ifx\@end#1\@empty\else + #1,\expandafter\@ignspaftercomma\fi} +\def\@ignendcommas,#1,\@end{#1} % Make \cite robust. % @@ -69,103 +77,32 @@ \def\@citex[#1]#2{\@cite{\citen{#2}}{#1}}% % Replacement for \@cite which defines the formatting normally done -% around the citation list. Minor changes can be done by changing -% \citeleft, \citemid, and \citeright; but in other cases it might -% be necessary to redefine the whole macro. +% around the citation list. Adjust the spacing before the citation: +% if no space or if there is extra space due to some punctuation, then +% change to one inter-word space. The way to change this is by changing +% \citeleft, \citemid, and \citeright; but in extreme cases it might be +% necessary to redefine the whole macro. % -\def\@cite#1#2{\leavevmode \cite@adjust - \citeleft{#1\if@tempswa \@safe@activesfalse\citemid{#2}\fi - \spacefactor\@m % punctuation in note doesn't affect outside - }\citeright} - -% Put a penalty before the citation, and adjust the spacing: if no space -% already or if there is extra space due to some punctuation, then change -% to one inter-word space. -% -\@ifundefined{cite@adjust}{\def\cite@adjust{\begingroup +\def\@cite#1#2{\leavevmode \@tempskipa\lastskip \edef\@tempa{\the\@tempskipa}\unskip - \ifnum\lastpenalty=\z@ \penalty\@highpenalty \fi \ifx\@tempa\@zero@skip \spacefactor1001 \fi % if no space before, set flag \ifnum\spacefactor>\@m \ \else \hskip\@tempskipa \fi - \endgroup}}{} - + \citeleft{#1\if@tempswa \citemid #2\fi}\citeright + \spacefactor\@m % punctuation in note doesn't affect outside +} \edef\@zero@skip{\the\z@skip} - -% \nocite: This is changed to ignore *ALL* spaces and be robust. The -% parameter list, with spaces removed, is `returned' in \@no@sparg, which -% is used by \citen. -% -\edef\nocite{\noexpand\protect\expandafter\noexpand\csname nocite \endcsname} - -\@namedef{nocite }#1{\@bsphack \begingroup - \let\@dftc@hbox\@gobble \let\citepunct\@empty - \@docite{#1}\endgroup\@esphack} - -% \@docite: Does most of the work for both \cite and \nocite. -% -\def\@docite#1{\begingroup\let\protect\string% normalize active chars - \xdef\@no@sparg{\expandafter\@ignsp#1 \: }% and remove ALL spaces - \if@filesw \immediate\write\@auxout {\string\citation{\@no@sparg}}\fi - \endgroup - \let\@citea\@empty % no punctuation preceding first - \gdef\dftc@prenum{-1}% - \@for \@citeb:=\@no@sparg\do{% - \ifnum\dftc@cnum{\@citeb}<\z@ % undefined - \dftc@vdef{b@\@citeb\@extra@b@citeb}{\dftc@tag{-1}?}% - \G@refundefinedtrue \dftc@warn - \else % defined (0 or num) - \dftc@checksort - \fi - \@advancecitecount - \@citea \@dftc@hbox{\@dftc@nums\@citeverb{\@citeb}}% - \let\@citea\citepunct - }} - -\def\dftc@warn{\@warning{Citation `\@citeb' on page \thepage\space undefined}} - -% for ignoring *ALL* spaces in the input. This presumes there are no -% \outer tokens and no \if-\fi constructs in the parameter. Spaces inside -% braces are retained. -% -\def\@ignsp#1 {\ifx\:#1\@empty\else #1\expandafter\@ignsp\fi} - % % Give the citation tag as the label (even if another label is specified) % \def\@lbibitem[#1]#2{\global\@HighCite\z@ - \item[\@biblabel{% - \ifnum\dftc@cnum{#2}>\z@ % cited - \DC@llap{$^{\dftc@cnum{#2}}$\ \ }% - \ifnum\dftc@cnum{#2}=\number 0#1\relax \else - \@warning {Bib item `#2' is in wrong order}% - \fi - \else % never cited - \@warning {Reference `#2' was never cited}% - \fi - \@citeverb{#2}}\hfill]% - \if@filesw {\let\protect\string - \immediate\write\@auxout{\string\bibcite{#2}{#1}}}\fi - \ignorespaces} + \item[\@biblabel{\@ifundefined{DCN@#2\@extra@b@citeb}{\@warning + {Reference `#2' on page \thepage\space was never cited}}{}% + \DC@llap{$^{\@nameuse{DCN@#2\@extra@b@citeb}}$\ \ }%%o + \@citeverb{#2}}\hfil]\if@filesw{\def\protect##1{\string ##1\space}% + \immediate\write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces} \def\@bibitem#1{\refstepcounter{\@listctr}\@lbibitem[\the\value{\@listctr}]{#1}} -\def\@testdef #1#2#3{% - \def\reserved@a{#3}\protected@edef\@tempa{\csname #1@#2\endcsname}% - \ifx \@tempa\reserved@a \else \@tempswatrue \fi} - -% Citations are tagged with their order of first-citation by prefacing -% \dftc@tag{<number>} to their definition. If reference "foo" is number -% 11 in the bibliography, and is first-cited 7th in the text, then -% \b@foo will be redefined from "11" to "\dftc@tag{7}11" when foo is -% first cited. A (pretend) tag number of 0 is used to indicate an uncited -% reference, and -1 indicates that "foo" was not defined by the bibliography -% (also when LaTeX isn't run enough times). -% -\def\dftc@cnum#1{\expandafter\expandafter\expandafter \dftc@cnumx - \csname b@#1\@extra@b@citeb\endcsname \dftc@tag 0\:} -\def\dftc@cnumx#1\dftc@tag#2#3\:{\ifx\relax#1-1\else#2\fi} - -% % make the special characters in the citation tag printable % \def\@citeverb#1{% @@ -174,9 +111,7 @@ \expandafter \string\csname b@#1\endcsname}% % \@gobble, in that order. }}% -\long\def\@gobblethree#1#2#3{} - -\let\dftc@tag\@gobble +\def\@gobblethree#1#2#3{} % \@extra@b@citeb is a hook for other style files to further specify % citations; for example, to number by chapter. @@ -184,72 +119,41 @@ \@ifundefined{@extra@b@citeb}{\def\@extra@b@citeb{}}{} -% count the citations as they appear in the text -% -\def\@advancecitecount{\begingroup - \ifcase\dftc@cnum\@citeb % not cited yet - \global\advance\@HighCite\@ne - \toks@\expandafter\expandafter\expandafter - {\csname b@\@citeb\@extra@b@citeb\endcsname}% - \expandafter\xdef\csname b@\@citeb\@extra@b@citeb\endcsname{% - \noexpand\dftc@tag{\the\@HighCite}\the\toks@}% - \fi\endgroup} - - %------------------------------------ % Handle optional variations: -\newcount\@HighCite \global\@HighCite\z@ -\let\@dftc@hbox\hbox -\let\@dftc@nums\@empty -\def\dftc@vdef{\global\@namedef} -\let\DC@llap=\llap -\let\dftc@checksort\@empty - \def\nocitecount{% - \let\DC@llap=\@gobble - \let\@dftc@nums\@empty - \let\@advancecitecount\@empty - \let\dftc@checksort\@empty} + \def\@advancecitecount{\global\@namedef{DCN@\@citeb\@extra@b@citeb}{}}% + \let\DC@llap\@gobble} +\nocitecount % in case what follows gets removed +\newcount\@HighCite \global\@HighCite\z@ +\let\@dftc@ifund\@ifundefined +\let\@dftc@hbox\hbox \@ifundefined{DeclareOption}{}% -{ \DeclareOption{nocitecount}{\nocitecount} - \DeclareOption{verbose}{\let\dftc@vdef\@gobbletwo} - \DeclareOption{tt}{\def\citeform{\texttt}} +{ \DeclareOption{nocitecount}{\endinput} + \toks@={\def\@dftc@ifund#1#2#3{#2}} + \DeclareOption{verbose}{\the\toks@} + \DeclareOption{tt}{\def\citeform{\tt}} \DeclareOption{nospace}{\def\citepunct{,\penalty\z@}} \DeclareOption{space}{\def\citepunct{,\ }} \DeclareOption{breakcites}{\let\@dftc@hbox\relax} - \DeclareOption{shownumbers}{\let\@dftc@nums\relax} - \DeclareOption{manualsort}{\let\dftc@checksort\relax} - \ProvidesPackage{drftcite}[2007/12/11 \space v 3.91] + \ProvidesPackage{drftcite}[1995/01/23 \space v 3.5] \ProcessOptions } +% The rest deals only with counting, and can be removed if counting is never +% desired. -\ifx\@dftc@nums\relax -\def\@dftc@nums{\leavevmode\raise1.4ex\rlap{\the\scriptfont\z@ - \csname b@\@citeb\@extra@b@citeb\endcsname\ - (\dftc@cnum\@citeb)}}% -\fi - -\ifx\@advancecitecount\@empty \nocitecount \endinput \fi - +\let\DC@llap=\llap +% +% count the citations as they appear in the text +% +\def\@advancecitecount{\@ifundefined {DCN@\@citeb\@extra@b@citeb}% +{\global\advance\@HighCite\@ne +\expandafter\xdef\csname DCN@\@citeb\@extra@b@citeb\endcsname{\the\@HighCite}}% +{}} % -% Check if cites in a \cite{a,b,c} are increasing. -% -\ifx\dftc@checksort\relax -\def\dftc@checksort{% - \edef\dftc@enum{\number0\csname b@\@citeb\@extra@b@citeb\endcsname}% - \ifnum \z@<\dftc@enum\relax % is numeric - \ifnum\dftc@prenum<\dftc@enum\relax - \else - \@warning {Citation `\@citeb' number \dftc@enum\space - cited on page \thepage\space is given out of order}% - \fi - \global\let\dftc@prenum\dftc@enum% - \fi} -\fi - % The remainder handles (counting over) input files skipped by \includeonly. % It adds code to LaTeX's \include to re-read the .aux file checking the % \citation commands. @@ -280,13 +184,14 @@ % D R F T C I T E . S T Y % -% version 3.91 (Dec 2007) +% version 3.5 (Jan 1995) % % This package makes LaTeX use the identifying label instead of the number % for citations, as if the bibliography had entries like \bibitem[name]{name} % but LaTeX writes the proper citation number to the aux file for later runs. -% This package is meant for draft copies documents using numeric citations, -% particularly those that will use cite.sty or overcite.sty but not bibtex. +% Spaces before the \cite command are ignored, and an ordinary interword +% space is used. This package is particularly useful for draft (draught) +% versions of documents. % % The \citen command is provided, as in cite.sty, to print just the citation % or list of citations without the brackets and other formatting. @@ -295,29 +200,30 @@ % for bibliography items that were never cited in the text. % % This package also keeps track of the order of first-citations in the text -% for easy sorting (in lieu of BibTeX). The cite-order is displayed in the -% bibliography along with the tags. +% for easy sorting (in lieu of BibTeX). To omit this counting... +% LaTeX 2.09: declare \nocitecount before the first \cite; or, for +% a more permanent removal, comment-out the lines ending with %%o +% below, and omit everything following the line that begins with %%o. +% LaTeX2e: specify \usepackage[nocitecount]{drftcite}, or perform the +% editing described above. % -% Both the cite-order number and the bibliography numbers can be displayed -% as superscripts with the citations; use option [shownumbers]. -% % The characters <>|_{}\ are not present in the cm roman fonts, so if you use % them in identifiers, they will have to be typeset in typewriter style. -% To do this, give package option [tt], or redefine \citeform as {\tt}. +% To do this,... +% LaTeX 2.09: insert \renewcommand\citeform{\tt} in your preamble +% LaTeX2e: specify \usepackage[tt]{drftcite} % % `Citation...undefined' warnings are only given once per undefined % citation name. In the text, missing numbers are represented with a -% bold `name?'. To restore multiple warnings, use option [verbose]. +% bold `name?'. To restore multiple warnings... +% LaTex 2.09: edit this file, removing the lines with the comments: +% "delete to warn always" +% LaTeX2e: specify \usepackage[verbose]{drftcite} % -% Options for \usepackage are: +% Other options for \usepackage are: % [space] - Separate printed names with comma-space (Default). % [nospace] - Print just a comma (not comma-space) after each name. % [breakcites] - Allow each printed name to be broken (hyphenated). -% [verbose] - Give warning every time an undefined citation is used. -% [tt] - Use tt font for citation tags -% [shownumbers] - show superscript: bib-number (cite-order) with the cite tags -% [manualsort] - Issue warnings when \cite tags are out of numeric order. -% [nocitecount] - Disable all numbering/sorting functions. % % There are several commands that you may redefine (using \renewcommand) % to change the formatting of citation lists: @@ -349,10 +255,8 @@ % names; better chapterbib support. % Version 3.5 (1995): Add tests before removing space + options from cite.sty. % change \@citeverb to not eat hash space. -% Version 3.9 (2001): Change a whole lot...and not thoroughly checked. -% Version 3.91 (2007): Use \hfill and \texttt; update email. % -% Send problem reports to asnd@triumf.ca +% Send problem reports to asnd@Reg.triumf.ca % % Test integrity of file: % brackets: round, square, curly, angle: () [] {} <> |