2

I'm wondering why this minimal example is not doing great when there is no framesubtitle content...

\documentclass[t]{beamer}

\setbeamertemplate{frametitle}{% 
     \nointerlineskip%

\begin{beamercolorbox}[wd=\paperwidth,ht=3.75ex,left]{frametitle}% 
         \hspace*{2ex}\strut{\insertframetitle}\strut
      \ifx\insertframesubtitle\@empty%
      \else
      {%\usebeamerfont{framesubtitle}%
       \usebeamercolor[fg]{framesubtitle}%
      \strut{ - \insertframesubtitle}\strut\par}%
      \fi
  \vskip-1ex
\end{beamercolorbox}}

\begin{document}
\begin{frame}{Frame title}{frame subtitle}

\end{frame}

\begin{frame}{Frame Title}

\end{frame}

\end{document}
2

Instead of \@empty, use \empty in the conditional \ifx:

\documentclass[t]{beamer}

\setbeamertemplate{frametitle}{% 
     \nointerlineskip%

\begin{beamercolorbox}[wd=\paperwidth,ht=3.75ex,left]{frametitle}% 
         \hspace*{2ex}\strut{\insertframetitle}\strut
      \ifx\insertframesubtitle\empty%
      \else
      {%\usebeamerfont{framesubtitle}%
       \usebeamercolor[fg]{framesubtitle}%
      \strut{ - \insertframesubtitle}\strut\par}%
      \fi
  \vskip-1ex
\end{beamercolorbox}}

\begin{document}
\begin{frame}{Frame title}{frame subtitle}

\end{frame}

\begin{frame}{Frame Title}

\end{frame}

\end{document}

By the way, when using commands containing the @ character in a .tex file, you should use \makeatletter, \makeatother (in this case, however, there will be no need since your definition won't contain this character); moreover, using \@empty and adding \makeatletter, \makeatother won't produce the desired result either; I just wanted to mention that using @ in control sequence names requires the precaution of \makeatleter, \makeatother.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.