ritex 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,7 @@
1
1
  /*
2
- -*- text -*-
3
- ## lib/ritex/lexer.rb -- contains Ritex::Lexer
2
+ ## lib/ritex/parser.y -- contains Ritex::Parser
4
3
  ## Author:: William Morgan (mailto: wmorgan-ritex@masanjin.net)
5
- ## Copyright:: Copyright 2005 William Morgan
4
+ ## Copyright:: Copyright 2005--2009 William Morgan
6
5
  ## License:: GNU GPL version 2
7
6
  */
8
7
 
@@ -12,44 +11,46 @@ class Ritex::Parser
12
11
  or 'rake racc'
13
12
  */
14
13
 
15
- /* spacing: spacing is ignored by the lexer except immediately after a
16
- '{' or before a '{' the value of those two tokens is the actual
17
- space inbetween (nil if none)
18
-
19
- unary minus: handled by the lexer. too complicated to really put in
20
- to the parser, even with precedence mangling, because i'm trying
21
- not to actually parse the stuff as much as possible.
14
+ /* spacing
15
+ SPACE represents whitespace. the (stateful) lexer starts
16
+ sending this signal whenever it sees an ENV, up till when
17
+ it sees a '}'. Crazy, but it works: it allows us to capture
18
+ spacing in evironments (like \text) where we want them,
19
+ and the rest of the time not to have to deal with them
20
+ in the parser.
22
21
  */
23
22
 
24
- token NUMBER VAR SYMBOL ARRAY FUNC0 FUNC1 FUNC2 FUNC3 MACRO0 MACRO1 MACRO2 MACRO3 ENV DOUBLEBACK DEFINE UNARYMINUS SPACE LEFT RIGHT
25
-
26
- expect 18 /* all from the \left\{ \right\} thing, which is naturally
27
- ambiguous and there's nothing i can do to fix that. */
23
+ token NUMBER VAR SYMBOL FUNC0 FUNC1 FUNC2 FUNC3 MACRO0 MACRO1 MACRO2 MACRO3 ENV DOUBLEBACK DEFINE LEFT RIGHT ARRAY ARRAYOPTS ROWOPTS CELLOPTS COLALIGN ROWALIGN ALIGN PADDING EQUALCOLS EQUALROWS ROWLINES COLLINES FRAME ROWSPAN COLSPAN SPACE OPERATOR
28
24
 
29
25
  rule
30
- exp: /* nothing */ { result = "" }
31
- | exp expel { result = join val[0], val[1] }
32
-
33
- expel: atom
34
- | atom '^' atom '_' atom { result = markup join(val[0], val[4], val[2]), :subsup }
35
- | atom '_' atom '^' atom { result = markup join(val[0], val[2], val[4]), :subsup }
36
- | atom '_' atom { result = markup join(val[0], val[2]), :sub }
37
- | atom '^' atom { result = markup join(val[0], val[2]), :sup }
38
-
39
- atom: NUMBER { result = markup val[0], :num }
40
- | VAR { result = markup val[0], :var }
41
- | SYMBOL { result = lookup val[0] }
42
- | func
43
- | macro
44
- | ENV arg { result = special(*val) }
45
- | '{' exp '}' { result = markup val[1], :group }
46
- | UNARYMINUS { result = markup val[0], :unaryminus }
47
- | array
48
- | macrodef
49
- | plainop { result = markup val[0], :op }
50
- | LEFT exp RIGHT pos { result = markup join(val[1], val[3]), :group }
51
- | LEFT exp RIGHT { result = markup val[1], :group }
52
-
26
+ exp: /* nothing */ { result = "" }
27
+ | exp '-' atom { result = join(val[0], markup(token(val[1]), :unaryminus), val[2]) }
28
+ | exp nontoken '-' atom { result = join(val[0], val[1], op(val[2]), val[3]) }
29
+ | exp nontoken '-' '-' atom { result = join(val[0], val[1], op(val[2]), markup(token(val[3]), :unaryminus), val[4]) }
30
+ | exp atom { result = join(*val) }
31
+
32
+ subsup: atom '^' atom '_' atom { result = markup join(val[0], val[4], val[2]), :subsup }
33
+ | atom '_' atom '^' atom { result = markup join(val[0], val[2], val[4]), :subsup }
34
+ | atom '_' atom { result = markup join(val[0], val[2]), :sub }
35
+ | atom '^' atom { result = markup join(val[0], val[2]), :sup }
36
+
37
+ nontoken: NUMBER { result = markup val[0], :num }
38
+ | VAR { result = join(*val[0].split(//).map { |v| markup v, :var }) }
39
+ | symbol
40
+ | func
41
+ | macro
42
+ | ENV arg { result = special(*val) }
43
+ | '{' exp '}' { result = markup val[1], :group }
44
+ | array
45
+ | macrodef
46
+ | LEFT delim exp RIGHT delim { result = markup join(val[1], val[2], val[4]), :group }
47
+
48
+
49
+ atom: token
50
+ | nontoken
51
+ | subsup
52
+ | OPERATOR { result = lookup val[0] }
53
+ | '.' { result = op val[0] }
53
54
 
54
55
  func: FUNC0 { result = special(*val) }
55
56
  | FUNC1 atom { result = special(*val) }
@@ -65,21 +66,22 @@ rule
65
66
  /* un-evalauted argument */
66
67
  arg: '{' string '}' { result = safe(val[1]) }
67
68
 
68
- pos: plainop { result = markup val[0], :op }
69
- | SYMBOL { result = lookup val[0] }
70
-
71
69
  stringel: NUMBER
72
- | plainop
73
70
  | '^'
74
71
  | '_'
75
72
  | VAR
76
73
  | ARRAY
77
74
  | escapeme { result = '\\' + val[0] } /* have to re-escape these */
78
75
  | DOUBLEBACK
76
+ | rawtoken
77
+ | rawdelimtoken
78
+ | '-'
79
+ | '.'
79
80
  | SPACE
80
81
  | '{' string '}' { result = "{#{val[1]}}" } /* nested shit must match up or we won't know when to end */
81
82
 
82
83
  escapeme: SYMBOL
84
+ | OPERATOR
83
85
  | FUNC0
84
86
  | FUNC1
85
87
  | FUNC2
@@ -89,6 +91,8 @@ rule
89
91
  | MACRO2
90
92
  | MACRO3
91
93
  | ENV
94
+ | LEFT
95
+ | RIGHT
92
96
 
93
97
  string: /* empty */ { result = "" }
94
98
  | string stringel { result = val[0] + val[1] }
@@ -99,6 +103,7 @@ rule
99
103
 
100
104
 
101
105
  symspec: SYMBOL
106
+ | OPERATOR
102
107
  | FUNC0
103
108
  | FUNC1
104
109
  | FUNC2
@@ -108,33 +113,66 @@ rule
108
113
  | MACRO2
109
114
  | MACRO3
110
115
 
111
- array: ARRAY '{' ainnards '}' { result = markup markup(val[2], :array), :group }
116
+ array: ARRAY '{' arrayopts ainnards '}' { result = markup markup(val[3], :array, val[2]), :group }
117
+
118
+ arrayopts: /* empty */
119
+ | ARRAYOPTS '{' arrayoptsinnards '}' { result = val[2] }
120
+
121
+ arrayoptsinnards: /* empty */
122
+ | arrayoptsinnards COLALIGN arg { result = join val[0], special(val[1], val[2]) }
123
+ | arrayoptsinnards ROWALIGN arg { result = join val[0], special(val[1], val[2]) }
124
+ | arrayoptsinnards ALIGN arg { result = join val[0], special(val[1], val[2]) }
125
+ | arrayoptsinnards PADDING arg { result = join val[0], special(val[1], val[2]) }
126
+ | arrayoptsinnards EQUALCOLS arg { result = join val[0], special(val[1], val[2]) }
127
+ | arrayoptsinnards EQUALROWS arg { result = join val[0], special(val[1], val[2]) }
128
+ | arrayoptsinnards ROWLINES arg { result = join val[0], special(val[1], val[2]) }
129
+ | arrayoptsinnards COLLINES arg { result = join val[0], special(val[1], val[2]) }
130
+ | arrayoptsinnards FRAME arg { result = join val[0], special(val[1], val[2]) }
112
131
 
113
132
  ainnards: arow
114
133
  | ainnards DOUBLEBACK arow { result = val[0] + val[2] }
115
134
 
116
135
  arow: arow1 { result = markup val[0], :row }
117
136
 
118
- arow1: acol
119
- | arow1 '&' acol { result = val[0] + val[2] }
120
-
121
- /* wrapper */
122
- acol: exp { result = markup val[0], :col }
123
-
124
- plainop: '+'
125
- | '-'
126
- | '*'
127
- | '/'
128
- | '['
129
- | ']'
130
- | '|'
131
- | '.'
132
- | ','
133
- | ';'
134
- | ':'
135
- | '<' { result = safe val[0] }
136
- | '>' { result = safe val[0] }
137
- | '='
138
- | '('
139
- | ')'
140
- | '#'
137
+ arow1: acell
138
+ | arow1 '&' acell { result = val[0] + val[2] }
139
+
140
+ acell: cellopts exp { result = markup val[1], :cell, val[0] }
141
+
142
+ cellopts: /* empty */
143
+ | CELLOPTS '{' celloptsinnards '}' { result = val[2] }
144
+ | celloptsinnards /* apparently you can elide this, though i only see that in the WebTeX examples */
145
+
146
+ celloptsinnards: /* empty */
147
+ | celloptsinnards ROWSPAN arg { result = join val[0], special(val[1], val[2]) }
148
+ | celloptsinnards COLSPAN arg { result = join val[0], special(val[1], val[2]) }
149
+ | celloptsinnards ROWALIGN arg { result = join val[0], special(val[1], val[2]) }
150
+ | celloptsinnards COLALIGN arg { result = join val[0], special(val[1], val[2]) }
151
+
152
+ token: rawtoken { result = op val[0] }
153
+ | rawdelimtoken { result = op val[0], "stretchy='false'" }
154
+
155
+ rawtoken: ','
156
+ | ';'
157
+ | ':'
158
+ | '<'
159
+ | '>'
160
+ | '='
161
+ | '#'
162
+ | '!'
163
+ | '+'
164
+ | '*'
165
+ | '/'
166
+
167
+ rawdelimtoken: '('
168
+ | ')'
169
+ | '['
170
+ | ']'
171
+ | '|'
172
+
173
+ delim: /* empty */
174
+ | rawdelimtoken { result = op val[0] }
175
+ | symbol
176
+ | '.' { result = nil } # counts as nothing
177
+
178
+ symbol: SYMBOL { result = lookup val[0] }
@@ -0,0 +1,233 @@
1
+ ---
2
+ - - ""
3
+ - ""
4
+ - - " a"
5
+ - <mi>a</mi>
6
+ - - " a"
7
+ - <mi>a</mi>
8
+ - - (\hat{x}) = {(\hat{x}})
9
+ - <mo stretchy='false'>(</mo><mover><mrow><mi>x</mi></mrow><mo>&Hat;</mo></mover><mo stretchy='false'>)</mo><mo>=</mo><mrow><mo stretchy='false'>(</mo><mover><mrow><mi>x</mi></mrow><mo>&Hat;</mo></mover></mrow><mo stretchy='false'>)</mo>
10
+ - - ","
11
+ - <mo>,</mo>
12
+ - - ,\,\,,,\,
13
+ - <mo>,</mo><mspace width="thinmathspace"/><mspace width="thinmathspace"/><mo>,</mo><mo>,</mo><mspace width="thinmathspace"/>
14
+ - - "-1"
15
+ - <mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mn>1</mn>
16
+ - - -\infty
17
+ - <mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mn>&infin;</mn>
18
+ - - -\log(1 - X)/\lambda
19
+ - <mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mi>log</mi><mo stretchy='false'>(</mo><mn>1</mn><mo>&minus;</mo><mi>X</mi><mo stretchy='false'>)</mo><mo>/</mo><mi>&lambda;</mi>
20
+ - - -x
21
+ - <mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mi>x</mi>
22
+ - - 100!
23
+ - <mn>100</mn><mo>!</mo>
24
+ - - F(x) = \Pr(X \leq x)\ \text{for}\ -\infinity < x < \infinity
25
+ - <mi>F</mi><mo stretchy='false'>(</mo><mi>x</mi><mo stretchy='false'>)</mo><mo>=</mo><mi>Pr</mi><mo stretchy='false'>(</mo><mi>X</mi><mo>&leq;</mo><mi>x</mi><mo stretchy='false'>)</mo><mspace width="mediummathspace"/><mtext>for</mtext><mspace width="mediummathspace"/><mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mn>&infin;</mn><mo>&lt;</mo><mi>x</mi><mo>&lt;</mo><mn>&infin;</mn>
26
+ - - |-
27
+ G(y) = \left\{\array{ 1 - e^{-\lambda y} & \text{ if } y \geq 0 \\
28
+ 0 & \text{ if } y < 0 }\right.
29
+ - <mi>G</mi><mo stretchy="false">(</mo><mi>y</mi><mo stretchy="false">)</mo><mo>=</mo><mrow><mo>{</mo><mrow><mtable><mtr><mtd><mn>1</mn><mo>&minus;</mo><msup><mi>e</mi><mrow><mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mi>&lambda;</mi><mi>y</mi></mrow></msup></mtd><mtd><mtext> if </mtext><mi>y</mi><mo>&geq;</mo><mn>0</mn></mtd></mtr><mtr><mtd><mn>0</mn></mtd><mtd><mtext> if </mtext><mi>y</mi><mo>&lt;</mo><mn>0</mn></mtd></mtr></mtable></mrow></mrow>
30
+ - - G^{-1}(x) = -\log(1 - x)/\lambda\text{ if } 0 < x < 1.
31
+ - <msup><mi>G</mi><mrow><mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mn>1</mn></mrow></msup><mo stretchy='false'>(</mo><mi>x</mi><mo stretchy='false'>)</mo><mo>=</mo><mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mi>log</mi><mo stretchy='false'>(</mo><mn>1</mn><mo>&minus;</mo><mi>x</mi><mo stretchy='false'>)</mo><mo>/</mo><mi>&lambda;</mi><mtext> if </mtext><mn>0</mn><mo>&lt;</mo><mi>x</mi><mo>&lt;</mo><mn>1</mn><mo>.</mo>
32
+ - - P(x) = P^*(x)/Z
33
+ - <mi>P</mi><mo stretchy='false'>(</mo><mi>x</mi><mo stretchy='false'>)</mo><mo>=</mo><msup><mi>P</mi><mo>*</mo></msup><mo stretchy='false'>(</mo><mi>x</mi><mo stretchy='false'>)</mo><mo>/</mo><mi>Z</mi>
34
+ - - \ -\infty
35
+ - <mspace width="mediummathspace"/><mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mn>&infin;</mn>
36
+ - - \,
37
+ - <mspace width="thinmathspace"/>
38
+ - - \Pr(a < X \leq b) = \int_a^b f(x)\ dx
39
+ - <mi>Pr</mi><mo stretchy='false'>(</mo><mi>a</mi><mo>&lt;</mo><mi>X</mi><mo>&leq;</mo><mi>b</mi><mo stretchy='false'>)</mo><mo>=</mo><msubsup><mo>&Integral;</mo><mi>a</mi><mi>b</mi></msubsup><mi>f</mi><mo stretchy='false'>(</mo><mi>x</mi><mo stretchy='false'>)</mo><mspace width="mediummathspace"/><mi>d</mi><mi>x</mi>
40
+ - - \alpha
41
+ - <mi>&alpha;</mi>
42
+ - - \alpha + b + c
43
+ - <mi>&alpha;</mi><mo>+</mo><mi>b</mi><mo>+</mo><mi>c</mi>
44
+ - - \alpha - x
45
+ - <mi>&alpha;</mi><mo>&minus;</mo><mi>x</mi>
46
+ - - |-
47
+ \array{ \colspan{3} (1,1) \text{ to } (1,3) & (1,4) \\
48
+ (2,1) & (2,2) & (2,3) & (2,4) }
49
+ - <mrow><mtable><mtr><mtd columnspan='3'><mo stretchy='false'>(</mo><mn>1</mn><mo>,</mo><mn>1</mn><mo stretchy='false'>)</mo><mtext> to </mtext><mo stretchy='false'>(</mo><mn>1</mn><mo>,</mo><mn>3</mn><mo stretchy='false'>)</mo></mtd><mtd><mo stretchy='false'>(</mo><mn>1</mn><mo>,</mo><mn>4</mn><mo stretchy='false'>)</mo></mtd></mtr><mtr><mtd><mo stretchy='false'>(</mo><mn>2</mn><mo>,</mo><mn>1</mn><mo stretchy='false'>)</mo></mtd><mtd><mo stretchy='false'>(</mo><mn>2</mn><mo>,</mo><mn>2</mn><mo stretchy='false'>)</mo></mtd><mtd><mo stretchy='false'>(</mo><mn>2</mn><mo>,</mo><mn>3</mn><mo stretchy='false'>)</mo></mtd><mtd><mo stretchy='false'>(</mo><mn>2</mn><mo>,</mo><mn>4</mn><mo stretchy='false'>)</mo></mtd></mtr></mtable></mrow>
50
+ - - |-
51
+ \array{ (1,1) & \rowspan{2} \int dx & (1,3) \\
52
+ (2,1) & (2,3) \\
53
+ (3,1) & (3,2) & (3,3) }
54
+ - <mrow><mtable><mtr><mtd><mo stretchy='false'>(</mo><mn>1</mn><mo>,</mo><mn>1</mn><mo stretchy='false'>)</mo></mtd><mtd rowspan='2'><mo>&Integral;</mo><mi>d</mi><mi>x</mi></mtd><mtd><mo stretchy='false'>(</mo><mn>1</mn><mo>,</mo><mn>3</mn><mo stretchy='false'>)</mo></mtd></mtr><mtr><mtd><mo stretchy='false'>(</mo><mn>2</mn><mo>,</mo><mn>1</mn><mo stretchy='false'>)</mo></mtd><mtd><mo stretchy='false'>(</mo><mn>2</mn><mo>,</mo><mn>3</mn><mo stretchy='false'>)</mo></mtd></mtr><mtr><mtd><mo stretchy='false'>(</mo><mn>3</mn><mo>,</mo><mn>1</mn><mo stretchy='false'>)</mo></mtd><mtd><mo stretchy='false'>(</mo><mn>3</mn><mo>,</mo><mn>2</mn><mo stretchy='false'>)</mo></mtd><mtd><mo stretchy='false'>(</mo><mn>3</mn><mo>,</mo><mn>3</mn><mo stretchy='false'>)</mo></mtd></mtr></mtable></mrow>
55
+ - - \array{ \arrayopts{\colalign{left center right}} a & b & c \\ 100000 & 100000 & 10000}
56
+ - <mrow><mtable columnalign="left center right"><mtr><mtd><mi>a</mi></mtd><mtd><mi>b</mi></mtd><mtd><mi>c</mi></mtd></mtr><mtr><mtd><mn>100000</mn></mtd><mtd><mn>100000</mn></mtd><mtd><mn>10000</mn></mtd></mtr></mtable></mrow>
57
+ - - \array{ \arrayopts{\colalign{left}} a & b & c \\ 100000 & 100000 & 10000}
58
+ - <mrow><mtable columnalign="left"><mtr><mtd><mi>a</mi></mtd><mtd><mi>b</mi></mtd><mtd><mi>c</mi></mtd></mtr><mtr><mtd><mn>100000</mn></mtd><mtd><mn>100000</mn></mtd><mtd><mn>10000</mn></mtd></mtr></mtable></mrow>
59
+ - - \array{ \arrayopts{\rowalign{top center bottom}} \binom{\alpha}{\omega} & a & b \\ \frac{3}{4} & c & d \\ \int_0^1 & e & f}
60
+ - <mrow><mtable rowalign='top center bottom'><mtr><mtd><mfrac linethickness="0"><mrow><mi>&alpha;</mi></mrow><mrow><mi>&omega;</mi></mrow></mfrac></mtd><mtd><mi>a</mi></mtd><mtd><mi>b</mi></mtd></mtr><mtr><mtd><mfrac><mrow><mn>3</mn></mrow><mrow><mn>4</mn></mrow></mfrac></mtd><mtd><mi>c</mi></mtd><mtd><mi>d</mi></mtd></mtr><mtr><mtd><msubsup><mo>&Integral;</mo><mn>0</mn><mn>1</mn></msubsup></mtd><mtd><mi>e</mi></mtd><mtd><mi>f</mi></mtd></mtr></mtable></mrow>
61
+ - - \array{ \arrayopts{\rowalign{top}} \binom{\alpha}{\omega} & a & b \\ \frac{3}{4} & c & d \\ \int_0^1 & e & f}
62
+ - <mrow><mtable rowalign='top'><mtr><mtd><mfrac linethickness="0"><mrow><mi>&alpha;</mi></mrow><mrow><mi>&omega;</mi></mrow></mfrac></mtd><mtd><mi>a</mi></mtd><mtd><mi>b</mi></mtd></mtr><mtr><mtd><mfrac><mrow><mn>3</mn></mrow><mrow><mn>4</mn></mrow></mfrac></mtd><mtd><mi>c</mi></mtd><mtd><mi>d</mi></mtd></mtr><mtr><mtd><msubsup><mo>&Integral;</mo><mn>0</mn><mn>1</mn></msubsup></mtd><mtd><mi>e</mi></mtd><mtd><mi>f</mi></mtd></mtr></mtable></mrow>
63
+ - - |-
64
+ \array{1 & 0 \\
65
+ 0 & 1}
66
+ - <mrow><mtable><mtr><mtd><mn>1</mn></mtd><mtd><mn>0</mn></mtd></mtr><mtr><mtd><mn>0</mn></mtd><mtd><mn>1</mn></mtd></mtr></mtable></mrow>
67
+ - - \array{1 & 0 \\ 0 & 1}
68
+ - <mrow><mtable><mtr><mtd><mn>1</mn></mtd><mtd><mn>0</mn></mtd></mtr><mtr><mtd><mn>0</mn></mtd><mtd><mn>1</mn></mtd></mtr></mtable></mrow>
69
+ - - \array{1 & 0}
70
+ - <mrow><mtable><mtr><mtd><mn>1</mn></mtd><mtd><mn>0</mn></mtd></mtr></mtable></mrow>
71
+ - - \array{1}
72
+ - <mrow><mtable><mtr><mtd><mn>1</mn></mtd></mtr></mtable></mrow>
73
+ - - \array{\arrayopts{\collines{solid}} a}
74
+ - <mrow><mtable columnlines="solid"><mtr><mtd><mi>a</mi></mtd></mtr></mtable></mrow>
75
+ - - \array{\arrayopts{\equalcols{true}} a}
76
+ - <mrow><mtable equalcolumns="true"><mtr><mtd><mi>a</mi></mtd></mtr></mtable></mrow>
77
+ - - \array{\arrayopts{\equalrows{true}} a}
78
+ - <mrow><mtable equalrows="true"><mtr><mtd><mi>a</mi></mtd></mtr></mtable></mrow>
79
+ - - \array{\arrayopts{\frame{solid}} a}
80
+ - <mrow><mtable frame="solid"><mtr><mtd><mi>a</mi></mtd></mtr></mtable></mrow>
81
+ - - \array{\arrayopts{\padding{20}} a & b & c \\ d & e & f \\ \alpha & \beta & \gamma}
82
+ - <mrow><mtable rowspacing="20" columnspacing="20"><mtr><mtd><mi>a</mi></mtd><mtd><mi>b</mi></mtd><mtd><mi>c</mi></mtd></mtr><mtr><mtd><mi>d</mi></mtd><mtd><mi>e</mi></mtd><mtd><mi>f</mi></mtd></mtr><mtr><mtd><mi>&alpha;</mi></mtd><mtd><mi>&beta;</mi></mtd><mtd><mi>&gamma;</mi></mtd></mtr></mtable></mrow>
83
+ - - \array{\arrayopts{\rowlines{solid}} a}
84
+ - <mrow><mtable rowlines="solid"><mtr><mtd><mi>a</mi></mtd></mtr></mtable></mrow>
85
+ - - \array{\cellopts{\colspan{2}} a \\ b & c}
86
+ - <mrow><mtable><mtr><mtd columnspan="2"><mi>a</mi></mtd></mtr><mtr><mtd><mi>b</mi></mtd><mtd><mi>c</mi></mtd></mtr></mtable></mrow>
87
+ - - \array{\cellopts{\rowspan{2}} a & b \\ c}
88
+ - <mrow><mtable><mtr><mtd rowspan="2"><mi>a</mi></mtd><mtd><mi>b</mi></mtd></mtr><mtr><mtd><mi>c</mi></mtd></mtr></mtable></mrow>
89
+ - - \array{\colspan{2} a \\ b & c}
90
+ - <mrow><mtable><mtr><mtd columnspan='2'><mi>a</mi></mtd></mtr><mtr><mtd><mi>b</mi></mtd><mtd><mi>c</mi></mtd></mtr></mtable></mrow>
91
+ - - \array{\rowspan{2} a & b \\ c}
92
+ - <mrow><mtable><mtr><mtd rowspan='2'><mi>a</mi></mtd><mtd><mi>b</mi></mtd></mtr><mtr><mtd><mi>c</mi></mtd></mtr></mtable></mrow>
93
+ - - \bar{x}
94
+ - <mover><mrow><mi>x</mi></mrow><mo>&OverBar;</mo></mover>
95
+ - - \binom{x}{2}
96
+ - <mfrac linethickness="0"><mrow><mi>x</mi></mrow><mrow><mn>2</mn></mrow></mfrac>
97
+ - - \check{x}
98
+ - <mover><mrow><mi>x</mi></mrow><mo>&macr;</mo></mover>
99
+ - - \ddot{x}
100
+ - <mover><mrow><mi>x</mi></mrow><mo>&Dot;</mo></mover>
101
+ - - \dot{x}
102
+ - <mover><mrow><mi>x</mi></mrow><mo>&dot;</mo></mover>
103
+ - - \forall x\,x<0
104
+ - <mo>&forall;</mo><mi>x</mi><mspace width="thinmathspace"/><mi>x</mi><mo>&lt;</mo><mn>0</mn>
105
+ - - \frac{1}{2}
106
+ - <mfrac><mrow><mn>1</mn></mrow><mrow><mn>2</mn></mrow></mfrac>
107
+ - - \frac{1}{N} \sum_r \phi({x^{(r)}})
108
+ - <mfrac><mrow><mn>1</mn></mrow><mrow><mi>N</mi></mrow></mfrac><msub><mo lspace="thinmathspace" rspace="thinmathspace">&Sum;</mo><mi>r</mi></msub><mi>&phi;</mi><mo stretchy='false'>(</mo><mrow><msup><mi>x</mi><mrow><mo stretchy='false'>(</mo><mi>r</mi><mo stretchy='false'>)</mo></mrow></msup></mrow><mo stretchy='false'>)</mo>
109
+ - - \frac{\sum_r w_r \phi({x^{(r)}})}{\sum_r w_r}
110
+ - <mfrac><mrow><msub><mo lspace="thinmathspace" rspace="thinmathspace">&Sum;</mo><mi>r</mi></msub><msub><mi>w</mi><mi>r</mi></msub><mi>&phi;</mi><mo stretchy='false'>(</mo><mrow><msup><mi>x</mi><mrow><mo stretchy='false'>(</mo><mi>r</mi><mo stretchy='false'>)</mo></mrow></msup></mrow><mo stretchy='false'>)</mo></mrow><mrow><msub><mo lspace="thinmathspace" rspace="thinmathspace">&Sum;</mo><mi>r</mi></msub><msub><mi>w</mi><mi>r</mi></msub></mrow></mfrac>
111
+ - - \frac{{N-x}}{2}
112
+ - <mfrac><mrow><mrow><mi>N</mi><mo>&minus;</mo><mi>x</mi></mrow></mrow><mrow><mn>2</mn></mrow></mfrac>
113
+ - - \hat{x}
114
+ - <mover><mrow><mi>x</mi></mrow><mo>&Hat;</mo></mover>
115
+ - - \int_x f(x)\ dx
116
+ - <msub><mo>&Integral;</mo><mi>x</mi></msub><mi>f</mi><mo stretchy='false'>(</mo><mi>x</mi><mo stretchy='false'>)</mo><mspace width="mediummathspace"/><mi>d</mi><mi>x</mi>
117
+ - - \int_{-\infinity}^\infinity f(x)\ dx = 1
118
+ - <msubsup><mo>&Integral;</mo><mrow><mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mn>&infin;</mn></mrow><mn>&infin;</mn></msubsup><mi>f</mi><mo stretchy='false'>(</mo><mi>x</mi><mo stretchy='false'>)</mo><mspace width="mediummathspace"/><mi>d</mi><mi>x</mi><mo>=</mo><mn>1</mn>
119
+ - - \left ( \binom{2}{3} \right )
120
+ - <mrow><mo>(</mo><mfrac linethickness="0"><mrow><mn>2</mn></mrow><mrow><mn>3</mn></mrow></mfrac><mo>)</mo></mrow>
121
+ - - \left ( \frac{2}{4+x} \right )^3
122
+ - <msup><mrow><mo>(</mo><mfrac><mrow><mn>2</mn></mrow><mrow><mn>4</mn><mo>+</mo><mi>x</mi></mrow></mfrac><mo>)</mo></mrow><mn>3</mn></msup>
123
+ - - \left ( x \right
124
+ - <mrow><mo>(</mo><mi>x</mi></mrow>
125
+ - - \left ( x \right )
126
+ - <mrow><mo>(</mo><mi>x</mi><mo>)</mo></mrow>
127
+ - - \left ( x \right + 3
128
+ - <mrow><mo>(</mo><mi>x</mi></mrow><mo>+</mo><mn>3</mn>
129
+ - - \left \frac{x}{y} \right|_{x=0}
130
+ - <msub><mrow><mfrac><mrow><mi>x</mi></mrow><mrow><mi>y</mi></mrow></mfrac><mo>|</mo></mrow><mrow><mi>x</mi><mo>=</mo><mn>0</mn></mrow></msub>
131
+ - - \left \{ x \right \}
132
+ - <mrow><mo>{</mo><mi>x</mi><mo>}</mo></mrow>
133
+ - - \lim_3
134
+ - <msub><mi>lim</mi><mn>3</mn></msub>
135
+ - - \lim_{x\to\infty}f(x)=0
136
+ - <msub><mi>lim</mi><mrow><mi>x</mi><mo>&rightarrow;</mo><mn>&infin;</mn></mrow></msub><mi>f</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mn>0</mn>
137
+ - - \ln x
138
+ - <mi>ln</mi><mi>x</mi>
139
+ - - \mathbb{Hello}
140
+ - <mi>&Hopf;&eopf;&lopf;&lopf;&oopf;</mi>
141
+ - - \mathcal{Hello}
142
+ - <mi>&Hscr;&escr;&lscr;&lscr;&oscr;</mi>
143
+ - - |-
144
+ \mathop{monkey}
145
+ <
146
+ b
147
+ - <mo lspace="0em" rspace="thinmathspace">monkey</mo><mo>&lt;</mo><mi>b</mi>
148
+ - - \overset{\text{n terms}}{\overbrace{1+2+\cdots+n}}
149
+ - <mover><mrow><mover><mrow><mn>1</mn><mo>+</mo><mn>2</mn><mo>+</mo><mo>&ctdot;</mo><mo>+</mo><mi>n</mi></mrow><mo>&OverBrace;</mo></mover></mrow><mrow><mtext>n terms</mtext></mrow></mover>
150
+ - - \root{3}{x+y}
151
+ - <mroot><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mrow><mn>3</mn></mrow></mroot>
152
+ - - \sqrt{i}
153
+ - <msqrt><mrow><mi>i</mi></mrow></msqrt>
154
+ - - \sum_{n=1}^\infty \frac{(-1)^n}{n} = \ln 2
155
+ - <msubsup><mo lspace="thinmathspace" rspace="thinmathspace">&Sum;</mo><mrow><mi>n</mi><mo>=</mo><mn>1</mn></mrow><mn>&infin;</mn></msubsup><mfrac><mrow><mo stretchy='false'>(</mo><mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mn>1</mn><msup><mo stretchy='false'>)</mo><mi>n</mi></msup></mrow><mrow><mi>n</mi></mrow></mfrac><mo>=</mo><mi>ln</mi><mn>2</mn>
156
+ - - \sum_{n=1}^\infty \frac{1}{n} \text{ is divergent, but } \lim_{n \to \infty} \sum_{i=1}^n \frac{1}{i} - \ln n \text{ exists.}
157
+ - <msubsup><mo lspace="thinmathspace" rspace="thinmathspace">&Sum;</mo><mrow><mi>n</mi><mo>=</mo><mn>1</mn></mrow><mn>&infin;</mn></msubsup><mfrac><mrow><mn>1</mn></mrow><mrow><mi>n</mi></mrow></mfrac><mtext> is divergent, but </mtext><msub><mi>lim</mi><mrow><mi>n</mi><mo>&rightarrow;</mo><mn>&infin;</mn></mrow></msub><msubsup><mo lspace="thinmathspace" rspace="thinmathspace">&Sum;</mo><mrow><mi>i</mi><mo>=</mo><mn>1</mn></mrow><mi>n</mi></msubsup><mfrac><mrow><mn>1</mn></mrow><mrow><mi>i</mi></mrow></mfrac><mo>&minus;</mo><mi>ln</mi><mi>n</mi><mtext> exists.</mtext>
158
+ - - \text{ if }
159
+ - <mtext> if </mtext>
160
+ - - \text{for}\ -\infty
161
+ - <mtext>for</mtext><mspace width="mediummathspace"/><mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mn>&infin;</mn>
162
+ - - \text{if \alpha}
163
+ - <mtext>if \alpha</mtext>
164
+ - - \text{if}
165
+ - <mtext>if</mtext>
166
+ - - \underoverset{S}{\alpha}{x=\infty}
167
+ - <munderover><mrow><mi>x</mi><mo>=</mo><mn>&infin;</mn></mrow><mrow><mi>S</mi></mrow><mrow><mi>&alpha;</mi></mrow></munderover>
168
+ - - \vec{x}
169
+ - <mover><mrow><mi>x</mi></mrow><mo>&RightVector;</mo></mover>
170
+ - - a < b
171
+ - <mi>a</mi><mo>&lt;</mo><mi>b</mi>
172
+ - - a = -3
173
+ - <mi>a</mi><mo>=</mo><mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mn>3</mn>
174
+ - - a ^ b
175
+ - <msup><mi>a</mi><mi>b</mi></msup>
176
+ - - a+3
177
+ - <mi>a</mi><mo>+</mo><mn>3</mn>
178
+ - - a-b
179
+ - <mi>a</mi><mo>&minus;</mo><mi>b</mi>
180
+ - - a=-b
181
+ - <mi>a</mi><mo>=</mo><mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mi>b</mi>
182
+ - - a\in S
183
+ - <mi>a</mi><mo>&Element;</mo><mi>S</mi>
184
+ - - a\mathbb{GOAT}
185
+ - <mi>a</mi><mi>&Gopf;&Oopf;&Aopf;&Topf;</mi>
186
+ - - a\text{ if a fd ew s }b
187
+ - <mi>a</mi><mtext> if a fd ew s </mtext><mi>b</mi>
188
+ - - a\text{ if }b
189
+ - <mi>a</mi><mtext> if </mtext><mi>b</mi>
190
+ - - a\text{ if}b
191
+ - <mi>a</mi><mtext> if</mtext><mi>b</mi>
192
+ - - a\text{if }b
193
+ - <mi>a</mi><mtext>if </mtext><mi>b</mi>
194
+ - - a\text{if}b
195
+ - <mi>a</mi><mtext>if</mtext><mi>b</mi>
196
+ - - a^b
197
+ - <msup><mi>a</mi><mi>b</mi></msup>
198
+ - - a^b_c
199
+ - <msubsup><mi>a</mi><mi>c</mi><mi>b</mi></msubsup>
200
+ - - a^{b_c} < a^b_c
201
+ - <msup><mi>a</mi><mrow><msub><mi>b</mi><mi>c</mi></msub></mrow></msup><mo>&lt;</mo><msubsup><mi>a</mi><mi>c</mi><mi>b</mi></msubsup>
202
+ - - a_b
203
+ - <msub><mi>a</mi><mi>b</mi></msub>
204
+ - - if
205
+ - <mi>i</mi><mi>f</mi>
206
+ - - w_r \equiv \frac{P^*({x^{(r)}})}{Q^*({x^{(r)}})}.
207
+ - <msub><mi>w</mi><mi>r</mi></msub><mo>&equiv;</mo><mfrac><mrow><msup><mi>P</mi><mo>*</mo></msup><mo stretchy="false">(</mo><mrow><msup><mi>x</mi><mrow><mo stretchy="false">(</mo><mi>r</mi><mo stretchy="false">)</mo></mrow></msup></mrow><mo stretchy="false">)</mo></mrow><mrow><msup><mi>Q</mi><mo>*</mo></msup><mo stretchy="false">(</mo><mrow><msup><mi>x</mi><mrow><mo stretchy="false">(</mo><mi>r</mi><mo stretchy="false">)</mo></mrow></msup></mrow><mo stretchy="false">)</mo></mrow></mfrac><mo>.</mo>
208
+ - - x
209
+ - <mi>x</mi>
210
+ - - x + - x
211
+ - <mi>x</mi><mo>+</mo><mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mi>x</mi>
212
+ - - x - x
213
+ - <mi>x</mi><mo>&minus;</mo><mi>x</mi>
214
+ - - x--x
215
+ - <mi>x</mi><mo>&minus;</mo><mo lspace="verythinmathspace" rspace="0em">&minus;</mo><mi>x</mi>
216
+ - - x\textstyle{\int_0^1}\displaystyle{\int_0^1}y
217
+ - <mi>x</mi><mstyle displaystyle="false"><mrow><msubsup><mo>&Integral;</mo><mn>0</mn><mn>1</mn></msubsup></mrow></mstyle><mstyle displaystyle="true"><mrow><msubsup><mo>&Integral;</mo><mn>0</mn><mn>1</mn></msubsup></mrow></mstyle><mi>y</mi>
218
+ - - "{E_\\theta\\left[\\hat{\\theta}\\right]}"
219
+ - <mrow><msub><mi>E</mi><mi>&theta;</mi></msub><mrow><mo>[</mo><mover><mrow><mi>&theta;</mi></mrow><mo>&Hat;</mo></mover><mo>]</mo></mrow></mrow>
220
+ - - "{\\frac{\\alpha-\\delta}{\\beta-\\gamma}}"
221
+ - <mrow><mfrac><mrow><mi>&alpha;</mi><mo>&minus;</mo><mi>&delta;</mi></mrow><mrow><mi>&beta;</mi><mo>&minus;</mo><mi>&gamma;</mi></mrow></mfrac></mrow>
222
+ - - "{\\frac{\\alpha-{\\mathbb{GOAT}}}{\\beta-{{\\mathbb{GOAT}}-x}}}"
223
+ - <mrow><mfrac><mrow><mi>&alpha;</mi><mo>&minus;</mo><mrow><mi>&Gopf;&Oopf;&Aopf;&Topf;</mi></mrow></mrow><mrow><mi>&beta;</mi><mo>&minus;</mo><mrow><mrow><mi>&Gopf;&Oopf;&Aopf;&Topf;</mi></mrow><mo>&minus;</mo><mi>x</mi></mrow></mrow></mfrac></mrow>
224
+ - - "{\\mathbb{GOAT}}_3"
225
+ - <msub><mrow><mi>&Gopf;&Oopf;&Aopf;&Topf;</mi></mrow><mn>3</mn></msub>
226
+ - - "{x}"
227
+ - <mrow><mi>x</mi></mrow>
228
+ - - "{y-x}"
229
+ - <mrow><mi>y</mi><mo>&minus;</mo><mi>x</mi></mrow>
230
+ - - "{{N-x}-x}"
231
+ - <mrow><mrow><mi>N</mi><mo>&minus;</mo><mi>x</mi></mrow><mo>&minus;</mo><mi>x</mi></mrow>
232
+ - - "{{{N-x}-x}-x}"
233
+ - <mrow><mrow><mrow><mi>N</mi><mo>&minus;</mo><mi>x</mi></mrow><mo>&minus;</mo><mi>x</mi></mrow><mo>&minus;</mo><mi>x</mi></mrow>