2

My goal is to switch the backgroundtemplate for every \AtBeginSection{}-frame. This is working so far, but the logo-region is overlaying the background with a plain white region.

enter image description here

I'm using \useoutertheme{sidebar}. I had this problem before, when i wanted to not include an actual logo, but include the logo and the gray region in \usebackgroundtemplate{}. The issue was also, that the logo-region was overlaid with white. I consider the way it works right now as a hack, as i've put the gray background and the logo inside a \tikz{}-command inside of \logo{} with very obscure coordinates:

\logo{
  \tikz{
    \fill[grayborder] (-1,0) rectangle (20.7mm,1cm);
    \node at (.5cm,.5cm) {\includegraphics[width=2.5cm]{Hochschule-esslingen}};
  }
}

This is what my \AtBeginSection{}-command looks like at the moment:

\AtBeginSection[]{
  {
    \logo{}
    \useoutertheme{}
    \setbeamertemplate{footline}{}
    \setbeamertemplate{background}{
      \begin{tikzpicture}[at=(current page.south east)]
        \shadedraw[shading=axis,
          left color=left,
          right color=right,
          shading angle=135,
          middle color=right,
          vertical custom shading=35
        ]
        (0,0) rectangle (\paperwidth,\paperheight);
      \end{tikzpicture}
    }
    \begin{frame}
      \textcolor{white}{\MakeUppercase{\Huge\thesection\\[.4ex]\insertsectionhead}}
    \end{frame}
  }
}

As an added bonus, the sidebar should also be disabled for the \AtBeginSection{}-frame, but that might be for another question.

MWE:

\documentclass[aspectratio=169]{beamer}

\usepackage{tikz}
\usepackage{xcolor}

\definecolor{right}{HTML}{002d58}
\definecolor{left}{HTML}{00aadc}

\setbeamertemplate{navigation symbols}{}

\setbeamertemplate{footline}{%
  \hspace{10pt}\insertdate\hfill% 
  \insertshorttitle\hfill%
  \insertframenumber/\inserttotalframenumber\hspace{10pt}%
  \vspace{8pt}%
}

\useoutertheme[%
  width=3cm,
  height=1cm,
  hideothersubsections,
  ]{sidebar}

\AtBeginSection[]{
  {
    \useoutertheme{} % Should deactivate outertheme temporarily
    \setbeamertemplate{footline}{}
    \setbeamertemplate{background}{
      \begin{tikzpicture}[at=(current page.south east)]
        \shadedraw[shading=axis,
          left color=left,
          right color=right,
          shading angle=135,
        ]
        (0,0) rectangle (\paperwidth,\paperheight);
      \end{tikzpicture}
    }
    \begin{frame}
      \textcolor{white}{\MakeUppercase{\Huge\thesection\\[.4ex]\insertsectionhead}}
    \end{frame}
  }
}


\begin{document}

\section{First section}

\begin{frame}{Title}
  Some content
\end{frame}

\begin{frame}{Title}
  Some content
\end{frame}

\section{Second section}

\begin{frame}{Title}
  Some content
\end{frame}

\begin{frame}{Title}
  Some content
\end{frame}

\end{document}
Tim Hilt
  • 848
  • 6
  • 18
  • Instead of posting code fragments, please prepare a complete minimal working example (MWE) that allows others to reproduce the output you get. – leandriis Nov 24 '19 at 13:17
  • @leandriis i hesitated because of the length the MWE would have. I edited the question now. – Tim Hilt Nov 25 '19 at 14:20
  • Reading the source code of beamerouterthemesidebar.sty, we see that the logo block is contained within a beamercolorbox environment, where \usebeamercolor[bg]{logo} is called. So, you can adjust the color of this rectangle using \setbeamercolor{logo}{bg=black}. Overall I think this is a bad assumption by the class, and unfortunately, I don't think LaTeX supports transparent colors, so I'm not sure what you can do here. – jessexknight Nov 25 '19 at 15:41
  • Can i delete the logo altogether somehow? I wouldn‘t need it anyways – Tim Hilt Nov 25 '19 at 15:44

1 Answers1

1

With the help of this thread, i tried to redefine the beamertemplate to disable the \logo-region altogether.

kpsewhich beamerouterthemesidebar.sty yielded the location to where the stylefile is stored on disk. After that one can check for the place, the logo is defined, which in this case looked like this:

\defbeamertemplate*{headline}{sidebar theme}
{%
  \begin{beamercolorbox}[wd=\paperwidth]{frametitle}
    \ifx\beamer@sidebarside\beamer@lefttext%
    \else%
      \hfill%
    \fi%
    \ifdim\beamer@sidebarwidth>0pt%
      \usebeamercolor[bg]{logo}%
      \vrule width\beamer@sidebarwidth height \beamer@headheight%
      \hskip-\beamer@sidebarwidth%
      \hbox to \beamer@sidebarwidth{\hss\vbox to
        \beamer@headheight{\vss\hbox{\color{fg}\insertlogo}\vss}\hss}%
    \else%
      \vrule width0pt height \beamer@headheight%
    \fi%
  \end{beamercolorbox}
}

Then i included

\defbeamertemplate{headline}{dummy}{}
\setbeamertemplate{headline}[dummy]

in the preamble of my document. This removed the logo throughout, which was sufficient for me.

jessexknight
  • 2,732
Tim Hilt
  • 848
  • 6
  • 18
  • Nice work. Just to confirm, this disables the use of the logo throughout (by the usual means). So not ideal, but it works. – jessexknight Nov 26 '19 at 00:53
  • Yes, i'm essentially taking away functionality. I could also include the \setbeamertemplate-command inside of the AtBeginSection-block to change it locally if i would need a logo for the regular frames. – Tim Hilt Nov 26 '19 at 07:46