Here is a start of an answer to this "challenge":
\documentstyle[beamer]
\usepackage{tikz}
\begin{document}
\begin{frame}
\tikzset{click/.style={draw}}
\begin{tikzpicture}[start chain=going right,
node distance=4mm,
every node/.style={on chain,draw}]
\node(A) {Alpha};
\node(B) {Bravo};
\node(C) {Charlie};
\node(D) {Delta};
\node(E) {Echo};
\node(F) {Foxtrot};
\end{tikzpicture}
\play{F,E,E,D}
\play{D,E,A,F}
\play{B,E,D}
\end{frame}
\end{document}
The question is how to define ''click'' so that in each overlay, the highlighted node, would change.
In pseudo code, "click" should be defined to:
If currentStep = myNodeName then
add "ultra thick", or "fill=green", or whatever
to the current node.
fi
Ideally, the [click] macro should apply to any path, not just to nodes.
At the same time, "\play" should translate to
Foreach currentStep in argumentList do
\only<+> {
invoke the above tikzpicture while setting currentStep
}
od
*MORE INFORMATION *
Here is something that almost works
tikzset{
Z/.code={
\ifthenelse{\equal{\noexpand\pc}{#1}}{%
\tikzset{rectangle}%
}{%
\tikzset{circle}%
}
}
}
\begin{frame}[fragile,label=current]{my frame}
\foreach \pc in {A,B,A,D,C,A} {
\only<+>{
\begin{tikzpicture}[start chain=going right,node distance=1cm]
\node[on chain][draw,Z=A] {A\pc};
\node[on chain][draw,Z=B] {B\pc};
\node[on chain][draw,Z=C] {C\pc};
\node[on chain][draw,Z=D] {D\pc};
\end{tikzpicture}
}
}
\end{frame}
But, there must be something I miss in the expansion process. The logic seems right, the document compiles nicely, but the true branch of the conditional is never executed. Any ideas?
Best Answer
2nd attempt
(Warning: TikZ 3.0 is required!)
Additional filled requirements (see 1st attempt below for all other filled requirements):
Allow for "decay" via
special prev
styles. Each named keyword (such askw
) must provide three styles:kw
,special kw
andspecial prev kw
.The names of "program counter" (
\pc
) and its previous value (\pcprev
) can be chosen via theZ choose macros
key.1st attempt
Here is an attempt without any test!
Filled requirements:
\pc
that would contain multiple nodes [...]Filled unformulated requirements: