22

For a presentation using the beamer class (MiKTeX 2.8 with TeXnicCenter on Windows Vista) I need to have the italicized title of a book in a section heading. When I use \textit{...} or \emph{...} within \section{...}, my document fails to compile. The first (of 8) error messages is, in the case of \section{\textit{...}...}, Argument of \@gobble has an extra }.

If I remove the \textit{...} command from the \section{} command, then the document complies without errors.

I found an exchange about this problem in French at http://fr.narkive.com/2010/7/23/2275621-juste-par-curiosite.html, but can't seem to find the answer to the problem in the exchange. Maybe it's my poor French reading skills.

Can someone suggest a way of getting the beamer class to put/allow italics in a section heading?

Here is my TeX file:

\documentclass{beamer}
\usepackage[american]{babel}
\usepackage[latin1]{inputenc}
%\usepackage{eco}
\usepackage{ragged2e}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{wrapfig}
\usepackage{hanging}
\usepackage{booktabs}
\usepackage{ragged2e}
\usepackage{color}
\usepackage{movie15}

\usetheme{Berkeley}
\title[\textit{LTLYM}]{Title of Talk with \textit{Name of Book in Italics}}
\author[name]{my full name}
\institute{my university}
\date{October 21, 2011}


\DeclareGraphicsRule{.tif}{png}{.jpg}{.bmp}
%\usepackage{movie15}

\usepackage{url}
\usepackage[]{breakurl}
\urlstyle{same}

\begin{document}

\justifying

\begin{frame}
\titlepage
\end{frame}

\AtBeginSection[]
{
  \begin{frame}<beamer>
    \frametitle{Layout}
    \tableofcontents[currentsection,currentsubsection]
  \end{frame}
}

\section{Introduction}
\begin{frame}{Introduction}

\end{frame}

\section{Title of A Book Which Should Be in Italics (2002--2009)}

\begin{frame}{Assignments: Overview}

\begin{enumerate}
    \item Arts and crafts projects
    \item Public outreach projects
    \item Revelatory self-description
\end{enumerate}

\end{frame}

\end{document}
lockstep
  • 250,273

2 Answers2

21

This depends on the fact that beamer makes multiple passes over the argument of \section, thus defeating the LaTeX protection mechanism:

\section{\protect\textit{Title of the book}}

works.

egreg
  • 1,121,712
2

From the link you sent, the person was asking why

\section{\itshape My title}

worked but

\section{\textit{My title}}

didn't. So Basically, doing the first method will solve the problem.

tforgione
  • 123