]> gitweb.michael.orlitzky.com - mjotex.git/blob - mjo-common.tex
Use the "amsfonts" package for \mathbb in mjo-common.tex.
[mjotex.git] / mjo-common.tex
1 %
2 % Only the most commonly-used macros. Needed by everything else.
3 %
4
5 % Needed for \mathbb.
6 \usepackage{amsfonts}
7
8 % Place the argument in matching left/right parntheses.
9 \providecommand*{\of}[1]{ \left({#1}\right) }
10
11 % Group terms using parentheses.
12 \providecommand*{\qty}[1]{ \left({#1}\right) }
13
14 % Group terms using square brackets.
15 \providecommand*{\sqty}[1]{ \left[{#1}\right] }
16
17 % Create a set from the given elements
18 \providecommand*{\set}[1]{\left\lbrace{#1}\right\rbrace}
19
20 % A set comprehension, where the ``such that...'' bar is added
21 % automatically. The bar was chosen over a colon to avoid ambiguity
22 % with the L : V -> V notation. We can't leverage \set here because \middle
23 % needs \left and \right present.
24 \providecommand*{\setc}[2]{\left\lbrace{#1}\ \middle|\ {#2} \right\rbrace}
25
26 % A pair of things.
27 \providecommand*{\pair}[2]{ \left({#1},{#2}\right) }
28
29 % A triple of things.
30 \providecommand*{\triple}[3]{ \left({#1},{#2},{#3}\right) }
31
32 % The Cartesian product of two things.
33 \providecommand*{\cartprod}[2]{ {#1}\times{#2} }
34
35 % The Cartesian product of three things.
36 \providecommand*{\cartprodthree}[3]{ \cartprod{{#1}}{\cartprod{{#2}}{{#3}}} }
37
38 % The direct sum of two things.
39 \providecommand*{\directsum}[2]{ {#1}\oplus{#2} }
40
41 % The factorial operator.
42 \providecommand*{\factorial}[1]{ {#1}! }
43
44 %
45 % Product spaces
46 %
47 % All of the product spaces (for example, R^n) that follow default to
48 % an exponent of ``n'', but that exponent can be changed by providing
49 % it as an optional argument. If the exponent given is ``1'', then it
50 % will be omitted entirely.
51 %
52
53 % The natural n-space, N x N x N x ... x N.
54 \providecommand*{\Nn}[1][n]{
55 \mathbb{N}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
56 }
57
58 % The integral n-space, Z x Z x Z x ... x Z.
59 \providecommand*{\Zn}[1][n]{
60 \mathbb{Z}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
61 }
62
63 % The rational n-space, Q x Q x Q x ... x Q.
64 \providecommand*{\Qn}[1][n]{
65 \mathbb{Q}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
66 }
67
68 % The real n-space, R x R x R x ... x R.
69 \providecommand*{\Rn}[1][n]{
70 \mathbb{R}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
71 }
72
73 % The complex n-space, C x C x C x ... x C.
74 \providecommand*{\Cn}[1][n]{
75 \mathbb{C}\if\detokenize{#1}\detokenize{1}{}\else^{#1}\fi
76 }
77
78
79 %
80 % Basic set operations
81 %
82
83 % The union of its two arguments.
84 \providecommand*{\union}[2]{ {#1} \cup {#2} }
85
86 % A three-argument union.
87 \providecommand*{\unionthree}[3]{ \union{\union{#1}{#2}}{#3} }
88
89 % The intersection of its two arguments.
90 \providecommand*{\intersect}[2]{ {#1} \cap {#2} }
91
92 % A three-argument intersection.
93 \providecommand*{\intersectthree}[3]{ \intersect{\intersect{#1}{#2}}{#3} }
94
95 % An indexed arbitrary binary operation such as the union or
96 % intersection of an infinite number of sets. The first argument is
97 % the operator symbol to use, such as \cup for a union. The second
98 % argument is the lower index, for example k=1. The third argument is
99 % the upper index, such as \infty. Finally the fourth argument should
100 % contain the things (e.g. indexed sets) to be operated on.
101 \providecommand*{\binopmany}[4]{
102 \mathchoice
103 { \underset{#2}{\overset{#3}{#1}}{#4} }
104 { {#1}_{#2}^{#3}{#4} }
105 { {#1}_{#2}^{#3}{#4} }
106 { {#1}_{#2}^{#3}{#4} }
107 }
108
109 \providecommand*{\unionmany}[3]{ \binopmany{\cup}{#1}{#2}{#3} }
110 \providecommand*{\intersectmany}[3]{ \binopmany{\cap}{#1}{#2}{#3} }