# Epilog->Inset crops text with large font sizes

Why does Epilog->Inset crop the first and last letters here ("a" and "g") when FontSize is set to large values (which varies with font family):

Plot[Cos[t], {t, -32 Pi, 32 Pi}, AspectRatio -> 1/4, PlotRange -> All,
Axes -> True, ImageSize -> 600,
Epilog ->
Inset[Graphics@
Text[Style["a   b   c   d   e   f   g", FontSize -> 30]], {0, 0}]
]


This renders as:

Are there options or a hack which still uses Epilog -> Inset, as opposed to using Show and passing the text as Graphics (which works correctly)?

-

Remove Graphics inside Inset:

 Plot[Cos[t], {t, -32 Pi, 32 Pi}, AspectRatio -> 1/4, PlotRange -> All,
Axes -> True, ImageSize -> 600,
Epilog -> Inset[Text[Style["a b c d e f g", FontSize -> 60]], {0, 0}]]


EDIT: Thanks to @Brett's comment, the following Epilog settings also work:

Inset[Style["a b c d e f g", FontSize -> 60], {0, 0}]
(* or *) Text[Style["a b c d e f g", FontSize -> 60], {0, 0}]
(* or *) Style[Text["a b c d e f g", {0, 0}], FontSize -> 60]

-
Got it thanks. 2nd question (after removing Graphics) if pos is changed to {0,-1} or lower, the text gets cropped. Any ideas? –  alancalvitti Jul 6 '12 at 2:47
@alancalvitti I've addressed this question in the answer I posted. For your case kguler's answer works fine (+1), but you shouldn't think that Graphics is in any way forbidden inside Inset. –  Jens Jul 6 '12 at 3:20
You could just use Inset[Style[...], {0,0}] or even Text[Style[...], {0,0}] since Text as a graphics primitive is implemented using Inset these days. –  Brett Champion Jul 6 '12 at 4:21
Alan, thanks for the accept. As @Jens explains in his answer, PlotRangePadding is the solution to avoid cropping of inset objects. Jens, thank you for the vote. –  kguler Jul 6 '12 at 4:44

Here are two possibilities to make the Inset work in exactly the form you have it right now:

• Use the scale argument for Inset and set it to Scaled[1]
• Use the ImageSize option for the inset Graphics and set it to Full

Both have essentially the same effect of asking the inset object to fill out the enclosing graphic fully. Since Text doesn't usually resize, it only has the effect of removing any cropping around the text, as desired. You could also just specify a fixed but sufficiently large ImageSize in the inset Graphics but that would require manual adjustment.

Here is how you'd do that for the example:

Plot[Cos[t], {t, -32 Pi, 32 Pi}, AspectRatio -> 1/4, PlotRange -> All,
Axes -> True, ImageSize -> 600,
Epilog ->
Inset[Graphics@
Text[Style["a   b   c   d   e   f   g", FontSize -> 30]], {0, 0},
Automatic, Scaled[1]]]

Plot[Cos[t], {t, -32 Pi, 32 Pi}, AspectRatio -> 1/4, PlotRange -> All,
Axes -> True, ImageSize -> 600,
Epilog ->
Inset[Graphics[
Text[Style["a   b   c   d   e   f   g", FontSize -> 30]],
ImageSize -> Full], {0, 0}]]


You then can get additional cropping problems when the Inset position is moved too far down (or anywhere beyond the plot range). This is a different issue and can be resolved by either specifying a PlotRange that's larger than All, or (to be independent of the specific range) by adding the option PlotRangePadding:

Plot[Cos[t], {t, -32 Pi, 32 Pi}, AspectRatio -> 1/4,
PlotRange -> All,
Axes -> True,
ImageSize -> 600,