Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tikz overlay combined with baseline doesn't work as expected #344

Open
pgf-tikz-bot opened this issue Dec 6, 2014 · 6 comments
Open

tikz overlay combined with baseline doesn't work as expected #344

pgf-tikz-bot opened this issue Dec 6, 2014 · 6 comments
Assignees
Milestone

Comments

@pgf-tikz-bot
Copy link

Migrated from SourceForge
Author: u_fischer
Timestamp: 2014-12-06 18:13:58.515000

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

@pgf-tikz-bot
Copy link
Author

Migrated from SourceForge
Author: hmenke
Timestamp: 2019-01-18 07:58:07.885000

What do you suggest baseline should do instead?

@pgf-tikz-bot
Copy link
Author

Migrated from SourceForge
Author: u_fischer
Timestamp: 2019-01-18 08:27:46.768000

Well the expected output was this:

\documentclass[]{article}
  \usepackage{tikz}

  \begin{document}

  \begin{minipage}[t]{4cm}
  abc\\
  abc\raisebox{0pt}[0pt][0pt]{\tikz[overlay,opacity=0.5,red,baseline={(3,3)}]\filldraw (0,0)rectangle (3,3);}def\\
  abc
  \end{minipage}
  \end{document}

That means the reference point of the picture relative to the "outside" is at (3,3) and that the picture has a 0pt size.

@pgf-tikz-bot
Copy link
Author

Migrated from SourceForge
Author: hmenke
Timestamp: 2019-01-18 23:35:37.692000

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 and baseline is also semantically meaningless for an overlay.

@pgf-tikz-bot
Copy link
Author

Migrated from SourceForge
Author: u_fischer
Timestamp: 2019-01-19 08:35:12.939000

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 overlay and that baseline is one of them.

@pgf-tikz-bot
Copy link
Author

Migrated from SourceForge
Author: hmenke
Timestamp: 2019-01-21 21:00:46.060000

  • Description has changed:

Diff:


--- old
+++ new
@@ -1,16 +1,16 @@
 When I use the baseline key in an overlay TikZ picture the picture suddenly has a nonzero depth:
+```tex
+\documentclass[]{article}
+\usepackage{tikz}
 
-     \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}
-
+\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

  • assigned_to: Henri Menke

@pgf-tikz-bot
Copy link
Author

Migrated from SourceForge
Author: frougon
Timestamp: 2019-03-18 09:51:02.257000

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:

\hbox(0.0+0.0)x0.0, shifted 85.35823

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

\showboxbreadth=\maxdimen \showboxdepth=20
%\tracingcommands=1 % uncomment to see the \lower command
\tracingoutput=1\tracingonline=1

HTH, thanks to both of you for all the great work!

[1] Possibly the height too, depending on the context.

@hmenke hmenke removed the open label Apr 2, 2019
@hmenke hmenke self-assigned this Apr 5, 2019
@hmenke hmenke added this to the 3.1.6 milestone Dec 17, 2019
@hmenke hmenke modified the milestones: 3.1.6, 3.1.7 Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants