Re: Two-dimensional input
- To: mathgroup at smc.vnet.net
- Subject: [mg31564] Re: [mg31183] Two-dimensional input
- From: Omega Consulting <omega_consulting at yahoo.com>
- Date: Sun, 11 Nov 2001 16:26:07 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
At 11:19 PM 10/15/2001, Garry Helzer wrote: >To accompany some lecture notes I am developing I would like to define a >pair of functions of x that could be entered from the keyboard as >x^\[UpArrow] and x^\[DownArrow]. The problem is that \[UpArrow] is a >binary operator and \[DownArrow] is a letterlike form. Is there a way? I >could, of course, use something like superminus and subminus, but I really >prefer the arrows. To have a certain kind of input interpreted as an expression, you must define how to convert the boxes into that expression. For example, In[]:= MakeExpression[SuperscriptBox["x","\[UpArrow]"],form_] := MakeExpression["XUpArrow",form] In[]:= \!\(\(x\^\[UpArrow]\)[1]\) Out[]= XUpArrow[1] If you want output to use the special form, you must define how to turn an expression into boxes. In[]:= MakeBoxes[XUpArrow[arg_], form_] := RowBox[{SuperscriptBox["x","\[UpArrow]"], "[",MakeBoxes[arg],"]"}] In[]:= \!\(\(x\^\[UpArrow]\)[1]\) Out[]= \!\(\(x\^\[UpArrow]\)[1]\) -------------------------------------------------------------- Omega Consulting "The final answer to your Mathematica needs" Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html