I noticed recently that tex-mcond is quite broken:
(%i2) tex(if x<0 then 0)$
$$\mathbf{if}\;x<0\;\mathbf{then}\;0\;\mathbf{else}\;\mathbf{false}$$
[looks like: if x<0 then 0 else false]
(%i3) tex(if x<0 then 0 elseif x>0 then 1)$
$$\mathbf{if}\;x<0\;\mathbf{then}\;0\;\mathbf{else}\;1$$
[looks like: if x<0 then 0 else 1]
(%i4) tex(if x<0 then 0 elseif x>0 then 1 else 1/2)$
$$\mathbf{if}\;x<0\;\mathbf{then}\;0\;\mathbf{else}\;1$$
[looks like: if x<0 then 0 else 1]
The code assumes that the mcond contains only two clauses, and that
the condition of the second clause is T. Thus it only handles the
following case correctly: "if <cond> then <e1> else <e2>"
Also, it contains logic to print only "if <cond> then <e1>" if the
result of the second clause is '$false. I believe it should be
checking for NIL instead, since Maxima parses "false" as NIL,
and NIL is what one actually finds in such expressions:
(%i5) ?print(if x<0 then 0)$
((MCOND SIMP) ((MLESSP SIMP) $X 0) 0 T NIL)
After applying the patch below, these are the new results:
(%i2) tex(if x<0 then 0)$
$$\mathbf{if}\;x<0\;\mathbf{then}\;0$$
(%i3) tex(if x<0 then 0 elseif x>0 then 1)$
$$\mathbf{if}\;x<0\;\mathbf{then}\;0\;\mathbf{elseif}\;x>0
\;\mathbf{then}\;1$$
(%i4) tex(if x<0 then 0 elseif x>0 then 1 else 1/2)$
$$\mathbf{if}\;x<0\;\mathbf{then}\;0\;\mathbf{elseif}\;x>0
\;\mathbf{then}\;1\;\mathbf{else}\;\frac{1}{2}$$
If I don't hear any objections, I will soon commit this patch to both
the trunk and the 5.23 branch.
Mark