]> gitweb.michael.orlitzky.com - mjotex.git/blob - mjo-common.tex
mjo-set: adopt \powerset{} from mjo-common.
[mjotex.git] / mjo-common.tex
1 %
2 % Only the most commonly-used macros. Needed by everything else.
3 %
4 \ifx\havemjocommon\undefined
5 \def\havemjocommon{1}
6
7 \ifx\mathbb\undefined
8 \usepackage{amsfonts}
9 \fi
10
11 \ifx\bigtimes\undefined
12 \usepackage{mathtools}
13 \fi
14
15 % Place the argument in matching left/right parentheses.
16 \newcommand*{\of}[1]{ \left({#1}\right) }
17
18 % Group terms using parentheses.
19 \newcommand*{\qty}[1]{ \left({#1}\right) }
20
21 % Group terms using square brackets.
22 \newcommand*{\sqty}[1]{ \left[{#1}\right] }
23
24 % Create a set from the given elements
25 \newcommand*{\set}[1]{\left\lbrace{#1}\right\rbrace}
26
27 % A set comprehension, where the ``such that...'' bar is added
28 % automatically. The bar was chosen over a colon to avoid ambiguity
29 % with the L : V -> V notation. We can't leverage \set here because \middle
30 % needs \left and \right present.
31 \newcommand*{\setc}[2]{\left\lbrace{#1}\ \middle|\ {#2} \right\rbrace}
32
33 % A pair of things.
34 \newcommand*{\pair}[2]{ \left({#1},{#2}\right) }
35
36 % A triple of things.
37 \newcommand*{\triple}[3]{ \left({#1},{#2},{#3}\right) }
38
39 % A four-tuple of things.
40 \newcommand*{\quadruple}[4]{ \left({#1},{#2},{#3},{#4}\right) }
41
42 % A five-tuple of things.
43 \newcommand*{\quintuple}[5]{ \left({#1},{#2},{#3},{#4},{#5}\right) }
44
45 % A six-tuple of things.
46 \newcommand*{\sextuple}[6]{ \left({#1},{#2},{#3},{#4},{#5},{#6}\right) }
47
48 % A seven-tuple of things.
49 \newcommand*{\septuple}[7]{ \left({#1},{#2},{#3},{#4},{#5},{#6},{#7}\right) }
50
51 % The Cartesian product of two things.
52 \newcommand*{\cartprod}[2]{ {#1}\times{#2} }
53
54 % The Cartesian product of three things.
55 \newcommand*{\cartprodthree}[3]{ \cartprod{{#1}}{\cartprod{{#2}}{{#3}}} }
56
57 % The direct sum of two things.
58 \newcommand*{\directsum}[2]{ {#1}\oplus{#2} }
59
60 % The direct sum of three things.
61 \newcommand*{\directsumthree}[3]{ \directsum{#1}{\directsum{#2}{#3}} }
62
63 % The factorial operator.
64 \newcommand*{\factorial}[1]{ {#1}! }
65
66 %
67 % Product spaces
68 %
69 % All of the product spaces (for example, R^n) that follow default to
70 % an exponent of ``n'', but that exponent can be changed by providing
71 % it as an optional argument. If the exponent given is ``1'', then it
72 % will be omitted entirely.
73 %
74
75 % The natural n-space, N x N x N x ... x N.
76 \newcommand*{\Nn}[1][n]{
77 \mathbb{N}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
78 }
79
80 \ifdefined\newglossaryentry
81 \newglossaryentry{N}{
82 name={\ensuremath{\Nn[1]}},
83 description={the set of natural numbers},
84 sort=N
85 }
86 \fi
87
88 % The integral n-space, Z x Z x Z x ... x Z.
89 \newcommand*{\Zn}[1][n]{
90 \mathbb{Z}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
91 }
92
93 \ifdefined\newglossaryentry
94 \newglossaryentry{Z}{
95 name={\ensuremath{\Zn[1]}},
96 description={the ring of integers},
97 sort=Z
98 }
99 \fi
100
101 % The rational n-space, Q x Q x Q x ... x Q.
102 \newcommand*{\Qn}[1][n]{
103 \mathbb{Q}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
104 }
105
106 \ifdefined\newglossaryentry
107 \newglossaryentry{Q}{
108 name={\ensuremath{\Qn[1]}},
109 description={the field of rational numbers},
110 sort=Q
111 }
112 \fi
113
114 % The real n-space, R x R x R x ... x R.
115 \newcommand*{\Rn}[1][n]{
116 \mathbb{R}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
117 }
118
119 \ifdefined\newglossaryentry
120 \newglossaryentry{R}{
121 name={\ensuremath{\Rn[1]}},
122 description={the field of real numbers},
123 sort=R
124 }
125 \fi
126
127
128 % The complex n-space, C x C x C x ... x C.
129 \newcommand*{\Cn}[1][n]{
130 \mathbb{C}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
131 }
132
133 \ifdefined\newglossaryentry
134 \newglossaryentry{C}{
135 name={\ensuremath{\Cn[1]}},
136 description={the field of complex numbers},
137 sort=C
138 }
139 \fi
140
141
142 %
143 % Basic set operations
144 %
145
146 % The union of its two arguments.
147 \newcommand*{\union}[2]{ {#1}\cup{#2} }
148
149 % A three-argument union.
150 \newcommand*{\unionthree}[3]{ \union{\union{#1}{#2}}{#3} }
151
152 % The intersection of its two arguments.
153 \newcommand*{\intersect}[2]{ {#1}\cap{#2} }
154
155 % A three-argument intersection.
156 \newcommand*{\intersectthree}[3]{ \intersect{\intersect{#1}{#2}}{#3} }
157
158 % An indexed arbitrary binary operation such as the union or
159 % intersection of an infinite number of sets. The first argument is
160 % the operator symbol to use, such as \cup for a union. The second
161 % argument is the lower index, for example k=1. The third argument is
162 % the upper index, such as \infty. Finally the fourth argument should
163 % contain the things (e.g. indexed sets) to be operated on.
164 \newcommand*{\binopmany}[4]{
165 \mathchoice{ \underset{#2}{\overset{#3}{#1}}{#4} }
166 { {#1}_{#2}^{#3}{#4} }
167 { {#1}_{#2}^{#3}{#4} }
168 { {#1}_{#2}^{#3}{#4} }
169 }
170
171 \newcommand*{\intersectmany}[3]{ \binopmany{\bigcap}{#1}{#2}{#3} }
172 \newcommand*{\cartprodmany}[3]{ \binopmany{\bigtimes}{#1}{#2}{#3} }
173 \newcommand*{\directsummany}[3]{ \binopmany{\bigoplus}{#1}{#2}{#3} }
174 \newcommand*{\unionmany}[3]{ \binopmany{\bigcup}{#1}{#2}{#3} }
175
176 % The four standard (UNLESS YOU'RE FRENCH) types of intervals along
177 % the real line.
178 \newcommand*{\intervaloo}[2]{ \left({#1},{#2}\right) } % open-open
179 \newcommand*{\intervaloc}[2]{ \left({#1},{#2}\right] } % open-closed
180 \newcommand*{\intervalco}[2]{ \left[{#1},{#2}\right) } % closed-open
181 \newcommand*{\intervalcc}[2]{ \left[{#1},{#2}\right] } % closed-closed
182
183
184 \fi