Re: Mathematica Ouput: subscripts and superscripts
- To: mathgroup at smc.vnet.net
- Subject: [mg15066] Re: Mathematica Ouput: subscripts and superscripts
- From: Rolf Mertig <rolf at mertig.com>
- Date: Thu, 10 Dec 1998 03:13:00 -0500
- Organization: Mertig Research & Consulting
- References: <74aj8i$46k@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Andreas Paul Friedrich Bernhard wrote: > > sub/super/over and underscripts. However, is it possible to define a > variable (including any sub,super,over,underscripts) that is recognised > as a single expression. > > For example I would like to use a variable defined as an x with two over > dots (as in "x dot dot"), however Mathematica will not permit this. > > Similarly I would like to define a variable defined as x with the > subscript 0a, however Mathematica will treats the subscript as a > seperate 0*a subexpression, rather than an intrinsic part of the > variable definition. > > Andy If you basically care about the output, then one possibility is: xdd/: MakeBoxes[xdd, _] := OverscriptBox["x", "\[DoubleDot]"] x0a/: MakeBoxes[x0a, _] := SubscriptBox["x", StyleBox["0a", ZeroWidthTimes -> True]] or, more general: x/: MakeBoxes[x[i_Integer,a_Symbol], _]:= SubscriptBox["x", StyleBox[RowBox[{i,a}], ZeroWidthTimes -> True]] Now evaluate: {xdd, x0a, x[1,s]} and it looks nice. Rolf ------ Rolf Mertig Mertig Research & Consulting Mathematica training and programming Development and distribution of FeynCalc Amsterdam, The Netherlands http://www.mertig.com