Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to reproduce the example on creating a Presentation with LaTeX Beamer – Equations and tikz and the given code throws the following error

Package pgfkeys Error: I do not know the key '/tikz/na'.

The LaTex code is

\documentclass[compress]{beamer}
\usetheme{Warsaw}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}

\tikzstyle{every picture}+=[remember picture]

\begin{document}

\begin{frame}
\frametitle{Test}


\begin{itemize}
\item Overall mean \tikz[na] \node[coordinate] (s1) {};
\end{itemize}

\tikzstyle{na} = [baseline=-.5ex]

\begin{equation}
y_{ijk} = \tikz[baseline]{ \node[fill=blue!20,anchor=base,rounded corners=2pt]
  (d1) {$\mu$}; }
+ \tikz[baseline]{ \node[fill=red!20,anchor=base,rounded corners=2pt]
  (d2) {$r_{i}$}; }
+ \tikz[baseline]{ \node[fill=green!20,anchor=base,rounded corners=2pt]
  (d3) {$c_{j}$}; }
+ \tikz[baseline]{ \node[fill=yellow!20,anchor=base,rounded corners=2pt]
  (d4) {$t_{k}$}; }
+ \epsilon_{ijk}
\end{equation}

\begin{itemize}
\item Effect of row $i$ \tikz[na] \node[coordinate] (s2) {};
\item Effect of column $j$ \tikz[na] \node[coordinate] (s3) {};
\item Effect of treatment $k$ \tikz[na] \node[coordinate] (s4) {};
\end{itemize}

\begin{tikzpicture}[overlay]
\path[->] (s1) edge [bend left] (d1);
\path[->] (s2) edge [bend right] (d2);
\path[->] (s3) edge [out=0, in=-90] (d3);
\path[->] (s4) edge [out=0, in=-90] (d4);
\end{tikzpicture}

\end{frame}

\end{document}

Also my equation is not animated. Any help to fix this error will be highly appreciated. Thanks

share|improve this question
add comment

2 Answers

up vote 11 down vote accepted

If you move the \tikzstyle{na} = [baseline=-.5ex] to be in the preamble, then it compiles:

enter image description here

Notes:

Animation:

  • Since you are using the beamer class, the \pause macro can be used to create the effect of animation across several slides:

    \begin{tikzpicture}[overlay]                  \pause
        \path[->] (s1) edge [bend left] (d1);     \pause
        \path[->] (s2) edge [bend right] (d2);    \pause
        \path[->] (s3) edge [out=0, in=-90] (d3); \pause
        \path[->] (s4) edge [out=0, in=-90] (d4); \pause
    \end{tikzpicture}
    

With this change and two compiles, you should get an 6 page document that I think will do what you are looking for.

enter image description here


Code:

\documentclass[compress]{beamer}
\usetheme{Warsaw}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}

\tikzstyle{every picture}+=[remember picture]
\tikzstyle{na} = [baseline=-.5ex]

\begin{document}

\begin{frame}
\frametitle{Test}


\begin{itemize}
\item Overall mean \tikz[na] \node[coordinate] (s1) {};
\end{itemize}


\begin{equation}
y_{ijk} = \tikz[baseline]{ \node[fill=blue!20,anchor=base,rounded corners=2pt]
  (d1) {$\mu$}; }
+ \tikz[baseline]{ \node[fill=red!20,anchor=base,rounded corners=2pt]
  (d2) {$r_{i}$}; }
+ \tikz[baseline]{ \node[fill=green!20,anchor=base,rounded corners=2pt]
  (d3) {$c_{j}$}; }
+ \tikz[baseline]{ \node[fill=yellow!20,anchor=base,rounded corners=2pt]
  (d4) {$t_{k}$}; }
+ \epsilon_{ijk}
\end{equation}

\begin{itemize}
\item Effect of row $i$ \tikz[na] \node[coordinate] (s2) {};
\item Effect of column $j$ \tikz[na] \node[coordinate] (s3) {};
\item Effect of treatment $k$ \tikz[na] \node[coordinate] (s4) {};
\end{itemize}

\begin{tikzpicture}[overlay]
\path[->] (s1) edge [bend left] (d1);
\path[->] (s2) edge [bend right] (d2);
\path[->] (s3) edge [out=0, in=-90] (d3);
\path[->] (s4) edge [out=0, in=-90] (d4);
\end{tikzpicture}

\end{frame}

\end{document}
share|improve this answer
    
Thanks @Peter for your help. Using your suggestion there is no error but not still there is no animation. I wonder how to get the animation of arrows. Any idea. Thanks –  MYaseen208 May 10 '12 at 5:25
    
@HarishKumar: Maybe I have a faster internet connection. :-) –  Peter Grill May 10 '12 at 5:28
    
@MYaseen208: I don't see anything about animation in the code or the page you linked to. –  Peter Grill May 10 '12 at 5:28
    
Sorry @PeterGrill, my bad! Would you mind to guide me how to animate these arrows. Thanks –  MYaseen208 May 10 '12 at 5:33
    
@MYaseen208: I am not an expert in beamer, but perhaps the updated solution is what you are looking for. The only other animation I have experience with is Sieve of Eratosthenes in tikz –  Peter Grill May 10 '12 at 5:40
show 7 more comments

This is supposed to be the supplement for @Peter Grill's solution regarding animation. One can use <1-> thing as in this MWE:

\documentclass[compress]{beamer}
\usetheme{Warsaw}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}

\tikzstyle{every picture}+=[remember picture]
\tikzstyle{na} = [baseline=-.5ex]

\begin{document}

\begin{frame}
\frametitle{Test}


\begin{itemize}
\item<2-> Overall mean \tikz[na] \node[coordinate] (s1) {};
\item<1->[]{%
\begin{equation}
y_{ijk} = \tikz[baseline]{ \node[fill=blue!20,anchor=base,rounded corners=2pt]
  (d1) {$\mu$}; }
+ \tikz[baseline]{ \node[fill=red!20,anchor=base,rounded corners=2pt]
  (d2) {$r_{i}$}; }
+ \tikz[baseline]{ \node[fill=green!20,anchor=base,rounded corners=2pt]
  (d3) {$c_{j}$}; }
+ \tikz[baseline]{ \node[fill=yellow!20,anchor=base,rounded corners=2pt]
  (d4) {$t_{k}$}; }
+ \epsilon_{ijk}
\end{equation}}%

\item<3-> Effect of row $i$ \tikz[na] \node[coordinate] (s2) {};
\item<4-> Effect of column $j$ \tikz[na] \node[coordinate] (s3) {};
\item<5-> Effect of treatment $k$ \tikz[na] \node[coordinate] (s4) {};
\end{itemize}


\begin{tikzpicture}[overlay]
\path<2->[->] (s1) edge [bend left] (d1);
\path<3->[->] (s2) edge [bend right] (d2);
\path<4->[->] (s3) edge [out=0, in=-90] (d3);
\path<5->[->] (s4) edge [out=0, in=-90] (d4);
\end{tikzpicture}

\end{frame}
\end{document}

enter image description here

share|improve this answer
    
Thanks @Harish for your effort. Much appreciated. –  MYaseen208 May 10 '12 at 15:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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