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.
Graphics[{
  Text[
       Style["Jean", 14, Bold, "Helvetica", Black, 
    TextAlignment -> Right],{1, 1}],

  Text[
       Style["Claude", 10, "Helvetica", Bold, Black, 
       TextAlignment -> Right], {19, .8}]},

 PlotRange -> {{0, 21}, {0, 2}}, ImageSize -> 300,
 Method -> {"ShrinkWrap" -> True},
 ImagePadding -> 2,
 ImageMargins -> 0]

enter image description here

Now if i just try to add a small Rectangle[], the Text[] disappear.

Graphics[{
  Rectangle[{18, 0}, {20, 2}],
  Text[
       Style["Jean", 14, Bold, "Helvetica", Black, 
    TextAlignment -> Right],{1, 1}],

  Text[
       Style["Claude", 10, "Helvetica", Bold, Black, 
       TextAlignment -> Right], {19, .8}]},

 PlotRange -> {{0, 21}, {0, 2}}, ImageSize -> 300,
 Method -> {"ShrinkWrap" -> True},
 ImagePadding -> 2,
 ImageMargins -> 0]

enter image description here

share|improve this question

2 Answers 2

up vote 10 down vote accepted

If you take out Method -> {"ShrinkWrap" -> True} it works as I think you expect.

share|improve this answer
    
+1 for pointing this out. I realized after I posted my answer that I didn't know why the leftmost part of the image was disappearing. Thanks! –  David Skulsky Feb 16 '12 at 5:40
    
@FJRA,Thank You it works, can you explain ? I use the "ShrinkWrap" to export with any borders. In this case I would like the text on a transparent BackGround. –  500 Feb 16 '12 at 5:43
1  
To export with a transparent background you can add the Background -> None option: Export["file.png", g, Background -> None] –  FJRA Feb 16 '12 at 6:18

The text doesn't disappear, you're just not seeing it. Try the following mod to your code:

Graphics[{Red, Rectangle[{18, 0}, {20, 2}], 
Text[Style["Jean", 14, Red, Bold, "Helvetica", Black, 
TextAlignment -> Right], {1, 1}], 
Text[Style["Claude", 10, "Helvetica", Bold, Black, 
TextAlignment -> Right], {19, .8}]}, 
PlotRange -> {{0, 21}, {0, 2}},
Frame -> Automatic,
ImageSize->Large,
ImageSize -> 300, Method -> {"ShrinkWrap" -> True}, 
ImagePadding -> 2, ImageMargins -> 0]

Here's what you'll see:

enter image description here

So Claude is just hidden by your black rectangle. Jean is far to the left of your rectangle.

share|improve this answer
    
Thank You but I dont want the frame. Frame->None` and I am back in Trouble. –  500 Feb 16 '12 at 5:41
    
As FJRA suggested, you should delete Method ->{"ShrinkWrap" -> True} –  David Skulsky Feb 16 '12 at 5:43

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.