\documentclass{beamer}
\usetheme{Madrid}
\begin{document}
\begin{frame}{Members}
\begin{columns}[T]
\hfill
\begin{column}{.32\textwidth}
\hspace{2mm} \includegraphics[height=0.2\textheight]{john.jpg} \hspace{2mm} John\\
\hspace{2mm} \includegraphics[height=0.2\textheight]{jane.jpg} \hspace{2mm} Jane\\
\hspace{2mm} \includegraphics[height=0.2\textheight]{sue.jpg} \hspace{2mm} Sue\\
\hspace{2mm} \includegraphics[height=0.2\textheight]{bob.jpg} \hspace{2mm} Bob\\
\end{column}
\hfill
\begin{column}{.32\textwidth}
Middle Part
\end{column}
\hfill
\begin{column}{.32\textwidth}
Right Part
\end{column}
\hfill
\end{columns}
\end{frame}
\end{document}
我将四张图片垂直并排放置,并希望将它们的名称放在相应图片的右侧。问题是名称与图片底部对齐。我可以让它与中心对齐吗?
答案1
在这里,我使用了一个\raisebox
包裹在宏中的宏,名为\Includegraphics
(大写“I”)。关键是要知道图像的正确向下垂直偏移,否则图像将与基线对齐。在本例中,该偏移是-.5\dimexpr\height-\ht\strutbox+\dp\strutbox
,无论图像高度和字体大小如何,它都会起作用。
\documentclass{beamer}
\usetheme{Madrid}
\newcommand\Includegraphics[2][]{%
\raisebox{-.5\dimexpr\height-\ht\strutbox+\dp\strutbox}{\includegraphics[#1]{#2}}}
\begin{document}
\begin{frame}{Members}
\begin{columns}[T]
\hfill
\begin{column}{.32\textwidth}
\hspace{2mm}\Includegraphics[height=0.2\textheight]{example-image} \hspace{2mm} John\\
\hspace{2mm}\Includegraphics[height=0.2\textheight]{example-image-A} \hspace{2mm} Jane\\
\hspace{2mm}\Includegraphics[height=0.2\textheight]{example-image-B} \hspace{2mm} Sue\\
\hspace{2mm}\Includegraphics[height=0.2\textheight]{example-image-C} \hspace{2mm} Bob\\
\end{column}
\hfill
\begin{column}{.32\textwidth}
Middle Part
\end{column}
\hfill
\begin{column}{.32\textwidth}
Right Part
\end{column}
\hfill
\end{columns}
\end{frame}
\end{document}