Long text inside a grid does not word wrap

If I create a simple grid with Ctrl+, and paste a long piece of text outside the boxes (I'm sure you can find some yourself), then that text does not break at the width of the window in Mathematica. Instead, you have to scroll through it with a newly appeared scroll bar at the bottom.

How can this be fixed?

As an example, you can see bellow here how the word 'also' is getting cut off. I am typing this in, it is not the output of a cell:

Really, my goal is to put text besides a picture.

So thanks to Kuba, here is an attempt to first create a Row which should WordWrap, and then turn that output cell into a text and TraditionalForm cell, and fill it in with my content: However, you can see that this breaks the text indeed, but on a new line bellow the picture, I would like to get it alongside the picture.

• Something like Grid[{{"kkkkkkkk"}, {"mmmmmm"}}, Frame -> All, ItemSize -> 10]? Sep 19, 2013 at 22:20
• I just updated the question. what you say works for a grid, but this thing I think is a GridBox and it doesnt have ItemSize Sep 19, 2013 at 22:35
• your grid // Grid[#, ItemSize -> 5] &
– Kuba
Sep 19, 2013 at 22:36
• 2D input is handy but you have less control, please take a look at links in this Q&A
– Kuba
Sep 19, 2013 at 22:38
• @Kuba, Its a text cell, so I can't execute it? Sep 19, 2013 at 22:40

I don't understand exactly what you want, but Grid does wrap. Here is an example:

longtext = StringJoin@RandomChoice[CharacterRange[" ", "z"], 500];
img = ImageResize[ExampleData[{"TestImage", "Lena"}], 200];
Grid[
{{Image[img, ImageSize -> All], longtext}},
Alignment -> {Center, Top}
]


The ImageSize->All ensures that the image doesn't get resized.

• OP is not using Grid, but grid with Ctrl+Enter/Ctrl+, then it just an array formated to GridBox.
– Kuba
Sep 20, 2013 at 1:15

I don't know any easy way to do what ask for, but a not-so-easy way is to edit to open the raw cell with Ctrl+Shift+E and, in the GridBox expression you find there, add the option GridBoxItemSize.

Cell[BoxData[
GridBox[{
{
RowBox[{
"The", " ", "quick", " ", "brown", " ", "fox", " ", "jumped", " ", "over", " ", "the",
" ", "lazy", " ", "dog"}],
RowBox[{
"The", " ", "quick", " ", "brown", " ", "fox", " ", "jumped", " ", "over", " ", "the",
" ", "lazy", " ", "dog"}]},
{
RowBox[{
"The", " ", "quick", " ", "brown", " ", "fox", " ", "jumped", " ", "over", " ", "the",
" ", "lazy", " ", "dog"}],
RowBox[{
"The", " ", "quick", " ", "brown", " ", "fox", " ", "jumped", " ", "over", " ", "the",
" ", "lazy", " ",  "dog"}]}
},
GridBoxDividers->{"Rows"->{{True}},"Columns"->{{True}}},
GridBoxItemSize->{"Columns"->{{15}}}]],
"Text"]//DisplayForm


Note 1: the postfix // DisplayForm is only there because I found it convenient to work this out in an input cell. Don't use it when you editing the raw cell.

Note 2: In your case, you probably want GridBoxItemSize -> {"Columns" -> {Automatic, 15}}. At least, that is the setting I would try as a first approximation.