2

For some reason, the \raggedleft isn't really right-aligned. I tried minipage but that apparently doesn't work in the if/else environment.

\documentclass[
    % handout,
    english,usenames,dvipsnames]{beamer}
\usepackage{graphicx}
\makeatletter
    \@ifclasswith{beamer}{handout}{\newif\ifhandoutmode \handoutmodetrue}{\newif\ifhandoutmode}
\makeatother

\begin{document}

\begin{frame}{Header}
\tiny Foo, bar, baz
\begin{overlayarea}{\textwidth}{\textheight}
    \ifhandoutmode
        \only<1>{\includegraphics[width=10cm]{example-image}}
    \else
        \only<1>{\includegraphics[width=10cm]{example-image}}
    \fi
    \ifhandoutmode
        \only<8>{
            \\ lalala
        }
    % % doesnt work:
    % \else
    %     \hfill
    %     \begin{minipage}{0.6\textwidth}
    %         \raggedleft
    %         \tiny\textbf{F} Random text: 1,4,7=Loreum; 2=Ipsum; 3,8,9=Dolor sit amet; 5,6=Consectetur adipiscing elit
    %     \end{minipage}
    %     \hspace*{0.4\textwidth} % Adjust this value if needed to align perfectly to the right
    % \fi
    \else
        \hfill \parbox{0.6\linewidth}{
            \raggedleft\tiny\textbf{F} Lorem ipsum: 1,4,7=Loreum; 2=Ipsum; 3,8,9=Dolor sit amet; 5,6=Consectetur adipiscing elit
        }
    \fi
\end{overlayarea}
\end{frame}

\end{document}

enter image description here

1 Answer 1

3

Your \hfill will be added on the right side of the image. If you'd like to use it in front of your parbox, finish the paragraph first.

Some other comments about your code:

  • you don't need graphicx, beamer automatically loads it

  • your overlay area is too high. It can't span the whole text height as you already have a frametitle and one line of text. The overfull box warning in the log file will tell you by how much you need to reduce the height.

    If you'd use a top frame, you could remove it all together.

  • instead of your \ifhandoutmode construct, you can use beamer:0 and handout:0 to exclude certain content from specific modes

\documentclass[
%     handout,
    english,dvipsnames]{beamer}
    
\begin{document}

\begin{frame}[t]
\frametitle{Header}
\tiny Foo, bar, baz
\only<handout:1|beamer:0>{\includegraphics[width=\linewidth]{example-image-duck}}%
\only<handout:0|beamer:1>{\includegraphics[width=\linewidth]{example-image-duck}}%
\only<beamer:0|handout:8>{%
  \par lalala%
}%
\only<handout:0>{%
  \par\hfill \parbox{0.6\linewidth}{%
    \raggedleft\tiny\textbf{F} Lorem ipsum: 1,4,7=Loreum; 2=Ipsum; 3,8,9=Dolor sit amet; 5,6=Consectetur adipiscing elit
  }%
}%
\end{frame}
\end{document}

enter image description here

You must log in to answer this question.

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