pgf gallery

I just discovered a nice gallery of pgf examples. This is a figure from Rumelhart and McClelland 1986 showing the structure of their model of parallel distributed processing. I am posting this example there, and here as well. First of all the picture:
parallel distributed processing

And next the latex code: (notice the foreach loops – very cool!!!)

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{figure*}[htbp]
\centering
\begin{tikzpicture}[scale=.8,cap=round]
% Styles
\tikzstyle{information text}=[text badly centered]
% The graphic
\begin{scope}
\pgfsetarrowsend{stealth'}
\pgfsetlinewidth{1pt}
\draw (1,.9) -- (1,1.8)
node[below=.9cm,text width=3cm,style=information text]
{\small Phonological representation of root form };
\draw (5,-.2) -- (5,.8)
node[below=.9cm,text width=3cm, style=information text]
{ \small Wickelfeature representation of root form };
\draw (11,-.2) -- (11,.8)
node[below=.9cm,text width=3cm, style=information text]
{ \small Wickelfeature representation of past tense };
\draw (16,0.9) -- (16,1.8)
node[below=.9cm,text width=3cm, style=information text]
{ \small Phonological representation of past tense };
\end{scope}
\draw (3,6)
node[text width=3cm, style=information text]
{ \small Fixed Encoding Network };
\draw (8,6)
node[text width=4cm, style=information text]
{ \small Pattern Associator Modifiable Connections };
\draw (13.5,6)
node[text width=3cm, style=information text]
{ \small Decoding/Binding Network };
% draw the nodes
\foreach \x in {1,16}
\foreach \y in {2,3,4} {
\draw (\x,\y) circle (0.1cm);
}
\foreach \x in {5,11}
\foreach \y in {1,2,3,4,5} {
\draw (\x,\y) circle (0.1cm);
}
% we add the lines for the nodes starting in y 2,3, and 4
\foreach \xa / \xb in {1.1 / 4.9, 5.1 / 10.9 , 10.9 / 5.1 , 15.9 / 11.1}
\foreach \ya / \yb / \yc / \yd / \ye in {2 / 3 / 4 / 5 / 1, 3 / 4 / 5 / 1 /
2, 4 / 5 / 1 / 2 / 3} {
\draw (\xa,\ya) -- (\xb,\ya);
\draw (\xa,\ya) -- (\xb,\yb);
\draw (\xa,\ya) -- (\xb,\yc);
\draw (\xa,\ya) -- (\xb,\yd);
\draw (\xa,\ya) -- (\xb,\ye);
}
% add remaining lines from y1 to y5
\foreach \xa / \xb in {5.1 / 10.9 , 10.9 / 5.1}
\foreach \ya / \yb in {1 / 5, 5 / 1} {
\draw (\xa,\ya) -- (\xb,\ya);
\draw (\xa,\ya) -- (\xb,\yb);
}
\end{tikzpicture}
\caption[Model structure from Rumelhart \& McClelland 1986]%
{Model structure from Rumelhart \& McClelland (1986, p .222, Figure 1)}
\label{F:PDP}
\end{figure*}
\end{document}
This entry was posted in latex. Bookmark the permalink.

3 Responses to pgf gallery

  1. rohin says:

    The picture looks cool, but how much coding has gone into it. is it worth doing all the hard coding.

  2. Pingback: cff7d446c4c58ba72a9c

  3. Hi informative site. I thought go karting london might be useful as it discusses some similar subjects. Anyway keep up the fantastic work, this is now one of my top 10 sites!