[Tex/LaTex] babel, beamer problem: refuse name change to part

babelbeamer

I wanted to change the name in my beamer slide from Part to Theme.

So in the Google BOK if found:

\renewcommand*{\partname}{Theme}

I could not get to work. Then I start to switch off (%) everything that I added and found that:

\usepackage[english]{babel}

is the holder of the key.

An MWE:

\documentclass[compress,infolines,smaller]{beamer}

%\usepackage[english]{babel}
\useinnertheme[shadow=true]{rounded}
\usecolortheme{beaver}

\renewcommand*{\partname}{Theme}


\begin{document}

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

\part{Title}
\begin{frame}<beamer>
\partpage
\end{frame}
\section{test1}
\begin{frame}
Test
\end{frame}

\end{document}

Is there a way to get passed this?

Best Answer

This has obviously to do with how babel manages the "fixed tags" such as \partname.

It stores them in a macro called \captions<language> (in this case \captionsenglish) that is executed as part of

\selectlanguage{<language>}

or

\begin{otherlanguage}{<language>}

The \selectlanguage command for the main language of the document is issued together \begin{document}. Thus your \renewcommand does nothing, because it's overridden by what's done by \selectlanguage{english}.

babel has a provision for this:

\addto\captionsenglish{\renewcommand{\partname}{Theme}}

is what you're looking for.


Also \AtBeginDocument{\renewcommand{\partname}{Theme}} would work unless you load babel with more than one language and issue some \selectlanguage command in the document. To make an example:

\documentclass{article}
\usepackage[italian,english]{babel}
\AtBeginDocument{\renewcommand{\partname}{Theme}

\begin{document}
\part{X}
Something in English.

\selectlanguage{italian}
Parole in italiano.

\selectlanguage{english}
\part{Y}
End in English.

\end{document}

would result in

Theme I

Something in English.

Parole in italiano

Part II

End in English.

This wouldn't happen with the \addto\captionsenglish approach.

Related Question