# Centering something that is scaled to fit an empty beamer slide

I am trying to fit something in a beamer slide so that it covers the entire frame width, but what I get seems to be offset to the right by \hoffset. Here is a MWE:

\documentclass{beamer}

\begin{document}

\begin{frame}[plain]
%
\centering
%
max totalsize={\paperwidth}%
{\dimexpr\paperheight-\voffset\relax}}
%
% Something larger than paperwidth, so that scaling is necessary.
%
%
\end{frame}

\end{document}


The above produces the following:

As can be seen, there is some empty space on the left. Moreover, the contents don't really seem to actually have a width of \paperwidth.

What is the right way of achieving this? I would like to avoid playing around with \usebackgroundtemplate, as something like Image on full slide in beamer package seems very ad-hoc to me.

With the current version of adjustbox just add the center key at the very end. There is also no need to use \dimexpr anymore. This has been fixed.

\documentclass{beamer}

\begin{document}

\begin{frame}[plain]
%
\centering
%
max totalsize={\paperwidth}{\paperheight-\voffset}, center}
%
% Something larger than paperwidth, so that scaling is necessary.
%
%
\end{frame}

\end{document}


TeX doesn't centre stuff which is wider than the text width. In that case it always starts at the left margin. To fix this, change the width that the typesetting algorithm sees to something which fits into the width with \makebox:

\documentclass{beamer}

\begin{document}

\begin{frame}[plain]
%
\centering
%
\makebox[\textwidth]{%
max totalsize={\paperwidth}%
{\dimexpr\paperheight-\voffset\relax}}%
%
% Something larger than paperwidth, so that scaling is necessary.

• @dow there were som missing % to end the line. Now it should work. – Skillmon likes topanswers.xyz Apr 3 '18 at 9:53
• You could shorten this to \begin{frame}[plain] \begin{adjustbox}{width=1.2\paperwidth, max totalsize={\paperwidth}{\dimexpr\paperheight-\voffset\relax}, center} Test text. \end{adjustbox} \end{frame}. – Martin Scharrer Apr 3 '18 at 15:16
• @MartinScharrer the adjustbox{width=1.2\paperwidth}{Test text.} is a left over from OP who wanted to see how the code works with stuff that is actually oversized. I didn't remove that because I saw no point in doing so (though the reresizing is lets say less than ideal). – Skillmon likes topanswers.xyz Apr 3 '18 at 18:39