Consider this example:
Grid[{{ TextCell[Row[{"This goes to the first column"}]
, PageWidth -> 80, Bold (* sufficient to state width only on first row of Grid *)
]
, TextCell[Row[{"and this to the second one"}]
, PageWidth -> 142, Bold
]
, TextCell[Row[{"3rd Col"}]
, PageWidth -> 30, Bold
]
, TextCell[Row[{"4th"}]
, PageWidth -> 80, Bold
]
} (* first grid row finished *)
, { TextCell[Row[{"x=", x}]]
, TextCell[Row[{"x^2="}]]
, TextCell[Row[{x^2}]]
, TextCell[Row[{"Squares are easily computed by hand."}]]
} (* 2nd grid row finished *)
, { TextCell[Row[{"x=", x}]]
, TextCell[Row[{"Sqrt[x]="}]]
, TextCell[Row[{Sqrt[x]}]]
, TextCell[Row[{"Square roots are more difficult."}]]
} (* 3rd grid row finished *)
, { TextCell[Row[{"x=", 2}]]
, TextCell[Row[{"Sqrt[x]="}]]
, TextCell[Row[{Sqrt[2]}]], TextCell[Row[{"easy as a symbol"}]]
} (* 4th grid row finished *)
, { TextCell[Row[{"x=", 2.}]]
, TextCell[Row[{"Sqrt[x]="}]]
, TextCell[Row[{1.4142135623730951}]]
, TextCell[Row[{"endless numerical work."}]]
} (* 5th grid row finished *)
}
, Alignment -> {Right, Top} (* why does it not work on the top of the first 2 cols? *)
, ItemSize -> {Automatic, Automatic} (* by this rewrap if window becomes too narrow *)
, Frame -> {All, 1 -> True}
] (*Grid*)
Why are the Grid-options {Right, Top} not honored in the first two headline columns of the grid? Is it a bug in Mma 12.3?
Why is the third column's headline wrapped although it would fit into the column?
The resultant Grid has the nice property that it is re-wrapped if the notebook window becomes too narrow to display the whole grid, which I consider to be very useful.
Background: The problem arose when developing something to print to columns with the hints I got from Is there a function similar to Print which really respects tabs and newlines?
CellFrame -> True
to each TextCell to see howGrid
is aligning each grid item. Didn't you ask a similar question before in there was white space in some of the grid items that made it look likeGrid
was failing to align them properly? $\endgroup$Grid
. Informatter[objects, Alignment -> a]
, the alignment is applied to each object, not to the things (such as text) inside the object. If an object is given an alignment option, it will apply to the things inside the object, and not to the object itself. (BaselinePosition
has an effect on or outside the object, arguably.) $\endgroup$Alignment
ofGrid
. The text in the box however is aligned to the left by default. It seems that one has to expressively request the alignment both on the Row-level and on the Grid-level, i.e. twice! It seems that there are bugs inAlignment->Right
andAlignment->Center
: If wrapping happens in the text, only one of the wrapped parts is really aligned to the right or center. $\endgroup$