MathGroup Archive 1999

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

Search the Archive

creating input cell with unevaluated expression?


Can anyone tell me how to do the following?  I want to write an
expression that creates and inserts (at the current position in the
front-end) an input cell containing a given *unevaluated* expression,
just as if the user had typed it in himself.  For instance, I'd like
to create an input cell containing the expression "1+1", so that if
the user then evaluates the cell, he gets an output cell containing
"2".

I tried 

	StylePrint[HoldForm[1+1],"Input"]

but that doesn't work -- the input cell still has the "Hold" tag, so
when the user evaluates it by hand, he gets an output cell containing
"1+1" rather than "2".

I also tried 

	StylePrint[Unevaluated[1+1],"Input"]

but that just gave me a "2" in the input cell.  So what's the "right"
way to do this?


  • Prev by Date: Mathematica programming language
  • Next by Date: Re: Hatching a Rectangle?
  • Previous by thread: Mathematica programming language
  • Next by thread: Re: Mathematica 3.0 "Report Summary"