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