我想实现表格和图形彼此相邻。我发现了这一点问题并尝试将其用于我的目的。但是,我无法让它工作。这是一个示例幻灯片。我想首先有三个项目(1、2、3),然后将表格和图片并排放置。
\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}
其中我为此目的的图片是
答案1
看起来不太好,但理论上你可以将表格和图像放在一起,像这样:
\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}
就我个人而言,我更喜欢表格更简洁的外观:
\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}