summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/akktex/source/akktex/math/akkmathrel.sty
blob: d74825267f5b67d064a953ed52ac6d6a9416677d (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
%=====================================================================================================================================
% Package akkmathrel by Igor Akkerman (c) 2000, 2001, 2002, 2003, 2004, 2005, 2006
% Package providing utilities for typesetting mathematical relations.
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License (latest version).
%
% The latest version of this license can be found at
%     http://www.latex-project.org/lppl.txt
%
% This file may only be distributed together with the full 'AkkTeX' bundle.
%=====================================================================================================================================
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{akkmathrel}[2006/10/22 2.0.1 by Igor Akkerman (c) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Package providing utilities for typesetting mathematical relations]
%=====================================================================================================================================

\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{amstext}
\RequirePackage{latexsym}
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

\makeatletter

%------------------------------------------------------------------------------
% Definition relations
%------------------------------------------------------------------------------
\newcommand \defas {:=}
\newcommand \asdef {=:}
\newcommand \defequiv {:\iff}
\newcommand \equivdef {\iff:}

%------------------------------------------------------------------------------
% Aligned annotated relations
%------------------------------------------------------------------------------
% \ann{annotation}                typesets an annotation in the annotation font
% \annrel{relation}{annotation}   typesets an annotated relation
% \alannrel{relation}{annotation} typesets an aligned annotated relation
% \setlength \relwidth {relwidth} defines the maximum required relation width
% \annwidth{annotation}        \/ defines the maximum required annotation width
% \annw{annotation}            /\ by the width of the specified annotation
% \alrel{relation}                align a relation within a box of the width 
%                                 of the maximum required annotation width
% \annfont{fontcommand}           defines the font to use for annotations
%                                 default: \scriptsize
%------------------------------------------------------------------------------
\newcommand \ann[1] {%
	{\akk@annfontsize #1}%
}

\newcommand \annrel[2] {%
    \stackrel{\mbox{\ann{#2}}}{#1}%
}

\newcommand \alannrel[2] {%
    \stackrel{\makebox[\akk@annwidth]{\ann{#2}}}{#1}%
}

\newcommand \annwidth[1] {%
    \settowidth \akk@annwidth {\mbox{\ann{#1}}}%
}

\newcommand \annw[1] {%
    \annwidth{#1}%
}

\newcommand \alrel[1] {%
    \alannrel{#1}{}%
}

\newcommand \annfont[1] {%
    \renewcommand \akk@annfont {#1}%
}

\newcommand \akk@annfontsize \scriptsize
\newlength  \akk@annwidth
%------------------------------------------------------------------------------

%------------------------------------------------------------------------------
% predefined relations prepared for annotations
%------------------------------------------------------------------------------
\let \akk@orig@neq       \neq
\let \akk@orig@in        \in
\let \akk@orig@leq       \leq
\let \akk@orig@geq       \geq
\let \akk@orig@iff       \iff
\let \akk@orig@implies   \implies
\let \akk@orig@impliedby \impliedby
\let \akk@orig@leadsto   \leadsto
\let \akk@orig@subset    \subset
\let \akk@orig@supset    \supset
\let \akk@orig@subseteq  \subseteq
\let \akk@orig@supseteq  \supseteq

\renewcommand {\=}[1][]        {\annrel{=}{#1}}
\newcommand   \eq[1][]         {\annrel{=}{#1}}
\renewcommand \neq[1][]        {\annrel{\akk@orig@neq}{#1}}
\renewcommand \iff[1][]        {\annrel{\akk@orig@iff}{#1}}
\renewcommand \implies[1][]    {\annrel{\akk@orig@implies}{#1}}
\newcommand   \impl[1][]       {\annrel{\akk@orig@implies}{#1}}
\renewcommand \impliedby[1][]  {\annrel{\akk@orig@impliedby}{#1}}
\newcommand   \implby[1][]     {\annrel{\akk@orig@impliedby}{#1}}
\renewcommand \in[1][]         {\annrel{\akk@orig@in}{#1}}
\renewcommand \leq[1][]        {\annrel{\akk@orig@leq}{#1}}
\renewcommand \geq[1][]        {\annrel{\akk@orig@geq}{#1}}
\newcommand   \lt[1][]         {\annrel{<}{#1}}
\newcommand   \gt[1][]         {\annrel{>}{#1}}
\renewcommand \subset[1][]     {\annrel{\akk@orig@subset}{#1}}
\newcommand   \subs[1][]       {\annrel{\akk@orig@subset}{#1}}
\renewcommand \subseteq[1][]   {\annrel{\akk@orig@subseteq}{#1}}
\newcommand   \subseq[1][]     {\annrel{\akk@orig@subseteq}{#1}}
\renewcommand \supset[1][]     {\annrel{\akk@orig@supset}{#1}}
\newcommand   \sups[1][]       {\annrel{\akk@orig@supset}{#1}}
\renewcommand \supseteq[1][]   {\annrel{\akk@orig@supseteq}{#1}}
\newcommand   \supseq[1][]     {\annrel{\akk@orig@supseteq}{#1}}

\newcommand \aleq[1][]         {\alannrel{=}{#1}}
\newcommand \alneq[1][]        {\alannrel{\neq}{#1}}
\newcommand \aliff[1][]        {\alannrel{\akk@orig@iff}{#1}}
\newcommand \alimplies[1][]    {\alannrel{\akk@orig@implies}{#1}}
\newcommand \alimpl[1][]       {\alannrel{\akk@orig@implies}{#1}}
\newcommand \alimpliedby[1][]  {\alannrel{\akk@orig@impliedby}{#1}}
\newcommand \alimplby[1][]     {\alannrel{\akk@orig@impliedby}{#1}}
\newcommand \alin[1][]         {\alannrel{\akk@orig@in}{#1}}
\newcommand \alleq[1][]        {\alannrel{\akk@orig@leq}{#1}}
\newcommand \algeq[1][]        {\alannrel{\akk@orig@geq}{#1}}
\newcommand \allt[1][]         {\alannrel{<}{#1}}
\newcommand \algt[1][]         {\alannrel{>}{#1}}
\newcommand \alsubset[1][]     {\alannrel{\akk@orig@subset}{#1}}
\newcommand \alsubs[1][]       {\alannrel{\akk@orig@subset}{#1}}
\newcommand \alsubseteq[1][]   {\alannrel{\akk@orig@subseteq}{#1}}
\newcommand \alsubseq[1][]     {\alannrel{\akk@orig@subseteq}{#1}}
\newcommand \alsupset[1][]     {\alannrel{\akk@orig@supset}{#1}}
\newcommand \alsups[1][]       {\alannrel{\akk@orig@supset}{#1}}
\newcommand \alsupseteq[1][]   {\alannrel{\akk@orig@supseteq}{#1}}
\newcommand \alsupseq[1][]     {\alannrel{\akk@orig@supseteq}{#1}}

%------------------------------------------------------------------------------


\newcommand \iffq[1][]      {{\iff[#1] \quad}}
\newcommand \qiff[1][]      {{\quad \iff[#1]}}
\newcommand \qqiff[1][]     {{\qquad \iff[#1]}}
\newcommand \qiffq[1][]     {{\quad \iff[#1] \quad}}
\newcommand \qqiffqq[1][]   {{\qquad \iff[#1] \qquad}}

\newcommand \qimplies[1][]    {{\quad \implies[#1]}}
\newcommand \qqimplies[1][]   {{\qquad \implies[#1]}}
\newcommand \qimpliesq[1][]   {{\quad \implies[#1] \quad}}
\newcommand \qqimpliesqq[1][] {{\qquad \implies[#1] \qquad}}

\newcommand \qimpl[1][]    {{\quad \impl[#1]}}
\newcommand \qqimpl[1][]   {{\qquad \impl[#1]}}
\newcommand \qimplq[1][]   {{\quad \impl[#1] \quad}}
\newcommand \qqimplqq[1][] {{\qquad \impl[#1] \qquad}}

\providecommand \inv {^{-1}}             % inverse relation (do not wrap twice! {{}})
\providecommand \inverse[1] {{#1}\inv}   % inverse of argument
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

\makeatother