2 % Only the most commonly-used macros. Needed by everything else.
4 \ifx\havemjocommon\undefined
11 \ifx\bigtimes\undefined
12 \usepackage{mathtools
}
15 % Place the argument in matching left/right parentheses.
16 \newcommand*
{\of}[1]{ \left(
{#1}\right)
}
18 % Group terms using parentheses.
19 \newcommand*
{\qty}[1]{ \left(
{#1}\right)
}
21 % Group terms using square brackets.
22 \newcommand*
{\sqty}[1]{ \left[{#1}\right] }
24 % Create a set from the given elements
25 \newcommand*
{\set}[1]{\left\lbrace{#1}\right\rbrace}
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}
34 \newcommand*
{\pair}[2]{ \left(
{#1},
{#2}\right)
}
37 \newcommand*
{\triple}[3]{ \left(
{#1},
{#2},
{#3}\right)
}
39 % A four-tuple of things.
40 \newcommand*
{\quadruple}[4]{ \left(
{#1},
{#2},
{#3},
{#4}\right)
}
42 % A five-tuple of things.
43 \newcommand*
{\quintuple}[5]{ \left(
{#1},
{#2},
{#3},
{#4},
{#5}\right)
}
45 % A six-tuple of things.
46 \newcommand*
{\sextuple}[6]{ \left(
{#1},
{#2},
{#3},
{#4},
{#5},
{#6}\right)
}
48 % A seven-tuple of things.
49 \newcommand*
{\septuple}[7]{ \left(
{#1},
{#2},
{#3},
{#4},
{#5},
{#6},
{#7}\right)
}
51 % The Cartesian product of two things.
52 \newcommand*
{\cartprod}[2]{ {#1}\times{#2} }
54 % The Cartesian product of three things.
55 \newcommand*
{\cartprodthree}[3]{ \cartprod{{#1}}{\cartprod{{#2}}{{#3}}} }
57 % The direct sum of two things.
58 \newcommand*
{\directsum}[2]{ {#1}\oplus{#2} }
60 % The direct sum of three things.
61 \newcommand*
{\directsumthree}[3]{ \directsum{#1}{\directsum{#2}{#3}} }
63 % The factorial operator.
64 \newcommand*
{\factorial}[1]{ {#1}!
}
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.
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
80 \ifdefined\newglossaryentry
82 name=
{\ensuremath{\Nn[1]}},
83 description=
{the set of natural numbers
},
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
93 \ifdefined\newglossaryentry
95 name=
{\ensuremath{\Zn[1]}},
96 description=
{the ring of integers
},
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
106 \ifdefined\newglossaryentry
107 \newglossaryentry{Q
}{
108 name=
{\ensuremath{\Qn[1]}},
109 description=
{the field of rational numbers
},
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
119 \ifdefined\newglossaryentry
120 \newglossaryentry{R
}{
121 name=
{\ensuremath{\Rn[1]}},
122 description=
{the field of real numbers
},
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
133 \ifdefined\newglossaryentry
134 \newglossaryentry{C
}{
135 name=
{\ensuremath{\Cn[1]}},
136 description=
{the field of complex numbers
},
143 % Basic set operations
146 % The union of its two arguments.
147 \newcommand*
{\union}[2]{ {#1}\cup{#2} }
149 % A three-argument union.
150 \newcommand*
{\unionthree}[3]{ \union{\union{#1}{#2}}{#3} }
152 % The intersection of its two arguments.
153 \newcommand*
{\intersect}[2]{ {#1}\cap{#2} }
155 % A three-argument intersection.
156 \newcommand*
{\intersectthree}[3]{ \intersect{\intersect{#1}{#2}}{#3} }
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} }
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} }
176 % The four standard (UNLESS YOU'RE FRENCH) types of intervals along
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