Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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:

try1

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: try2 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.

share|improve this question
    
Something like Grid[{{"kkkkkkkk"}, {"mmmmmm"}}, Frame -> All, ItemSize -> 10]? –  belisarius Sep 19 '13 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 –  AimForClarity Sep 19 '13 at 22:35
    
your grid // Grid[#, ItemSize -> 5] & –  Kuba Sep 19 '13 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 '13 at 22:38
    
@Kuba, Its a text cell, so I can't execute it? –  AimForClarity Sep 19 '13 at 22:40
show 4 more comments

2 Answers 2

up vote 2 down vote accepted

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.

output

share|improve this answer
    
OP is not using Grid, but grid with Ctrl+Enter/Ctrl+, then it just an array formated to GridBox. –  Kuba Sep 20 '13 at 1:15
add comment

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

grid.png

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.