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