I think I've found a bug in the tex() function. Consider the following:
b[n];
tex(%);
1/(b[n]);
tex(%);
1/b[n]**2;
tex(%);
b[n]**2;
tex(%);
when run I get:
(C1) b[n];
(D1) b
n
(C2) tex(%);
$$b_{n}$$
(D2) FALSE
(C3) 1/(b[n]);
1
(D3) --
b
n
(C4) tex(%);
$${{1}\over{b_{n}}}$$
(D4) FALSE
(C5) 1/b[n]**2;
1
(D5) --
2
b
n
(C6) tex(%);
$${{1}\over{b^2\left(n\right)}}$$
(D6) FALSE
(C7) b[n]**2;
2
(D7) b
n
(C8) tex(%);
$$b^2\left(n\right)$$
The first two are correct, but the last two aren't.
David