]> gitweb.michael.orlitzky.com - mjotex.git/blob - mjo-common.tex
New \restrict macro to restrict a function to a subset of its domain.
[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 % The factorial operator.
43 \newcommand*{\factorial}[1]{ {#1}! }
44
45 % Restrict the first argument (a function) to the second argument (a
46 % subset of that functions domain). Abused for polynomials to specify
47 % an associated function with a particular domain (also its codomain,
48 % in the case of univariate polynomials).
49 \newcommand*{\restrict}[2]{{#1}{\restriction}_{#2}}
50 \ifdefined\newglossaryentry
51 \newglossaryentry{restriction}{
52 name={\ensuremath{\restrict{f}{X}}},
53 description={the restriction of $f$ to $X$},
54 sort=r
55 }
56 \fi
57
58 %
59 % Product spaces
60 %
61 % All of the product spaces (for example, R^n) that follow default to
62 % an exponent of ``n'', but that exponent can be changed by providing
63 % it as an optional argument. If the exponent given is ``1'', then it
64 % will be omitted entirely.
65 %
66
67 % The natural n-space, N x N x N x ... x N.
68 \newcommand*{\Nn}[1][n]{
69 \mathbb{N}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
70 }
71
72 \ifdefined\newglossaryentry
73 \newglossaryentry{N}{
74 name={\ensuremath{\Nn[1]}},
75 description={the set of natural numbers},
76 sort=N
77 }
78 \fi
79
80 % The integral n-space, Z x Z x Z x ... x Z.
81 \newcommand*{\Zn}[1][n]{
82 \mathbb{Z}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
83 }
84
85 \ifdefined\newglossaryentry
86 \newglossaryentry{Z}{
87 name={\ensuremath{\Zn[1]}},
88 description={the ring of integers},
89 sort=Z
90 }
91 \fi
92
93 % The rational n-space, Q x Q x Q x ... x Q.
94 \newcommand*{\Qn}[1][n]{
95 \mathbb{Q}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
96 }
97
98 \ifdefined\newglossaryentry
99 \newglossaryentry{Q}{
100 name={\ensuremath{\Qn[1]}},
101 description={the field of rational numbers},
102 sort=Q
103 }
104 \fi
105
106 % The real n-space, R x R x R x ... x R.
107 \newcommand*{\Rn}[1][n]{
108 \mathbb{R}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
109 }
110
111 \ifdefined\newglossaryentry
112 \newglossaryentry{R}{
113 name={\ensuremath{\Rn[1]}},
114 description={the field of real numbers},
115 sort=R
116 }
117 \fi
118
119
120 % The complex n-space, C x C x C x ... x C.
121 \newcommand*{\Cn}[1][n]{
122 \mathbb{C}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
123 }
124
125 \ifdefined\newglossaryentry
126 \newglossaryentry{C}{
127 name={\ensuremath{\Cn[1]}},
128 description={the field of complex numbers},
129 sort=C
130 }
131 \fi
132
133
134 % An indexed arbitrary binary operation such as the union or
135 % intersection of an infinite number of sets. The first argument is
136 % the operator symbol to use, such as \cup for a union. The second
137 % argument is the lower index, for example k=1. The third argument is
138 % the upper index, such as \infty. Finally the fourth argument should
139 % contain the things (e.g. indexed sets) to be operated on.
140 \newcommand*{\binopmany}[4]{
141 \mathchoice{ \underset{#2}{\overset{#3}{#1}}{#4} }
142 { {#1}_{#2}^{#3}{#4} }
143 { {#1}_{#2}^{#3}{#4} }
144 { {#1}_{#2}^{#3}{#4} }
145 }
146
147
148 % The four standard (UNLESS YOU'RE FRENCH) types of intervals along
149 % the real line.
150 \newcommand*{\intervaloo}[2]{ \left({#1},{#2}\right) } % open-open
151 \newcommand*{\intervaloc}[2]{ \left({#1},{#2}\right] } % open-closed
152 \newcommand*{\intervalco}[2]{ \left[{#1},{#2}\right) } % closed-open
153 \newcommand*{\intervalcc}[2]{ \left[{#1},{#2}\right] } % closed-closed
154
155
156 \fi