]> gitweb.michael.orlitzky.com - mjotex.git/blob - mjo-common.tex
ccb22daa8509db9788d8c357a741ea4b53c37495
[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 \ifx\restriction\undefined
12 \usepackage{amssymb}
13 \fi
14
15 % Place the argument in matching left/right parentheses.
16 \newcommand*{\of}[1]{ \left({#1}\right) }
17
18 % Group terms using parentheses.
19 \newcommand*{\qty}[1]{ \left({#1}\right) }
20
21 % Group terms using square brackets.
22 \newcommand*{\sqty}[1]{ \left[{#1}\right] }
23
24 % A pair of things.
25 \newcommand*{\pair}[2]{ \left({#1},{#2}\right) }
26
27 % A triple of things.
28 \newcommand*{\triple}[3]{ \left({#1},{#2},{#3}\right) }
29
30 % A four-tuple of things.
31 \newcommand*{\quadruple}[4]{ \left({#1},{#2},{#3},{#4}\right) }
32
33 % A five-tuple of things.
34 \newcommand*{\quintuple}[5]{ \left({#1},{#2},{#3},{#4},{#5}\right) }
35
36 % A six-tuple of things.
37 \newcommand*{\sextuple}[6]{ \left({#1},{#2},{#3},{#4},{#5},{#6}\right) }
38
39 % A seven-tuple of things.
40 \newcommand*{\septuple}[7]{ \left({#1},{#2},{#3},{#4},{#5},{#6},{#7}\right) }
41
42 % A free-form tuple of things. Useful for when the exact number is not
43 % known, such as when \ldots will be stuck in the middle of the list,
44 % and when you don't want to think in column-vector terms, e.g. with
45 % elements of an abstract Cartesian product space.
46 \newcommand*{\tuple}[1]{ \left({#1}\right) }
47
48 % The "least common multiple of" function. Takes a nonempty set of
49 % things that can be multiplied and ordered as its argument. Name
50 % chosen for synergy with \gcd, which *does* exist already.
51 \newcommand*{\lcm}[1]{ \operatorname{lcm}\of{{#1}} }
52 \ifdefined\newglossaryentry
53 \newglossaryentry{lcm}{
54 name={\ensuremath{\lcm{X}}},
55 description={the least common multiple of the elements of $X$},
56 sort=l
57 }
58 \fi
59
60 % The factorial operator.
61 \newcommand*{\factorial}[1]{ {#1}! }
62
63 % Restrict the first argument (a function) to the second argument (a
64 % subset of that functions domain). Abused for polynomials to specify
65 % an associated function with a particular domain (also its codomain,
66 % in the case of univariate polynomials).
67 \newcommand*{\restrict}[2]{{#1}{\restriction}_{#2}}
68 \ifdefined\newglossaryentry
69 \newglossaryentry{restriction}{
70 name={\ensuremath{\restrict{f}{X}}},
71 description={the restriction of $f$ to $X$},
72 sort=r
73 }
74 \fi
75
76 %
77 % Product spaces
78 %
79 % All of the product spaces (for example, R^n) that follow default to
80 % an exponent of ``n'', but that exponent can be changed by providing
81 % it as an optional argument. If the exponent given is ``1'', then it
82 % will be omitted entirely.
83 %
84
85 % The natural n-space, N x N x N x ... x N.
86 \newcommand*{\Nn}[1][n]{
87 \mathbb{N}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
88 }
89
90 \ifdefined\newglossaryentry
91 \newglossaryentry{N}{
92 name={\ensuremath{\Nn[1]}},
93 description={the set of natural numbers},
94 sort=N
95 }
96 \fi
97
98 % The integral n-space, Z x Z x Z x ... x Z.
99 \newcommand*{\Zn}[1][n]{
100 \mathbb{Z}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
101 }
102
103 \ifdefined\newglossaryentry
104 \newglossaryentry{Z}{
105 name={\ensuremath{\Zn[1]}},
106 description={the ring of integers},
107 sort=Z
108 }
109 \fi
110
111 % The rational n-space, Q x Q x Q x ... x Q.
112 \newcommand*{\Qn}[1][n]{
113 \mathbb{Q}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
114 }
115
116 \ifdefined\newglossaryentry
117 \newglossaryentry{Q}{
118 name={\ensuremath{\Qn[1]}},
119 description={the field of rational numbers},
120 sort=Q
121 }
122 \fi
123
124 % The real n-space, R x R x R x ... x R.
125 \newcommand*{\Rn}[1][n]{
126 \mathbb{R}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
127 }
128
129 \ifdefined\newglossaryentry
130 \newglossaryentry{R}{
131 name={\ensuremath{\Rn[1]}},
132 description={the field of real numbers},
133 sort=R
134 }
135 \fi
136
137
138 % The complex n-space, C x C x C x ... x C.
139 \newcommand*{\Cn}[1][n]{
140 \mathbb{C}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
141 }
142
143 \ifdefined\newglossaryentry
144 \newglossaryentry{C}{
145 name={\ensuremath{\Cn[1]}},
146 description={the field of complex numbers},
147 sort=C
148 }
149 \fi
150
151 % The n-dimensional product space of a generic field F.
152 \newcommand*{\Fn}[1][n]{
153 \mathbb{F}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
154 }
155
156 \ifdefined\newglossaryentry
157 \newglossaryentry{F}{
158 name={\ensuremath{\Fn[1]}},
159 description={a generic field},
160 sort=F
161 }
162 \fi
163
164
165 % An indexed arbitrary binary operation such as the union or
166 % intersection of an infinite number of sets. The first argument is
167 % the operator symbol to use, such as \cup for a union. The second
168 % argument is the lower index, for example k=1. The third argument is
169 % the upper index, such as \infty. Finally the fourth argument should
170 % contain the things (e.g. indexed sets) to be operated on.
171 \newcommand*{\binopmany}[4]{
172 \mathchoice{ \underset{#2}{\overset{#3}{#1}}{#4} }
173 { {#1}_{#2}^{#3}{#4} }
174 { {#1}_{#2}^{#3}{#4} }
175 { {#1}_{#2}^{#3}{#4} }
176 }
177
178
179 % The four standard (UNLESS YOU'RE FRENCH) types of intervals along
180 % the real line.
181 \newcommand*{\intervaloo}[2]{ \left({#1},{#2}\right) } % open-open
182 \newcommand*{\intervaloc}[2]{ \left({#1},{#2}\right] } % open-closed
183 \newcommand*{\intervalco}[2]{ \left[{#1},{#2}\right) } % closed-open
184 \newcommand*{\intervalcc}[2]{ \left[{#1},{#2}\right] } % closed-closed
185
186
187 \fi