Debian Codegraph @

texmf-dist/tex/latex/base/ifthen.sty

raw
1 %%
2 %% This is file `ifthen.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% ifthen.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% The source is maintained by the LaTeX Project team and bug
12 %% reports for it can be opened at https://latex-project.org/bugs.html
13 %% (but please observe conditions on bug reports sent to that address!)
14 %%
15 %%
16 %% Copyright (C) 1993-2025
17 %% The LaTeX Project and any individual authors listed elsewhere
18 %% in this file.
19 %%
20 %% This file was generated from file(s) of the LaTeX base system.
21 %% --------------------------------------------------------------
22 %%
23 %% It may be distributed and/or modified under the
24 %% conditions of the LaTeX Project Public License, either version 1.3c
25 %% of this license or (at your option) any later version.
26 %% The latest version of this license is in
27 %% https://www.latex-project.org/lppl.txt
28 %% and version 1.3c or later is part of all distributions of LaTeX
29 %% version 2008 or later.
30 %%
31 %% This file has the LPPL maintenance status "maintained".
32 %%
33 %% This file may only be distributed together with a copy of the LaTeX
34 %% base system. You may however distribute the LaTeX base system without
35 %% such generated files.
36 %%
37 %% The list of all files belonging to the LaTeX base distribution is
38 %% given in the file `manifest.txt'. See also `legal.txt' for additional
39 %% information.
40 %%
41 %% The list of derived (unpacked) files belonging to the distribution
42 %% and covered by LPPL is defined by the unpacking scripts (with
43 %% extension .ins) which are part of the distribution.
44 %%
45 %% File `ifthen.dtx'.
46 %% Copyright (C) 1991 by Leslie Lamport
47 %% Copyright (C) 1994-2025 LaTeX project, David Carlisle
48 %% all rights reserved.
49 %%
50 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
51 \ProvidesPackage{ifthen}
52 [2024/03/16 v1.1e Standard LaTeX ifthen package (DPC)]
53 \def\TE@throw{\@ne=\@ne\noexpand\fi}
54 \def\boolean#1#2{%
55 \TE@throw\expandafter\noexpand\csname if#1\endcsname#2}
56 \def\TE@length#1#2{\TE@throw\noexpand\ifdim#1#2}
57 \def\TE@odd#1#2{%
58 \TE@throw\noexpand\TE@@odd#1\noexpand\@nil\noexpand\ifodd\count@#2}
59 \def\TE@@odd#1#2\@nil{%
60 \@defaultunits
61 \count@\if-#1-0\else0\expandafter#1\fi#2\relax\@nnil}
62 \def\TE@repl#1#2{%
63 \long\def\@tempc##1#1##2{%
64 \def\@tempa{##2}\def\@tempb{\@tempc}%
65 \ifx\@tempa\@tempb
66 \toks@\expandafter{\the\toks@##1}%
67 \expandafter\@gobble
68 \else
69 \toks@\expandafter{\the\toks@##1#2}%
70 \expandafter\@tempc
71 \fi
72 ##2}%
73 \expandafter\toks@\expandafter{\expandafter}%
74 \expandafter\@tempc\the\toks@#1\@tempc}
75 \@ifl@t@r\fmtversion{2022/06/01}
76 {\def\TE@ref@exp{\let\pageref\@kernel@pageref@exp
77 \let\ref\@kernel@ref@exp}}
78 {\def\TE@ref@exp{\def\@setref##1##2##3{%
79 \ifx##1\relax\z@\else\expandafter##2##1\fi}}}
80 \begingroup
81 \lccode`\~`\> %
82 \catcode`\+\active
83 \lccode`\+`\< %
84 \catcode`\!\active
85 \lccode`\!`\= %
86 \lowercase{\endgroup
87 \def\TE@repl@active{%
88 \TE@repl~>%
89 \TE@repl+<%
90 \TE@repl!=%
91 }
92 \long\def\ifthenelse#1{%
93 \toks@{#1}%
94 \TE@repl\or\TE@or
95 \TE@repl\and\TE@and
96 \TE@repl\not\TE@neg
97 \TE@repl@active
98 \TE@repl\OR\TE@or
99 \TE@repl\AND\TE@and
100 \TE@repl\NOT\TE@neg
101 \begingroup
102 \let\protect\@unexpandable@protect
103 \TE@ref@exp
104 \def\value##1{\the\csname c@##1\endcsname}%
105 \let\equal\TE@equal \let\(\TE@lparen \let\)\TE@rparen
106 \let\isodd\TE@odd \let\lengthtest\TE@length
107 \let\isundefined\TE@undef
108 \begingroup
109 \let\@tempa\relax\let\@tempb\relax
110 \xdef\@gtempa{\expandafter\TE@eval\the\toks@\TE@endeval}%
111 \endgroup
112 \@gtempa
113 \expandafter\endgroup\ifTE@val
114 \expandafter\@firstoftwo
115 \else
116 \expandafter\@secondoftwo
117 \fi}%
118 }
119 \def\TE@eval{\noexpand\TE@negatefalse\noexpand\iftrue\noexpand\ifnum}
120 \newif\ifTE@val
121 \newif\ifTE@negate
122 \def\TE@endeval{\relax
123 \noexpand\TE@setvaltrue\noexpand
124 \else
125 \noexpand\TE@setvalfalse\noexpand
126 \fi
127 \noexpand\TE@negatefalse\noexpand
128 \fi}
129 \def\TE@setvaltrue{%
130 \ifTE@negate\TE@valfalse\else\TE@valtrue\fi}
131 \def\TE@setvalfalse{\let\ifTE@val\ifTE@negate}
132 \def\TE@or{\TE@endeval\noexpand\ifTE@val\noexpand\else\noexpand\ifnum}
133 \def\TE@and{\TE@endeval\noexpand\ifTE@val\noexpand\ifnum}
134 \def\TE@neg{\TE@throw\noexpand\TE@negswitch\noexpand\ifnum}
135 \def\TE@negswitch{\ifTE@negate\TE@negatefalse\else\TE@negatetrue\fi}
136 \def\TE@lparen#1{\TE@throw\begingroup\TE@eval#1}
137 \def\TE@rparen#1{%
138 \TE@endeval
139 \noexpand\expandafter\endgroup\noexpand\ifTE@val#1}
140 \long\def\TE@equal#1#2#3{\TE@throw
141 \def\@tempa{#1}\def\@tempb{#2}%
142 \noexpand\ifx\@tempa\@tempb#3}
143 \def\setboolean#1#2{%
144 \lowercase{\def\@tempa{#2}}%
145 \@ifundefined{@tempswa\@tempa}%
146 {\PackageError{ifthen}%
147 {You can only set a boolean to `true' or `false'}\@ehc}%
148 {\@ifundefined{#1\@tempa}%
149 {\PackageError{ifthen}{Boolean #1 undefined}\@ehc}%
150 {\csname#1\@tempa\endcsname}}}
151 \def\newboolean#1{%
152 \expandafter\@ifdefinable\csname if#1\endcsname{%
153 \expandafter\newif\csname if#1\endcsname}}
154 \def\provideboolean#1{%
155 \@ifundefined{if#1}{%
156 \expandafter\newif\csname if#1\endcsname}\relax}
157 \long\def\whiledo#1#2{%
158 \ifthenelse{#1}%
159 {\@whiledotrue
160 \@whilesw\if@whiledo\fi
161 {#2%
162 \ifthenelse{#1}\@whiledotrue\@whiledofalse}}%
163 {}%
164 }
165 \def\TE@undef#1#2{%
166 \TE@throw\noexpand\ifx\noexpand\@undefined\noexpand#1#2}
167 \newif\if@whiledo
168 \endinput
169 %%
170 %% End of file `ifthen.sty'.