TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to implement a personnal class using key-value options (I am a beginner in that field). For exemple, I would like to specify the language (for babel package) with an option "langue=xxx" with "francais" as default value. I tried the kvoptions package as follows :

Class file : (I give you the whole list of packages in case you detect a conflict)

\ProvidesClass{mepp}[2014/03/08 Personnal class development version]




\RequirePackage[paper=a4paper, lmargin=15mm, rmargin=15mm, tmargin=15mm, bmargin=15mm,
                    includeall, marginparwidth=44mm, headheight=\baselineskip]{geometry}

\RequirePackage{array, multirow, tabularx}
\RequirePackage{xcolor, color, colortbl}
\RequirePackage{amssymb, mathrsfs, stmaryrd, gensymb}
\RequirePackage{graphicx, picins}
\RequirePackage{fancyhdr, lastpage}
\RequirePackage{titlesec, titletoc}



Tex file :


but compilation fails : compiler says there is no language specified for babel. If I do not specify any option or if I give a "wrong" option without "=" symbol, compilation works, because it assigns the default value to "langue".

So, why is the option "langue=francais" not recognized ? Thanks for your help.

(sorry for language, I am French)

share|improve this question
Welcome to TeX.SX! You have \PassOptionsToPackage{\mepp@langue}{babel} after \RequirePackage{babel} which is a possible source of your problem. Try \RequirePackage{\mepp@langue}{babel} instead. – egreg Mar 30 '14 at 9:41
up vote 5 down vote accepted

You're loading babel before \PassOptionsToPackage{\mepp@langue}{babel} so the option is not evaluated; just use


If you want to load babel only if the langue option is specified, you can do


and then


so if the langue=... option is not specified, babel won't be loaded.

share|improve this answer
Thank you, it works ! But I do not understand : if I do not specify the option "langue", \mepp@langue takes the defaut value "francais" and option is correctly evaluated although babel is loaded before the command \PassOptionToPackage... Why ? – Emmanuel G. Mar 30 '14 at 11:51
@EmmanuelG. With the syntax you use, \mepp@langue is initialized to francais. – egreg Mar 30 '14 at 12:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.