7

Consider the following MWE:

\documentclass{beamer}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\uselanguage{Spanish}
\languagepath{Spanish}

\deftranslation[to=Spanish]{Proposition}{Proposición}
\newtheorem{proposition}[theorem]{Proposition}

\begin{document}
\begin{frame}
  \begin{proposition}
    Foo
  \end{proposition}
\end{frame}
\end{document}

This will print the Proposition environment as Proposition and I want it printed as Proposición. I know I can define the new environment as \newtheorem{proposition}[theorem]{Proposición} but I was wondering if the translation can be done automatically i.e if the language of the document is spanish and a new theorem environment is defined as \newtheorem{proposition}[theorem]{Proposition} then print the word Proposition in spanish.

  • I think you need to define something like \propositionname in the same way that babel sets up things like \bibname. That is, you need a language-sensitive macro to trigger babel's magic. – cfr Sep 18 '14 at 23:55
  • @cfr I do want to trigger babel's magic. In the article class I define a general new theorem in English and when babel switches language the theorem environment name switches accordingly. I want to achieve the same thing in beamer class – petobens Sep 19 '14 at 1:42
  • One difference maybe that beamer uses its own translation-setup. That is, it does not use babel. If you look at beamerbasemisc.sty, you can find a note to the effect that the translation stuff is 'suboptimal' and that babel should be used (but isn't). So for beamer, you might need to look at the way beamer does it. – cfr Sep 19 '14 at 1:47
6

The following likely won't work in the real world so you'll have to try it and see. However, it does at least produce the right result for the MWE.

\documentclass{beamer}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\uselanguage{Spanish}
\languagepath{Spanish}

\newtheorem{proposition}[theorem]{\translate{Proposition}}

\begin{document}
\begin{frame}
  \begin{proposition}
    Foo
  \end{proposition}
\end{frame}
\end{document}

A Spanish proposition

8

As it has been already explained, Beamer uses translator (its particular babel system). If the dictionary exists, you can active the system introducing the language name in beamer options: \documentclass[spanish]{beamer}. This way spanish is applied to beamer-translator system and babel. If spanish is passed only as babel option, you need to apply it for beamer with \uselanguage{spanish}\languagepath{spanish}.

So with an example like:

\documentclass[spanish]{beamer}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}

\newtheorem{proposition}[theorem]{Proposition}

\begin{document}
\begin{frame}
  \begin{proposition}
    Foo
  \end{proposition}

  \begin{theorem}
   Foo2
   \end{theorem}
\end{frame}
\end{document} 

you'll get

enter image description here

As you can see, theorem is translated but proposition is not. Why? Because theorem, corollary, fact, lemma, problem, solution, definition and example environments are already provided by beamer but not proposition. And how are all these environments declared? Take a look at beamerbasetheorems.sty

\newtheorem{corollary}[theorem]{\translate{Corollary}}
\newtheorem{fact}[theorem]{\translate{Fact}}
\newtheorem{lemma}[theorem]{\translate{Lemma}}
\newtheorem{problem}[theorem]{\translate{Problem}}
\newtheorem{solution}[theorem]{\translate{Solution}}

All of them make explicit use of translate command as cfr suggested in his answer. You can do the same:

\newtheorem{proposition}[theorem]{\translate{Proposition}}

There's no need for \deftranslation because propositionis already defined in translatordictionarys.

  • Thanks for such a detailed explanation! I apologize for accepting the other answers but I only did that because he answered first. – petobens Sep 19 '14 at 18:08
  • @Ignasi. Usefull answer. However, it is nice for beamer, but it doesn't work in article class. How you can add to the dictionary the word Propiedad, where \deftranslation dosen't work? – Dog_69 Mar 17 '17 at 0:11
  • 1
    @Ignasi. Don't worry for my previous comment. The solution to my problem is use the translator package. It seems beameruses it automatically. – Dog_69 Mar 17 '17 at 0:31
  • Please fix the following: the correct spelling is beamerbasetheorems.sty . – evaristegd Jun 6 '19 at 0:54

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.