When I use the baseline key in an overlay TikZ picture the picture suddenly has a nonzero depth:
\documentclass[]{article}
\usepackage{tikz}
\begin{document}
\begin{minipage}[t]{4cm}
abc\\
abc\tikz[overlay,opacity=0.5,red,baseline={(3,3)}]\filldraw (0,0)rectangle (3,3);def\\
abc
\end{minipage}
\end{document}
It looks like a bug to me. See also http://tex.stackexchange.com/questions/215583/tikz-overlay-combined-with-baseline
Ulrike Fischer
What do you suggest
baselineshould do instead?Well the expected output was this:
That means the reference point of the picture relative to the "outside" is at (3,3) and that the picture has a 0pt size.
I get that, but how do you suggest this is accomplished without breaking all existing uses of
baseline? I'm very tempted to close this as wont-fix because there is a workaround for this andbaselineis also semantically meaningless for anoverlay.Last edit: Henri Menke 2019-01-18
I'm not sure what you mean by "semantically meaningless". Setting the baseline changes the reference point and so the placement on the line. That's quite independent from the question if the picture occupies space or not. I also don't think that it would break current usages of baseline. What I don't know is if the behaviour can be implemented without breaking something - percusse comments in the tex.sx sounded as if it could be difficult. In this case it should be documented that some keys can break
overlayand thatbaselineis one of them.Diff:
Hi,
I hope I'm not stating the obvious, but the unwanted depth appears to come from the fact that the tikzpicture produces \lower〈dimen〉〈box〉 in this case, instead of just a 〈box〉. The 〈box〉 has zero width, height and depth:
but the fact that it is lowered (apparently due to the use of 'baseline') influences the depth[1] of the enclosing box (in this case, the line containing 'abc' and 'def'). This can be shown with
HTH, thanks to both of you for all the great work!
[1] Possibly the height too, depending on the context.