6

I want to change the title question in English to other language. How to do that? You can choose any other language in your answer.

\documentclass{article}
\usepackage{exsheets}

\begin{document}
\begin{question}
What is your name?
\end{question}
\end{document}

Bonus question: I still don't understand why the default language (English) uses "Exercise" rather than "Question" for the question title? Intuitively, question environment should be titled "Question", solution environment should be titled Solution. What do you think?

Mico
  • 506,678

1 Answers1

9

Load babel and use the desired localization (whether as a global option for the class or as local option for babel (in this case load exsheets after babel)):

\documentclass[spanish]{article}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{exsheets}

\begin{document}
\begin{question}
¿Cómo te llamas?
\end{question}
\end{document}

enter image description here

In a multi-lingual document you can use, for example. \selectlanguage, (after registering the languages tobabel) or the environmentotherlanguage` for switching languages:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman,english,spanish]{babel}
\usepackage{exsheets}

\begin{document}
\begin{question}
¿Cómo te llamas?
\end{question}

\selectlanguage{ngerman}
\begin{question}
Wie heissen Sie?
\end{question}

\selectlanguage{english}
\begin{question}
What is your name?
\end{question}

\end{document}

enter image description here

If you want to change the string used in the localization, you can use

\DeclareTranslation{<Language>}{exsheets-exercise-name}{<New string>}

For example, when using the spanish modulo for babel, to change the default "Ejercicio" to "Cuestión", one would use

\DeclareTranslation{Spanish}{exsheets-exercise-name}{Cuestión}

A complete example:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{exsheets}

\DeclareTranslation{Spanish}{exsheets-exercise-name}{Cuestión}

\begin{document}
\begin{question}
¿Cómo te llamas?
\end{question}
\end{document}

enter image description here

A similar procedure can be applied with polyglossia (in case of XeLaTeX).

The documentation also gives advise on how to proceed if the desired localization is not available and offers an example for Danish:

\DeclareTranslation{Danish}{exsheets-exercise-name}
{\O{}velse}
\DeclareTranslation{Danish}{exsheets-question-name}
{Opgave}
\DeclareTranslation{Danish}{exsheets-solution-name}
{Opl\o{}sning}

To answer the bonus question, the question environment has an associated type which determines the string used in the title; in English, the default type is exercise, which causes the question environment to be titled "Exercise"; if you want the title to be "Question", you have to use the exam type:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{exsheets}


\begin{document}
\begin{question}
What is your name?
\end{question}

\begin{question}[type=exam]
What is your name?
\end{question}
\end{document}

enter image description here

Gonzalo Medina
  • 505,128
  • 1
    @PSTikZ the author recommends, for these cases, the option I mentioned at the end using \DeclareTranslation. – Gonzalo Medina Sep 11 '13 at 01:15
  • I couldn't have given a better answer... :) – cgnieder Sep 11 '13 at 06:57
  • 1
    BTW there's always the last resort to set \begin{question}[name=Whatever] or \SetupExSheets{question/name=Whatever}. – cgnieder Sep 11 '13 at 07:09
  • For greek it's the same methode? – Y_gr Sep 11 '13 at 13:58
  • @giannis Sure! But it depends on your settings for the Greek language. Something like `\documentclass{article} \usepackage[utf8]{inputenc} \usepackage[greek]{babel} \usepackage{exsheets}

    \DeclareTranslation{Greek}{exsheets-exercise-name}{φύσις}

    \begin{document}

    \begin{question} \end{question}

    \end{document}` (soory, but I don't know the Greek word for "Exercise") should work. If this is not waht you want, please feel free to open a follow-up question.

    – Gonzalo Medina Sep 11 '13 at 14:45