1

I'm using the tabular environment to place 2 figures side by side on beamer. When images are "small enough" everything is good, but if I ask for images to be a little larger (using \textwidth) the result is that they are not centered horizontally anymore. Here's an example of both not centered and centered:

\documentclass{beamer}
\usepackage[spanish,es-nodecimaldot,es-tabla]{babel}
\usepackage[T1]{fontenc}
\usepackage{tikz,graphicx,multirow,amsmath,amsfonts}
\usepackage{lmodern}

\usetheme{Goettingen}

\begin{document}

\section{First section}


\begin{frame}{Figures are not centered on the sides}{Looks bad :(}

\begin{tabular}{cc}
Some figure 1 & Some figure 2\\
\includegraphics[width=0.49\textwidth]{example-image} & \includegraphics[width=0.49\textwidth]{example-image}
\end{tabular}

\end{frame}

\begin{frame}{These are centered!}

\begin{tabular}{cc}
Some figure 1 & Some figure 2\\
\includegraphics[width=0.45\textwidth]{example-image} & \includegraphics[width=0.45\textwidth]{example-image}
\end{tabular}

\end{frame}

\end{document}

And it produces:

enter image description here

I don't know if it's because I'm using \textwidth. Maybe I should use something else instead? But I don't know what. Using scale does the same thing.

Any advice is greatly appreciated!

3
  • I suppose (I am really sure) that images are not centered by default in beamer. So if you want them to be centered you have to use a center environment or something similar. When your content is too wide for the \textwidth it will break out, nevertheless.
    – Jürgen
    Mar 29, 2017 at 14:45
  • @Jürgen Thanks for the advice but sadly it's not working. I tried adding \centering before the tabular environment and it doesn't change anything. Using \begin{center} ... \end{center} around tabular changes vertical alignment, but not horizontal. Any other ideas? Mar 29, 2017 at 14:51
  • Yes, that's exactly what I tried to tell you: If your content is too wide ...
    – Jürgen
    Mar 29, 2017 at 18:14

1 Answer 1

4

The images on your second slide aren't centered, it only looks more or less right due to the values you used. You can put your tabular in a \makebox:

\documentclass{beamer}
\usepackage[spanish,es-nodecimaldot,es-tabla]{babel}
\usepackage[T1]{fontenc}
\usepackage{tikz,graphicx,multirow,amsmath,amsfonts}
\usepackage{lmodern}

\usetheme{Goettingen}

\begin{document}

\section{First section}


\begin{frame}{Figures are not centered on the slides}{Looks bad :(}

\makebox[\linewidth]{%
 \begin{tabular}{cc}
 Some figure 1 & Some figure 2\\
 \includegraphics[width=0.49\textwidth]{example-image} & \includegraphics[width=0.49\textwidth]{example-image}
\end{tabular}}

\end{frame}
\end{document}

enter image description here

1
  • Doesn't work when figure environment is used (for capitons, for instance).
    – luchonacho
    Jun 5, 2020 at 18:52

You must log in to answer this question.

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