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