Using latex symbols in expressions



On 2013-01-01, Johan Ekh <ekh.johan at gmail.com> wrote:

> here comes a newbie question. I'd like to  use symbols like "\Delta u" in
> mathematical expressions. It seems that maxima treats the above as two
> separate symbols but I'd like it to be a single symbol. Is this possible?

Well, you can customize the LaTeX output; see 'texput'.

  texput (Delta_u, "\\Delta u");
  tex (sqrt (1 + Delta_u));
   => $$\sqrt{\Delta u+1}$$

Note that the symbol in Maxima is still Delta_u. If you want Maxima to
parse "Delta u" as an operator Delta applied to an argument u, you can
declare Delta as a prefix operator:

  prefix ("Delta");
  foo : Delta u;
  [op (foo), args (foo)];
   => [Delta, [u]] 
  sqrt (1 + Delta u);
   => sqrt(Delta u + 1)
  texput ("Delta", "\\Delta ", prefix);
  tex (sqrt (1 + Delta u));
   => $$\sqrt{\Delta u+1}$$

Hope this helps,

Robert Dodier