I'm trying to display a number tables of data in my document which have column headings that are longer than the cell width for those columns so they need to wrap within the grid cell. I have no problem getting the text to wrap however when it does the wrapped text is indented from the first line rather than in line with it - which produces other undesirable results.
I'd like the wrapped text to be in vertical alignment with the first line of text.
As an alternative, I'd like to have all the text in the cell centered.
The code to generate this table is as follows
inputs = {{{231001, "BaseCase", "Base"}, {231001, "BaseCase",
"10"}, {231001, "BaseCase", "8"}, {231001, "BaseCase",
"Base"}, {231001, "BaseCase", "Base"}, {231001, "BaseCase",
"Base"}, {231001, "BaseCase", "Base"}, {231001, "BaseCase",
"Inactive"}, {231001, "BaseCase", "Base"}}, {{231002,
"BaseCase + 4xFail", "Base"}, {231002, "BaseCase + 4xFail",
"10"}, {231002, "BaseCase + 4xFail", "4"}, {231002,
"BaseCase + 4xFail", "Base"}, {231002, "BaseCase + 4xFail",
"Base"}, {231002, "BaseCase + 4xFail", "Base"}, {231002,
"BaseCase + 4xFail", "Base"}, {231002, "BaseCase + 4xFail",
"Inactive"}, {231002, "BaseCase + 4xFail", "Base"}}, {{231003,
"BaseCase + 6xFail", "Base"}, {231003, "BaseCase + 6xFail",
"10"}, {231003, "BaseCase + 6xFail", "6"}, {231003,
"BaseCase + 6xFail", "Base"}, {231003, "BaseCase + 6xFail",
"Base"}, {231003, "BaseCase + 6xFail", "Base"}, {231003,
"BaseCase + 6xFail", "Base"}, {231003, "BaseCase + 6xFail",
"Inactive"}, {231003, "BaseCase + 6xFail", "Base"}}, {{231004,
"BaseCase + 8xFail", "Base"}, {231004, "BaseCase + 8xFail",
"10"}, {231004, "BaseCase + 8xFail", "8"}, {231004,
"BaseCase + 8xFail", "Base"}, {231004, "BaseCase + 8xFail",
"Base"}, {231004, "BaseCase + 8xFail", "Base"}, {231004,
"BaseCase + 8xFail", "Base"}, {231004, "BaseCase + 8xFail",
"Inactive"}, {231004, "BaseCase + 8xFail", "Base"}}, {{231005,
"BaseCase + 10xFail", "Base"}, {231005, "BaseCase + 10xFail",
"10"}, {231005, "BaseCase + 10xFail", "10"}, {231005,
"BaseCase + 10xFail", "Base"}, {231005, "BaseCase + 10xFail",
"Base"}, {231005, "BaseCase + 10xFail", "Base"}, {231005,
"BaseCase + 10xFail", "Base"}, {231005, "BaseCase + 10xFail",
"Inactive"}, {231005, "BaseCase + 10xFail", "Base"}}};
factorNames = {\[ThinSpace]"Animal Purpose", "Event Duration",
"Long Failure Count", "Smelly Dam Capacity", "Septic Dam Capacity",
"New Dam Purpose", "Big Pump Status",
"Temp Elephant Status (Train 0)", "Plant Variety"\[ThinSpace]};
tableText = Join[
{Join[{"Scenario Number", "Scenario Name"}, factorNames]},
Join[inputs[[#, 1, {1, 2}]], inputs[[#, All, 3]]] & /@
Range[Length[inputs]]
];
Text[Grid[tableText, Frame -> All,
ItemStyle -> {FontSize -> 10, {Bold}}, ItemSize -> {{5, 15, {6}}}]]
BaseStyle -> {LineIndent -> 0}
. In general you will have no guarantee that the string won't be split just before whitespace which will later look like an indent anyway. From my experience, prepare labels exactly as you want them to be, don't count on automatic text styling. $\endgroup$