Re: Format[ ] with \[OverBracket] in a package `Private` context
- To: mathgroup at smc.vnet.net
- Subject: [mg56469] Re: Format[ ] with \[OverBracket] in a package `Private` context
- From: Peter Pein <petsie at arcor.de>
- Date: Tue, 26 Apr 2005 01:33:59 -0400 (EDT)
- References: <d4hvn9$1io$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Trevor Baca wrote:
> hello mathgroup,
>
> my goal is to format foo[_List] objects with an overscripted
> \[OverBracket], and then shove this bit of code into a package for
> later access. this does the trick in a notebook session:
>
> Format[foo[l_List]] := Overscript[RowBox[l], \[OverBracket]] //
> DisplayForm;
>
> the interpreter now outputs foo[{2,3,4,5}] as 1 2 3 4 with a lovely
> overbracket stretching across the top. so far so good. now the hard
> part: shoving this bit of code into a package without context issues
> getting in the way.
>
> (three example packages follow; feel free to skip to the section marked
> "CONCLUSION" at the bottom for the actual question.)
>
OK, skipping...
>
> CONCLUSION: so is it better to stick the OverBracket symbol into the
> System` context (as in solution package 1), or to stick the OverBracket
> symbol into the Foo` context (as in solution package 2), or to do
> something else entirely?
>
> (i strongly prefer solution 1 (using the System` context) because it
> seems bizarre to me that the OverBracket symbol doesn't already exist
> in the System` context, so why not remedy the situation? on the other
> hand, i could be convinced that messing with the System` context is as
> bad an idea as messing with most reserved namespaces, hence solution 2.
> but what i don't like about solution 2 is that after loading the
> package, Names["Foo`*"] will give you both "foo" (which is good) and
> "\[OverBracket]" (which just seems wrong)).
>
> anything to help make the decision or clean this up?
>
>
> trevor.
>
Hello Trevor,
simply use System`\[OverBracket]:
BeginPackage["Foo`"]
foo::usage="foo objects print with overbracket.";
Begin["`Private`"]
Format[foo[e_]]:=Overscript[RowBox[e],System`\[OverBracket]]//DisplayForm
End[]
EndPackage[]
--
Peter Pein
Berlin