1

I am making a presentation and I have two issues there: 1) I need to use the package subcaption to make subfigures, while simultaneously I want to use the command from this site \setbeamertemplate{caption}{\raggedright\insertcaption\par} to get rid of "Figure:" before the figure caption. However, when I use the package subcaption, the latter command stops working and I can still see "Figure:" before the caption - see the first image. enter image description here

Do you know how to make "Figure:" dissapear and still use subcaption package?

2) Why is the distance between caption and the figure so long in the image below? (last few lines of the code) enter image description here The code for this figure is the same as the code for the first figure, so I don't understand why there are such differences in the distance of caption from the figure.

The code is:

\PassOptionsToPackage{table}{xcolor}
\documentclass[xcolor=svgnames]{beamer}

%\PassOptionsToPackage{svgnames}{xcolor}
%\documentclass[xcolor=table]{beamer}
%
% Choose how your presentation looks.
%
% For more themes, color themes and font themes, see:
% http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
%
\mode<presentation>
{
  \usetheme{Warsaw}      % or try Darmstadt, Madrid, Warsaw, ...
  \usecolortheme{default} % or try albatross, beaver, crane, ...
  \usefonttheme{default}  % or try serif, structurebold, ...
  \setbeamertemplate{navigation symbols}{}
%  \setbeamertemplate{caption}[numbered]
%\setbeamercolor{section in head/foot}{bg=NavyBlue}
}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{tabu}
\usepackage{booktabs}% for better rules in the table
\usepackage{ragged2e}
\usepackage{rotating}
\usepackage{threeparttable}
\usepackage{subcaption}


\title[Thesis Defense]{Name of thesis}
\subtitle{Thesis Defense}
\author{name}
 \institute{University}
\date{January 31, 2018}

\begin{document}
\setbeamertemplate{caption}{\raggedright\insertcaption\par}
\setbeamerfont{caption}{size=\tiny}
\setlength{\abovecaptionskip}{-2pt}
\setlength{\belowcaptionskip}{6pt}



\begin{frame}[plain]
  \titlepage
\end{frame}

\begin{frame}{Motivation}
\begin{figure}[!t]
\centering

\begin{measuredfigure}
\includegraphics[width=\linewidth,height=0.5\textheight,keepaspectratio]{WuXia_rate_Real_HPI}
\caption{\textit{Shaded area marks the pre-crisis period in which effective federal funds rate was below the Taylor rule rate.}}
\end{measuredfigure}

\end{figure}

\begin{itemize}
\item 
\item 
\end{itemize}

\end{frame}


\begin{frame}{Results - Impulse responses, baseline model}

\begin{figure}[!htb]
\begin{footnotesize}
\centering
\begin{subfigure}{.5\textwidth}
  \centering
  \includegraphics[height=0.3\textheight,width=\linewidth,keepaspectratio]{IRF_baseline_big_November2006}
%  \vspace{-3mm}
%
%  \hspace{5mm} \small{November 2006}
  %\caption{November 2006}
  %\label{fig:}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
  \centering
  \includegraphics[height=0.3\textheight,width=\linewidth,keepaspectratio]{IRF_baseline_big_July2007}
%  \vspace{-3mm}
%
%  %\caption{}
%  \hspace{5mm} \small{July 2007}
  %\label{fig:}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
  \centering
  \includegraphics[height=0.3\textheight,width=\linewidth,keepaspectratio]{IRF_baseline_small_October2008}
%  \vspace{-6mm}
%
%  %\caption{}
%  \hspace{5mm} \small{October 2008}
  %\label{fig:}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
  \centering
  \includegraphics[height=0.3\textheight,width=\linewidth,keepaspectratio]{IRF_baseline_big_August2011}
%  \vspace{-6mm}
%
% % \caption{}
% \hspace{5mm} \small{August 2011}
  %\label{fig:}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
  \centering
  \includegraphics[height=0.3\textheight,width=\linewidth,keepaspectratio]{IRF_baseline_small_December2013}
%  \vspace{-6mm}
%
%  %\caption{}
%  \hspace{5mm} \small{December 2013}
  %\label{fig:}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
  \centering
  \includegraphics[height=0.3\textheight,width=\linewidth,keepaspectratio]{IRF_baseline_small_April2017}
%  \vspace{-6mm}
%
%  %\caption{}
%  \hspace{5mm} \small{April 2017}
  %\label{fig:}
\end{subfigure}
%\label{fig:IRF_baseline}
\end{footnotesize}
\end{figure}

\end{frame}


\begin{frame}{Results - FEVD}

\begin{figure}[!t]
\centering

\begin{measuredfigure}
  \includegraphics[width=\linewidth]{FEVD_baseline_small_April2017}
\caption{Some caption...}
\end{measuredfigure}

\end{figure}


\end{frame}



\end{document}
  • 2
    Why use figure environments at all? They are used for dynamic adjustment of positions, and you don't need that in a beamer presentation. Just use \includegraphics and put captions e.g. into center environments, and align everything with the column environment and similar beamer-specific things. – Tiuri Jan 30 '18 at 11:32
5

Instead of the subcaption package you could simply use beamers column mechanism in order to place your images.

Please note that you don't need \usepackage{graphicx}, \usepackage{hyperref} or \usepackage{xcolor} with beamer. \usecolortheme{default} and \usefonttheme{default} are called default, because they are loaded per default, so no need to load them a second time. And giving floating specifier (such as [!htb]) does not make sense in a class that does not have floating objects.

\PassOptionsToPackage{table}{xcolor}
\documentclass[xcolor=svgnames]{beamer}

\mode<presentation>
{
  \usetheme{Warsaw}  
  \setbeamertemplate{navigation symbols}{}
}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
%\usepackage{graphicx}
%\usepackage{hyperref}
\usepackage{amsmath}
%\usepackage{xcolor}
\usepackage{tabu}
\usepackage{booktabs}% for better rules in the table
\usepackage{ragged2e}
\usepackage{rotating}
\usepackage{threeparttable}
%\usepackage{subcaption}

\setbeamertemplate{caption}{\raggedright\insertcaption\par}
\setbeamerfont{caption}{size=\tiny}
%\setlength{\abovecaptionskip}{-2pt}
%\setlength{\belowcaptionskip}{6pt}

\title[Thesis Defense]{Name of thesis}
\subtitle{Thesis Defense}
\author{name}
\institute{University}
\date{January 31, 2018}

\begin{document}

\begin{frame}{Results - Impulse responses, baseline model}

\begin{figure}
\setbeamerfont{caption}{size=\footnotesize}
\begin{columns}[onlytextwidth]
    \begin{column}{.45\textwidth}
        \centering
        \includegraphics[height=0.2\textheight,width=\linewidth,keepaspectratio]{example-image}
        \includegraphics[height=0.2\textheight,width=\linewidth,keepaspectratio]{example-image}
        \includegraphics[height=0.2\textheight,width=\linewidth,keepaspectratio]{example-image}
    \end{column}
    \begin{column}{.45\textwidth}
        \centering
        \includegraphics[height=0.2\textheight,width=\linewidth,keepaspectratio]{example-image}
        \includegraphics[height=0.2\textheight,width=\linewidth,keepaspectratio]{example-image}
        \includegraphics[height=0.2\textheight,width=\linewidth,keepaspectratio]{example-image}
    \end{column}    
\end{columns}   
\caption{whatever caption you want}
\end{figure}

\end{frame}

\end{document}
  • +1 for nice answer, but ... what to do when i like to have two subfigures with own subcaption? is there beamer template similar as it is for caption? my search so far was not fruitful :-( – Zarko Feb 4 '18 at 16:24
  • @Zarko Thank you for the vote! One could simply place the subcaption text manually at the end of the columns. Or one could add a new beamertemplate. (maybe I can look into this later this evening) – user36296 Feb 4 '18 at 17:28
  • @Zarko How about using \documentclass{beamer} \setbeamerfont{caption}{size=\tiny} \setbeamerfont{subcaption}{size=\tiny} \usepackage{subcaption} \DeclareCaptionTextFormat{simple}{\usebeamerfont{subcaption}#1} \begin{document} \begin{frame} \begin{figure} \subcaptionbox{Original}{\includegraphics[scale=0.15]{example-image}} \subcaptionbox{New}{\includegraphics[scale=0.15]{example-image}} \caption{Image} \end{figure} \end{frame} \end{document} ? – user36296 Feb 5 '18 at 14:52
  • thank you very much! i learn something new about beamer. you should enjoy to beamer's maintainer team :-) – Zarko Feb 5 '18 at 16:27
  • @Zarko You're welcome! FYI: I submitted a feature request for the caption package to use the caption font for the subcation: github.com/axelsommerfeldt/caption/issues/4 – user36296 Feb 5 '18 at 16:32

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.