-
Notifications
You must be signed in to change notification settings - Fork 0
/
naproche.sty
150 lines (121 loc) · 4.27 KB
/
naproche.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
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
\NeedsTeXFormat{LaTeX2e}
%\ProvidesPackage{naproche}[2021/02/04 Typesetting for Naproche formalizations]
\RequirePackage{amsmath}
\RequirePackage{amsthm}
\RequirePackage{amsfonts}
\RequirePackage{etoolbox}
\RequirePackage{braket} % \Set
\RequirePackage{linegoal} % \linegoal
\RequirePackage{xspace} % \xspace
\newtheoremstyle{formalized}% name of the style to be used
{4pt}% measure of space to leave above the theorem. E.g.: 3pt
{4pt}% measure of space to leave below the theorem. E.g.: 3pt
{\normalfont} % name of font to use in the body of the theorem
{0pt}% measure of space to indent
{\bfseries}% name of head font
{}% punctuation between head and body
{ }% space after theorem head; " " = normal inter-word space
{\thmname{#1}\thmnumber{ #2}. \thmnote{ (#3) }}
\theoremstyle{formalized}
\newcounter{theoremcount}
\newtheorem{axiom}[theoremcount]{Axiom}
\newtheorem{corollary}[theoremcount]{Corollary}
\newtheorem{definition}[theoremcount]{Definition}
\newtheorem{fact}[theoremcount]{Fact}
\newtheorem{lemma}[theoremcount]{Lemma}
\newtheorem{proposition}[theoremcount]{Proposition}
\newtheorem{remark}[theoremcount]{Remark}
\newtheorem{signature}[theoremcount]{Signature}
\newtheorem{theorem}[theoremcount]{Theorem}
% Theorem environments without numbering.
\newtheorem*{quotedaxiom}{Axiom}
\newtheorem*{quotedcorollary}{Corollary}
\newtheorem*{quoteddefinition}{Definition}
\newtheorem*{quotedfact}{Fact}
\newtheorem*{quotedlemma}{Lemma}
\newtheorem*{quotedproposition}{Proposition}
\newtheorem*{quotedremark}{Remark}
\newtheorem*{quotedsignature}{Signature}
\newtheorem*{quotedtheorem}{Theorem}
\RequirePackage[most]{tcolorbox}
\definecolor{block-gray}{gray}{0.95}
\newtcolorbox{grayblock}{arc=0mm,colframe=block-gray,colback=block-gray,grow to right by=0mm,grow to left by=0mm,
boxrule=0pt,boxsep=0pt,breakable}
\newenvironment{forthel}{%
\setbool{forthel}{true}%
\begin{grayblock}\rmfamily
}{%
\end{grayblock}\rmfamily%
\setbool{forthel}{false}%
}
\newenvironment{greybox}{
\begin{grayblock}
}{
\end{grayblock}
}
%% Space between paragraphs in proofs in ForTheL environments
\newlength{\ftlparskip}
\setlength{\ftlparskip}{0.5em}
% Flexible class terms
% ====================
% Use "\class{ ... | ... }" the same way as "\Set{ ... | ... }" from the braket
% package, i.e. as an alternative to "\{ ... \mid ... \}" with additional
% support for flexible sizes of the braces and the vertical bar.
\def\class{\Set}
% Let "\classtext{...}" behave as "\text{...}" but with automatic linebreaks.
% Intended to be used together with "\class{ ... | ... }" as in
% "\class{ ... | \classtext{...}}".
\newcommand{\classtext}[1]{\parbox{\linegoal}{#1}}
% More visible line breaks in proofs.
% ===================================
\newbool{forthel}
\let\originalproof\proof
\let\originalendproof\endproof
% Set length of \parskip to \ftlparskip in proofs in ForTheL environments.
%
% NOTE: "\vspace*{-\parskip}" is necessary to avoid additional space between
% theorem and proof
\renewenvironment{proof}{%
\originalproof%
\ifbool{forthel}{\setlength{\parskip}{\ftlparskip}\vspace*{-\parskip}}%
\relax%
}
{%
\originalendproof%
}
% Predefined symbols
% ==================
\newcommand{\dom}{\operatorname{dom}}
\newcommand{\fun}{\mathrm{\lambda}}
% Naproche logo
% =============
\newcommand{\Naproche}{\ensuremath{\mathbb{N}}aproche\xspace}
% Options
% =======
% If the option 'nonumbers' is activated, then all the theorem environment are left unnumbered.
\DeclareOption{nonumbers}{%
\renewcommand{\axiom}{\quotedaxiom}
\renewcommand{\corollary}{\quotedcorollary}
\renewcommand{\definition}{\quoteddefinition}
\renewcommand{\fact}{\quotedfact}
\renewcommand{\lemma}{\quotedlemma}
\renewcommand{\proposition}{\quotedproposition}
\renewcommand{\remark}{\quotedremark}
\renewcommand{\signature}{\quotedsignature}
\renewcommand{\theorem}{\quotedtheorem}
}
\DeclareOption{numberswithinsection}{%
\counterwithin{theoremcount}{section}
}
\DeclareOption{numberswithinsubsection}{%
\counterwithin{theoremcount}{subsection}
}
\DeclareOption{unmarked}{%
\renewenvironment{forthel}{%
\setbool{forthel}{true}%
}{%
\setbool{forthel}{false}%
}
}
\DeclareOption*{\PackageWarning{naproche}{Unknown ‘\CurrentOption’}}
\ProcessOptions\relax