0

I would like to achieve that a table and a figure are next to each other. I found this question and tried to use it for my purpose. However, I can't make it work. Here is an example slide. I would like to have first the three items (1, 2, 3) and then next to each other the table and the picture.

\documentclass{beamer}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}
\begin{itemize}
\item 1
\item 2
\item 3
\end{itemize}
\begin{block}{test}
  \begin{minipage}{0.5\textwidth}
    \centering
  \begin{table}[]
    \begin{tabularx}{ccc}{0.9\textwidth}
      \textbf{API hits per month (in Mio.)} & \textbf{Price per month} & \textbf{Price per year} \\ \hline
      \rowcolor[HTML]{DDDDDD} 
      0.1                                   & 2'500                    & 30'000                  \\
      0.5                                   & 3'250                    & 39'000                  \\
      \rowcolor[HTML]{DDDDDD} 
      1                                     & 4'000                    & 48'000                  \\
      1.5                                   & 4'750                    & 57'000                  \\
      \rowcolor[HTML]{DDDDDD} 
      2                                     & 5'500                    & 66'000                 
    \end{tabularx}
  \end{table}
  \end{minipage}
\begin{minipage}{0.5\textwidth}
\centering
  \includegraphics[width=\textwidth]{b.png}
\end{minipage}
\end{block}
\end{frame}
\end{document}

where the picture I for this purpose is

enter image description here

1 Answer 1

3

Does not really look good, but in theory you could place the table and images besides each other like this:

\documentclass[xcolor={table}]{beamer}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}
\begin{frame}
\begin{itemize}
\item 1
\item 2
\item 3
\end{itemize}
\begin{block}{test}
  \begin{minipage}{0.58\textwidth}
%    \centering
%  \begin{table}
    \begin{tabularx}{\textwidth}{XXX}
        \footnotesize \textbf{API hits per month (in Mio.)} & 
        \footnotesize \textbf{Price per month} & 
        \footnotesize \textbf{Price per year} \\ \hline
      \rowcolor[HTML]{DDDDDD} 
      0.1                                   & 2'500                    & 30'000                  \\
      0.5                                   & 3'250                    & 39'000                  \\
      \rowcolor[HTML]{DDDDDD} 
      1                                     & 4'000                    & 48'000                  \\
      1.5                                   & 4'750                    & 57'000                  \\
      \rowcolor[HTML]{DDDDDD} 
      2                                     & 5'500                    & 66'000                 
    \end{tabularx}
%  \end{table}
  \end{minipage}%
  \hfill
\begin{minipage}{0.38\textwidth}
%\centering
  \includegraphics[width=\textwidth]{example-image}
\end{minipage}
\end{block}
\end{frame}
\end{document}

enter image description here

Personally I would prefer a cleaner look for the table:

\documentclass{beamer}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{array}

\newcolumntype{R}{>{\raggedright\arraybackslash}X}



\begin{document}
\begin{frame}

\begin{itemize}
\item 1
\item 2
\item 3
\end{itemize}

\begin{block}{test}
    \smallskip
  \begin{minipage}{0.58\textwidth}
    \footnotesize
    \begin{tabularx}{\textwidth}{@{}RRR@{}}
        \toprule
        API hits per month [Mio.] & 
        Price per month & 
        Price per year\\
        \midrule
      0.1                                   & 2'500                    & 30'000\\
      0.5                                   & 3'250                    & 39'000\\
      1                                     & 4'000                    & 48'000\\
      1.5                                   & 4'750                    & 57'000\\
      2                                     & 5'500                    & 66'000\\
      \bottomrule            
    \end{tabularx}
  \end{minipage}%
  \hfill
    \begin{minipage}{0.38\textwidth}
      \includegraphics[width=\textwidth]{example-image}
    \end{minipage}
\end{block}

\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 .