# Extending a grid to avoid line breaks in text

I was wondering what the best way is to extend the cells in a GraphicsGrid so that my text fits without line breaks. My problem is illustrated by the graphic produced by the code below:

GraphicsGrid[{
{Graphics[{Blue, Rectangle[{1, -1}]}],
Style["Antidisestablishmentarianism", FontSize -> 30],
SpanFromLeft},
{Graphics[{Red, Rectangle[{1, -1}]}],
Style["Pneumonoultramicroscopicsilicovolcanoconiosis", FontSize -> 30],
SpanFromLeft}}]


I've been looking for ways to extend the cells on the right of the GraphicsGrid so that the text fits in on one line. In the code above, I've used SpanFromLeft to extend the cells a little. I would have to use many SpanFromLeft commands in order to fit the word next to the red square. So I was hoping that someone knew of a better way of doing this.

• yes, but then I can't control image size, and I need to do that – Mas May 12 '14 at 12:13
• To clear things up, I meant the size of the whole Grid. Essentially what I want is for the cells on the right hand side to be wider; just wondering if there's a better way of doing this than repeated SpanFromLeft's – Mas May 12 '14 at 12:54

Tell me if that fits you:

grid = Grid[
{
{Graphics[{Blue, Rectangle[{1, -1}]}, ImageSize -> 100],
Style["Antidisestablishmentarianism", FontSize -> 30], SpanFromLeft},
{Graphics[{Red, Rectangle[{1, -1}]}, ImageSize -> 100],
Style["Pneumonoultramicroscopicsilicovolcanoconiosis", FontSize -> 30], SpanFromLeft}
}, ItemSize -> {{10, 60}}]


Show[First@

Then ImageSize can be used as will:
• The text autofits with Grid. Using the Show[] part allows you to change the ImageSize. – Öskå May 12 '14 at 13:03
• @Öskå After applying ImportString[ExportString[#, "PDF"]] &` you have no text: every glyph is outlined. It is the standard way to outline fonts in Mathematica. – Alexey Popkov May 12 '14 at 13:41