3

I am trying to add a directed acrylic graph to a beamer presentation. Using this code (reproduced below) I created a slide, but the image produced has every node and arrow stacked roughly on top of one another. I've tried playing with the positions of the nodes, but no matter what positions I enter they seem to stack on top of one another in the image. How do I get it to display correctly (like the image below from the site) in beamer?

DAG of IV

\begin{frame}
\begin{tikzpicture}
% nodes %
\node[text centered] (z) {$Z$};
\node[right = 1.5 of z, text centered] (t) {$T$};
\node[right=1.5 of t, text centered] (y) {$Y$};
\node[draw, rectangle, dashed, above = 1 of t, text centered] (u) {$U$};

% edges %
\draw[->, line width= 1] (z) --  (t);
\draw [->, line width= 1] (t) -- (y);
\draw[->,red, line width= 1,dashed] (u) --node {X} (z);
\draw[->,line width= 1] (u) --(t);
\draw[->,line width= 1] (u) -- (y);
\draw[->, red, line width=1,dashed] (z) to  [out=270,in=270, looseness=0.5] node{X} (y);
\end{tikzpicture}

\end{frame}

closed as off-topic by cmhughes, Gonzalo Medina, Adam Liter, Peter Jansson, Thorsten Mar 16 '14 at 19:55

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Did you write \usetikzlibrary{positioning} in your preamble? Please post a complete code that can be compiled by anyone (see minimal working example (MWE) ). – Pier Paolo Mar 16 '14 at 18:52
  • Thanks! That did it. The website I got from the example said to use \usepackage{pgf,tikz} with no mention of positioning. – Michael Mar 16 '14 at 18:55
  • 4
    This question appears to be off-topic because it has been resolved in the comments – cmhughes Mar 16 '14 at 19:15
  • "This question appears to be off-topic because it has been resolved in the comments." How nonsensical. The question is specifically about using a package in LaTeX. It's as if you're saying that questions about LaTeX as having no easy solution by definition. The question got answered in the comments ?! No way that's about LaTeX! – Michael Mar 17 '14 at 19:13

Browse other questions tagged or ask your own question.