summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/notoccite/notoccite.sty
blob: af4ec3bd0481f7e9e073fa1bc065c07b708efbd6 (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
% notoccite.sty        no t.o.c. cite     Jul 20, 2000
% Donald Arseneau      asnd@triumf.ca     TRIUMF, Vancouver, Canada,
% This is unrestricted software contributed to the public domain.
%
% Ordinarily, cites used in titles or figure captions also appear in 
% the table of contents and list of figures.  If you then run bibtex
% using the unsrt (unsorted) style, they get numbered starting from 1,
% not the number they should have in the main text.
%
% A good option is to avoid cites in titles, and to specify optional
% caption text without cites:
%    \caption [Picture of a bird.]{Picture of a bird \cite{audobon}.} 
%
% If you must use moving cites, you could manage them by deleting toc 
% and lof files, then running latex once, then bibtex.  However, the
% following definition fixes the problem so you don't need to worry 
% about that.  
%
% *NOTE*  This definition works for the ordinary LaTeX definitions
% for \cite and others (\addtocontents, \label) but it may well
% fail when used with various packages for citations or cross
% references.  
%
% It works by locally setting \@fileswfalse, which is something like
% \nofiles, but \@fileswfalse does not affect \label or \addtocontents.
% \nofiles does most of its work by redefining \protected@write, and
% neither \addtocontents nor \label check for \if@filesw.  \cite *does* 
% check \if@filesw.

\ProvidesPackage{notoccite}[2000/07/20]
\def\@starttoc#1{%
  \begingroup
    \@fileswfalse
    \makeatletter
    \@input{\jobname.#1}%
  \endgroup
  \if@filesw
    \expandafter\newwrite\csname tf@#1\endcsname
    \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
  \fi
  \@nobreakfalse
}