imaxima and definitions (UI question)



   >From mailnull  Fri Mar  1 21:05:02 2013
   Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of math.utexas.edu designates 146.6.25.6 as permitted sender) client-ip=146.6.25.6; envelope-from=maxima-bounces at math.utexas.edu; helo=irongate.mail.utexas.edu;
   From: Tamas Papp <tkpapp at gmail.com>
   Date: Fri, 1 Mar 2013 15:19:50 +0100
   Content-Type: text/plain; charset="us-ascii"

   Hi,

   I have a problem and I am not sure what the best approach is to a
   solution, so I will just describe it -- I am sure that someone has
   encountered it before.  Suggestions would be welcome.

   When writing equations, I prefer to introduce a layer of indirection in
   LaTeX: instead of writing, say, $r+\\sigma$, I prefer to define

   \newcommand{\Ndisc}{r}      % the discount rate
   \newcommand{\Nsep}{\\sigma} % the separation rate

   and write $\Ndisc+\Nsep$.  This allows flexible redefinition if I want
   to change the notation later on.

   I want to continue using this style with maxima, and it should be simple
   with texput().  But I want to keep using imaxima, which introduces a
   complication.  Ideally I would just save the definitions in a LaTeX
   file, and make imaxima use \input{definitions.tex}.  There is
   imaxima-latex-preamble, but it is dumped when imaxima is started, so I
   would have to set it before I start (i)maxima.

   I tried 

   set_tex_environment_default("$$\\input{definitions.tex}","$$")$

   but imaxima (or appears to ignore) ignores the environment.

   I could have two sets of texput commands, one for working with imaxima,
   one for dumping TeX for direct use, but that is somewhat tedious, for a
   lot of definitions.

   So I don't know what the best approach is.

   Best,

   Tamas


Can't you use the hook imaxima-startup-hook to set
imaxima-latex-preamble at the right time?  If this hook isn't run at
the right time for you, then you could advise the imaxima function, I
guess. Or, you could write a small elisp wrapper that does something
equivalent.

Leo