MathGroup Archive 2011

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

Search the Archive

Re: Formatting a Cell Programmatically

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116756] Re: Formatting a Cell Programmatically
  • From: Helen Read <readhpr at gmail.com>
  • Date: Sat, 26 Feb 2011 06:07:40 -0500 (EST)
  • References: <ik8493$n1v$1@smc.vnet.net>

On 2/25/2011 6:37 AM, Gregory Lypny wrote:
> Hello everyone,
>
> Is there a way to programmatically format an output cell so that even if it is deleted, it can be restored with its original format simply by executing the input cell again?  Suppose my input cell contains an expression to create a table such as
>
> 	Table[{x, Sqrt[x], x^3}, {x, 0, 100}]
>

> What functions would I wrap around that input so that the output
> cell  appears with, say, a frame and a light brown background? I've been
> messing around Cell[...] and CellPrint[...] but all of the examples I've
> seen have taken straight text as the argument and I haven't gotten
> anything to work with a computation.

Have a look at Style and Framed.

Framed[Style[Table[{x, Sqrt[x], x^3}, {x, 0, 100}],
   Background -> LightBrown]]


For a Table, you might want to display as a Grid, like so.


Grid[Table[{x, Sqrt[x], x^3}, {x, 0, 100}], Frame -> All]


Here it is rather massively styled:


Grid[Table[
   Map[Style[#, 16, Bold, Red] &, {x, Sqrt[x], x^3}], {x, 0, 100}],
  Frame -> All, FrameStyle -> Thick,
  Background -> {None, {{LightBlue, LightOrange}}, 1 -> Yellow}]



-- 
Helen Read
University of Vermont


  • Prev by Date: Re: Formatting a Cell Programmatically
  • Next by Date: Re: Formatting a Cell Programmatically
  • Previous by thread: Re: Formatting a Cell Programmatically
  • Next by thread: Re: Formatting a Cell Programmatically