]> matita.cs.unibo.it Git - helm.git/blob - matita/components/binaries/matex/test/matex.sty
- matex: minor corrections to handle applications with many arguments
[helm.git] / matita / components / binaries / matex / test / matex.sty
1 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
2 \ProvidesPackage{matex}[2016/06/19 MaTeX Package]
3 \RequirePackage{xcolor}
4 \RequirePackage{stix}
5 \ExecuteOptions{}
6 \ProcessOptions*
7
8 \makeatletter
9
10 \newcommand*\ma@cast{\mathbin:}
11 \newcommand*\ma@abbr{\mathrel\eqdef}
12 \newcommand*\ma@prod{\mathord\Pi}
13 \newcommand*\ma@arrw{\mathrel\Rightarrow}
14 \newcommand*\ma@fall{\mathord\forall}
15 \newcommand*\ma@impl{\mathrel\supset}
16 \newcommand*\ma@case{\mathrel\questeq}
17 \newcommand*\ma@caze{\mathrel\mapsto}
18 \newcommand*\ma@pair{\mathbin\mapsto}
19
20 \definecolor{ma@black}{HTML}{000000}
21 \definecolor{ma@blue}{HTML}{00005F}
22 \definecolor{ma@purple}{HTML}{3F005F}
23
24 \newcommand*\ma@fwd{ma@black}
25 \newcommand*\ma@open{ma@blue}
26 \newcommand*\ma@exit{ma@blue}
27 \newcommand*\ma@prim{ma@purple}
28 \newcommand*\ma@qed{ma@blue}
29
30 \newcommand*\neverindent{\setlength\parindent{0pt}}
31
32 %\newcommand*\setlabel[1]{\protected@edef\@currentlabel{#1}}
33 %\newcommand*\ObjLabel[1]{\label{obj:#1}\hypertarget{obj:#1}{}}
34 %\newcommand*\ObjRef[1]{\hyperlink{obj:#1}{\ref*{obj:#1}}}
35 %\newcommand*\ma@setlabel[2]{\setlabel{#1}\ObjLabel{#2}}
36
37 \newcommand*\ma@settarget[2]{\hypertarget{obj:#2}{#1}}
38 \newcommand*\ma@setlink[2]{\hyperlink{obj:#2}{#1}}
39 \newcommand*\ma@setopttarget[2]{\def\ma@tmp{#2}%
40    \mathord{\ifx\ma@tmp\empty #1\else\ma@settarget{#1}{#2}\fi}%
41 }
42 \newcommand*\ma@setoptlink[2]{\def\ma@tmp{#2}%
43    \mathord{\ifx\ma@tmp\empty #1\else\ma@setlink{#1}{#2}\fi}%
44 }
45
46 \newcommand*\setordlink[2]{\mathord{\ma@setlink{#1}{#2}}}
47 \newcommand*\setoplink[2]{\mathop{\ma@setlink{#1}{#2}}}
48 \newcommand*\setbinlink[2]{\mathbin{\ma@setlink{#1}{#2}}}
49 \newcommand*\setrellink[2]{\mathrel{\ma@setlink{#1}{#2}}}
50 \newcommand*\setopenlink[2]{\mathopen{\ma@setlink{#1}{#2}}}
51 \newcommand*\setcloselink[2]{\mathclose{\ma@setlink{#1}{#2}}}
52 \newcommand*\setpunctlink[2]{\mathpunct{\ma@setlink{#1}{#2}}}
53
54 \newcommand*\ObjIncNode{}
55 \newcommand*\ObjNode{}
56
57 \newcommand*\ma@thehead[3]{\ObjIncNode\textbf{#1 \ObjNode(\ma@settarget{#2}{#3})}\neverindent\par}
58 \newcommand*\ma@theneck[1]{\textsl{#1}\neverindent\par}
59
60 \newenvironment{axiom}[2]{\ma@thehead{Axiom}{#1}{#2}$}{$\par}
61 \newenvironment{declaration}[2]{\ma@thehead{Declaration}{#1}{#2}$}{$\par}
62 \newenvironment{definition}[2]{$}{$\par}
63 \newenvironment{proposition}[2]{\ma@thehead{Proposition}{#1}{#2}$}{$\par}
64 \newenvironment{proof}[2]{\ma@theneck{Proof}}{\par}
65 \newenvironment{ma@step}[1]{\color{#1}}{\par}
66
67 \newcommand*\ma@tmp{}
68 \newcommand*\ma@last[4]{#4}
69 \newcommand*\ma@list[5]{\def\ma@tmp{#5}%
70    \ifx\ma@tmp\empty\let\ma@tmp=\ma@last\else #1#2{#5}\let\ma@tmp=\ma@list\fi
71    \ma@tmp{#3}{#2}{#3}{#4}%
72 }
73 \newcommand*\ma@thop[1]{\mathpunct{#1}\allowbreak}
74 \newcommand*\ma@cm{\ma@thop{,}}
75 \newcommand*\ma@or{\mathbin\vert}
76 \newcommand*\ma@cp{)\allowbreak}
77 \newcommand*\ma@qm{\mathord{?}}
78 \newcommand*\ma@arg[1]{#1}
79 \newcommand*\ma@args{(\ma@list\relax\ma@arg\ma@cm\ma@cp}
80 \newcommand*\ma@cases{\ma@list\relax\ma@arg\ma@or\relax}
81 \newcommand*\ma@bind{\ma@thop{}}
82 \newcommand*\ma@skip[1]{}
83
84 \newcommand*\PROP{\mathord\mathrm{PROP}}
85 \newcommand*\CROP[1]{\mathord\mathrm{CROP}}
86 \newcommand*\TYPE[1]{\mathord\mathrm{TYPE}}
87 \newcommand*\LREF[2]{\ma@setoptlink{#1}{#2}}
88 \newcommand*\GREF[2]{\ma@setoptlink{\mathrm{#1}}{#2}}
89 \newcommand*\ABBR[4]{(\ma@setopttarget{#1}{#2}\ma@abbr #4\ma@cast #3)\ma@bind}
90 \newcommand*\ABST[3]{(\ma@setopttarget{#1}{#2}\ma@cast #3)\ma@bind}
91 \newcommand*\PROD[3]{\def\ma@tmp{#2}%
92    \ifx\ma@tmp\empty #3\ma@arrw\else
93    (\ma@prod\ma@setopttarget{#1}{#2}\ma@cast #3)\ma@bind\fi
94 }
95 \newcommand*\FALL[3]{\def\ma@tmp{#2}%
96    \ifx\ma@tmp\empty #3\ma@impl\else
97    (\ma@fall\ma@setopttarget{#1}{#2}\ma@cast #3)\ma@bind\fi
98 }
99 \newcommand*\APPL[1]{#1\ma@args}
100 \newcommand*\CASE[3]{#3\ma@case\ma@cases}
101 \newcommand*\CAZE[3]{#3\ma@caze(\ma@qm\ma@cast #2)\ma@cases}
102 \newcommand*\PAIR[2]{#1\ma@pair #2}
103
104 \newcommand*\ma@term[1]{$#1$}
105 \newcommand*\ma@with{ with }
106 \newcommand*\ma@comma{, }
107 \newcommand*\ma@stop{.\end{ma@step}}
108 \newcommand*\ma@head[6]{\def\ma@tmp{#5}%
109    \ifx\ma@tmp\empty\begin{ma@step}{#1}$\mathbf{\ma@setopttarget{#2}{#3}}$%
110    \else\begin{ma@step}{#4}$\mathbf{\ma@setopttarget{#5}{#6}}$%
111    \fi
112 }
113 \newcommand*\ma@tail{\ma@list\ma@with\ma@term\ma@comma\ma@stop}
114 \newcommand*\ma@type[1]{\def\ma@tmp{#1}%
115    \ifx\ma@tmp\empty\mathrm{(omitted)}\else #1\fi
116 }
117
118 \newcommand*\EXIT[1]{\ma@head{\ma@exit}{end}{}{}{}{} of block #1\ma@stop}
119 \newcommand*\OPEN[3]{\ma@head{}{}{}{\ma@open}{#1}{#2} is this block #3\ma@stop}
120 \newcommand*\PRIM[3]{\ma@head{}{}{}{\ma@prim}{#1}{#2} will have type $\ma@type{#3}$\ma@stop}
121 \newcommand*\DECL[3]{\ma@head{\ma@qed}{\_QED}{}{\ma@fwd}{#1}{#2} has type $\ma@type{#3}$\par}
122 \newcommand*\BODY[1]{being $#1$\ma@stop}
123 \newcommand*\STEP[1]{by $#1$\ma@tail}
124 \newcommand*\DEST[1]{by cases on $#1$\ma@tail}
125
126 \makeatother
127
128 \endinput