Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

So here is a MWE that illustrates the problem.

\documentclass{beamer}
\defbeamertemplate{frametitle}{weird}{%
  \insertframetitle\par%
  \rule{\textwidth}{4pt}%
  \flushright%
  \insertframesubtitle\par%
}
\setbeamertemplate{frametitle}[weird]
\begin{document}
\begin{frame}
\frametitle{Here is the title}
%\framesubtitle{Here is the subtitle}
Here is the text
\pause
Here is more text
\end{frame}
\end{document}

This code fails with a:

! LaTeX Error: Something's wrong--perhaps a missing \item.

Commenting out the \pause or \flushright or uncommenting the \framesubtitle allows it to compile. [Commenting out the \pause leads to a spurious empty page at the end.]

So my guess is that this is a "wrong mode" problem when the subtitle is empty. But I don't know enough to fix it. Any clues? Or any hints on what to try in order to fix it?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

where is the sense to use the two macros instead of using the arguments of frame? This works:

\begin{frame}{Here is the title}{Here is the subtitle}


you should also check for an existing subtitle:

\documentclass{beamer}
\makeatletter
\defbeamertemplate{frametitle}{weird}{%
  \insertframetitle\par%
  \rule{\textwidth}{4pt}%
  \ifx\insertframesubtitle\@empty\else
  \flushright%
  \insertframesubtitle\par\fi}
\makeatother
\setbeamertemplate{frametitle}[weird]
\begin{document}
\begin{frame}{Here is the title}{}
Here is the text
\pause
Here is more text
\end{frame}
\end{document}
share|improve this answer
    
\begin{frame}{Title}{} breaks. –  Seamus Oct 11 '11 at 11:51
    
So does \begin{frame}{Title} (i.e. just the one extra argument. As for why use these macros? I read somewhere they are more robust, and I think they're more semantic. [Also, emacs does them automatically...] –  Seamus Oct 11 '11 at 11:53
    
see edit for handling a missing subtitle –  Herbert Oct 11 '11 at 11:58
    
Thanks! So it is a problem with TeX not liking to \flushright an empty paragraph, right? Why is this? –  Seamus Oct 11 '11 at 12:25
1  
I suppose a problem with horizontal and vertical mode, but I am not really sure. The code of beamer is not really user friendly ... –  Herbert Nov 2 '11 at 16:41
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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