summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex3/xtheorem/xtheorem.sty
blob: 4018ff8070ce63a8d1afc2c0ecde3d8e04eabec8 (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
%%
%% This is file `xtheorem.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xtheorem.dtx  (with options: `package,trace')
%% 
%% Not for distribution
%%
%% (C) Copyright 1999 Achim Blumensath
%% All rights reserved.
%%
%% Not for general distribution. In its present form it is not allowed
%% to put this package onto CD or an archive without consulting the
%% the authors.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{xtheorem}
          [1999/12/19 v0.1 theorem styles]
\RequirePackage{xparse}
\RequirePackage{template}

\IgnoreWhiteSpace
\DeclareTemplateType{theoremstyle}{3}

\newskip\TSpre@skip
\newskip\TSpost@skip
\newdimen\TShead@indent
\newskip\TShead@sep

\DeclareTemplate{theoremstyle}{std}{3}
{
  pre-skip    =l  [\DelayEvaluation{\topsep}]     \TSpre@skip,
  post-skip   =l  [\DelayEvaluation{\topsep}]     \TSpost@skip,
  body-style  =f0 [\itshape]                      \TSbody@style,
  head-style  =f0 [\bfseries]                     \TShead@style,
  note-style  =f0 [\fontseries\mddefault\upshape] \TSnote@style,
  head-punct  =f0 [.]                             \TShead@punct,
  head-format =f3 [\IfNoValueF{#1}{#1\IfNoValueF{#2}{\space}}
                   \IfNoValueF{#2}{\textup{#2}}
                   \IfNoValueF{#3}{\space{\TSnote@style(#3)}}]
                                                  \TShead@format,
  head-indent      =l  [0pt]                      \TShead@indent,
  head-sep         =l  [5pt plus 1pt minus 1pt]   \TShead@sep,
  post-head-action =f0 []                         \TSpost@head@action
}
{
  \DoParameterAssignments
  \ifhmode\unskip\unskip\par\fi
  \normalfont
  \trivlist
  \let\thmheadnl\relax
  \@topsep\TSpre@skip
  \@topsepadd\TSpost@skip
  \IfNoValueF{#1}
    {\refstepcounter{#1}}
  \deferred@thm@head{
    \TShead@style
    \hskip\TShead@indent
    \IfNoValueTF{#1}
      {\TShead@format{#2}{#1}{#3}}
      {\TShead@format{#2}{\csname the#1\endcsname}{#3}}
    \TShead@punct
    \TSpost@head@action
    \hskip\TShead@sep
  }
  \TSbody@style
  \ignorespaces
}
\let\adjust@parskip@nobreak=\@nbitem
\newtoks\dth@everypar
\dth@everypar={
  \@minipagefalse
  \global\@newlistfalse
  \if@inlabel
    \global\@inlabelfalse
    \begingroup
      \setbox\z@\lastbox
      \ifvoid\z@ \kern-\itemindent \fi
    \endgroup
    \unhbox\@labels
  \fi
  \if@nobreak
    \@nobreakfalse
    \clubpenalty\@M
  \else
    \clubpenalty\@clubpenalty
    \everypar{}
  \fi
}
\def\deferred@thm@head#1{%
  \if@inlabel \indent \par \fi % eject a section head if one is pending
  \if@nobreak
    \adjust@parskip@nobreak
  \else
    \addpenalty\@beginparpenalty
    \addvspace\@topsep
    \addvspace{-\parskip}%
  \fi
  \global\@inlabeltrue
  \everypar\dth@everypar
  \sbox\@labels{\normalfont#1}%
  \ignorespaces
}
\DeclareInstance{theoremstyle}{plain}{std}{}

\DeclareInstance{theoremstyle}{definition}{std}
{
  body-style = \normalfont
}

\DeclareInstance{theoremstyle}{remark}{std}
{
  pre-skip   = \DelayEvaluation{0.5\topsep},
  post-skip  = \DelayEvaluation{0.5\topsep},
  body-style = \normalfont,
  head-style = \itshape
}
\def\@endtheorem{\endtrivlist\@endpefalse }
\DeclareDocumentCommand{\newtheorem}{smmomo}
{
  \expandafter\@ifdefinable\csname #3\endcsname
  {
    \global\expandafter\let\csname end#3\endcsname\@endtheorem
    \IfBooleanTF{#1}
    {
      \expandafter\DeclareDocumentCommand\csname #3\endcsname{o}
        {\UseInstance{theoremstyle}{#2}{\NoValue}{#5}{##1}}
    }
    {
      \IfNoValueTF{#4}
      {
        \IfNoValueTF{#6}
        {
          \newcounter{#3}
        }
        {
          \newcounter{#3}[#6]
          \expandafter\xdef\csname the#3\endcsname{
            \expandafter\noexpand\csname the#6\endcsname
            \@thmcountersep\@thmcounter{#3}}
        }
        \expandafter\DeclareDocumentCommand\csname #3\endcsname{o}
          {\UseInstance{theoremstyle}{#2}{#3}{#5}{##1}}
      }
      {
        \@ifundefined{c@#4}
        {
          \@nocounterr{#4}
        }
        {
          \expandafter\xdef\csname the#3\endcsname{
            \expandafter\noexpand\csname the#4\endcsname}
          \expandafter\DeclareDocumentCommand\csname #3\endcsname{o}
            {\UseInstance{theoremstyle}{#2}{#4}{#5}{##1}}
        }
      }
    }
  }
}
\endinput
%%
%% End of file `xtheorem.sty'.