2

Is it possible to adjust the font size of the prefix Figure when captioning an included image? Furthermore, is it possible to refer to a picture in a meaningful way without using a caption; I tried but no number was attributed to the figure I get double ?? instead. I am using the package \hypcap by the way.

Thanks

MWE:

\documentclass{beamer}

\mode<presentation> {
}
\makeatletter
\let\insertsupervisor\relax
\newcommand\supervisortitle{Supervisor}
\mode<all>
{
    \newcommand\supervisor[1]{\def\insertsupervisor{#1}}
    \titlegraphic{}
}
\defbeamertemplate*{title page}{supdefault}[1][]
{
    \vbox{}
    \vfill
    \begingroup
    \centering
    \begin{beamercolorbox}[sep=8pt,center,#1]{title}
        \usebeamerfont{title}\inserttitle\par%
        \ifx\insertsubtitle\@empty\relax%
        \else%
        \vskip0.25em%
        {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
        \fi%     
    \end{beamercolorbox}%
    \vskip1em\par
    \begin{beamercolorbox}[sep=8pt,center,#1]{author}
        \usebeamerfont{author}\insertauthor
    \end{beamercolorbox}
    \ifx\insertsupervisor\relax\relax\else
    \begin{beamercolorbox}[sep=8pt,center,#1]{author}
        \usebeamerfont{author}\supervisortitle:~\insertsupervisor
    \end{beamercolorbox}\fi
    \begin{beamercolorbox}[sep=8pt,center,#1]{institute}
        \usebeamerfont{institute}\insertinstitute
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center,#1]{date}
        \usebeamerfont{date}\insertdate
    \end{beamercolorbox}\vskip0.5em
    {\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par}
    \endgroup
    \vfill
}
\setbeamertemplate{title page}[supdefault][colsep=-4bp,rounded=true,shadow=\beamer@themerounded@shadow]\makeatother

\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{hyperref}
\usepackage{siunitx}
\usepackage{hypcap}
\usepackage{amsmath}
\usepackage{pgf}
\usepackage[font={scriptsize}]{caption}
\usetheme{CambridgeUS}
\usecolortheme{seagull}
\setbeamertemplate{bibliography item}[text]
\begin{document}
\begin{frame}
    \frametitle{Cooling power measurements}
    \begin{columns}[c]
        \column{.5\textwidth}
        \begin{figure}
            \vspace{-.5cm}
            \includegraphics[width=.9\linewidth]{fig5a.png}\label{fig:5a}
        \end{figure}
        \footnotesize
        \begin{enumerate}
            \item He-Rb mixture with 200 bar He
            \item About 5 mW of cooling power
        \end{enumerate}
        \column{.5\textwidth}
        \begin{figure}
            \vspace{-.5cm}
            \includegraphics[width=.9\linewidth]{fig5b.png}\label{fig:5b}
        \end{figure}
        \footnotesize
        \begin{enumerate}
            \item Ar-Rb mixture with 230 bar Ar
            \item Order of magnitude larger CP
        \end{enumerate}
    \end{columns}
    \footnotesize
    \begin{itemize}
        \centering
        \item Expected cooling power red crosses
        \item Observed deflection angle blue crosses
    \end{itemize}
\end{frame}
\begin{frame}
    \frametitle{Temperature Gradient}
    \footnotesize
    Using a heat transfer model \cite{24}, after a cooling time $t$, the expected temperature gradient profile is:
    \begin{equation}
        \frac{dT}{dr}=-\frac{P_{cool}}{2\pi \kappa}\frac{e^{-\alpha z}}{r}\left[ \exp\left(\frac{2r^2}{\omega^2}\right)-\exp\left(\frac{2r^2}{\omega^2-8Dt}\right)\right]
    \end{equation}
    \begin{description}
        \item[Cooling]Probe beam deflected towards the cooling beam\ref{fig:5a}
        \item[Heating]Probe beam deflected away from the cooling beam\ref{fig:5b}
    \end{description}
\end{frame}
\end{document} 
Vesnog
  • 1,307
  • 2
  • 15
  • 30
  • @Wernet MWE has been added and it demonstrates my problem. ?? are displayed when the figure is hyper referenced does not have a caption. When I add the caption the font size of the caption and the prefix is too large. – Vesnog May 06 '14 at 16:15

1 Answers1

1

Figures that are numbered or referenced by number in a presentation is somewhat bizarre, since viewers don't get to flip through it the way one would in an article. However, some presentations may be distributed to viewers (like in a classroom environment where students get to download presentations by the instructor).

Here's one option by using \figcaption[*][<opt>]{<text>} which shows a figure caption in the text with title <text> (and prefix; the starred version removes the prefix). Additionally, [<opt>] can be used to adjust the way the reference is named. The references in the below MWE should explain possible usages:

enter image description here

\documentclass{beamer}
\let\Tiny\tiny% http://tex.stackexchange.com/q/58087/5764
\usepackage{xparse}
\makeatletter
\NewDocumentCommand{\figcaption}{s o m}{%
  \par\IfBooleanF{#1}{\refstepcounter{figure}}% Step figure counter
  {\footnotesize\IfBooleanF{#1}{\alert{Figure~\thefigure}: }#3\par}%
  \xdef\@currentlabelname{\IfNoValueTF{#2}{#3}{#2}}%
}
\makeatother

\mode<presentation> {
}
\makeatletter
\let\insertsupervisor\relax
\newcommand\supervisortitle{Supervisor}
\mode<all>
{
    \newcommand\supervisor[1]{\def\insertsupervisor{#1}}
    \titlegraphic{}
}
\defbeamertemplate*{title page}{supdefault}[1][]
{
    \vbox{}
    \vfill
    \begingroup
    \centering
    \begin{beamercolorbox}[sep=8pt,center,#1]{title}
        \usebeamerfont{title}\inserttitle\par%
        \ifx\insertsubtitle\@empty\relax%
        \else%
        \vskip0.25em%
        {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
        \fi%     
    \end{beamercolorbox}%
    \vskip1em\par
    \begin{beamercolorbox}[sep=8pt,center,#1]{author}
        \usebeamerfont{author}\insertauthor
    \end{beamercolorbox}
    \ifx\insertsupervisor\relax\relax\else
    \begin{beamercolorbox}[sep=8pt,center,#1]{author}
        \usebeamerfont{author}\supervisortitle:~\insertsupervisor
    \end{beamercolorbox}\fi
    \begin{beamercolorbox}[sep=8pt,center,#1]{institute}
        \usebeamerfont{institute}\insertinstitute
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center,#1]{date}
        \usebeamerfont{date}\insertdate
    \end{beamercolorbox}\vskip0.5em
    {\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par}
    \endgroup
    \vfill
}
\setbeamertemplate{title page}[supdefault][colsep=-4bp,rounded=true,shadow=\beamer@themerounded@shadow]
\makeatother

\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage[utf8]{inputenc}
\usepackage{xcolor,amsmath,pgf,siunitx}
\usepackage{hyperref}
\usepackage{hypcap}
\usetheme{CambridgeUS}
\usecolortheme{seagull}
\setbeamertemplate{bibliography item}[text]
\begin{document}
\begin{frame}
    \frametitle{Cooling power measurements}
    \begin{columns}[c]
        \column{.5\textwidth}
        \begin{figure}
            \vspace{-.5cm}
            \includegraphics[width=.9\linewidth]{example-image-a}
            \figcaption{ABC}\label{fig:5a}
        \end{figure}
        \footnotesize
        \begin{enumerate}
            \item He-Rb mixture with 200 bar He
            \item About 5 mW of cooling power
        \end{enumerate}
        \column{.5\textwidth}
        \begin{figure}
            \vspace{-.5cm}
            \includegraphics[width=.9\linewidth]{example-image-b}
            \figcaption*{BCD}\label{fig:5b}
        \end{figure}
        \footnotesize
        \begin{enumerate}
            \item Ar-Rb mixture with 230 bar Ar
            \item Order of magnitude larger CP
        \end{enumerate}
    \end{columns}
    \footnotesize
    \begin{itemize}
        \centering
        \item Expected cooling power red crosses
        \item Observed deflection angle blue crosses
    \end{itemize}
\end{frame}
\begin{frame}
    \frametitle{Temperature Gradient}
    \footnotesize
    Using a heat transfer model \cite{24}, after a cooling time $t$, the expected temperature gradient profile is:
    \begin{equation}
        \frac{dT}{dr}=-\frac{P_{cool}}{2\pi \kappa}\frac{e^{-\alpha z}}{r}\left[ \exp\left(\frac{2r^2}{\omega^2}\right)-\exp\left(\frac{2r^2}{\omega^2-8Dt}\right)\right]
    \end{equation}
    \begin{description}
        \item[Cooling]Probe beam deflected towards the cooling beam (see Figure~\ref{fig:5a})
        \item[Heating]Probe beam deflected away from the cooling beam (see \hyperlink{fig:5b}{\nameref{fig:5b}})
    \end{description}
\end{frame}
\end{document}
Werner
  • 603,163
  • Thanks for that you have also resolved the problem of font size I guess. – Vesnog May 06 '14 at 17:17
  • @Vesnog: You can adjust the definition of \figcaption to suit your needs. I've used \footnotesize since you used font=\footnotesize as part of your caption package loading. – Werner May 06 '14 at 17:19
  • Okay got it. Before your modification the code did not work with footnote size in the command \usepackage[font={footnotesize}]{caption} but passing scriptsize instead worked. – Vesnog May 06 '14 at 17:22
  • @Vesnog: You'll see that I dropped the use of caption, since it's not that necessary in a presentation IMHO. – Werner May 06 '14 at 17:24
  • By the way I tried to insert a citation into the caption and run into numerous errors. Can it be easily implemented? – Vesnog May 06 '14 at 18:47
  • @Vesnog: Use the <opt> argument for that. As in \figcaption[An image]{An image \cite{image}}, or try \figcaption{An image \protect\cite{image}}. – Werner May 06 '14 at 18:49
  • Thanks, the first one worked but the second did not. By the way where can I learn to implement new commands like this. – Vesnog May 06 '14 at 18:52