2

I'm trying to put into a beamer presentation on overleaf a graph that I already have in a document of class article. However, it's not working. It says missing value, treated as 0 of line \end{frame}. Might be a package missing, but which one? Thanks!

\documentclass{beamer}
\usetheme{Madrid} % new 
\usepackage{hyperref}
\setbeamercovered{transparent}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{amsmath}

\begin{document}

\begin{frame}
\frametitle{Distribution of $W$}

\begin{figure}
\caption{Distribution of the $W$ statistic} \label{w_c}
  \begin{subfigure}{\textwidth}
  \caption{Singh-Madalla with $c=1.7$} \label{w_c_1.7}
  \includegraphics[width=0.23\textwidth]{gini_fim2.pdf}\hfill
  \includegraphics[width=0.23\textwidth]{ge_0_fim2.pdf}\hfill
  \includegraphics[width=0.23\textwidth]{ge_1_fim2.pdf}\hfill
  \includegraphics[width=0.23\textwidth]{ge_2_fim2.pdf}
  \end{subfigure}
  \bigskip
  \begin{subfigure}{\textwidth}
  \caption{Singh-Madalla with $c=1.2$} \label{w_c_1.2}
  \includegraphics[width=0.23\textwidth]{gini_fim12.pdf}\hfill
  \includegraphics[width=0.23\textwidth]{ge0_fim12.pdf}\hfill
  \includegraphics[width=0.23\textwidth]{ge1_fim12.pdf}\hfill
  \includegraphics[width=0.23\textwidth]{ge2_fim_12.pdf}
  \end{subfigure} 
\end{figure}
\end{frame}
\end{document}

1 Answer 1

2
  • Don't use subfigure, it is obsolete package. instead it rather use subcaption package.
  • In general the package hypperref had to be loaded last in preamble, however, the beamer document class already loaded it (see samcarter comment below), so it is no need tp load it again.
  • The package graphicx is loaded by beamer document class too.

enter image description here

\documentclass[demo]{beamer}
\usetheme{Madrid} % new
\setbeamercovered{transparent}
\usepackage{subcaption}

\begin{document}

\begin{frame}
\frametitle{Distribution of $W$}

\begin{figure}
\caption{Distribution of the $W$ statistic} \label{w_c}
  \begin{subfigure}{\textwidth}
  \caption{Singh-Madalla with $c=1.7$} \label{w_c_1.7}
  \includegraphics[width=0.23\textwidth, height=22mm]{gini_fim2.pdf}\hfill
  \includegraphics[width=0.23\textwidth, height=22mm]{ge_0_fim2.pdf}\hfill
  \includegraphics[width=0.23\textwidth, height=22mm]{ge_1_fim2.pdf}\hfill
  \includegraphics[width=0.23\textwidth, height=22mm]{ge_2_fim2.pdf}
  \end{subfigure}

  \bigskip
  \begin{subfigure}{\textwidth}
  \caption{Singh-Madalla with $c=1.2$} \label{w_c_1.2}
  \includegraphics[width=0.23\textwidth, height=22mm]{gini_fim12.pdf}\hfill
  \includegraphics[width=0.23\textwidth, height=22mm]{ge0_fim12.pdf}\hfill
  \includegraphics[width=0.23\textwidth, height=22mm]{ge1_fim12.pdf}\hfill
  \includegraphics[width=0.23\textwidth, height=22mm]{ge2_fim_12.pdf}
  \end{subfigure}
\end{figure}
\end{frame}
\end{document}
  • Option demo in \documentclass[demo]{beamer} is passed to graphics package and in real document had to be removed. Here it is used because we haven't your actual images (it generate black squares instead them).

Addendum:

  • Since all images are the same size, the figure code can be greatly shortened by using of the macro \setkeys{Gin}{...}:
\begin{figure}
\caption{Distribution of the $W$ statistic} \label{w_c}
\setkeys{Gin}{width=0.23\textwidth, height=22mm}    % <---
  \begin{subfigure}{\textwidth}
  \caption{Singh-Madalla with $c=1.7$} \label{w_c_1.7}
  \includegraphics{gini_fim2.pdf}\hfill
  \includegraphics{ge_0_fim2.pdf}\hfill
  \includegraphics{ge_1_fim2.pdf}\hfill
  \includegraphics{ge_2_fim2.pdf}
  \end{subfigure}

\bigskip
  \begin{subfigure}{\textwidth}
  \caption{Singh-Madalla with $c=1.2$} \label{w_c_1.2}
  \includegraphics{gini_fim12.pdf}\hfill
  \includegraphics{ge0_fim12.pdf}\hfill
  \includegraphics{ge1_fim12.pdf}\hfill
  \includegraphics{ge2_fim_12.pdf}
  \end{subfigure}
\end{figure}
3
  • beamer already loads hyperref, so I would simply remove it. And instead of the RequirePackage, you can pass the option directly to beamer with \documentclass[demo]{beamer} Nov 28, 2016 at 21:57
  • @samcarter, thank you to remains me. on this. It is a while when I last time check manual for Beamer ... and my presentations regarding figures are mostly simpler :). I correct my answer.
    – Zarko
    Nov 28, 2016 at 22:50
  • Thanks! That's it. Didn't know it was obsolete. Nov 28, 2016 at 22:58

You must log in to answer this question.

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