| 1 |
%% |
| 2 |
%% This is file `uniquecounter.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% uniquecounter.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% This is a generated file. |
| 10 |
%% |
| 11 |
%% Project: uniquecounter |
| 12 |
%% Version: 2019/12/15 v1.4 |
| 13 |
%% |
| 14 |
%% Copyright (C) |
| 15 |
%% 2009, 2011 Heiko Oberdiek |
| 16 |
%% 2016-2019 Oberdiek Package Support Group |
| 17 |
%% |
| 18 |
%% This work may be distributed and/or modified under the |
| 19 |
%% conditions of the LaTeX Project Public License, either |
| 20 |
%% version 1.3c of this license or (at your option) any later |
| 21 |
%% version. This version of this license is in |
| 22 |
%% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 23 |
%% and the latest version of this license is in |
| 24 |
%% https://www.latex-project.org/lppl.txt |
| 25 |
%% and version 1.3 or later is part of all distributions of |
| 26 |
%% LaTeX version 2005/12/01 or later. |
| 27 |
%% |
| 28 |
%% This work has the LPPL maintenance status "maintained". |
| 29 |
%% |
| 30 |
%% The Current Maintainers of this work are |
| 31 |
%% Heiko Oberdiek and the Oberdiek Package Support Group |
| 32 |
%% https://github.com/ho-tex/uniquecounter/issues |
| 33 |
%% |
| 34 |
%% |
| 35 |
%% The Base Interpreter refers to any `TeX-Format', |
| 36 |
%% because some files are installed in TDS:tex/generic//. |
| 37 |
%% |
| 38 |
%% This work consists of the main source file uniquecounter.dtx |
| 39 |
%% and the derived files |
| 40 |
%% uniquecounter.sty, uniquecounter.pdf, uniquecounter.ins, |
| 41 |
%% uniquecounter.drv, uniquecounter-example.tex, |
| 42 |
%% uniquecounter-test1.tex, uniquecounter-test2.tex, |
| 43 |
%% uniquecounter-test3.tex. |
| 44 |
%% |
| 45 |
\begingroup\catcode61\catcode48\catcode32=10\relax% |
| 46 |
\catcode13=5 % ^^M |
| 47 |
\endlinechar=13 % |
| 48 |
\catcode35=6 % # |
| 49 |
\catcode39=12 % ' |
| 50 |
\catcode44=12 % , |
| 51 |
\catcode45=12 % - |
| 52 |
\catcode46=12 % . |
| 53 |
\catcode58=12 % : |
| 54 |
\catcode64=11 % @ |
| 55 |
\catcode123=1 % { |
| 56 |
\catcode125=2 % } |
| 57 |
\expandafter\let\expandafter\x\csname [email protected]\endcsname |
| 58 |
\ifx\x\relax % plain-TeX, first loading |
| 59 |
\else |
| 60 |
\def\empty{}% |
| 61 |
\ifx\x\empty % LaTeX, first loading, |
| 62 |
% variable is initialized, but \ProvidesPackage not yet seen |
| 63 |
\else |
| 64 |
\expandafter\ifx\csname PackageInfo\endcsname\relax |
| 65 |
\def\x#1#2{% |
| 66 |
\immediate\write-1{Package #1 Info: #2.}% |
| 67 |
}% |
| 68 |
\else |
| 69 |
\def\x#1#2{\PackageInfo{#1}{#2, stopped}}% |
| 70 |
\fi |
| 71 |
\x{uniquecounter}{The package is already loaded}% |
| 72 |
\aftergroup\endinput |
| 73 |
\fi |
| 74 |
\fi |
| 75 |
\endgroup% |
| 76 |
\begingroup\catcode61\catcode48\catcode32=10\relax% |
| 77 |
\catcode13=5 % ^^M |
| 78 |
\endlinechar=13 % |
| 79 |
\catcode35=6 % # |
| 80 |
\catcode39=12 % ' |
| 81 |
\catcode40=12 % ( |
| 82 |
\catcode41=12 % ) |
| 83 |
\catcode44=12 % , |
| 84 |
\catcode45=12 % - |
| 85 |
\catcode46=12 % . |
| 86 |
\catcode47=12 % / |
| 87 |
\catcode58=12 % : |
| 88 |
\catcode64=11 % @ |
| 89 |
\catcode91=12 % [ |
| 90 |
\catcode93=12 % ] |
| 91 |
\catcode123=1 % { |
| 92 |
\catcode125=2 % } |
| 93 |
\expandafter\ifx\csname ProvidesPackage\endcsname\relax |
| 94 |
\def\x#1#2#3[#4]{\endgroup |
| 95 |
\immediate\write-1{Package: #3 #4}% |
| 96 |
\xdef#1{#4}% |
| 97 |
}% |
| 98 |
\else |
| 99 |
\def\x#1#2[#3]{\endgroup |
| 100 |
#2[{#3}]% |
| 101 |
\ifx#1\@undefined |
| 102 |
\xdef#1{#3}% |
| 103 |
\fi |
| 104 |
\ifx#1\relax |
| 105 |
\xdef#1{#3}% |
| 106 |
\fi |
| 107 |
}% |
| 108 |
\fi |
| 109 |
\expandafter\x\csname [email protected]\endcsname |
| 110 |
\ProvidesPackage{uniquecounter}% |
| 111 |
[2019/12/15 v1.4 Provide unlimited unique counter (HO)]% |
| 112 |
\begingroup\catcode61\catcode48\catcode32=10\relax% |
| 113 |
\catcode13=5 % ^^M |
| 114 |
\endlinechar=13 % |
| 115 |
\catcode123=1 % { |
| 116 |
\catcode125=2 % } |
| 117 |
\catcode64=11 % @ |
| 118 |
\def\x{\endgroup |
| 119 |
\expandafter\edef\csname uqc@AtEnd\endcsname{% |
| 120 |
\endlinechar=\the\endlinechar\relax |
| 121 |
\catcode13=\the\catcode13\relax |
| 122 |
\catcode32=\the\catcode32\relax |
| 123 |
\catcode35=\the\catcode35\relax |
| 124 |
\catcode61=\the\catcode61\relax |
| 125 |
\catcode64=\the\catcode64\relax |
| 126 |
\catcode123=\the\catcode123\relax |
| 127 |
\catcode125=\the\catcode125\relax |
| 128 |
}% |
| 129 |
}% |
| 130 |
\x\catcode61\catcode48\catcode32=10\relax% |
| 131 |
\catcode13=5 % ^^M |
| 132 |
\endlinechar=13 % |
| 133 |
\catcode35=6 % # |
| 134 |
\catcode64=11 % @ |
| 135 |
\catcode123=1 % { |
| 136 |
\catcode125=2 % } |
| 137 |
\def\TMP@EnsureCode#1#2{% |
| 138 |
\edef\uqc@AtEnd{% |
| 139 |
\uqc@AtEnd |
| 140 |
\catcode#1=\the\catcode#1\relax |
| 141 |
}% |
| 142 |
\catcode#1=#2\relax |
| 143 |
} |
| 144 |
\TMP@EnsureCode{33}{12}% ! |
| 145 |
\TMP@EnsureCode{39}{12}% ' |
| 146 |
\TMP@EnsureCode{42}{12}% * |
| 147 |
\TMP@EnsureCode{43}{12}% + |
| 148 |
\TMP@EnsureCode{46}{12}% . |
| 149 |
\TMP@EnsureCode{47}{12}% / |
| 150 |
\TMP@EnsureCode{91}{12}% [ |
| 151 |
\TMP@EnsureCode{93}{12}% ] |
| 152 |
\TMP@EnsureCode{96}{12}% ` |
| 153 |
\edef\uqc@AtEnd{\uqc@AtEnd\noexpand\endinput} |
| 154 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 155 |
\expandafter\ifx\csname RequirePackage\endcsname\relax |
| 156 |
\def\TMP@RequirePackage#1[#2]{% |
| 157 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 158 |
\expandafter\ifx\csname ver@#1.sty\endcsname\relax |
| 159 |
\input #1.sty\relax |
| 160 |
\fi |
| 161 |
}% |
| 162 |
\TMP@RequirePackage{bigintcalc}[2007/11/11]% |
| 163 |
\TMP@RequirePackage{infwarerr}[2007/09/09]% |
| 164 |
\else |
| 165 |
\RequirePackage{bigintcalc}[2007/11/11]% |
| 166 |
\RequirePackage{infwarerr}[2007/09/09]% |
| 167 |
\fi |
| 168 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 169 |
\expandafter\ifx\csname numexpr\endcsname\relax |
| 170 |
\def\uqc@IncNum#1{% |
| 171 |
\begingroup |
| 172 |
\count@=\csname uqc@cnt@#1\endcsname\relax |
| 173 |
\advance\count@\@ne |
| 174 |
\expandafter\xdef\csname uqc@cnt@#1\endcsname{% |
| 175 |
\number\count@ |
| 176 |
}% |
| 177 |
\ifnum\count@=2147483647 % |
| 178 |
\global\expandafter\let\csname uqc@inc@#1\endcsname |
| 179 |
\uqc@IncBig |
| 180 |
\fi |
| 181 |
\endgroup |
| 182 |
}% |
| 183 |
\else |
| 184 |
\def\uqc@IncNum#1{% |
| 185 |
\expandafter\xdef\csname uqc@cnt@#1\endcsname{% |
| 186 |
\number\numexpr\csname uqc@cnt@#1\endcsname+1% |
| 187 |
}% |
| 188 |
\ifnum\csname uqc@cnt@#1\endcsname=2147483647 % |
| 189 |
\global\expandafter\let\csname uqc@inc@#1\endcsname |
| 190 |
\uqc@IncBig |
| 191 |
\fi |
| 192 |
}% |
| 193 |
\fi |
| 194 |
\def\uqc@IncBig#1{% |
| 195 |
\expandafter\xdef\csname uqc@cnt@#1\endcsname{% |
| 196 |
\expandafter\expandafter\expandafter |
| 197 |
\BigIntCalcInc\csname uqc@cnt@#1\endcsname!% |
| 198 |
}% |
| 199 |
} |
| 200 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 201 |
\expandafter\ifx\csname newcommand\endcsname\relax |
| 202 |
\def\uqc@Def#1{\def#1##1}% |
| 203 |
\else |
| 204 |
\def\uqc@Def#1{\newcommand*{#1}[1]}% |
| 205 |
\fi |
| 206 |
\uqc@Def\UniqueCounterNew{% |
| 207 |
\expandafter\ifx\csname uqc@cnt@#1\endcsname\relax |
| 208 |
\expandafter\xdef\csname uqc@cnt@#1\endcsname{0}% |
| 209 |
\global\expandafter\let\csname uqc@inc@#1\endcsname\uqc@IncNum |
| 210 |
\@PackageInfo{uniquecounter}{New unique counter `#1'}% |
| 211 |
\else |
| 212 |
\@PackageError{uniquecounter}{Unique counter `#1' is already defined}\@ehc |
| 213 |
\fi |
| 214 |
} |
| 215 |
\uqc@Def\UniqueCounterIncrement{% |
| 216 |
\expandafter\ifx\csname uqc@cnt@#1\endcsname\relax |
| 217 |
\@PackageError{uniquecounter}{Unique counter `#1' is undefined}\@ehc |
| 218 |
\else |
| 219 |
\csname uqc@inc@#1\endcsname{#1}% |
| 220 |
\fi |
| 221 |
} |
| 222 |
\uqc@Def\UniqueCounterGet{% |
| 223 |
\csname uqc@cnt@#1\endcsname |
| 224 |
} |
| 225 |
\uqc@Def\UniqueCounterCall{% |
| 226 |
\expandafter\ifx\csname uqc@cnt@#1\endcsname\relax |
| 227 |
\@PackageError{uniquecounter}{Unique counter `#1' is undefined}\@ehc |
| 228 |
\expandafter\uqc@Call\expandafter0% |
| 229 |
\else |
| 230 |
\UniqueCounterIncrement{#1}% |
| 231 |
\expandafter\expandafter\expandafter\uqc@Call |
| 232 |
\expandafter\expandafter\expandafter{% |
| 233 |
\csname uqc@cnt@#1\expandafter\endcsname\expandafter |
| 234 |
}% |
| 235 |
\fi |
| 236 |
} |
| 237 |
\long\def\uqc@Call#1#2{#2{#1}}% |
| 238 |
\uqc@AtEnd% |
| 239 |
%% \section{Installation} |
| 240 |
\endinput |
| 241 |
%% |
| 242 |
%% End of file `uniquecounter.sty'. |