# how to include tikz figure in beamer

While copy-pasting the following code from my article to one of the frames in my beamer presentation (along with all the packages), I get 11 errors that are mostly "undefined control sequence" and "missing number, treated as zero". Could you explain what is wrong and what additional packages I may have to include in the preamble?

\documentclass{beamer}
\usetheme{Warsaw}
\title{HH Decisions}
\author{Abhimanyu Arora}
\institute{Doctoral workshop}
\date{}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{comment}
\usepackage{graphicx}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{pgfplots}
\usepackage[capposition=top]{floatrow}
\usetikzlibrary{pgfplots.groupplots}
\usetikzlibrary{positioning}
\newtheorem{proposition}[theorem]{Proposition}

\begin{document}

\begin{frame}
\titlepage
\end{frame}

\begin{frame}{Results (contd.)}

\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
title=Share of expenditure,
xlabel={$z$},
ylabel={$S(z)$},
]
\legend{Case 1, Case 2}
\end{axis}
\end{tikzpicture}
\floatfoot{Case 1:$\alpha_W=\beta_H=0.55=1-\alpha_H=1-\beta_W$, Case 2:$\alpha_W=\beta_H=0.9=1-\alpha_H=1-\beta_W$}
\label{fig:share}
\end{figure}

\end{frame}

\end{document}

• It will be very difficult to explain what is wrong and tell you any additional packages without seeing what is in your preamble currently... please post a complete document, starting at \documentclass{...} and ending with \end{document} – darthbith May 26 '14 at 17:38
• Where does \floatfoot come from? Which package defines it? If it is a user command, are you including the definition in your preamble? – Gonzalo Medina May 26 '14 at 17:43
• Thank you @darthbith. I have editted the code to include the preamble. The article seems to compile fine but not the presentation – Abhimanyu Arora May 26 '14 at 17:46
• @GonzaloMedina: Thanks, have editted to include the preamble. But as you might notice, there are errors – Abhimanyu Arora May 26 '14 at 17:47
• @AbhimanyuArora Thanks for providing the example code. I provided an answer below. – Gonzalo Medina May 26 '14 at 18:07

The floatrow package is not compatible with beamer; don't load this package with the beamer document class; in this case, you can't use \floatfoot, but you can use \caption instead or just a simple paragraph of text:

\documentclass{beamer}
\usepackage{comment}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.groupplots}
\usetikzlibrary{positioning}

\usetheme{Warsaw}

\newtheorem{proposition}[theorem]{Proposition}

\title{HH Decisions}
\author{Abhimanyu Arora}
\institute{Doctoral workshop}
\date{}

\begin{document}

\begin{frame}
\titlepage
\end{frame}

\begin{frame}{Results (contd.)}

\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
title=Share of expenditure,
xlabel={$z$},
ylabel={$S(z)$},
height=6cm
]
\legend{Case 1, Case 2}
\end{axis}
\end{tikzpicture}
\caption{Case 1:$\alpha_W=\beta_H=0.55=1-\alpha_H=1-\beta_W$, Case 2:$\alpha_W=\beta_H=0.9=1-\alpha_H=1-\beta_W$}
\label{fig:share}
\end{figure}

\end{frame}

\begin{frame}{Results (contd.)}

\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
title=Share of expenditure,
xlabel={$z$},
ylabel={$S(z)$},
height=6cm
]
Case 1:$\alpha_W=\beta_H=0.55=1-\alpha_H=1-\beta_W$, Case 2:$\alpha_W=\beta_H=0.9=1-\alpha_H=1-\beta_W$