Imaxima and imath home page adds inline graph tutorial



I wonder if someone knows how a user can define a
new rule for imaxima to output a piece of latex'd math.
I think this question is not too specific to imaxima.

Ideally, I would have both a variable that turns the special
processing on and off, like display2d, and with a one-shot
funtion like pretty_print_my_object().

Specifically, if I have
  
  v : matrix( [x,y] )

I would get the following processed and inserted into the imaxima
(or wxmaxima, or ...) buffer when I display v

  $ x \lvert 0 \rangle + y \lvert 1 \rangle $

and, of course, I would write a function to process more complicated
cases.