1

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}}]`

enter image description here

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.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Mas
  • 177
  • 7
  • 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

1 Answers1

3

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}}]

Then taking that answer:

Show[First@
  ImportString[ExportString[#, "PDF"], "TextOutlines" -> True] &@ grid,
  ImageSize -> 100]

enter image description here

Then ImageSize can be used as will:

enter image description here

Öskå
  • 8,587
  • 4
  • 30
  • 49