It does not seem to be using Rasterize[Text[...], "RasterSize"] nor ImageDimensions[ImageCrop[Graphics[Text[...]]]] nor Rasterize[Text[...], "BoundingBox"] (and indeed seems to do the computation differently than png export, which leads me to suspect this might be a bug).
Consider
Rasterize[p1 = With[{nmax = 10},
Graphics[
Table[With[{v = StringJoin @@ Table["a", Mod[n, 2, 1]*10]},
Inset[Text[v],
Offset[ImageDimensions[ImageCrop[Graphics[Text[v]]]]/2 + {3,
0}, {0, n/nmax}], {0, 0}]], {n, 1, nmax}]
]]]
Rasterize[p2 = With[{nmax = 10},
Graphics[
Table[With[{v = StringJoin @@ Table["a", Mod[n, 2, 1]*10]},
Inset[Text[v],
Offset[Rasterize[Text[v], "RasterSize"]/2 + {3, 0}, {0,
n/nmax}], {0, 0}]], {n, 1, nmax}]
]]]
Rasterize[p3 = With[{nmax = 10},
Graphics[
Table[With[{v = StringJoin @@ Table["a", Mod[n, 2, 1]*10]},
Inset[Text[v],
Offset[Rasterize[Text[v], "BoundingBox"][[1 ;; 2]]/2 + {3,
0}, {0, n/nmax}], {0, 0}]], {n, 1, nmax}]
]]]
Export[FileNameJoin[{NotebookDirectory[], "foop1.pdf"}], p1]
Export[FileNameJoin[{NotebookDirectory[], "foop2.pdf"}], p2]
Export[FileNameJoin[{NotebookDirectory[], "foop3.pdf"}], p3]
In Mathematica, only the first one is correctly aligned:
p2 looks like this:
And p3 is similar but not identical. However, when I export to pdf, foop1.pdf looks like this (screenshot):
and foop2.pdf and foop3.pdf look similar. What's going on?





CalloutandPlotLabelsinsert text inGraphics(though they seem to useTextrather thanInset, but the doc says that they behave the same when given three arguments). The problem is fixed if I set the x coordinates the same and align the text to the left edge. But this is not whatPlotLabels -> Automaticdoes! What I am doing here is saying "place the center of the text at a location which is width-of-text/2 from where I want the left edge to be. The figure p1 displays correctly in Mathematica. And in png export. But not pdf export. Why? – Jason Gross Jan 11 '18 at 13:07