MathGroup Archive 2010

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

Search the Archive

Formatting a symbol without evaluating it

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109007] Formatting a symbol without evaluating it
  • From: Rui <rui.rojo at gmail.com>
  • Date: Sat, 10 Apr 2010 06:52:51 -0400 (EDT)

In a package, I want some output to be of the form x[blabla] in
TraditioanlForm. I don't want "x" to be replaced by a value in the
case x is already defined. If I use "x" as a String instead of x, it
doesn't format well in TraditionalForm, and same happens with
HoldForm[x][blah]. I thought of wrapping x in a block but then it is
part of the package context and formats with package`x[blahblah]. I've
solved that issue in several ways throughout these weeks, but I'm
seing it happens often, so I'd like to know a neat nice way of dealing
with it.Perhaps you know some simple way to tell Mathematica "in this
place, treat x as a symbol belonging to the context where it's
executed, and don't evaluate iiit, just format it".
Well, here's a simplistic sample code to show my general doubt:

blah.m:
BeginPackage[];
hoho::usage="Hello fellows";
Begin["`private`"];
hoho:=Style[

x[a+b+2 b

], Large]//TraditionalForm
End[];
EndPackage[];

blah2.nb

Needs["blah`"];
x=234;
hoho
(* I want "x(a+3b)" here. And I want that to be the output always, no
matter if x has a value here, if x has a value in another part of the
package, or if it's called from Global or Whatever context*)

Thank you all :)


  • Prev by Date: Re: evaluate the floor s to yield a number
  • Next by Date: Re: List Manipulation: Conditionally changing y value when x value meets some criteria
  • Previous by thread: Re: List Manipulation: Conditionally changing y value
  • Next by thread: Simultaneous Nonlinear Data Fits