如何垂直对齐投影仪标题图形?

如何垂直对齐投影仪标题图形?

beamer演示文稿中,我使用以下代码在标题页上添加徽标:

\titlegraphic{
  \includegraphics[width=3cm]{logo-lirmm.png}
  \hspace*{0.75cm}~%
  \includegraphics[width=3cm]{logo-york.png}
  \hspace*{0.75cm}~%
  \includegraphics[width=3cm]{logo-dc.png}
}

此代码将三个徽标垂直对齐在底部. 我怎样才能使它们垂直居中?

答案1

\parbox图像周围可以帮助它们居中:

\documentclass{beamer}

\begin{document}

\begin{frame}
    \parbox[c]{3cm}{\includegraphics[width=3cm]{example-image}}
    \hspace*{0.75cm}%
    \parbox[c]{2cm}{\includegraphics[width=2cm]{example-image}}
    \hspace*{0.75cm}%
    \parbox[c]{1cm}{\includegraphics[width=1cm]{example-image}}
\end{frame} 

\end{document}

在此处输入图片描述

答案2

将每个图形放在一个框内,然后可以测量框的内容。这样,您可以将框升高/降低到位,使它们垂直对齐:

在此处输入图片描述

\documentclass{beamer}

\usetheme{Warsaw}

% Store logos inside boxes
\newsavebox{\logoA}
\newsavebox{\logoB}
\savebox{\logoA}{\includegraphics[width=2.5cm]{example-image-a}}
\savebox{\logoB}{\includegraphics[width=3.5cm]{example-image-b}}

\titlegraphic{%
  \raisebox{.5\dimexpr\ht\logoB-\ht\logoA}{\usebox{\logoA}}% raise smaller logo into position
  \hspace*{5cm}%
  \usebox{\logoB}
}

\title{A title}
\author{An author}

\begin{document}

\begin{frame}
  \maketitle
\end{frame}

\end{document}

相关内容