I'm giving a course where students are used to the mixed number notation. However, all the calculations that maxima does, use the more traditional notation of fractions. Is it possible to present 3/2 as 1 1/2. I need this for the latex output only.
(%i4) tex(3/2);
$${{3}\over{2}}$$
(%o4) false
So instead of this I would like to get:
(%i4) tex(3/2);
$$1 {{1}\over{2}}$$
(%o4) false
Is this possible?
You can assign TeX properties via
texput. Rational numbers are represented as((RAT) mmm nnn)which you can see via:lisp $xwherexis a Maxima variable which is a rational number. So, you can set the TeX property by:where your function
texratis defined as (for example):Example:
Note that the new function is applied to a rational even when it's inside another operator.
Of course you can change the output of
texratto make it whatever you want.Note that the
?beforeratis necessary in the call totexput.Some of this stuff is undocumented; sorry about that.