0

Assume I have a tree of the following form:

\node (r) {Root}
  child { node (c1) {Left Child} }
  child { node (c2) {Right Child} }
  ;

Now, I want to put this into a beamer frame and apply \only and \uncover to individual \node; elements. But if I have one huge tree, I cannot do that. So is there a way to decouple the child nodes, and refer to the parent node by name?

  • 1
    Can you please make a minimal working example (MWE)? And could you also include a sketch of what the result should look like? – user36296 Aug 22 '18 at 20:02
  • @samcarter How would that help in this case? – bitmask Aug 22 '18 at 20:07
  • 2
    It would give the people willing to help you something to start with when they work on a solution for you. – user36296 Aug 22 '18 at 20:13
  • 1
    Because then one could give a better answer. Just load the \usetikzlibrary{overlay-beamer-styles} library and try \node (r) {Root} child { node[visible on=<2->] (c1) {Left Child} } child { node[visible on=<3->] (c2) {Right Child} } ; No guarantee that it works because there is no MWE to play with, as already explained by @samcarter. (@samcarter I need to take off and have no interest in answering this question, but will be happy to use my remaining upvote for today for your answer. ;-) – user121799 Aug 22 '18 at 20:14
  • Never mind, I figured it out. – bitmask Aug 22 '18 at 20:20
1

The solution is quite simple, one can leave empty childs and then reference them in a separate node:

\node (r) {Root}
  child 
  child 
  ;
\node (c1) at (r-1) {Left Child};
\node (c2) at (r-2) {Right Child};

The syntax is basically appending -1, -2, etc to the parent node's identifier.

Child nodes can also be named:

\node (r) {Root}
  child {coordinate (left)}
  child {coordinate {right)}
  ;
\node (c1) at (left) {Left Child};
\node (c2) at (right) {Right Child};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.