(*********************************************************************

	Copyright 1989 by Roman E. Maeder
	
	Adapted from
	Roman E. Maeder: Programming in Mathematica, Addison-Wesley, 1989.

	Permission is hereby granted to make copies of this file for
	any purpose other than direct profit, or as part of a
	commercial product, provided this copyright notice is left
	intact.  Sale, other than for the cost of media, is prohibited.
	
	Permission is hereby granted to reproduce part or all of
	this file, provided that the source is acknowledged.

 *********************************************************************)


BeginPackage["RMPackages`Tensors`"]

ui::usage = "ui[index] denotes an upper index in a tensor."
li::usage = "li[index] denotes a lower index in a tensor."
Tensor::usage = "Tensor[h][indices] denotes a tensor h with index list indices."

Begin["`Private`"]

Format[ Tensor[t_][ind___] ] :=
	Block[{indices},
		indices = {ind} /. {ui->Superscript, li->Subscript};
		SequenceForm[t, Sequence @@ indices]
	] 

Format[ Tensor[t_][ind___], TeXForm ] :=
	Block[{indices},
		indices = {ind} /. {ui->Superscript, li->Subscript};
		indices = Transpose[{Table["{}", {Length[indices]}], indices}];
		SequenceForm[t, Sequence @@ Flatten[indices, 1]]
	] 

End[]

EndPackage[]
