1

In my slideshow, I have a picture which needs a caption but for better looking I want it to be in the original ratio. Therefore the size of the image is defined as width=\pagewidth and height=\pageheight. How do I add a caption which is shown on the image itself, for example in the upper right corner.

MMW of the frame with the image

\documentclass[aspectratio=169]{beamer}
\usepackage{media9}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{tikz}
\usetheme{default}
\usetikzlibrary{calc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% absolute positioning of typeset material    
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\placetextbox}[4][center]{%
    % [#1]: box anchor: center (default) | 
    %                 south west | west | north west | north |
    %                 north east | east | south east | south | 
    %                 mid west | mid | mid east |
    %                 base west | base | base east 
    % #2: horizontal position (fraction of page width)
    % #3: vertical position (fraction of page height)
    % #4: content
    %
    \tikz[remember picture,overlay,x=\paperwidth,y=\paperheight]{%
        \node[anchor=#1,inner sep=0pt]
        at ($(current page.south west)+(#2,#3)$) {#4};
    }%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usecolortheme{wolverine}
\begin{frame}{}
\placetextbox[south]{0.5}{0}{\includegraphics[width=\paperwidth,height=\paperheight]{IMG_7917.jpg}}
\end{frame}
\end{document}
1
  • If you want to use an actual caption (\captionof{figure}), put it inside a minipage {\linewidth}. The height adjustment is a bit trickier since bearmer doesn't know how bit the trame is until later. Apr 25 '19 at 14:38
3

Something like this?

\documentclass[aspectratio=169]{beamer}
\usepackage{tikz}
\usetheme{default}
\usetikzlibrary{calc}
\usecolortheme{wolverine}
\begin{document}
\begin{frame}{}
\begin{tikzpicture}[overlay,remember picture]
\node at (current page.center){\includegraphics[width=\paperwidth,height=\paperheight]{example-image-duck}};
\node[anchor=north east] at (current page.north east){Some text about ducks.};
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

2
  • Any way to center the text?
    – mugdi
    Apr 25 '19 at 13:43
  • 1
    @mugdi \node at (current page.center){Some text about ducks.}; or \node[anchor=north] at (current page.north){Some text about ducks.};.
    – user121799
    Apr 25 '19 at 13:58

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.