1

i have a sample code with which i'm trying to use the whole space of the slide for 1 image plus a text block (2 x 1 invisible table e.g.) or 2 images plus 2 text blocks (2 x 2). But for the latter i'm not able to make text blocks centered en their "cells". At the bottom i put an image of what i want. I did it in loimpress.

\documentclass[aspectratio=1610]{beamer}
%\usetheme{Warsaw}

\usepackage{graphicx}
\graphicspath{ {./} {../../items/} }

\begin{document}

\begin{frame}[c]
\begin{columns}
  \column{0.5\textwidth}
  \includegraphics[width=\textwidth]{apple.png}
  \column{0.5\textwidth}
  \center\huge apple \\
  pomme
\end{columns}
\end{frame}

\begin{frame}[c]
\begin{columns}
  \column{0.5\textwidth}
  \includegraphics[width=\textwidth]{banana.png}
  \includegraphics[width=\textwidth]{apple.png}

  \column{0.5\textwidth}
  \center\huge banana \\
  banane \\
  apple \\
  pomme
\end{columns}
\end{frame}
\end{document}

enter image description here

1
  • BTW: I have never seen so long apples or so round bananas. ;-) Dec 19, 2021 at 12:51

4 Answers 4

1

There are many possibilities to achieve what you want, including tikz. The above answers so far suffer a bit from limited control of the exact position. My favorite approach is to use a \textblock for the "rows" and then use a columns environment inside the textblock. Most of the time this seems to correspond to the way how slide content is used/composed (at least for me...).

Here is an example how you could achieve this:

\documentclass[aspectratio=1610]{beamer}

\usepackage{graphicx}
\graphicspath{ {./} {../../items/} }

% textpos allows to arbitrary position TeX code, e.g., by 
% \begin{textblock}{1}(0., -0.08) Some text \end{textblock}
\usepackage[absolute,overlay,showboxes]{textpos}  % delete "showboxes" to remove the outline of the text boxes
\TPGrid{1}{1} % defines the units


\begin{document}
    \begin{frame}[c]
        % ====================================================================================================
        % ======= Define the upper row with image on the left and text on the right.                     =====
        % ====================================================================================================
        \begin{textblock*}{0.9\pagewidth}(0.05\pagewidth, 0.01\pageheight)  % {size}(hpos, vpos)
            \begin{columns}
                % ------ the left "box" with the image ------------------
                \column{0.45\textwidth}
                    \color{blue}\fbox{\color{black} %  draw the blue box on the left        
                  % The minipage takes all the horizontal space of the column;
                  % the height (0.42\textwidth) can be changed and defines the height of the row
                        \begin{minipage}[c][0.42\textheight][c]{\textwidth}
                            \centering
                            \includegraphics[width=0.25\pagewidth]{apple}
                        \end{minipage}
                    }
                % -------- the right "box" with the text ----------------
                \column{0.45\textwidth}
                    \color{red}\fbox{\color{black}%  draw the red box on the right
                        \begin{minipage}[c][0.42\textheight][c]{0.95\textwidth}
                            \centering\huge apple\\
                            pomme 
                        \end{minipage}
                    }
            \end{columns}               
        \end{textblock*}        
        % ====================================================================================================
        
        
        % ====================================================================================================
        % ======= Define the lower row with image on the left and text on the right.                    ======
        % ======= This is independent of the upper "row" -- just specify the offset (vpos) of textblock ======
        % ====================================================================================================
        \begin{textblock*}{0.9\pagewidth}(0.05\pagewidth, 0.5\pageheight)  % {size}(hpos, vpos)
            \begin{columns}
                % ------ the left "box" with the image ------------------
                \column{0.45\textwidth} % width of the green box
                \color{green}\fbox{\color{black} %  draw the green box on the left      
                    \begin{minipage}[c][0.42\textheight][c]{\textwidth}
                        \centering
                        \includegraphics[width=0.25\pagewidth]{banana}
                    \end{minipage}
                }
                % -------- the right "box" with the text ----------------
                \column{0.45\textwidth}
                \centering
                \color{cyan}\fbox{\color{black}%  draw the cyan box on the right
                    \begin{minipage}[c][0.42\textheight][c]{0.95\textwidth}
                        \centering\huge banana\\
                        banane\\
                        banana
                    \end{minipage}
                }
            \end{columns}               
        \end{textblock*}    
        % ====================================================================================================
    \end{frame}

\end{document}

I added colored boxes to show which object is which (black: textblock, colored: minipages within colum environments): you can remove the boxes by deleting "showboxes" in the respective usepackage command and by deleting the lines containing fbox (including the closing "}").

The arguments of the textblock environment allow absolute positioning of content on the frame, the columns environment do what they do best ...

Finally, here's a screenshot: screenshot.

Last but not least, from my code it should be clear that you can also do this using only textblocks, not using the colums environment at all. But that might be a matter of taste ;)

I hope that this is useful for someone!

2

Without additional packages, the content could be organized using four minipages.

