diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:53:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:53:03 +0000 |
commit | 937cf3132125ac1442ce180ab23325b26c62743f (patch) | |
tree | 6194fd89fbc556907e5eb5a092c30991d95d0af8 /Master/texmf-dist/tex/latex/cite | |
parent | 0c9405f885f771f05b1a96ff3d298cc1a814966b (diff) |
cite
git-svn-id: svn://tug.org/texlive/trunk@758 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/cite')
-rw-r--r-- | Master/texmf-dist/tex/latex/cite/chapterbib.sty | 446 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cite/cite.sty | 500 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cite/drftcite.sty | 359 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cite/overcite.sty | 21 |
4 files changed, 1326 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/cite/chapterbib.sty b/Master/texmf-dist/tex/latex/cite/chapterbib.sty new file mode 100644 index 00000000000..66224a2c4b7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/cite/chapterbib.sty @@ -0,0 +1,446 @@ +% chapterbib.sty Version 1.11 (29-FEB-2004) Donald Arseneau +% +% Allow multiple bibliographies in a LaTeX document, including items +% \cite'd in more than one bibliography. +% +% Instructions are below, after \endinput. +% +%====================== BEGIN MACROS =========================== + +\newenvironment{cbunit}% +{\global\advance\c@inputfile\@ne \xdef\the@ipfilectr{@-\the\c@inputfile}% + \@CB@writeContext}% +{\gdef\the@ipfilectr{}\@CB@writeContext} + +\def\@CB@writeContext{\if@filesw\begingroup + \edef\@tempa{\string\gdef\string\@extra@binfo{\@extra@b@citeb}}% + \immediate\write\@auxout{\@tempa\@CB@wtoc{toc}\@CB@wtoc{lof}\@CB@wtoc{lot}}% + \endgroup\fi} +\def\@CB@wtoc#1{\string\@writefile{#1}{\gdef + \string\the@ipfilectr{\@extra@b@citeb}}}% + +\let\cb@include\include +\def\include#1{\clearpage \cbunit \xdef\@currentipfile{#1}% + \cb@include{#1}\global\let\@currentipfile\@savedjobname\endcbunit} + +\newcommand\cb@input[1]{\cbunit \xdef\@currentipfile{#1}% + \input{#1}\global\let\@currentipfile\@savedjobname\endcbunit} +\let\cbinput\cb@input + +\@ifundefined{@extra@binfo}{% if not defined by compatible package +% \@ifundefined{@safe@activestrue}{}{% babel is loaded + \@ifundefined{org@bibcite}{% + \let\bibcite@iii\bibcite + \def\bibcite#1{\bibcite@iii{#1\@extra@binfo}}% + }{% and will clobber us + \let\bibcite@iii\org@bibcite + \def\org@bibcite#1{\bibcite@iii{#1\@extra@binfo}}% + }%} + }{}% + +\@ifundefined{@extra@b@citeb}{% if not defined by compatible package + \def\@citex[#1]#2{% Add \@extra@b@citeb to \cite + \let\@citea\@empty + \@cite{\@for\@citeb:=#2\do + {\@citea\let\@citea\citepunct + \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% + \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi + \@ifundefined{b@\@citeb \@extra@b@citeb}{\mbox{\reset@font\bf ?}% + \@warning{Citation `\@citeb' in file `\@currentipfile' + on page \thepage \space undefined}\G@refundefinedtrue}% + {\hbox{\citeform{\csname b@\@citeb \@extra@b@citeb\endcsname}}}}}{#1}} +}{}% + +% Test if \@extra@b@citeb hook needs to be added to \nocite +\setbox\@tempboxa\hbox{\let\@onlypreamble\document% + \def\@extra@b@citeb{\global\let\@gtempa\relax}\@extra@b@citeb + \def\@ifundefined#1#2#3{\global\let\@gtempa\@empty #1}% + \@fileswfalse \nocite{x}} + +\ifx\@gtempa\@empty % define \nocite with hook +\def\nocite#1{\@bsphack % Add \@extra@b@citeb to \nocite + \ifx\@onlypreamble\document + \@for\@citeb:=#1\do{% + \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% + \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi + \@ifundefined{b@\@citeb\@extra@b@citeb}{\G@refundefinedtrue + \@warning{Citation `\@citeb' in file `\@currentipfile' undefined}}{}}% + \else + \@latex@error{Cannot be used in preamble}\@eha + \fi + \@esphack} +\fi + +\long\def\@firstofone#1{#1} + +\@ifundefined{citeform}{\let\citeform\@empty}{} +\@ifundefined{citepunct}{\def\citepunct{,\penalty\@m\ }}{} + +\xdef\@savedjobname{\jobname}% save root file name as a macro +\let\@currentipfile\@savedjobname +\gdef\the@ipfilectr{} +\def\@extra@b@citeb{\the@ipfilectr} +\newcount\c@inputfile \global\c@inputfile=0 + +\gdef\@extra@binfo{} % in case .aux files are left from old run. + +\@ifundefined{reset@font}{\let\reset@font\relax}{} +\@ifundefined{G@refundefinedtrue}{\let\G@refundefinedtrue\relax}{} + +\let\cb@bibliographystyle\bibliographystyle +\def\bibliographystyle#1{\if\cb@roottest\cb@bibliographystyle{#1}\fi} +\def\cb@roottest{11}% for [rootbib]: {2\ifx\the@ipfilectr\@empty 1\else2\fi} + +\def\bibliography#1{\if\cb@roottest + \if@filesw\immediate\write\@auxout{\string\bibdata{#1}}\fi + \fi \cb@dobiblio{\@currentipfile.bbl}} + +\@ifundefined{PackageWarning}{\let\cb@warning\@warning}% + {\def\cb@warning{\PackageWarning{chapterbib}}} + +\@ifundefined{@newl@bel}{% pre-1995; must redefine \@testdef + \let\@test@defiii\@testdef + \def\@testdef#1#2#3{% + \if#1b\relax\@test@defiii b{#2\@extra@binfo}{#3}% + \else \@test@defiii #1{#2}{#3}\fi}% + \let\cb@dobiblio\@input}% + {\let\cb@dobiblio\@input@} + +\def\sectionbib#1#2{% Macro to convert \thebibliography command + \@ifundefined{bibsection}{% Regular -- patch \thebibliography + \long\def\@tempa##1##{% to parse beginning of old def + \long\def\@tempa####1\endthebibliography{}\def\@tempc{##1}\@tempa}% + \expandafter\@tempa\thebibliography{}{}\endthebibliography + \def\@tempa{\chapter*}\ifx\@tempa\@tempc\else \begingroup\toks@{#1}% + \cb@warning {The sectionbib option changes \string"\expandafter + \strip@prefix\meaning\@tempc\string" to \string"\the\toks@\string" + in \string\thebibliography }\endgroup\fi + \let\cb@thebibliography\thebibliography + \def\thebibliography{\let\@currentlabel\@empty + \ifx\the@ipfilectr\@empty \else + \expandafter\expandafter\expandafter\cb@sectionbib\fi + \cb@thebibliography}% + \expandafter\def\expandafter\cb@sectionbib\@tempc##1{#1{\bibname}% + \ifx\@currentlabel\@empty \begingroup \c@secnumdepth\z@ + \addcontentsline{toc}{#2}{\bibname}% local: * -> no num + \csname#2mark\endcsname{\bibname}\endgroup\fi + \@ifnextchar\@mkboth{\@gobblethree}{}}% + }{% Some package or class has \bibsection -- patch that. + \long\def\@tempa##1##{% to parse beginning of old def + \long\def\@tempa####1\endthebibliography{}\def\@tempc{##1}\@tempa}% + \expandafter\@tempa\bibsection{}{}\endthebibliography + \def\@tempa{\chapter*}\ifx\@tempa\@tempc\else \begingroup\toks@{#1}% + \cb@warning {The sectionbib option changes \string"\expandafter + \strip@prefix\meaning\@tempc\string" to \string"\the\toks@\string" + in \string\bibsection }\endgroup\fi + \let\cb@bibsection\bibsection + \def\bibsection{\let\@currentlabel\@empty + \ifx\the@ipfilectr\@empty \else + \expandafter\expandafter\expandafter\cb@sectionbib\fi + \cb@bibsection}% + \expandafter\def\expandafter\cb@sectionbib\@tempc{#1}% +}} + +\long\def\@gobblethree#1#2#3{}% +\def\strip@prefix#1>{} +\@ifundefined{bibname}{\def\bibname{Bibliography}}{} + + +\@ifundefined{DeclareOption}{% LaTeX2.09 + \def\@CB@wtoc#1{}% disable; broken in 2.09 +}{% LaTeX2e option +\ProvidesPackage{chapterbib}[2004/02/29 \space v 1.11] +\DeclareOption{sectionbib}{\AtBeginDocument{\sectionbib{\section*}{section}}% + \providecommand\StartFinalBibs{\chapter*{\bibname}\chaptermark\bibname + \protected@edef\bibname{\chaptername\space\noexpand\thechapter}}}% +\DeclareOption{draft}{\let\cbinput=\include} +\DeclareOption{rootbib}{\def\cb@roottest{2\ifx\the@ipfilectr\@empty2\else1\fi}} +\DeclareOption{duplicate}{\gdef\cb@biblist{}\let\cb@sub@input\@input@} +\DeclareOption{gather}{\gdef\cb@biblist{}\let\cb@sub@input\@gobble} +\ProcessOptions + +\@ifundefined{chapter}{% + \@ifundefined{section}{}{\providecommand\CBMainSectioning{section}}% +}{\providecommand\CBMainSectioning{chapter}} + +\ifx\cb@sub@input\@input@ % For [duplicate] + \def\cb@dofinalbibs{\if@filesw + \toks@{\let\cb@bc\bibcite\let\bibcite\@gobbletwo}% + \immediate\write\@auxout{\the\toks@}\fi + \let\cb@elt\cb@dogatherbib \cb@biblist + \if@filesw\immediate\write\@auxout{\let\string\bibcite\string\cb@bc}\fi}% +\fi +\ifx\cb@sub@input\@gobble % For [gather] + \def\cb@dofinalbibs{\let\cb@elt\cb@dogatherbib \cb@biblist}% +\fi +\ifx\cb@biblist\@empty % duplicate or gather declared + \providecommand\StartFinalBibs{\protected@edef\bibname + {\bibname\space for \chaptername\space \noexpand\thechapter}}% + \def\cb@dobiblio#1{\begingroup\makeatletter + \ifx\the@ipfilectr\@empty % in root + \StartFinalBibs \cb@dofinalbibs + \else % in chapter, or section + \let\cb@elt\relax + \xdef\cb@biblist{\cb@biblist + \cb@elt{\csname the\CBMainSectioning\endcsname}% = \thechapter + {\the\c@inputfile}{\@currentipfile}}% + \cb@sub@input{#1}% + \fi\endgroup} + \def\cb@dogatherbib#1#2#3{% + \setcounter{\CBMainSectioning}{#1}% + \global\c@inputfile#2\global\advance\c@inputfile\m@ne + \IfFileExists{#3.bbl}{\cb@input{#3.bbl}}{}} +\fi + +\AtBeginDocument{\let\sectionbib\undefined} +} +\endinput + +%====================== BEGIN INSTRUCTIONS =========================== + + + chapterbib.sty Version 1.11 (29-FEB-2004) DA (allow \nocite check) + ~~~~~~~~~~~~~~ 1.10 (23-JUN-2003) DA (\bibsection \CBMainSectioning) + 1.9 (19-SEP-2001) DA (sectionbib change; babel) + 1.8 (29-APR-1999) DA (gather, duplicate, toc) + 1.7 (21-JUL-1997) DA (sectionbib, \nocite) + 1.6 (08-FEB-1997) Donald Arseneau (more sectionbib) + 1.5 (09-OCT-1995) Donald Arseneau (rootbib) + 1.4 (11-MAR-1995) Donald Arseneau (sectionbib) + 1.3 (04-JUL-1994) Donald Arseneau (2e, cbunit) + 1.2 (21-MAY-1993) Donald Arseneau (bug fix) + 1.1 (24-MAR-1993) Donald Arseneau + 1.0 (23-NOV-1988) Niel Kempson + + Allow multiple bibliographies in a LaTeX document, including items + \cite'd in more than one bibliography. Despite the name "chapterbib", + the BIBLIOGRAPHIES ARE FOR EACH INCLUDED FILE, not necessarily for each + chapter. The main point is to allow you to use BibTeX: Each included + file should have its own \bibliographystyle and \bibliography commands, + and you should run BibTeX on each included file separately rather than + on the root file. + + There are also the commands \begin{cbunit}, \end{cbunit}, and \cbinput + to allow multiple bibliographies without using \include (see item 4). + There are two added hooks, \citeform and \citepunct, to customise the + formatting of each entry in a citation list. + + Usage, Restrictions, and Options + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + 1. Normal use: Put \bibliographystyle and \bibliography commands in + each \include'd file. Run LaTeX; run BibTeX on each included file; + run LaTeX; run LaTeX. + + 2. If you get errors like "! LaTeX Error: Command \xxx already defined." + then bibtex is foolishly putting "\newcommand" in each bbl file. The + fix is to put the \bibliography command in braces: {\bibliography{x}}. + + 3. The \bibliography and \bibliographystyle commands are not normally used + in the root file, only in files that have been \include'd. To have a + whole-document bibliography, see items 7-10, depending on which style of + whole-document bib. + + 4. If you can't use \include because a new section must start below the + preceding bibliography on the same page [odd format!], then you can + use \begin{cbunit}...\end{cbunit} or \cbinput, with a {thebibliography} + environment in each unit or input file. To use BibTeX: input separate + files using \cbinput; at first use the package or global option [draft], + run LaTeX on the document, then BibTeX on each file that was \cbinput; + finally, remove the [draft] option and run LaTeX again (maybe twice to + get page references right). The [draft] option only affects the treatment + of \cbinput, not \include or \begin{cbunit}. + With old LaTeX, do the preliminary run using \include commands, and + change these to \cbinput for the final run(s). + + 5. Your preferred citation style (xxx.sty) may not work with chapterbib at + first, but it is easy to make it compatible: In `xxx.sty' change every + "@\@citeb" to "@\@citeb\@extra@b@citeb", and insert the line + \@ifundefined{@extra@b@citeb}{\def\@extra@b@citeb{}}{} + somewhere (but not as a comment or as part of another definition!). + If the package also redefines \bibcite then you should change that + definition, replacing "@#1" with "@#1\@extra@binfo", and insert + \gdef\@extra@binfo{} + somewhere in the file. + Some citation packages deviate quite far from LaTeX's own method of + organizing cite tags using "b@\@citeb". The instructions above catch + such extensions as "Y@\@citeb", but not more radical differences. + In such cases, try contacting the author of the citation package. + If a citation style does not define "\nocite", then that command + would not be converted when you make the patches to "@\@citeb". + Chapterbib will try to detect the hook in "\nocite", but if this fails + you may need to redefine "\nocite" (with any "@\@citeb" changed to + "@\@citeb\@extra@b@citeb") in that sty file. + + 6. The report and book document classes usually treat the bibliography as + an unnumbered chapter (\chapter*), which is not so good for bibliographies + IN a chapter. You can specify + \usepackage[sectionbib]{chapterbib} + to convert your bibliographies from \chapter* to \section*, with an + entry in the table of contents and the page-header. A bibliography in + the root file remains as a \chapter*. The [sectionbib] option modifies + the existing thebibliography environment (or the \bibsection command, if + present already), so the other formatting in the bibliography should + remain unchanged. On the other hand, if you already have a non-standard + bibliography defined, or if you want them numbered, it may be easier to + redefine \thebibliography directly, without any trickery. + Alternatively, you can use the \sectionbib command directly in the + document preamble. It takes two parameters: the sectioning command, and + the name of the sectioning level. For instance, the [sectionbib] option + does \sectionbib{\section*}{section}. Again, for the most control, it is + better to redefine \thebibliography entirely. + + 7. If you want a completely unrelated bibliography in the root file, perhaps + for a general reading list, you can provide your own bibliography there + using the thebibliography environment. I don't suppose this will appeal + to BibTeX users! + + 8. To have a cohesive bibliography for the whole document, plus individual + bibs in the chapters, put \bibliography commands in the included chapters + plus in the root file; use \usepackage[rootbib]{chapterbib}; run LaTeX; + run BibTeX on the root file; change to \usepackage{chapterbib}; run + LaTeX; run BibTeX on each included file; run LaTeX; run LaTeX. + This produces an independent `overall' bibliography which only makes + sense for various `named' bibliography styles; a style with numbering + will give unrelated numbers in each bibliography. + Actually, you probably don't *need* to ever run with [rootbib] + because, although bibTeX should complain about multiple \bibdata + commands, it should produce all the right bbl files -- but the root + \bibliographystyle must come first in the document. + + 9. To have a bibliography-by-chapter at the end instead of separate bibs + in the chapters, use \usepackage[gather]{chapterbib}, put \bibliography + commands in each file, and at the end of the main file. Run LaTeX as + in item 1. You can control the titling of the final bibliography by + defining \StartFinalBibs. The default definition is (like) + + \newcommand{\StartFinalBibs}{% + \renewcommand{\bibname}{Bibliography for Chapter \thechapter}} + + normally, but when using the [sectionbib] option it becomes + + \newcommand{\StartFinalBibs}{% + \chapter*{\bibname}\chaptermark{\bibname}% + \renewcommand{\bibname}{Chapter \thechapter}} + + You should really provide your own definition. If you are using the + article document class and \section, then you MUST do so. + + If your document class has neither section nor chapter, then you must + define \StartFinalBibs (of course) and also indicate the sectioning: + \newcommand\CBMainSectioning{motif} + if the main sectioning command is \motif, for example. + +10. To have bibliographies in each chapter PLUS a bibliography-by-chapter at + the end, follow item 9, but declare \usepackage[duplicate]{chapterbib} + (or \usepackage[duplicate,sectionbib]{chapterbib}). + +11. If you use Babel, load chapterbib before babel. + + \citeform and \citepunct: + ~~~~~~~~~~~~~~~~~~~~~~~~~ + Normally, the citations are formatted as given, but you can define \citeform + (with one parameter) to reformat every citation. Some possibilities: + \renewcommand\citeform[1]{\romannumeral 0#1}% roman numerals: [iv,x] + \renewcommand\citeform[1]{(#1)} % parentheses: [(3),(4),(7)] + \renewcommand\citeform[1]{\thechapter.#1} % number by chapter: [3.9,3.10] + If you change \citeform, you should define \@biblabel to match. + \citepunct gives the punctuation (comma-penalty-space) between items. + +%====================== END INSTRUCTIONS =========================== +% +% -----------------Implementation notes--------------- +% +% LaTeX normally uses command names in the form \b@TAG to associate a mnemonic +% TAG with the citation name or number. Chapterbib changes this to a command +% like \b@TAG@-nn where nn is a number identifying which included file is in +% effect. +% +% Tags indicating the citations and/or the input files: +% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +% \c@inputfile = counter counting included files +% \the@ipfilectr = (empty) when typesetting from the root file, +% = @-\the\c@inputfile when typesetting from an included file +% \@extra@b@citeb = \the@ipfilectr (just an alias) +% \@extra@binfo = the value of \@extra@b@citeb as saved in .aux files +% +% \b@FOO: +% ~~~~~~~ +% In the root file, the citation number (or name) is given by \b@FOO +% just like regular LaTeX, but in an \include'd file it is given by +% \b@FOO@-number. Any definition of \cite (\@citex) should refer +% to this using \csname b@\@citeb\@extra@b@citeb \endcsname. +% +% \include \cbinput and \cbunit: +% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +% Redefine the \include macro so that when a file is \include'd... +% Increment the file number, (globally) update \the@ipfilectr to be +% @-number, and write \gdef\@extra@binfo{@-number} in the (main) .aux +% file, and do regular \include. When the \include'd file is finished, +% write \gdef\@extra@binfo{} in the (main) .aux file. Globally reset +% \the@ipfilectr to {}. Provide similar \cbunit and \cbinput. +% +% \cite: +% ~~~~~~ +% Redefine \cite (\@citex actually) and \bibcite to use the file number +% tag along with the specified tag. \@citex also uses \citeform as a hook +% to reformat each individual citation. +% Only do the redefinitions if no citation style that supports chapterbib +% has been loaded--as indicated by existence of filename tags. +% +% \nocite: +% ~~~~~~~~ +% A while ago LaTeX changed its \nocite so it checks the validity of the +% (no)citation tags. This necessitated adding the "\@extra@b@citeb" hook +% to \nocite. At first, I only redefined \nocite when redefining \cite, +% but there existed citation packages that supported chapterbib by putting +% \@extra@b@citeb into \cite but which did not define \nocite at all! +% These then gave warning messages for every \nocite. With version 1.7, +% I now try exercising the \nocite command with some functions disabled: +% (1) .aux file output is locally switched off; (2) The \@ifundefined +% command is hacked to merely typeset the text of the tag; (3) this is +% done in a disappearing \hbox so it generates no output. This detects +% (by setting a global flag \@gtempa) a \nocite command that executes +% \@ifundefined but not \@extra@b@citeb. In such cases, \nocite must +% be redefined. +% +% \citepunct and \citeform: +% ~~~~~~~~~~~~~~~~~~~~~~~~~ +% These customization hooks are present in cite.sty; others (\citemid, +% \citeleft, \citeright) are not defined here because \@cite is not redefined. +% +% We redefine \@testdef so that it properly checks whether the +% \cite labels have changed. +% +% Handle package options and redefining thebibliography. [sectionbib] +% converts "\chapter*{...}" to "\section*{\bibname\markright{\bibname}% +% \addcontentsline{toc}{section}{\bibname}}" +% +% Table of contents etc: +% ~~~~~~~~~~~~~~~~~~~~~~ +% As of version 1.8, definitions of \@extra@b@citeb are written to the +% toc, lot, and lof files to avoid undefined citation tags in those tables. +% This is actually a problem in regular LaTeX with bibTeX -- cites that +% appear in those tables get numbered starting with 1, but they should +% be sequenced by where they originated -- but the problem was worse with +% chapterbib. +% +%--------------------------------------------------------------- +% +% Authors Niel Kempson (original) +% ~~~~~~~ Donald Arseneau <asnd@triumf.ca> March 1993 - Feb 2004 +% +% Changes with ver 1.11: Follow LaTeX's barring \nocite from preamble +% Changes with ver 1.10: \CBMainSectioning; \bibsection hook +% Changes with ver 1.9: sectionbib remove \@mkboth +% Changes with ver 1.8: options gather and duplicate; babel workarounds; toc +% Changes with ver 1.7: change the \sectionbib command re. headings. +% update \nocite and alter \citeform +% Changes with ver 1.6: change the \sectionbib command to take arguments. +% Changes with ver 1.5: rootbib option; item 8 in instructions. +% Changes with ver 1.4: sectionbib and draft options +% Changes with ver 1.3: rewrite: +% The filename tag is defined in each .aux file by \include, not as an +% extra parameter to \bibcite. \@bibitem & \@lbibitem are left alone. Add +% \citeform and \citepunct. Add \cbunit and \cbinput for use without \include. +% diff --git a/Master/texmf-dist/tex/latex/cite/cite.sty b/Master/texmf-dist/tex/latex/cite/cite.sty new file mode 100644 index 00000000000..5444e23f930 --- /dev/null +++ b/Master/texmf-dist/tex/latex/cite/cite.sty @@ -0,0 +1,500 @@ +% C I T E . S T Y +% +% version 4.01 (Nov 2003) +% +% Compressed, sorted lists of on-line or superscript numerical citations. +% see also drftcite.sty (And the stub overcite.sty) +% +% Copyright (C) 1989-2003 by Donald Arseneau +% These macros may be freely transmitted, reproduced, or modified +% provided that this notice is left intact. +% +% Instructions follow \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 optional variations: +% [ verbose, nospace, space, ref, nosort, noadjust, superscript, nomove ], +% \citeform,\citeleft,\citeright,\citemid,\citepunct,\citedash +% +% Set defaults: + +% [ on the left. Option [ref] does: [Ref. 12, note] +\providecommand\citeleft{[} + +% ] on the right: +\providecommand\citeright{]} + +% , (comma space) before note +\providecommand\citemid{,\penalty\@medpenalty\ } + +% , (comma thin-space) between entries; [nospace] eliminates the space +\providecommand\citepunct{,\penalty\@m\hskip.13emplus.1emminus.1em}% + +% -- (endash) designating range of numbers: +% (using \hbox avoids easy \exhyphenpenalty breaks) +\providecommand{\citedash}{\hbox{--}\penalty\@m} + +% Each number left as-is: +\providecommand\citeform{} + +% punctuation characters to move for overcite +\providecommand{\CiteMoveChars}{.,:;} + +% font selection for superscript numbers +\providecommand\OverciteFont{\fontsize\sf@size\baselineskip\selectfont} + + +% Do not repeat warnings. [verbose] reverses +\let\oc@verbo\relax + +% Default is to move punctuation: +\def\oc@movep#1{\futurelet\@tempb\@citey} + +%---------------------- +% \citen uses \@nocite to ignore spaces after commas, and write the aux file +% \citation. \citen then loops over the citation tags, using \@make@cite@list +% to make a sorted list of numbers. Finally, \citen executes \@citelist to +% compress ranges of numbers and print the list. \citen can be used by itself +% to give citation numbers without the brackets and other formatting; e.g., +% "See also ref.~\citen{junk}." +% +\DeclareRobustCommand\citen[1]{% + \begingroup + \let\@safe@activesfalse\@empty + \@nocite{#1}% ignores spaces, writes to .aux file, returns #1 in \@no@sparg + \@tempcntb\m@ne % \@tempcntb tracks highest number + \let\@h@ld\@empty % nothing held from list yet + \let\@citea\@empty % no punctuation preceding first + \let\@celt\delimiter % an unexpandable, but identifiable, token + \def\@cite@list{}% % empty list to start + \@for \@citeb:=\@no@sparg\do{\@make@cite@list}% make a sorted list of numbers + % After sorted citelist is made, execute it to compress citation ranges. + \@tempcnta\m@ne % no previous number + \let\@celt\@compress@cite \@cite@list % output number list with compression + \@h@ld % output anything held over + \endgroup + \@restore@auxhandle + } + +% For each citation, check if it is defined and if it is a number. +% if a number: insert it in the sorted \@cite@list +% otherwise: output it immediately. +% +\def\@make@cite@list{% + \expandafter\let \expandafter\@B@citeB + \csname b@\@citeb\@extra@b@citeb \endcsname + \ifx\@B@citeB\relax % undefined: output ? and warning + \@citea {\bfseries ?}\let\@citea\citepunct \G@refundefinedtrue + \@warning {Citation `\@citeb' on page \thepage\space undefined}% + \oc@verbo \global\@namedef{b@\@citeb\@extra@b@citeb}{?}% + \else % defined % remove previous line to repeat warnings + \ifcat _\ifnum\z@<0\@B@citeB _\else A\fi % a positive number, put in list + \@addto@cite@list + \else % citation is not a number, output immediately + \@citea \citeform{\@B@citeB}\let\@citea\citepunct + \fi\fi} + +% Regular definition for adding entry to cite list, with sorting + +\def\@addto@cite@list{\@tempcnta\@B@citeB \relax + \ifnum \@tempcnta>\@tempcntb % new highest, add to end (efficiently) + \edef\@cite@list{\@cite@list \@celt{\@B@citeB}}% + \@tempcntb\@tempcnta + \else % arbitrary number: insert appropriately + \edef\@cite@list{\expandafter\@sort@celt \@cite@list \@gobble @}% + \fi} +% +% \@sort@celt inserts number (\@tempcnta) into list of \@celt{num} (#1{#2}) +% \@celt must not be expandable; list should end with two vanishing tokens. +% +\def\@sort@celt#1#2{\ifx \@celt #1% parameters are \@celt {num} + \ifnum #2<\@tempcnta % number goes later in list + \@celt{#2}% + \expandafter\expandafter\expandafter\@sort@celt % continue + \else % number goes here + \@celt{\number\@tempcnta}\@celt{#2}% stop comparing +\fi\fi} + +% Check if each number follows previous and can be put in a range +% +\def\@compress@cite#1{% % This is executed for each number + \advance\@tempcnta\@ne % Now \@tempcnta is one more than the previous number + \ifnum #1=\@tempcnta % Number follows previous--hold on to it + \ifx\@h@ld\@empty % first pair of successives + \expandafter\def\expandafter\@h@ld\expandafter{\@citea + \citeform{#1}}% + \else % compressible list of successives + \def\@h@ld{\citedash \citeform{#1}}% + \fi + \else % non-successor -- dump what's held and do this one + \@h@ld \@citea \citeform{#1}% + \let\@h@ld\@empty + \fi \@tempcnta#1\let\@citea\citepunct +} + +% Make \cite choose superscript or normal + +\DeclareRobustCommand{\cite}{% + \@ifnextchar[{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}} + +% Do \cite command on line. +% +\def\@citex[#1]#2{\@cite{\citen{#2}}{#1}} + +\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 + \@restore@auxhandle} + +% 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. +% +\def\cite@adjust{\begingroup% + \@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} + + +\edef\@zero@skip{\the\z@skip} + +% Superscript cite, with no optional note. Check for punctuation first. +% +\def\@citew#1{\begingroup \leavevmode + \@if@fillglue \lastskip \relax \unskip + \def\@tempa{\@tempcnta\spacefactor + \/% this allows the last word to be hyphenated, and it looks better. + \@citess{\citen{#1}}\spacefactor\@tempcnta + \endgroup \@restore@auxhandle}% + \oc@movep\relax}% check for following punctuation (depending on options) + +% Move trailing punctuation before the citation: +% +\def\@citey{\let\@tempc\@tempa + % Watch for double periods and suppress them + \ifx\@tempb.\ifnum\spacefactor<\@bigSfactor\else + \let\@tempb\relax \let\@tempc\oc@movep + \fi\fi + % Move other punctuation + \expandafter\@citepc\CiteMoveChars\delimiter + \@tempc}% + +\def\@citepc#1{% + \ifx\@tempb#1\@empty #1\let\@tempc\oc@movep \fi + \ifx\delimiter#1\else \expandafter\@citepc\fi} + +% Replacement for \@cite which defines the formatting normally done +% around the citation list. This uses superscripts with no brackets. +% HOWEVER, trailing punctuation has already been moved over. The +% format for cites with note is given by \@cite. Redefine \@cite and/ +% or \@citex to get different appearance. I don't use \textsuperscript +% because it is defined BADLY in compatibility mode. + +\def\@citess#1{\mbox{$\m@th^{\hbox{\OverciteFont{#1}}}$}} + +% \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. +% +\DeclareRobustCommand\nocite[1]{% + \@bsphack \@nocite{#1}% + \@for \@citeb:=\@no@sparg\do{\@ifundefined{b@\@citeb\@extra@b@citeb}% + {\G@refundefinedtrue\@warning{Citation `\@citeb' undefined}% + \oc@verbo \global\@namedef{b@\@citeb\@extra@b@citeb}{?}}{}}% + \@esphack} + +\def\@nocite#1{\begingroup\let\protect\string% normalize active chars + \xdef\@no@sparg{\expandafter\@ignsp#1 \: }\endgroup% and remove ALL spaces + \if@filesw \immediate\write\@newciteauxhandle % = \@auxout, except with multibib + {\string\citation {\@no@sparg}}\fi + } + +% 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} + +% \@if@fillglue{glue}{true}{false} +\begingroup + \catcode`F=12 \catcode`I=12\catcode`L=12 + \lowercase{\endgroup + \def\@if@fillglue#1{% + \begingroup \skip@#1\relax + \expandafter\endgroup\expandafter + \@is@fil@ \the\skip@ \relax\@firstoftwo FIL\relax\@secondoftwo\@nil} + \def\@is@fil@ #1FIL#2\relax#3#4\@nil{#3} +} + +\let\nocitecount\relax % in case \nocitecount was used for drftcite + +% For the time being, just prevent gross errors from using hyperref. +% There are no hyper-links. (I will need to carry the cite tags through +% the sorting process, and use \hyper@natlinkstart) + +\providecommand\hyper@natlinkstart[1]{} +\providecommand\hyper@natlinkend{} +\providecommand\NAT@parse{\@firstofone} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% option processing + +\DeclareOption{verbose}{\def\oc@verbo#1#2#3#4{}} +\DeclareOption{nospace}{\def\citepunct{,\penalty\@m}} +\DeclareOption{space}{\def\citepunct{,\penalty\@highpenalty\ }} +\DeclareOption{ref}{\def\citeleft{[Ref.\penalty\@M\ }} +\DeclareOption{nosort}{\def\@addto@cite@list + {\edef\@cite@list{\@cite@list \@celt{\@B@citeB}}}} +\DeclareOption{sort}{}% default! +\DeclareOption{nomove}{\def\oc@movep{\@tempa}\let\@citey\oc@movep} +\DeclareOption{move}{}% default +\DeclareOption{nocompress}{% + \def\@compress@cite#1{% % This is executed for each number + \@h@ld \@citea \hyper@natlinkstart\citeform{#1}\hyper@natlinkend + \let\@h@ld\@empty \let\@citea\citepunct} +} +\DeclareOption{compress}{}% default +\DeclareOption{super}{\ExecuteOptions{superscript}} +\DeclareOption{superscript}{% + \DeclareRobustCommand{\cite}{% + \@ifnextchar[{\@tempswatrue\@citex}{\@tempswafalse\@citew}} +} +\DeclareOption{noadjust}{\let\cite@adjust\@empty}% Don't change spaces +\DeclareOption{adjust}{}% adjust space before [ ] +\DeclareOption{biblabel}{\def\@biblabel#1{\@citess{#1}\kern-\labelsep\,}} +\ProvidesPackage{cite}[2003/11/04 \space v 4.01] +\ProcessOptions + +\ifx\@citey\oc@movep\else % we are moving punctuation; must ensure sfcodes + \mathchardef\@bigSfactor3000 + \expandafter\def\expandafter\frenchspacing\expandafter{\frenchspacing + \mathchardef\@bigSfactor1001 + \sfcode`\.\@bigSfactor \sfcode`\?\@bigSfactor \sfcode`\!\@bigSfactor }% + \ifnum\sfcode`\.=\@m \frenchspacing \fi +\fi + +% Compatability with chapterbib (see use of \@extra@b@citeb) +\@ifundefined{@extra@b@citeb}{\def\@extra@b@citeb{}}{} + +% Compatability with multibib (see use of \@newciteauxhandle) (Yes, this is +% overly messy, but I asked for it... I can't have multibib putting junk after +% the cite command because it hides following punctuation, but then I have +% to restore the ordinary meaning of \@newciteauxhandle = \@auxout.) +\providecommand\@newciteauxhandle{\@auxout} +\AtBeginDocument{\@ifundefined{newcites}{\global\let\@restore@auxhandle\relax}{}} +\def\@restore@auxhandle{\def\@newciteauxhandle{\@auxout}} + + +\@ifundefined{G@refundefinedtrue}{\let\G@refundefinedtrue\relax}{} + +\@ifundefined{@safe@activesfalse}{}{} +\@ifundefined{bbl@cite@choice}{}{\@ifundefined{org@@citex}{}% + {\let\org@@citex\@citex}}% Prevent stomping by babel + + +\citenum % execute restore-catcodes + +% Aliases: +\let\citenum\citen +\let\citeonline\citen + +\endinput +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + CITE.STY + +Modify LaTeX's normal citation mechanism to: + +o Put a comma and a small space between each citation number. The option + [nospace] removes that space, and the option [space] replaces it with + an ordinary inter-word space. + +o Sort citation numbers into ascending order, printing non-numbers before + numbers. All numbers should be greater than zero. The [nosort] package + option turns off sorting. + +o Compress lists of three or more consecutive numbers to one number range + which can be split, with difficulty, after the dash. All numbers should + be greater than zero. E.g., if you used to get the (nonsense) list + [7,5,6,?,4,9,8,Einstein,6], then this style will give [?,Einstein,4-6,6-9]. + Compression of ranges is disabled by the [nocompress] package option. + +o Allow, but strongly discourage, line breaks within a series of + citations. Each number is separated by a comma and a small space. + A break at the beginning of an optional note is discouraged also. + +o Put a high-penalty breakpoint before the citation (unless you specifically + forbid it with ~ ). Also, adjust the spacing: if there is no space or if + there is extra space due to some punctuation, then change to one inter-word + space. E.g., A space will be inserted here\cite{Larry,Curly,Moe}. + +o With package option [superscript] (or [super] for short), display citation + numbers as superscripts (unless they have optional notes, causing them to + be treated as described above). Superscripted citations follow these + additional rules: + +- Superscript citations use THE SAME INPUT FORMAT as ordinary citations; this + style will ignore spaces before the citation, and move trailing punctuation + before the superscript citation. For example, "information \cite{source};" + ignores the space before \cite and puts the semicolon before the number, just + as if you had typed "information;$^{12}$". You may switch off movement with + the [nomove] package option (only relevant with [superscript]). + +- The punctuation characters that will migrate before the superscript are + listed in the macro \CiteMoveChars, which you can redefine. The default is + .,;:. Perhaps ! and ? should too, but they weren't listed in the APS style + manual I looked at, and I agree with that rule to prevent too much visual + separation. Quotes were listed, but they should never have to migrate + because both on-line and superscript versions put quotes before the citation. + This gives one difficulty --- punctuation following quotes won't migrate + inside the quotation: e.g., "``Transition State Theory''\cite{Eyring}." gives + "``Transition State Theory''.$^8$", but you may want the period inside the + quotes, thus: ``Transition State Theory.''$^8$. + +- Doubling of periods (.., ?., !.) is checked for and suppressed. The spacing + after the citation is set according to the final punctuation mark moved. + There is a problem with double periods after a capitalized abbreviation + or directly after \@ : Both of "N.A.S.A. \cite{space}." and "et al.\@ + \cite{many}." will give doubled periods. These can be fixed as follows: + "N.A.S.A\@. \cite{space}." and "et al.\ \cite{many}.". The NASA example + gives the wrong spacing when there is no citation. Sorry. Use \ after + abbreviations like et al. to get the right spacing within a sentence whether + or not a citation follows. + +- Remember, these rules regarding punctuation only apply when the [superscript] + option was given (or overcite.sty used) and the [nomove] option was NOT + given. + +o Define \citen to get just the numbers without the brackets or superscript + and extra formatting. Aliases are \citenum and \citeonline for easy + conversion to other citation packages. + +o `Citation...undefined' warnings are only given once per undefined citation + tag. In the text, missing numbers are represented with a bold `?' at the + first occurrence, and with a normal `?' thenceforth. The package option + [verbose] restores the usual repeated warnings. + +o Make \nocite, \cite, and \citen all ignore spaces in the input tags. + +Although each \cite command sorts its numbers, better compression into +ranges can usually be achieved by carefully selecting the order of the +\bibitem entries or the order of initial citations when using BibTeX. +Having the entries pre-sorted will also save processing time, especially +for long lists of numbers. + +Customization: +~~~~~~~~~~~~~~ +There are several options for \usepackage{cite}, some already mentioned. + + [superscript] use superscrpts for cites without optional notes + [super] alias for [superscript] (like natbib) + [verbose] causes warnings for undefined cites to be repeated each time + [ref] uses the format "[Ref.~12, optional note]" (useful with + the superscript option) + [nospace] eliminates the spaces after commas in the number list. + [space] uses a full inter-word space after the commas + [nosort] prevents sorting of the numbers (default is to sort, and a + [sort] option is provided for completeness). + [nomove] prevents moving the superscript cite after punctuation. + [move] is the default + [noadjust] disables `smart' handling of space before a cite + [adjust] is the default + [nocompress] inhibit compression of consecutive numbers into ranges + [compress] is the default + [biblabel] define the bibliography label as a superscript + +There are several commands that you may redefine to change the formatting +of citation lists: + +command function default +---------- ----------------------- ---------------------------- +\citeform reformats each number nothing +\citepunct printed between numbers comma + penalty + thin space +\citeleft left delimiter of list [ +\citeright right delimeter of list ] +\citemid printed before note comma + space +\citedash used in a compressed range endash + penalty +\CiteMoveChars charcters that move .,:; +\OverciteFont font selection command for superscripts + +The left/mid/right commands don't affect the formatting of superscript +citations. You may use \renewcommand to change any of these. Remember, +these commands are extensions made by this package; they are not regular +LaTeX. Some examples of changes: + +1: \renewcommand\citeform[1]{\romannumeral 0#1}} % roman numerals i,vi +2: \renewcommand\citeform[1]{(#1)} % parenthesized numbers (1)-(5),(9) +3: \renewcommand\citeform{\thechapter.} % by chapter: ^{2.18-2.21} +4: \renewcommand\citepunct{,} % no space and no breaks at commas +5: \renewcommand\citemid{; } % semicolon before optional note +6: \renewcommand\citeleft{(} % parentheses around list with note + \renewcommand\citeright{)} % parentheses around list with note + +The appearance of the whole citation list is governed by \@cite, (for full- +sized cites) and \@citess (for superscripts). For more extensive changes +to the formatting, redefine these. For example, to get brackets around the +list of superscript numbers you can do: + + \def\@citess#1{\textsuperscript{[#1]}} + +after \makeatletter. + +Related Note: The superscript option does not affect the numbering format +of the bibliography; the "[12]" style is still the default. To get +superscripts in the bibliography (at any time) you can define + + \renewcommand\@biblabel[1]{\textsuperscript{#1}} + +Aw, OK, for your convenience, there is the [biblabel] package option that +just performs this definition (sort of). + +\@extra@b@citeb is a hook for other style files to further specify +citations; for example, to number by chapter (see chapterbib.sty). + +% Version 1991: Ignore spaces after commas in the parameter list. Move most of +% \citen into \@cmpresscites for speed. Give the proper \spacefactor afterwards. +% Version 1992: make \citepunct hold the punctuation between numbers (for ease +% of changing). Add \/ to allow hyphenation of previous word, and look better +% in italics. +% 1992a: Make it work with NFSS. (Thank you C. Hamlin and Rainer Schoepf) +% +% Version 3.0 (1992): Rewrite, including sorting. Make entries like "4th" +% be treated properly as text. +% 3.1: Bug fixes (and Joerg-Martin Schwarz also convinced me to use \ifcat) +% 3.2: NFSS support was wrong--added \reset@font. Suppress repetitions of +% warnings. Include \@extra@b@citeb hook. +% 3.3: Handle LaTeX2e options. Introduce various customization hooks. +% 3.4: Heuristics to avoid removing \hspace glue before on-line \cite. +% Make \nocite ignore spaces in list, simplify. Aliases for \citen. +% Compatability with amsmath (which defines \over). +% 3.5: Replace \reset@font with \selectfont so italics are preserved +% Include \G@refundefinedtrue. Fix cite-with-note bug (Lars Engebretsen). +% 3.6: Add nosort option. +% 3.7: Add nomove option; catcode preservation and global \@no@sparg for +% french.sty; warnings in \nocite. +% 3.8: \citedash hook, fix token look-ahead (Heiko Selber), noadjust, babel. +% 3.9: More babel-compatibility hacks. Punctuation move with \frencspacing. +% 4.0: Combine overcite with cite: [superscript] option. Also add [nocompress] +% option and \CiteMoveChars; multibib hooks. +% 4.01 \bf -> \bfseries +% +% Send problem reports to asnd@triumf.ca + +Test file integrity: ASCII 32-57, 58-126: !"#$%&'()*+,-./0123456789 +:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ diff --git a/Master/texmf-dist/tex/latex/cite/drftcite.sty b/Master/texmf-dist/tex/latex/cite/drftcite.sty new file mode 100644 index 00000000000..eee05fbae77 --- /dev/null +++ b/Master/texmf-dist/tex/latex/cite/drftcite.sty @@ -0,0 +1,359 @@ +% D R F T C I T E . S T Y +% +% version 3.9 (Nov 2001) +% +% 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. +% +% Copyright (C) 1989,1991-1997,2001 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 +% +% Set defaults: + +% [ on the left. +\@ifundefined{citeleft}{\let\citeleft=[}{} + +% ] on the right: +\@ifundefined{citeright}{\let\citeright=]}{} + +% , (comma space) before note +\@ifundefined{citemid}{\def\citemid{,\penalty\@lowpenalty\ }}{} + +% , (comma space) between entries +\@ifundefined{citepunct}{ +% Default: To put space after the comma. [nospace] eliminates the space + \def\citepunct{,\penalty\@lowpenalty\ }% + }{} + +% Each citation tag left as-is: +\@ifundefined{citeform}{\def\citeform{}}{} + +% Do not repeat warnings. [verbose] reverses +\let\oc@verbo\relax + +% Use \citen to give citation name without the other formatting. +% +\edef\citen{\noexpand\protect \expandafter\noexpand\csname citen \endcsname} + +\@namedef{citen }#1{% +\begingroup +\@docite{#1}% do everything +\endgroup} + +% Make \cite robust. +% +\edef\cite{\noexpand\protect\expandafter\noexpand\csname cite \endcsname} + +\@namedef{cite }{\@ifnextchar [{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}} + +% Make \@citex refer to \citen: +% (Put a single space before the output) +% +\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. +% +\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 + \@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}}{} + +\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}}\hfil]% + \if@filesw {\let\protect\string + \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{% + {\citeform{% to get characters <>_|{}: \citeform->\tt + \expandafter \expandafter \expandafter \@gobblethree % do \csname, \string, + \expandafter \string\csname b@#1\endcsname}% % \@gobble, in that order. +}}% + +\long\def\@gobblethree#1#2#3{} + +\let\dftc@tag\@gobble + +% \@extra@b@citeb is a hook for other style files to further specify +% citations; for example, to number by chapter. +% In case no fancy bib package (chapterbib) defines it: + +\@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} + + +\@ifundefined{DeclareOption}{}% +{ \DeclareOption{nocitecount}{\nocitecount} + \DeclareOption{verbose}{\let\dftc@vdef\@gobbletwo} + \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}[2001/11/20 \space v 3.9] + \ProcessOptions } + + +\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 + +% +% 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. +% +% For included files that are skipped (not listed by \includeonly) +% input the .aux file ignoring all commands but \citation, which +% does \@advancecitecount (keeps count of the citations). This adds +% a requirement for other style files that add commands to the .aux +% file: the commands must be safe to execute an extra time. +% +\let\@dftc@include\include +\def\include#1{\relax + \ifx\DC@llap\llap \begingroup % do counting only if wanted + \@ifundefined{cp@#1}{}% don't do if .aux file not there! + {\toks@\expandafter\expandafter\expandafter{\csname cp@#1\endcsname}% + \expandafter\xdef\csname cp@#1\endcsname{\the\toks@ + \noexpand\@dftc@auxcite{#1}}}% + \endgroup\fi \@dftc@include{#1}} +% +\def\@dftc@auxcite#1{\begingroup % disable everything but \citation + \let\bibcite\@gobbletwo \let\newlabel\@gobbletwo \let\@writefile\@gobbletwo + \let\bibdata\@gobble \let\bibstyle\@gobble % already \@gobble normally + \def\citation##1{\@for\@citeb:=##1\do {\@advancecitecount}}% + \makeatletter\@input{#1.aux}\endgroup +} +\endinput + + +% D R F T C I T E . S T Y +% +% version 3.9 (Nov 2001) +% +% 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. +% +% The \citen command is provided, as in cite.sty, to print just the citation +% or list of citations without the brackets and other formatting. +% +% Drftcite keeps track of which references were cited, and issues warnings +% 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. +% +% 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}. +% +% `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]. +% +% 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: +% +% command function default +% ---------- ----------------------- ---------------------------- +% \citeform reformats every entry nothing +% \citepunct printed between numbers comma + space +% \citeleft left delimiter of list [ +% \citeright right delimeter of list ] +% \citemid printed before note comma + space +% +% This version of drftcite can co-exist with chapterbib.sty (version 1.4 +% or later). +% +% [This file is named "drftcite" because "draftcite" is too long a name for +% some computers. Sorry to those who use the spelling "draught." I could +% have abbreviated the name by selecting the shared letters in "draft" and +% "draught," but "dratcite" somehow conveys the wrong meaning.] +% +% Version 1991: Ignore spaces after commas in the parameter list. Create +% \nocitecount to turn off counting the order of citations. +% Version 3.1 (1992): protect \cite and \citen. (There is no version 3.0) +% Version 3.2 (1993): Supress repetitions of warning messages. Include +% \@extra@b@citeb hook for chapterbib.sty. Make \include handle case that +% \cp@FOO was not defined. +% Version 3.3 (1993): Fix \nocitecount. Change printing of undefined refs. +% Version 3.4 (1994): LaTex2e support, including spaces in protected command +% 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. +% +% Send problem reports to asnd@Reg.triumf.ca +% +% Test integrity of file: +% brackets: round, square, curly, angle: () [] {} <> +% backslash, slash, vertical, at, dollar, and: \ / | @ $ & +% hat, grave, acute (apostrophe), quote, tilde, under: ^ ` ' " ~ _ diff --git a/Master/texmf-dist/tex/latex/cite/overcite.sty b/Master/texmf-dist/tex/latex/cite/overcite.sty new file mode 100644 index 00000000000..ccec9ccdde4 --- /dev/null +++ b/Master/texmf-dist/tex/latex/cite/overcite.sty @@ -0,0 +1,21 @@ +% O V E R C I T E . S T Y +% +% version 4.0 (May 2003) +% +% Compressed, sorted lists of superscript numerical citations. +% +% Copyright (C) 2003 by Donald Arseneau +% These macros may be freely transmitted, reproduced, or modified +% provided that this notice is left intact. +% +% This package is provided for compatibility with the original +% overcite.sty. All it does is invoke cite.sty with the option +% [superscript]. +% +% It would be a shame to lose this pun. +% +% ------------------------------------ + \ProvidesPackage{overcite}[2003/05/27 \space v 4.0] + \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{cite}} + \ProcessOptions + \RequirePackage[superscript]{cite} |