MathGroup Archive 2012

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

Search the Archive

Re: Superscript on plus expression


Am 27.11.2012 09:39, schrieb Dave Snead:
> Hi,
>
> How can I get Mathematica to parenthesize the sum in
> Superscript[Plus[a,b],k] ?

Seems to be impossible to intercept output of Superscript by Format. 
Defining

Format[superscript[a_Plus,b_]]:= Superscript[MatrixForm[{a}],b]

is working.

One may catch Superscript[Plus ,..] by  postprocessing output:

$Post=
If[ MatchQ[#,Superscript[_Plus,_],
     (MapAt[MatrixForm[{#}]&), #, 1],
     #]&

Superscript is a special text case because the input parser reads it as 
power, which is a pain for index gynm. On the other hand even in text 
cells it is not possible to avoid brackets in mixed tensor index 
super/subscripts.

Probably, the best way is to write a tensor index Format routine with
a List of {index-x-position,index-y-position, indexvalue} for each 
index, a task not a too difficult with MakeBoxes.

-- 

Roland Franzius



  • Prev by Date: Re: vlookup like function sugestion
  • Next by Date: FinancialBond / Cashflow
  • Previous by thread: Superscript on plus expression
  • Next by thread: Re: Superscript on plus expression