0

While designing a custom title page for a beamer presentation I want to position a logo in the top right corner using the same marging like the rest of the page.

According to the beamer documentation page 76 the default value for the left/right margin size is 1cm. But I don't want to rely on a default value, I want to use whichever value might have been set with \setbeamersize{text margin right=whatever}.

Ideally I would want to do this:

\hspace*{\getbeamersize{text margin right}}%

But there is no command \getbeamersize. How do I get the margin in a document using the beamer class?


I am using something similar to the following code to insert the logo:

\begingroup
\setbeamertemplate{footline}{}
\setbeamertemplate{headline}{%
    \begin{minipage}{\paperwidth}%
    \vspace*{1cm}%
    \hfill
    \includegraphics[height=1.5cm]{logo}%
    \hspace*{1cm}%
    \end{minipage}%
}
\begin{frame}
    ...
\end{frame}
\endgroup
1
  • Please don't post code fragments, always make a small, but compilable test document. Commented Jul 31, 2023 at 8:08

1 Answer 1

2

Beamer stores these values in \beamer@leftmargin and \beamer@rightmargin:

\documentclass{beamer}

\begin{document}
    
\begingroup
\makeatletter
\setbeamertemplate{footline}{}
\setbeamertemplate{headline}{%
    \begin{minipage}{\paperwidth}%
    \vspace*{\beamer@leftmargin}%
    \hfill
    \includegraphics[height=1.5cm]{example-image-duck}%
    \hspace*{\beamer@rightmargin}%
    \end{minipage}%
}
\makeatother
\begin{frame}
    ...
\end{frame}
\endgroup

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