]> gitweb.michael.orlitzky.com - mjotex.git/blob - mjo-common.tex
Replace all uses of \providecommand with \newcommand.
[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 % Needed for \mathbb.
9 \usepackage{amsfonts}
10
11 % Needed for \bigtimes.
12 \usepackage{mathtools}
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 % The Cartesian product of two things.
39 \newcommand*{\cartprod}[2]{ {#1}\times{#2} }
40
41 % The Cartesian product of three things.
42 \newcommand*{\cartprodthree}[3]{ \cartprod{{#1}}{\cartprod{{#2}}{{#3}}} }
43
44 % The direct sum of two things.
45 \newcommand*{\directsum}[2]{ {#1}\oplus{#2} }
46
47 % The direct sum of three things.
48 \newcommand*{\directsumthree}[3]{ \directsum{#1}{\directsum{#2}{#3}} }
49
50 % The factorial operator.
51 \newcommand*{\factorial}[1]{ {#1}! }
52
53 %
54 % Product spaces
55 %
56 % All of the product spaces (for example, R^n) that follow default to
57 % an exponent of ``n'', but that exponent can be changed by providing
58 % it as an optional argument. If the exponent given is ``1'', then it
59 % will be omitted entirely.
60 %
61
62 % The natural n-space, N x N x N x ... x N.
63 \newcommand*{\Nn}[1][n]{
64 \mathbb{N}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
65 }
66
67 % The integral n-space, Z x Z x Z x ... x Z.
68 \newcommand*{\Zn}[1][n]{
69 \mathbb{Z}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
70 }
71
72 % The rational n-space, Q x Q x Q x ... x Q.
73 \newcommand*{\Qn}[1][n]{
74 \mathbb{Q}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
75 }
76
77 % The real n-space, R x R x R x ... x R.
78 \newcommand*{\Rn}[1][n]{
79 \mathbb{R}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
80 }
81
82 % The complex n-space, C x C x C x ... x C.
83 \newcommand*{\Cn}[1][n]{
84 \mathbb{C}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
85 }
86
87 % The space of real symmetric n-by-n matrices.
88 \newcommand*{\Sn}[1][n]{
89 \mathcal{S}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
90 }
91
92 % The space of complex Hermitian n-by-n matrices.
93 \newcommand*{\Hn}[1][n]{
94 \mathcal{H}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
95 }
96
97 %
98 % Basic set operations
99 %
100
101 % The union of its two arguments.
102 \newcommand*{\union}[2]{ {#1}\cup{#2} }
103
104 % A three-argument union.
105 \newcommand*{\unionthree}[3]{ \union{\union{#1}{#2}}{#3} }
106
107 % The intersection of its two arguments.
108 \newcommand*{\intersect}[2]{ {#1}\cap{#2} }
109
110 % A three-argument intersection.
111 \newcommand*{\intersectthree}[3]{ \intersect{\intersect{#1}{#2}}{#3} }
112
113 % An indexed arbitrary binary operation such as the union or
114 % intersection of an infinite number of sets. The first argument is
115 % the operator symbol to use, such as \cup for a union. The second
116 % argument is the lower index, for example k=1. The third argument is
117 % the upper index, such as \infty. Finally the fourth argument should
118 % contain the things (e.g. indexed sets) to be operated on.
119 \newcommand*{\binopmany}[4]{
120 \mathchoice{ \underset{#2}{\overset{#3}{#1}}{#4} }
121 { {#1}_{#2}^{#3}{#4} }
122 { {#1}_{#2}^{#3}{#4} }
123 { {#1}_{#2}^{#3}{#4} }
124 }
125
126 \newcommand*{\intersectmany}[3]{ \binopmany{\bigcap}{#1}{#2}{#3} }
127 \newcommand*{\cartprodmany}[3]{ \binopmany{\bigtimes}{#1}{#2}{#3} }
128 \newcommand*{\directsummany}[3]{ \binopmany{\bigoplus}{#1}{#2}{#3} }
129 \newcommand*{\unionmany}[3]{ \binopmany{\bigcup}{#1}{#2}{#3} }
130
131
132 % The four standard (UNLESS YOU'RE FRENCH) types of intervals along
133 % the real line.
134 \newcommand*{\intervaloo}[2]{ \left({#1},{#2}\right) } % open-open
135 \newcommand*{\intervaloc}[2]{ \left({#1},{#2}\right] } % open-closed
136 \newcommand*{\intervalco}[2]{ \left[{#1},{#2}\right) } % closed-open
137 \newcommand*{\intervalcc}[2]{ \left[{#1},{#2}\right] } % closed-closed
138
139
140 \fi