3

I am trying to add two minipages beside each other in Latex beamer and I am getting the error ! Undefined control sequence.

I appreciate any help.

\documentclass[xcolor=dvipsnames]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{graphicx} %  30.05  13:01 adedd [demo]
\usepackage{wrapfig}
\usepackage{tikz}
\usetikzlibrary{shapes, arrows, shadows}
\usepackage{amsmath}
\usetheme{Antibes}
\newcommand{\twoobjects}[2]{%
  \centering \leavevmode\vbox{\hbox{#1}\nointerlineskip\hbox{#2}} %
}

\usecolortheme[named=Maroon]{structure}
\setbeamercovered{transparent}
\setbeamertemplate{footline}[page number]
\title{Test Test}
\author{Test Test}
\institute{Test Test}
\date{11.02.15}
\usepackage{float}
\begin{document}



\begin{frame}
\frametitle{Related Projects}

\begin{block}{Test Test}

Test Test Test Test

\begin{itemize}
\item Test, Test, Test,...
\end{itemize}

\end{block}


\begin{figure}[H]
\centering
\begin{minipage}{.5\textwidth}
  \centering
  \includegraphics[width=.8\linewidth, height=360px]{img/moovit_2}
  \captionof{figure}{Moovit map modes}
  \label{fig:test1}
\end{minipage}%
\begin{minipage}{.5\textwidth}
  \centering
  \includegraphics[width=.8\linewidth, height=360px]{img/moovit_4}
  \captionof{figure}{Moovit route monitoring}
  \label{fig:test2}
\end{minipage}
\end{figure}

\end{frame}


\end{document}
  • 1
    \usepackage{capt-of} should do. But you can quite savely use normal figure-environments as floating is deactivated in beamer. – Johannes_B Feb 9 '15 at 20:35
  • Is there any way to put one caption for the both minipages? Not separated? – ocean Feb 9 '15 at 20:54
2

Command \captionof is provided by packages like capt-of, caption or any KOMA-class. It is useful if you want to give a caption in a non-floating environment, which can be useful at times.

Here, we have a beamer case. Floating is disabled in beamer, the user is solely responsible that suff is fitting on the frame. You are using package float along with the H placement specifier, which would again disable the floating.

You were using minipages to align the graphics, and give two separate captions. You don't need captionof though.

If you want to have a single caption for both figures, no problem as well :-)

\documentclass[xcolor=dvipsnames]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{mwe}
\usepackage{capt-of}
\begin{document}



\begin{frame}
    \frametitle{Related Projects}
    \begin{figure}%[H]
        \centering
        \begin{minipage}{.5\textwidth}
            \centering
            \includegraphics[width=.8\linewidth, height=36px]{example-image}
            \caption{Moovit map modes}
            \label{fig:test1}
        \end{minipage}%
        \begin{minipage}{.5\textwidth}
            \centering
            \includegraphics[width=.8\linewidth, height=36px]{example-image}
            \captionof{figure}{Moovit route monitoring}
            \label{fig:test2}
        \end{minipage}
    \end{figure}

    \begin{figure}%[H]
        \centering
            \includegraphics[width=.4\linewidth,
            height=36px]{example-image}\hfill%
            \includegraphics[width=.4\linewidth, height=36px]{example-image}
            \caption{A caption for both images}
    \end{figure}

\end{frame}
\end{document}

eanUndefinedMinipage.

In general, a presentation is a visual/oral thing. Any text should aid the speaker. In my opinion, it is best just to say what is in the picture: «And here you can see the platypus doing the jazz dance«.

  • You are right I will do it as u recommended ;) – ocean Feb 9 '15 at 21:21
  • @ocean You may later decide to put your presentation in an article (keyword beamerarticle), maybe keeping the captions might be a good idea (and just print them in case of putting it into an article \mode<article>). – Johannes_B Feb 9 '15 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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