MathGroup Archive 2005

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

Search the Archive

CellPrint with text, table and graphics


I am trying to work out how to mix text, a table and graphics all in one
cell. Developing a previous post (which I can't now find) I have got as far
as the code below.

1. Can my approach be improved on and made simpler?

2. Can the data in the table be aligned on the first digit so that the
negative sign projects to the left? I note that sign counts as one digit it
would be better if it didn't.

3. Can the heading for the column in the table, bk,  be centered over the
column? (The heading should be in Traditional form and be b subscript k but
this caused a flood of box forms to appear when I cut and pasted the email)



Thanks

Hugh Goyder

(* generate raw text, data and graphics *)
tx = "Some text";
bb = {-19214.88484, 230.1609318, -1.028803876, 0.002414336487,
-2.902395566 10^(-6), 1.430493449 10^(-9)};
tt = Transpose[{Table[n - 1, {n, Length[bb]}], bb}];
gg = Plot[x + 2Sin[x], {x, 0, 2Pi}, Frame -> True,
FrameLabel -> {ToString[Unevaluated[x "-axis"], TraditionalForm],
ToString[Unevaluated[x + y Sin[x]], TraditionalForm]},
TextStyle -> {FontFamily -> "Times", FontSize -> 16},
ImageSize -> 5 72];


(* format text, data and graphics *)
tx1 = StyleForm[tx,
FontFamily -> "Times", FontSize -> 18, FontSlant -> "Italic"]
tt1 = TableForm[tt, TableHeadings -> {None,
{ToString[Unevaluated[k], TraditionalForm],
ToString[Unevaluated[bk], TraditionalForm]}},
TableAlignments -> {Left}]
gg1 = Cell[GraphicsData["PostScript", DisplayString[gg]]];


(* print a cell with mixed text, data and graphics *)
CellPrint[
Cell[ BoxData[ GridBox[{{gg1, GridBox[{{ToBoxes[tx1]}, {ToBoxes[tt1]}},
RowsEqual -> False, RowLines -> True, RowSpacings -> 5]}},
RowAlignments -> Center, ColumnLines -> True, GridFrame -> True] ],
"Text"]]




  • Prev by Date: Re: Re: pure functions vs. functions
  • Next by Date: Re: How To Override FrontEnd/init.m Settings?
  • Previous by thread: Re: JLink / java.io.ObjectInputStream.redObject[] - ClassNotFoundException
  • Next by thread: Re: CellPrint with text, table and graphics