summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/thmtools/unique.sty
blob: 8914828f34bffa164adfff83fb954116df5d58b2 (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
%%
%% This is file `unique.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% unique.dtx  (with options: `code')
%% This is a generated file.
%% 
%% This file is part of the `thmtools' package.
%% The `thmtools' package has the LPPL maintenance status: maintained.
%% Current Maintainer is Yukai Chou, muzimuzhi@gmail.com
%% 
%% Copyright (C) 2008-2014 by Ulrich M. Schwarz
%% Copyright (C) 2019      by Frank Mittelbach
%% Copyright (C) 2020-     by Yukai Chou
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, version 1.3c.
%% This version is obtainable at
%% http://www.latex-project.org/lppl/lppl-1-3c.txt
%% 
%% 
\NeedsTeXFormat {LaTeX2e}
\ProvidesPackage {unique}[2020/08/01 v0.72]

\DeclareOption{unq}{%
  \newwrite\uniq@channel
  \InputIfFileExists{\jobname.unq}{}{}%
  \immediate\openout\uniq@channel=\jobname.unq
  \AtEndDocument{%
    \immediate\closeout\uniq@channel%
  }
}
\DeclareOption{aux}{%
  \let\uniq@channel\@auxout
}

\newcommand\setuniqmark[1]{%
  \expandafter\ifx\csname uniq@now@#1\endcsname\relax
    \global\@namedef{uniq@now@#1}{\uniq@ONE}%
  \else
    \expandafter\ifx\csname uniq@now@#1\endcsname\uniq@MANY
    \else
      \immediate\write\uniq@channel{%
        \string\uniq@setmany{#1}%
      }%
      \ifuniq{#1}{%
        \uniq@warnnotunique{#1}%
      }{}%
    \fi
    \global\@namedef{uniq@now@#1}{\uniq@MANY}%
  \fi
}
\newcommand\ifuniq[1]{%
  \expandafter\ifx\csname uniq@last@#1\endcsname\uniq@MANY
    \expandafter\@secondoftwo
  \else
    \expandafter\@firstoftwo
  \fi
}
\def\uniq@ONE{\uniq@ONE}
\def\uniq@MANY{\uniq@MANY}
\newif\if@uniq@rerun
\def\uniq@setmany#1{%
  \global\@namedef{uniq@last@#1}{\uniq@MANY}%
  \AtEndDocument{%
    \uniq@warnifunique{#1}%
  }%
}
\def\uniq@warnifunique#1{%
  \expandafter\ifx\csname uniq@now@#1\endcsname\uniq@MANY\else
    \PackageWarningNoLine{uniq}{%
      `#1' is unique now.\MessageBreak
      Rerun LaTeX to pick up the change%
    }%
    \@uniq@reruntrue
  \fi
}
\def\uniq@warnnotunique#1{%
  \PackageWarningNoLine{uniq}{%
    `#1' is not unique anymore.\MessageBreak
    Rerun LaTeX to pick up the change%
  }%
  \@uniq@reruntrue
}
\def\uniq@maybesuggestrerun{%
  \if@uniq@rerun
    \PackageWarningNoLine{uniq}{%
      Uniquenesses have changed. \MessageBreak
      Rerun LaTeX to pick up the change%
    }%
  \fi
}
\AtEndDocument{%
  \immediate\write\@auxout{\string\uniq@maybesuggestrerun}%
}
\ExecuteOptions{aux}
\ProcessOptions\relax
\endinput
%%
%% End of file `unique.sty'.