MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Design problem in 4.2?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38783] Re: Design problem in 4.2?
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Sun, 12 Jan 2003 06:17:06 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

	Earlier I showed Jonathan Mann how to have a muliplication sign used
when the result of the following is displayed.

> In[1]:=  40 (8)^t
> 
> Out[1]  5 8^(1+t)
> 
> --------------
	You might also want to ensure a multiplication sign is used in cases
such as  
	In[2]:=  40*8.2^t
	In[3]:=  40.5*8^t
	In[4]:=  40.5*8.2^t
	To do that use the following lines as desired.
	--------------

MakeBoxes[n_Integer*m_Integer^pow_,form_]:=
   RowBox[{ToString[n],"*",SuperscriptBox[ToString[m],MakeBoxes[pow,form]]}]

MakeBoxes[n_Integer*m_Real^pow_,form_]:=
   RowBox[{ToString[n],"*",SuperscriptBox[ToString[m],MakeBoxes[pow,form]]}]

MakeBoxes[n_Real*m_Integer^pow_,form_]:=
   RowBox[{ToString[n],"*",SuperscriptBox[ToString[m],MakeBoxes[pow,form]]}]

MakeBoxes[n_Real*m_Real^pow_,form_]:=
   RowBox[{ToString[n],"*",SuperscriptBox[ToString[m],MakeBoxes[pow,form]]}]
	  
	---------------------

	I thought instead of the four lines above I could only use the
following:

MakeBoxes[n:(_Integer|_Real)*m:(_Integer|_Real)^pow_,form_]:=
	
RowBox[{ToString[n],"*",SuperscriptBox[ToString[m],MakeBoxes[pow,form]]}] 

	but this doesn't work.  Can anyone explain why?

> -------------
> If you put code like this in your (init.m) file it will evaluate every
> time Mathematica is launched.  On my computer the init.m file is located
> at 
	   C:\Program Files\Wolfram
Research\Mathematica\4.1\Configuration\Kernel\init.m 


> Regards,
>   Ted Ersek
> 
> Download my collection of Mathematica tricks from:  
> http://www.verbeia.com/mathematica/tips/Tricks.html
> and  
> http://www.verbeia.com/mathematica/tips/GraphicsTricks.html
> 
> 


  • Prev by Date: Re: FileNameDialog
  • Next by Date: Re:MacOS X front end patch available
  • Previous by thread: Re: Design problem in 4.2?
  • Next by thread: Re: Design problem in 4.2?