-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmac-thm.sty
88 lines (71 loc) · 2.1 KB
/
mac-thm.sty
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
%
%% THEOREM ENVIRONMENTS
%
%% v2.0.0
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mac-thm}[2020/07/04 amsthm patch + defaults]
\RequirePackage{mac-util}
\makeatletter
\RequirePackage{amsthm} % Provide proof environment, QED stack.
\swapnumbers % Theorem number precedes heading.
% The following resets \end of theorem and proof environments to LaTeX
% defaults, which suppress indentation on immediately following line.
\makeatletter
\patchcmd{\@endtheorem}{\@endpefalse }{}{}{}
\patchcmd{\endproof}{\@endpefalse}{}{}{}
\makeatother
% Set theorem number prefix counter
\pgfkeys{counter/prefix/.initial={}}
\ProcessPGFOptions
% Initialise main theorem counter
\newtoggle{theorem@counter@initialized}
\newcommand{\InitializeTheoremCounter}{
\iftoggle{theorem@counter@initialized}{
\PackageWarning{mac-thm}{Theorems already initialized. Doing nothing.}
}{
\pgfkeys{counter/prefix/.get=\prefix} % scoped to avoid redundant macros
\ifdefvoid{\prefix}{
\newtheorem{main@theorem}{}
}{
\newtheorem{main@theorem}{}[\prefix]
}
\toggletrue{theorem@counter@initialized}
}
}
\InitializeTheoremCounter
% The prefix will be accessible as \p@main@theorem
% FUNCTION \DeclareTheorem[style = last_used]{name}{heading}
%
% Provides starred unnumbered version
\newcommand{\DeclareTheorem}[3][]{
\ifstrempty{#1}{
\newtheorem{#2}[main@theorem]{#3}
\newtheorem*{#2*}{#3}
}{
\theoremstyle{#1}
\newtheorem{#2}[main@theorem]{#3}
\newtheorem*{#2*}{#3}
}
}
% Some defaults
%
\DeclareTheorem[plain]{theorem}{Theorem}
\DeclareTheorem{thm}{Theorem}
\DeclareTheorem{proposition}{Proposition}
\DeclareTheorem{prop}{Proposition}
\DeclareTheorem{lemma}{Lemma}
\DeclareTheorem{corollary}{Corollary}
\DeclareTheorem{cor}{Corollary}
\DeclareTheorem{conjecture}{Conjecture}
\DeclareTheorem{conj}{Conjecture}
\DeclareTheorem{hypothesis}{Hypothesis}
%
\DeclareTheorem[definition]{para}{}
\DeclareTheorem{definition}{Definition}
\DeclareTheorem{defn}{Definition}
%
\DeclareTheorem[remark]{remark}{Remark}
\DeclareTheorem{rmk}{Remark}
\DeclareTheorem{example}{Example}
\DeclareTheorem{eg}{Example}