beamer icon indicating copy to clipboard operation
beamer copied to clipboard

Make plain frames really fillable by canceling sidebars (and not only hidding them)

Open josephwright opened this issue 11 years ago • 15 comments

Originally reported by: denisbitouze (Bitbucket: denisbitouze, GitHub: Unknown)


Because sidebars in some themes are only hidden and not actually canceled, plain frames are not really fillable, despite what is written in beamer's documentation, page 61. The following MCE shows a drawback of the current situation where title frame cannot be horizontally centered in plain frames with some themes (the commented code is a workaround but is tricky especially for beginners).

#!latex

\documentclass{beamer}
\usetheme{PaloAlto}
\begin{document}
% \begingroup
% \makeatletter
% \setlength{\hoffset}{-.5\beamer@sidebarwidth}
% \makeatother
\title{Foo}
\author{Bar}
\begin{frame}[plain]
\maketitle
\end{frame}
\end{document}


  • Bitbucket: https://bitbucket.org/rivanvx/beamer/issue/274

josephwright avatar Nov 25 '13 15:11 josephwright

Original comment by denisbitouze (Bitbucket: denisbitouze, GitHub: Unknown):


Note that % \endgroup is missing just after \end{frame}. Any chance this issue could be fixed in a near future?

josephwright avatar Apr 29 '16 08:04 josephwright

Sigh... Already release 3.48 and this issue is still alive :(

dbitouze avatar Jan 16 '18 15:01 dbitouze

@dbitouze This is a hard problem: The page width (\textwidth) is calculated by (\paperwidth - sidebar width left - sidebar width right) at the beginning of document. Therefore, the only way to "cancel" the sidebar is to redefine the paper size using \geometry command at the begining of a plain frame (otherwise the way of arranging frame components must be totally altered) and restore it on a normal slide. I tried a few times with this but has not succeed by now.

louisstuart96 avatar Jan 16 '18 15:01 louisstuart96

Maybe I'm wrong but wouldn't it be enough, in case of sidebar outer theme, to redefine plain frames to be preceded and followed respectively by:

\begingroup
\makeatletter
\setlength{\hoffset}{-.5\beamer@sidebarwidth}
\makeatother

and:

\endgroup

dbitouze avatar Jan 16 '18 16:01 dbitouze

@dbitouze This way only moves the frame content. Our goal is to stretch its width to fill the whole \paperwidth. Besides, current way fails if one puts sidebar onto the right side, that is, he has to use \setlength{\hoffset}{.5\beamer@sidebarwidth}.

louisstuart96 avatar Jan 16 '18 16:01 louisstuart96

@louisstuart96 I see.

dbitouze avatar Jan 16 '18 20:01 dbitouze

Modified from https://tex.stackexchange.com/a/198224/36296 and https://tex.stackexchange.com/a/113412/36296 the following would a) stretch the textwidth and b) only move it when necessary, e.g. when the sidebar is on the left.

    \hoffset=-\beamer@leftsidebar
    \advance\textwidth\beamer@sidebarwidth
    \hsize\textwidth
    \columnwidth\textwidth

(With this ansatz, the frametitle still needs to be adjusted, see e.g. https://tex.stackexchange.com/q/423242/36296)

ghost avatar Mar 26 '18 16:03 ghost

@samcarter8 A problem remains: if the background color is changed, only a part of the extended area is colored:

\documentclass{beamer}
%
\usetheme{PaloAlto}
\setbeamercolor{background canvas}{bg=yellow!50}
%
\title{Foo}
\author{Bar}
%
\begin{document}
%
\makeatletter
\hoffset=-\beamer@leftsidebar
\advance\textwidth\beamer@sidebarwidth
\hsize\textwidth
\columnwidth\textwidth
\makeatother
%
\begin{frame}[plain]
\maketitle
\end{frame}
%
\end{document}

test

dbitouze avatar Mar 31 '18 06:03 dbitouze

@dbitouze Like the frametitle, this would need to be repaired, but it is doable, see my updated answer to your questions at tex.se https://tex.stackexchange.com/a/423246/36296

ghost avatar Mar 31 '18 14:03 ghost

Quite perfect now! :)

dbitouze avatar Mar 31 '18 17:03 dbitouze

So we know it is doable.

But should the current behaviour be changed by default? This would probably alter many old presentation which worked around this problem in one way or another.

ghost avatar Mar 31 '18 17:03 ghost

Indeed, this would break backward compatibility but, IMHO, it is an unfortunate necessity: I don't see any reason to be happy with non centered text in plain frames, especially since it is centered in case of themes without sidebars.

dbitouze avatar Mar 31 '18 17:03 dbitouze

Another problem remains: that trick doesn't work with sidebar-less themes (see #755).

\documentclass{beamer}
%
% \usetheme{PaloAlto}
%
\title{Foo}
\author{Bar}
%
\begin{document}
%
\begingroup
\makeatletter
\hoffset=-\beamer@leftsidebar
\advance\textwidth\beamer@sidebarwidth
\hsize\textwidth
\columnwidth\textwidth
\makeatother
\begin{frame}[plain]
\maketitle
\end{frame}
\endgroup
\end{document}

dbitouze avatar Jan 28 '22 10:01 dbitouze

I went template by template (which can appear both in plain frame and in default frame) and added something similar to this line. It does work in my case

\addtobeamertemplate{title page}{
    \ifbeamer@plainframe%
        \advance\textwidth\beamer@sidebarwidth % I only use right sidebar ... 
        \hsize\textwidth
        \columnwidth\textwidth
    \fi                 
}{}

Does it make sense?

iagobaapellaniz avatar Jun 27 '22 20:06 iagobaapellaniz

The above did not yet work for the bibliography / reference list as it works as a list and its width is set by \linewidth, so I added \linewidth\textwidth to the above.

moritzpoll avatar Sep 03 '22 15:09 moritzpoll