I want to use an overprint environment inside a tikz-node.
I expect the content text of the overprint-sections to be aligned centrally, but it aligns right and even protrudes a little beyond the overprint/nodes border.

Minimal example output:

What am I missing and how can the issue be fixed?

Also I do not want the overprint to wobble, which it does a little bit, but I expect that will automatically be gone with a fix.

I don't have a reasonable explanation to give you, but if you change the size of the overprint area (from 4cm to 5.9cm) all goes well.
–
Claudio FiandrinoJun 24 '12 at 14:54

I've tracked this down to the interaction between the way overprint is implemented and the center environment. At this point, I need to call in the experts (tex.stackexchange.com/q/61112/86)
–
Loop SpaceJun 25 '12 at 11:24

1 Answer
1

This is due to an unfortunate interaction between how overprint works and the center environment. Because the center environment is in force when overprint is figuring out which text to use, the text gains some extra horizontal space (to centre it). But when overprint sets the text, it modifies it in such a way that TeX adds yet more space to centre it again. Net result being that the text gets shoved too far over to the right. Thanks to David Carlisle and Herbert, I can offer two ways to "cancel" the effect. Both get rid of the centre effect when the overprint environment is doing its stuff.

Note that due to the way overprint works, to get the contents centred, you have to add in \centering to each piece. There's no other way to do that. I've assumed, in the below, that that is what you want to happen.

I'm not sure which of the two to prefer. One thing to note about David's method (with the additional minipage) is that if you put anything "normal" (such as bare text) inside that minipage then it will have width \textwidth which is not desirable.