summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/newthm/newthm.sty
blob: 92ab26ff12dd88a5e9a8f5d194b4f10304c45e1b (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
\ifx\theoremstyle\undefined\else\typeout{WARNING: Package \string"theorem\string" will not
be loaded twice.}\expandafter\endinput\fi
%%
%% Original "theorem.sty" von Frank Mittelbach
%%
\def\filedate{1996/12/29}
%\def\docdate{1996/09/01}
\def\fileversion{1.0}
\def\filename{newthm.sty}
\ProvidesPackage{newthm}[\filedate]
\typeout{** Andreas's Document Style 'newthm' <\filedate>.}
\DeclareOption*{\PackageWarning{newthm}{Unknown Option '\CurrentOption'}}
\ProcessOptions
%%
%% Theoremdefinitionen erm"oglichen
%%
\gdef\theoremstyle#1{%
   \@ifundefined{th@#1}{\@warning
          {Unknown theoremstyle `#1'. Using `plain'}%
          \theorem@style{plain}}%
      {\theorem@style{#1}}%
      \begingroup
        \csname th@\the\theorem@style \endcsname
      \endgroup}
\global\let\@begintheorem\relax
\global\let\@opargbegintheorem\relax
\newtoks\theorem@style
\global\theorem@style{plain}
\gdef\theorembodyfont#1{%
   \def\@tempa{#1}%
   \ifx\@tempa\@empty
    \theorem@bodyfont{}%
   \else
    \theorem@bodyfont{\reset@font#1}%
   \fi
   }
\newtoks\theorem@bodyfont
\global\theorem@bodyfont{}
\gdef\theoremheaderfont#1{\gdef\theorem@headerfont{#1}%
       \gdef\theoremheaderfont##1{%
        \typeout{\string\theoremheaderfont\space should be used
                 only once.}}}
\ifx\upshape\undefined
\gdef\theorem@headerfont{\bfseries}
\else \gdef\theorem@headerfont{\normalfont\bfseries}\fi
%%
%% Stile
%%
\gdef\th@plain{\@input@{n-thp.sty}}
\gdef\th@break{\@input@{n-thb.sty}}
\gdef\th@marginbreak{\@input@{n-thmb.sty}}
\gdef\th@changebreak{\@input@{n-thcb.sty}}
\gdef\th@change{\@input@{n-thc.sty}}
\gdef\th@margin{\@input@{n-thm.sty}}
%%
%% Ohne Nummer
%%
\gdef\th@plainNo{\@input@{n-thpno.sty}}
\gdef\th@breakNo{\@input@{n-thbno.sty}}
\gdef\th@marginbreakNo{\@input@{n-thmbno.sty}}
\gdef\th@changebreakNo{\@input@{n-thcbno.sty}}
\gdef\th@changeNo{\@input@{n-thcno.sty}}
\gdef\th@marginNo{\@input@{n-thmno.sty}}
%%
%% Ein Trennzeichen?
%%
\gdef\theoremseparator#1{\gdef\th@thmsep{#1}
   \gdef\theoremseparator##1{
        \typeout{\string\theoremseparator\space should be used
                 only once.}}}
     
\gdef\th@thmsep{}
%%
%% Latexinterna umdefinieren
%%
\gdef\@xnthm#1#2[#3]{\expandafter\@ifdefinable\csname #1\endcsname
   {\vig@definelthm{#1}
    \@definecounter{#1}\@addtoreset{#1}{#3}%
    \expandafter\xdef\csname the#1\endcsname
      {\expandafter \noexpand \csname the#3\endcsname
       \@thmcountersep \@thmcounter{#1}}%
    \def\@tempa{\global\@namedef{#1}}%
    \expandafter \@tempa \expandafter{%
      \csname th@\the \theorem@style
            \expandafter \endcsname \the \theorem@bodyfont
     \@thm{#1}{#2}{#1}}%
    \global \expandafter \let \csname end#1\endcsname \@endtheorem
   }}
\gdef\@ynthm#1#2{\expandafter\@ifdefinable\csname #1\endcsname
   {\vig@definelthm{#1}\@definecounter{#1}%
    \expandafter\xdef\csname the#1\endcsname{\@thmcounter{#1}}%
    \def\@tempa{\global\@namedef{#1}}\expandafter \@tempa
     \expandafter{\csname th@\the \theorem@style \expandafter
     \endcsname \the\theorem@bodyfont \@thm{#1}{#2}{#1}}%
    \global \expandafter \let \csname end#1\endcsname \@endtheorem}}
\gdef\@othm#1[#2]#3{\expandafter\@ifdefinable\csname #1\endcsname
    {\vig@definelthm{#1}\expandafter \xdef \csname the#1\endcsname
     {\expandafter \noexpand \csname the#2\endcsname}%
    \def\@tempa{\global\@namedef{#1}}\expandafter \@tempa
     \expandafter{\csname th@\the \theorem@style \expandafter
     \endcsname \the\theorem@bodyfont \@thm{#2}{#3}{#1}}%
    \global \expandafter \let \csname end#1\endcsname \@endtheorem}}
\gdef\@ythm#1#2#3[#4]{\@opargbegintheorem{#2}{\csname the#1\endcsname}{#4}\ignorespaces
 \vig@thmcaption{#3}{{#2}{\csname the#1\endcsname}{#4}}}
\gdef\@thm#1#2#3{\refstepcounter{#1}%
   \trivlist
   \@topsep \theorempreskipamount               % used by first \item
   \@topsepadd \theorempostskipamount           % used by \@endparenv
   \@ifnextchar [%
   {\@ythm{#1}{#2}{#3}}%
   {\@begintheorem{#2}{\csname the#1\endcsname}%
    \vig@thmcaption{#3}{{#2}{\csname the#1\endcsname}{}}\ignorespaces}}
\global\let\@xthm\relax
\newskip\theorempreskipamount
\newskip\theorempostskipamount
\global\setlength\theorempreskipamount{12pt plus 5pt minus 3pt}
\global\setlength\theorempostskipamount{8pt plus 3pt minus 1.5pt}
\global\let\@endtheorem=\endtrivlist
\@onlypreamble\@xnthm
\@onlypreamble\@ynthm
\@onlypreamble\@othm
\@onlypreamble\newtheorem
\@onlypreamble\theoremstyle
\@onlypreamble\theorembodyfont
\@onlypreamble\theoremheaderfont
\@onlypreamble\theoremseparator
\@onlypreamble\theoremnumbering
\theoremstyle{plain}
%%
%% Folgende Definitionen, um Listen zu ermoeglichen
%% Dokumentation anhand \begin{erinnerung}[A_n], 1.Erinnerung, Seite 5
%%
% \vig@thmcaption schreibt ins aux-file, 
%   z.B.  \contentsline {thm}{{Erinnerung}{1}{A_n}}}{5}
% \vig@thmcaption wird für jedes Theorem aufgerufen
%   die beiden Parameter werden einfach weitergereicht
%
\def\vig@thmcaption#1#2{\vig@@thmcaption{#1}#2}
\def\vig@@thmcaption#1#2#3#4{\begingroup% \x, \y local
    \def\y##1->##2\relax{##2}% "macro:->" entfernen
    \def\x{#4}%
    \edef\x{{#2}{#3}{\expandafter\y\meaning\x\relax}}% do it!
    \addcontentsline{thm}{#1}{\x}%
    \endgroup}
%%
%% \vig@@thmline gibt die einzelnen Zeilen aus
%% Aufruf z.B. \vig@@thmline{Erinnerung}{1}{A_n}{5}
%%
\def\theoremlistall{%
    \def\vig@@thmline##1##2##3##4{%
        \@dottedtocline{-2}{0em}{2.3em}%
                   {\protect\numberline{##2}##3}% 1, A_n
                   {##4}}% Seite
}
\def\theoremlistallname{%
    \def\vig@@thmline##1##2##3##4{%
         \@dottedtocline{-2}{0em}{2.3em}%
                   {##1 \protect\numberline{##2}##3}% 1, A_n
                   {##4}}% Seite
}
%                   
% Um nur Theoreme mit optionalem Text zu erhalten, \vig@@thmline 
% umdefinieren
%
\def\theoremlistoptional{%
    \def\vig@@thmline##1##2##3##4{%
         \ifx\empty ##3%
         \else%
            \@dottedtocline{-2}{0em}{2.3em}%
                     {\protect\numberline{##2}##3}%
                     {##4}%
         \fi}%
}
\def\theoremlistoptname{%
    \def\vig@@thmline##1##2##3##4{%
         \ifx\empty ##3%
         \else%
            \@dottedtocline{-2}{0em}{2.3em}%
                     {##1 \protect\numberline{##2}##3}%
                     {##4}%
         \fi}%
}
\theoremlistall
%
\def\theoremlisttype#1{\csname vig@thml@#1\endcsname}
\def\vig@thml@all{\theoremlistall}
\def\vig@thml@opt{\theoremlistoptional}
\def\vig@thml@optname{\theoremlistoptname}
\def\vig@thml@allname{\theoremlistallname}
%
% \vig@thmline ruft \vig@@thmline auf, und enfernt die äußeren {}
% Klammern bei {{Erinnerung}{1}{A_n}}
%
\def\vig@thmline#1#2{\vig@@thmline#1{#2}}
%
% Um Zeilen zu ignorieren wird \vig@lgobble benötigt
%
\def\vig@lgobble#1#2{}
%
% \vig@definelthm wird durch \newtheorem aufgerufen
% und definiert die Befehle \l@erinnerung etc.
%
\def\vig@definelthm#1{%
 \expandafter\gdef\csname l@#1\endcsname{\vig@lgobble}%
}
%
% listoftheorems{satz,satz*,aufgabe}
%
\def\listtheorems#1{\begingroup%
  \c@tocdepth=-2%
  \def\thm@list{#1}\thm@processlist%
  \endgroup}
\def\thm@processlist{%
 \begingroup%
 \typeout{** Generating table of \thm@list}%
 \@for\thm@currentlist:=\thm@list\do{%
  \ifx\thm@currentlist\@empty\else%
   \expandafter\def\csname l@\thm@currentlist\endcsname{\vig@thmline}%
  \fi%
 }
 \@input{\jobname .thm}
 \endgroup
}
%
% \enablelistoftheorems startet das Schreiben in das thm-file
% !! Dieser Befehl muss nach dem letzten listtheorems stehen,
% am besten vor \end{document}
%
\def\enablelistoftheorems{\@starttoc{thm}}
%%
%%
%% Griechische Counter
%%
%%
\def\@greek#1{\if b\expandafter\@car\f@series\@nil\boldmath\fi%
 \ifcase#1\or$\alpha$\or$\beta$\or$\gamma$\or$\delta$\or$\varepsilon$%
  \or$\zeta$\or$\eta$\or$\vartheta$\or$\iota$\or$\kappa$\or$\lambda$\or$%
  \mu$\or$\nu$\or$\xi$\or$ o$\or$\varpi$\or$\varrho$\or$\varsigma$\or$\tau$%
  \or$\upsilon$\or$\varphi$\or$\chi$\or$\psi$\or$\omega$\else\@ctrerr\fi}
\def\@Greek#1{\if b\expandafter\@car\f@series\@nil\boldmath\fi%
 \ifcase#1\or A\or B\or$\Gamma$\or$\Delta$\or E%
  \or Z\or H\or$\Theta$\or I\or K\or$\Lambda$\or M%
  \or N\or$\Xi$\or O\or$\Pi$\or P\or$\Sigma$\or T%
  \or$\Upsilon$\or$\Phi$\or X\or$\Psi$\or$\Omega$\else\@ctrerr\fi}
\def\greek#1{\@greek{\csname c@#1\endcsname}}
\def\Greek#1{\@Greek{\csname c@#1\endcsname}}
\def\none#1{\@gobble{#1}}
%%
\def\theoremnumbering#1{\gdef\@thmcounter##1{\noexpand\csname #1\endcsname{##1}}}
\theoremnumbering{arabic}
%%
\AtEndDocument{\enablelistoftheorems}
%%
%%
%%+-------------------------------------------+
%%| Andreas Schlechte                         |
%%| Am Klepperberg 2                          |
%%| 38678 Clausthal-Zellerfeld                |
%%| email: Andreas.Schlechte@tu-clausthal.de  |
%%+-------------------------------------------+