The default behavior of the minipage is to center its content vertically. The \centering inside does it horizontally.

a

\documentclass[aspectratio=1610]{beamer}
%\usetheme{Warsaw}  
    
\usepackage{graphicx}
\graphicspath{ {./} {../../items/} }

\begin{document}
    \begin{frame}[c]
        \begin{minipage}{0.5\linewidth}
            \centering
            \includegraphics[width=0.8\linewidth]{example-image-duck}
        \end{minipage}\hfill
        \begin{minipage}{0.5\linewidth}
            \centering\huge apple \\
            pomme
        \end{minipage}
        \vfill
        \begin{minipage}{0.5\linewidth}
            \centering
            \includegraphics[width=0.8\linewidth]{example-image-duck}
        \end{minipage}\hfill
        \begin{minipage}{0.5\linewidth}
            \centering\huge  banana \\
            banane \\
            apple \\
            pomme
        \end{minipage}  
    \end{frame}

\end{document}
2
  • here you stacked 4 minipages. As a result i get a stack of minipages, not 2 x 2. Jan 5, 2022 at 9:25
  • @user1850133 As I understood your question the only issue was to auto *center the content (figures or text) in their quarter of the frame. There are many alternatives to do that. The minpage is a useful latex environment, easy to use. Jan 5, 2022 at 19:21
2

Another solution, without any other package or structures like tabular or minipage. Just a columns environment for any pair image+text will do it.

\documentclass[aspectratio=1610]{beamer}
%\usetheme{Warsaw}

\usepackage{graphicx}
\graphicspath{ {./} {../../items/} }

\begin{document}

\begin{frame}[c]
\begin{columns}
  \column{0.5\textwidth}
  \includegraphics[width=\textwidth]{example-image-a}
  \column{0.5\textwidth}
  \center\huge apple \\
  pomme
\end{columns}
\end{frame}

\begin{frame}[c]
\begin{columns}
  \column{0.5\textwidth}
  \includegraphics[width=\textwidth]{example-image-a}
  \column{0.5\textwidth}
  \centering\huge banana \\
  banane \\
\end{columns}
\begin{columns}
  \column{0.5\textwidth}
  \includegraphics[width=\textwidth]{example-image-b}
  \column{0.5\textwidth}
  \centering\huge 
  apple \\
  pomme
\end{columns}
\end{frame}
\end{document}

enter image description here

2
  • no control on the height. Jan 5, 2022 at 9:57
  • @user1850133 the control of the height is fixed with the height of the figure. \includegraphics[height=...]{...}. In my example I've only fixed image width, but you can decide what you prefer.
    – Ignasi
    Jan 5, 2022 at 10:57
2

You can organize images and belonging text with table.

Edit: Regarding to your comment (after 20 days!) now images height are defined by height=<desired vale> and text is also horizontali centered by changing type of column to C and X[c, font=\huge]. BTW those requirements are not clear (at least to me) from question. Hopefully now both examples are what you after.

For example:

  • with tabularx and adjustbox packages:
\documentclass[aspectratio=1610]{beamer}
%\usetheme{Warsaw}
\graphicspath{ {./} {../../items/} }
\usepackage[export]{adjustbox}
\usepackage{booktabs, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}

\begin{frame}[c]
    \begin{tabularx}{\textwidth}{C@{\qquad\qquad}>{\huge}C}
\includegraphics[height=33mm, valign=m]{example-image-duck}
    &   I'm a duck who love bananas \\
    \addlinespace
\includegraphics[height=33mm, valign=m]{example-image-duck}
    &   I'm a duck who love apples \\
    \end{tabularx}
\end{frame}
\end{document}

enter image description here

  • by use of the tabularray and adjustbox packages:
\documentclass[aspectratio=1610]{beamer}
%\usetheme{Warsaw}
\graphicspath{ {./} {../../items/} }
\usepackage[export]{adjustbox}
\usepackage{tabularray}
\UseTblrLibrary{varwidth}

\begin{document}

\begin{frame}[c]
\adjustboxset{{height=33mm, valign=m}
    \begin{tblr}{colspec = {X[c] X[c, font=\huge]},
                 measure = vbox
                 }
\adjincludegraphics{example-image-duck}
    &   I'm a duck who love bananas \\
\adjincludegraphics{example-image-duck}
    &   I'm a duck who love apples \\
    \end{tblr}
\end{frame}
\end{document}

enter image description here

3
  • The height of the rows is not controlled. The text is not centered, and '\\' will add a new row instead of a newline. Jan 5, 2022 at 9:44
  • Images and text are vertical centered, height of images is implicite controlled by width of images. However, I can do this explicit. See edited answer.
    – Zarko
    Jan 5, 2022 at 10:03
  • the fact that i wanted centered text on both dimensions was clear enough in my text. I had said "text centered in their cell", which means both V and H. height control was not requested but i made clear that it's a 2x2 table covering the whole space and i illustrated with an example. Jan 6, 2022 at 3:44

You must log in to answer this question.

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