I am preparing a homework for my students with LaTeX, so I used \usepackage{exercise}. In the .pdf file I got "exercise" and I want it to be in French (exercice) not English.

I put \usepackage[french]{babel} but nothing changed.

Here is my code:






On exercise documentation (§5.2), you can see how the text "constants" (e.g. List of exercises, Exercise, Answer of exercise, ...) are defined. It is done through following macros, respectively:

\def\listexercisename{List of exercises}%
\def\AnswerName{Answer of exercise}%

Thus, you can use following macro to adapt them according to your needs:


However, for some languages (spanish, italian, dutch... and french), Paul Pichaureau (creator of this package) already did this work. This should be done automatically when you load a language in babel; but how?
You can see (in the same paragraph), that exercise recognise the language loaded via this command: \@ifpackageloaded{babel}{\addto{\captions<LANGUAGE>}{....

In the case of french language, the command is: \addto{\captionsfrenchb}{, thus you should load the frenchb option (and not french) of babel-package to make exercise automatically translate macros in french. → if this works for most languages (at least spanish, dutch, and italian), it now doesn't seem to work with neither french, nor frenchb.

TL;DR: To translate the names in french, you have two one solutions:

  • translate each of them manually via \renewcommand{\ExerciseName}{Nouveau nom de mes exercices}-like commands.
  • load the frenchb option in babel (and not the french one): already implemented translations will be automatically used;

Edit: With most recent (i.e. post TeXlive 2012) LaTeX distro, neither frenchb nor french options in babel seem to work with automated translation of exercice package (cf. Exercise package with Babel). You should then copy-paste these lines into your .tex files to emulate the translation:

\renewcommand\listexercisename{Liste des exercices}%
\renewcommand\AnswerName{Solution de l'exercice}%
  • Did you test it? – Bernard Nov 9 '16 at 10:38
  • @Bernard good catch: I actually tried it... but with another language than french(b). my bad! See similar issue on Exercise package with Babel. – ebosi Nov 9 '16 at 10:52
  • \renewcommand{\ExerciseName}{Exercice} works fine with me ... thanks! – bttX Nov 9 '16 at 11:00

The simplest perhaps: line 74 of exercise.sty, replace addto{\captionsfrenchb} with addto{\captionsfrench}.

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.