2

I have the following code which gives me the figure.

\documentclass[xcolor=dvipsnames]{beamer}
\usepackage{times, pgf,verbatim} % pgf added for the umbc4 sty
\usepackage{tikz}
\usetikzlibrary{positioning,shapes.multipart,calc,arrows.meta}
\tikzset{
  basic/.style={draw, text centered},
  circ/.style={basic, circle, minimum size=2em, inner sep=1.5pt},
  rect/.style={basic, text width=1.5em, text height=1em, text depth=.5em},
  1 up 1 down/.style={basic, text width=1.5em, rectangle split, rectangle split horizontal=false, rectangle split parts=2},
}
\newcommand{\frt}[1]{\frametitle{#1}}
\title[]{Example}
\begin{document}
\titlepage
\begin{frame}
\frt{tikzpicture example}
\begin{tikzpicture}
  \node [rect] (base) {$Y_1$} (0,2.75);
  \node [rect, below=of base] (Y2) {$Y_2$};
  \node [circ, above left=1cm and 4cm of base] (I) {$X_1$};
  \node [circ, below left=1cm and 4cm of base] (T) {$X_5$};
  \foreach \i [count=\ino] in {X_2,X_3,X_4,X_5,X_6,X_7,X_8} \node [circ] at ($(I)!\ino/4!(T)$) (\i) {$\i$};
  \draw [->,>=Stealth] (X_3) -- (base);
  \coordinate (arr) at (base.west);
  \foreach \i/\j in {X_2/arr,X_4/arr,X_6/arr,X_7/arr,X_8/arr,I/arr,T/arr} \draw [->,>=Stealth] (\i) -- (\j);
  \draw [->,>=Stealth] (T) -- (Y2);
  \coordinate (arr) at (Y2.west);
  \foreach \i/\j in {X_2/arr,X_3/arr,X_4/arr,X_6/arr,X_7/arr,X_8/arr,I/arr} \draw [->,>=Stealth] (\i) -- (\j);
\end{tikzpicture}

\end{frame}
\end{document}

So I get this image here.

So, pretty reasonable but I would like the circles to actually be ellipses. And also, I would like a curved arrow connecting X_1 to X_5 on the left. How do I accomplish this task?

1 Answer 1

2

I simplified the loops so that the iteration is done on a single variable since the second one is a constant, it is useless to loop on a constant.

screenshot

\documentclass[xcolor=dvipsnames]{beamer}
\usepackage{times, pgf,verbatim} % pgf added for the umbc4 sty
\usepackage{tikz}
\usetikzlibrary{positioning,shapes.multipart,calc,arrows.meta}
\usetikzlibrary{shapes.geometric}%<-- new library
\tikzset{
  basic/.style={draw, text centered},
  circ/.style={basic, ellipse, minimum height=1em,minimum width=2cm, inner sep=1.5pt},
  rect/.style={basic, text width=1.5em, text height=1em, text depth=.5em},% ellipse
  1 up 1 down/.style={basic, text width=1.5em, rectangle split, rectangle split horizontal=false, rectangle split parts=2},
}
\newcommand{\frt}[1]{\frametitle{#1}}
\title[]{Example}
\begin{document}
%\titlepage
\begin{frame}
\frt{tikzpicture example}
\begin{tikzpicture}
  \node [rect] (base) {$Y_1$} (0,2.75);
  \node [rect, below=of base] (Y2) {$Y_2$};
  \node [circ, above left=1cm and 4cm of base,alias=X_1] (I) {$X_1$};%<- add a alias X_1 for I 
  \node [circ, below left=1cm and 4cm of base,red] (T) {$X_5$};

  \foreach \i [count=\ino] in {2,...,8} \node [circ] at ($(I)!\ino/4!(T)$) (X_\i) {$X_\i$};
%  \draw [->,>=Stealth] (X_3) -- (base);
%  \coordinate (arr) at (base.west);
  \foreach \i in {1,...,8} 
    \draw [->,>=Stealth] (X_\i.0) -- (base.west);
    \draw  (X_1) to [out=180,in=180](X_5);
%  \draw [->,>=Stealth] (X_5) -- (Y2);
%  \coordinate (arr) at (Y2.west);
  \foreach \i in {1,...,8} \draw [->,>=Stealth] (X_\i.east) -- (Y2.west);
\end{tikzpicture}

\end{frame}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .