21

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}
20

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.

  • 1
    That did the trick! Thank you for your help. – Daniel Balestrini Oct 16 '11 at 12:48
  • This works for \protect\linebreak[n] also. The \protect must be put right before the command in question. – Yan King Yin May 5 at 7:18
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.

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.