Re: TeXForm and negative exponents

*To*: mathgroup at smc.vnet.net*Subject*: [mg32252] Re: TeXForm and negative exponents*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Wed, 9 Jan 2002 23:37:05 -0500 (EST)*Organization*: Universitaet Leipzig*References*: <a1gv2g$n6g$1@smc.vnet.net>*Reply-to*: kuska at informatik.uni-leipzig.de*Sender*: owner-wri-mathgroup at wolfram.com

Hi, Unprotect[Times] Format[a_*E^(b_), TeXForm] := SequenceForm[a, "\\,\\exp\\left({", b, "}\\right)"] Protect[Times] should do that. Regards Jens Jens Dreger wrote: > > Hi all! > > I want to save some expressions in TeX-format like so: > > Put[TeXForm[expr],file] > > where expr contains exponentials with negative exponents > which I want to show up in the output as _negative_. > For some reason, Mathematica always "simplifies" the > expression so it only contains positive exponents. > > Example: > > In[1]:= TeXForm[1/(1 + 2 Exp[-3 t])] > Out[1]:= \frac{1}{1 + \frac{2}{e^{3\,t}}} > > Ok, so I thought, HoldForm might help: > > In[2]:= TeXForm[HoldForm[(1 + 2 Exp[-3 t] )]] > Out[2]:= 1 + 2\,\exp (-3\,t) > > Great, only my expression does not contain Exp[], but > the 2d form. In that case, HoldForm does not seem to do > the trick... > > 1 > In[3]:= TeXForm[HoldForm[--------------] > (1+2 e^{-3 t}) > > Out[3]:= \frac{1}{1 + \frac{2}{e^{3\,t}}} > > The output I want is: > > \frac{1}{1 + 2 e^{-3 t}} > > Wrapping StandardForm around expr does seem to help, > but then the TeX-Output contains all kinds of special > commands, which I don't want. In this small example > it's ok, but not on the large expressions. > > Is there an easy way, to get TeXFrom to do what I intend? > > Thanks a lot in advance! > > Jens.