A Babel language definition file for French

Daniel Flipo

                    Daniel.Flipo@univ-lille1.fr

1 The French Language

1.1 About French typography

The file frenchb.dtx^{1}, derived from frenchy.sty, defines all the language definition macros for the French language. Customization for the French language is achieved following the book “Lexique des règles typographiques en usage à l’Imprimerie nationale” troisième édition (1994), ISBN-2-11-081075-0. This file has been designed to be used with L^{A}TEX 2ε, L^{A}TEX-2.09 and PlainTEX formats. If you are still using L^{A}TEX-2.09, you should consider switching to L^{A}TEX 2ε!

Any of the commands \selectlanguage{french}, \selectlanguage{francais},

or \selectlanguage{frenchb} switches to the French language with the following effects:

1. French hyphenation patterns are made active;

2. ‘double punctuation’ is made active for correct spacing in French;

3. \today prints the date in French;

4. the caption names are translated into French (L^{A}TEX only);

5. the default items in itemize environment are set to ‘–’ instead of •, and no vertical spacing and no glue is added, a hook to reset standard L^{A}TEX spacing

     is provided (\FrenchItemizeSpacingfalse);

6. vertical spacing in general L^{A}TEX lists is shortened, a hook to reset standard L^{A}TEX settings is provided (\FrenchListSpacingfalse) ;

7. the first paragraph of each section is indented (L^{A}TEX only);

8. French quotation marks can be typeset using the commands \og and \fg which work in L^{A}TEX 2ε, L^{A}TEX-2.09 and PlainTEX, their appearance depending on what is available to draw them; if you use L^{A}TEX 2ε with T1-encoding you can also enter them as <<~French quotation marks~>> but then don’t forget the unbreakable spaces, (\og and \fg provide for correct line breaks);

9. a command \up is provided to typeset superscripts like M\up{me} (abbreviation for “Madame”), 1\up{er} (for “premier”); 10. family names should be typeset in small capitals and never be hyphenated,

1The file described in this section has version number v1.3d and was last revised on 1998/07/04.

the macro \bsc (boxed small caps) does this, e.g., Leslie~\bsc{Lamport} will produce Leslie Lamport;

11. commands \primo, \secundo, \tertio and \quarto may be used to enumerate in lists;

12. abbreviations for “Numéro” and “numéro” are obtained via the commands

\No, \no;

13. two commands are provided to typeset abbreviations for “degré”: \degre prints the raw character and \degres should be used to typeset temperatures (e.g., “20~\degres C” with an unbreakable space), or for alcohols’ strengths (e.g., “45\degres” with no space in French);

14. an command \nombre is provided to ease the typesetting of numbers: it works both in text and in math-mode: inputting \nombre{3141,592653} will format this number properly according to the current language (French or non-French) ^{2}. The command \nombre is a contribution of Vincent Jalby using ideas of David Carlisle in comma.sty.

15. frenchb has been designed to take advantage of the xspace package if present: adding \usepackage{xspace} in the preamble will force macros like \fg, \ier, …, \ieme to respect the spaces you type after them, for instance typing ‘1\ier juin’ will print ‘1^{er} juin’ (no need for a forced space after 1\ier).

All commands previously available in francais.ldf have been included in frenchb.ldf for compatibility, sometimes with updated definitions. The french package, by Bernard Gaulle, was not designed to run with babel (although the latest versions claim to be babel compatible), but rather as a standalone package for the French language. It provides many more functionalities (like \lettrine, \sommaire…) not available in frenchb, at the cost of a much greater complexity and possible incompatibilities with other languages. As french is known to produce the best layout available for French typography, I have borrowed many ideas from Bernard’s file. I did my best to help users of both packages (french and frenchb) to exchange their sources files easily, with one exception which affects the way French quotation marks are entered: frenchb uses macros (\og and \fg) while french uses active characters (<< and >>).

French typographic rules specify that some white space should be present before ‘double punctuation’ characters. These characters are ; ! ? and :. In order to get this white space automatically, the category code of these characters is made \active. In French, the user should input these four characters preceded with a space, but as many people forget about it (even among native French writers!), the default behaviour of frenchb is to automatically add a \thinspace before ‘;’ ‘!’ ‘?’ and a normal (unbreakable) space before ‘:’ (this is the rule in French typography). It’s up to the user to add or not a space after ‘double punctuation’ characters: usually a space is necessary, but not always (before a full point or a closing brace for instance), so this cannot done automatically. In (rare) cases where no space should be added before a ‘double punctua-

2In math-mode the comma has to be surrounded with braces to avoid a spurious space being inserted after it (see the TEXbook p. 134). Besides this, each slice of three digits should be separated either with a comma in English or with a space in French.

tion’, either use \string; \string: \string! \string? instead of ; : ! ?,

or switch locally to english. For instance you can type C\string:TEX or

\begin{otherlanguage}{english}{C:TEX}\end{otherlanguage} to avoid the

space before : in a MS-DOS path. Some users dislike this automatic insertion of a space before ‘double punctuation’, and prefer to decide themselves whether a space should be added or not; so a hook \NoAutoSpaceBeforeFDP is provided: if this command is added (in file frenchb.cfg, or anywhere in a document) frenchb will respect your typing, and introduce a suitable space before ‘double punctuation’ if and only if a space is typed in the source file before those signs. The command \AutoSpaceBeforeFDP switches back to the default behaviour of

frenchb.

Once you have built your format, a good precaution would be to perform some basic tests about hyphenation in French. For L^{A}TEX 2ε I suggest this:

• run the following file, with the encoding suitable for your machine (myencoding will be latin1 for unix machines and PCs running Windows, applemac for Macintoshs, or cp850 for PCs running DOS. If you are using MlTEX together with CM fonts, comment out the line

     \usepackage[my-encoding]{inputenc}.
     %%% Test file for French hyphenation.
     \documentclass{article}
     \usepackage[my-encoding]{inputenc}
     \usepackage[francais]{babel}
     \begin{document}
     \showhyphens{signal container \'ev\'enement alg\`ebre}
     \showhyphens{signal container événement algèbre}
     \end{document}

• check the hyphenations proposed by TEX in your log-file; in French you should get with both 7-bit and 8-bit encodings

     si-gnal contai-ner évé-ne-ment al-gèbre.

Do not care about how accented characters are displayed in the log-file, what matters is the position of the ‘-’ hyphen signs only.

If they are all correct, your installation (probably) works fine, if one (or more) is (are) wrong, ask a local wizard to see what’s going wrong and perform the test again (or e-mail me about what happens). Frequent mismatches:

• you get sig-nal con-tainer, this probably means that the hyphenation patterns you are using are for US-english, not for French;

• you get no hyphen at all in évé-ne-ment, this probably means that you are using CM fonts and the macro \accent to produce accented characters. Consider switching to DC/EC fonts and T1-encoding or use MlTEX.

frenchb has been improved using helpful suggestions from many people, the main contributions came from Vincent Jalby. Thanks to all of them!

First version released: 1.1 as of 1996/05/31 part of babel-3.6beta. Changes in version 1.1b: update for babel-3.6. Changes in version 1.2: new command \nombre to format numbers; removed command \fup borrowed from the french package (\up does a better job in L^{A}TEX 2ε); also removed aliases \french and \english (frenchb.cfg is a better place for these). Changes in version 1.3:

• The ‘xspace’ extension, when present, now controls spacing after all (sensible) macros, formerly ‘xspace’ worked on \fg (suggested by Vincent Jalby);

• spacing after opening and before closing guillemets improved as suggested by Thierry Bouche;

• environment ’itemize’ has been redesigned in French according to specifications from Jacques André and Thierry Bouche;

• two switches have been added to go back to standard L^{A}TEX list spacing

     \FrenchItemizeSpacingfalse and \FrenchListSpacingfalse;

• \nombre now properly handles signs in L^{A}TEX 2ε;

• definition of \dots changed in French;

• in French, captions in figures and tables are printed with an endash instead of a colon.

1.2 TEXnical details

The macro \LdfInit takes care of preventing that this file is loaded more than once, checking the category code of the @ sign, etc.

1 ⟨∗code⟩

 2 %% Please report errors to: Daniel Flipo, GUTenberg
 3 %%                          Daniel.Flipo@univ-lille1.fr
 4 %%
 5 \LdfInit{frenchb}\NoAutoSpaceBeforeFDP

Check if hyphenation patterns for the French language have been loaded in language.dat: requested name ‘french’ or ‘francais’.

 6 \ifx\l@french\@undefined
 7 \ifx\l@francais\@undefined
 8  \@nopatterns{French}
 9  \adddialect\l@french0
10 \fi
11 \fi

Regardless of \CurrentOption the internal name for the French language will be ‘frenchb’; ‘francais’ and ‘french’ will be synonymous for ‘frenchb’: first let both names use the same hyphenation patterns. Later we will have to set aliases for

\captionsfrenchb, \datefrenchb, \extrasfrenchb and \noextrasfrenchb. As

French uses the standard values of \lefthyphenmin (2) and \righthyphenmin (3), no special setting is required here.

12 \def\CurrentOption{frenchb}
13 \ifx\l@francais\@undefined
14 \let\l@francais\l@french
15 \else
16 \let\l@french\l@francais
17 \fi
18 \let\l@frenchb\l@french

To check the format in use (plain or LaTeX), we’ll need macros to hold the names of the plain and L^{A}TEX 2ε formats.

19 \def\PlainFmtName{plain}
20 \def\LaTeXeFmtName{LaTeX2e}

\if@Two@E We will need a new ‘if’ : \if@Two@E is true if and only if L^{A}TEX 2ε is running not in compatibility mode. It is used in the definitions of the command \nombre and \up. The definition is somewhat complicated, due to the fact that \if@compatibility is not recognized as a \if in L^{A}TEX-2.09 based formats.

21 \newif\if@Two@E \@Two@Etrue
22 \def\@FI@{\fi}
23 \ifx\@compatibilitytrue\@undefined
24 \@Two@Efalse \def\@FI@{\relax}
25 \else
26 \if@compatibility \@Two@Efalse \fi
27 \@FI@

\extrasfrenchb \noextrasfrenchb The macro \extrasfrenchb will perform all the extra definitions needed for the French language. The macro \noextrasfrenchb is used to cancel the actions of

\extrasfrenchb.

In French “apostrophe” is used in hyphenation in expressions like l'ambulance (French patterns provide entries for this kind of words). This means that the \lccode of “apostrophe” has to be non null in French for proper hyphenation of those expressions, and to be reset to null when exiting French.

28 \@namedef{extras\CurrentOption}{\lccode`\'=`\'}

29 \@namedef{noextras\CurrentOption}{\lccode`\'=0}
30 \def\extrasfrancais{\extrasfrenchb}
31 \def\extrasfrench{\extrasfrenchb}
32 \def\noextrasfrancais{\noextrasfrenchb}
33 \def\noextrasfrench{\noextrasfrenchb}

It is best to use L^{A}TEX 2ε’s font changing commands, and to emulated those we need when they are not available, as in PlainTEX or L^{A}TEX-2.09. Be aware that old commands \sc, \it, etc. exist in L^{A}TEX 2ε, but they behave like they did in L^{A}TEX-2.09 (i. e., they switch back to \normalfont instead of keeping the other font attributes unchanged).

34 \ifx\scshape\@undefined
35 \ifx\sc\@undefined
36  \let\scshape\relax
37 \else
38  \let\scshape\sc
39 \fi
40 \fi
41 \ifx\emph\@undefined
42 \ifx\em\@undefined
43  \let\emph\relax
44 \else
45  \def\emph#1{\em #1}
46 \fi
47 \fi

1.3 Caption names

The next step consists of defining the French equivalents for the L^{A}TEX caption names. In French, captions in figures and tables should be printed with an endash instead of the standard ‘:’, so we add a hook called \CaptionSeparator to the definition of \@makecaption (this definition set in classes.dtx is frozen for L^{A}TEX 2ε according to Frank Mittelbach).

48 \def\CaptionSeparator{\string:\space}
49 \long\def\@makecaption#1#2{%
50 \vskip\abovecaptionskip
51 \sbox\@tempboxa{#1\CaptionSeparator #2}%
52 \ifdim \wd\@tempboxa >\hsize
53  #1\CaptionSeparator #2\par
54 \else
55  \global \@minipagefalse
56  \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
57 \fi
58 \vskip\belowcaptionskip}
59 \expandafter\addto\csname noextras\CurrentOption\endcsname{%
60 \def\CaptionSeparator{\string:\space}}

\captionsfrenchb The macro \captionsfrenchb defines all strings used in the four standard document classes provided with L^{A}TEX. Some authors do not like some of these names; it is easy to change them in the preamble after loading frenchb (or in your file

frenchb.cfg), e.g \addto\captionsfrenchb{\def\figurename{Figure}} will

print ‘Figure’ in Roman instead of ‘Fig.’. added \CaptionSeparator

61 \ifx\fmtname\PlainFmtName
62 \else
63 \@namedef{captions\CurrentOption}{%
64 \def\refname{R\'ef\'erences}%
65 \def\abstractname{R\'esum\'e}%
66 \def\bibname{Bibliographie}%
67 \def\prefacename{Pr\'eface}%
68 \def\chaptername{Chapitre}%
69 \def\appendixname{Annexe}%
70 \def\contentsname{Table des mati\`eres}%
71 \def\listfigurename{Table des figures}%
72 \def\listtablename{Liste des tableaux}%
73 \def\indexname{Index}%
74 \def\figurename{{\scshape Fig.}}%
75 \def\tablename{{\scshape Tab.}}%
76 \def\CaptionSeparator{\space--\space}%

“Première partie” instead of “Part I”

77 \def\partname{\protect\@Fpt partie}%
78 \def\@Fpt{{\ifcase\value{part}\or Premi\`ere\or Deuxi\`eme\or
79 Troisi\`eme\or Quatri\`eme\or Cinqui\`eme\or Sixi\`eme\or
80 Septi\`eme\or Huiti\`eme\or Neuvi\`eme\or Dixi\`eme\or Onzi\`eme\or
81 Douzi\`eme\or Treizi\`eme\or Quatorzi\`eme\or Quinzi\`eme\or
82 Seizi\`eme\or Dix-septi\`eme\or Dix-huiti\`eme\or Dix-neuvi\`eme\or
83 Vingti\`eme\fi}\space\def\thepart{}}%
84 \def\pagename{page}%
85 \def\seename{{\emph{voir}}}%
86 \def\alsoname{{\emph{voir aussi}}}%
87 \def\enclname{P.~J. }%
88 \def\ccname{Copie \`a }%
89 \def\headtoname{}%
90 \def\proofname{D\'emonstration}% for AMS-\LaTeX

91 }

92 \def\captionsfrench{\captionsfrenchb}
93 \def\captionsfrancais{\captionsfrenchb}
94 \fi

1.4 Punctuation

The ‘double punctuation’ characters (; ! ? and :) have to be made \active for an automatic control of the amount of space to insert before them.

95 \initiate@active@char{:}
96 \initiate@active@char{;}
97 \initiate@active@char{!}

 98 \initiate@active@char{?}

We specify that the French group of shorthands should be used.

 99 \expandafter\addto\csname extras\CurrentOption\endcsname{%
100 \languageshorthands{frenchb}}

These characters are ‘turned on’ once, later their definition may vary.

101 \expandafter\addto\csname extras\CurrentOption\endcsname{%
102 \bbl@activate{:}\bbl@activate{;}%
103 \bbl@activate{!}\bbl@activate{?}}
104 \expandafter\addto\csname noextras\CurrentOption\endcsname{%
105 \bbl@deactivate{:}\bbl@deactivate{;}%
106 \bbl@deactivate{!}\bbl@deactivate{?}}

One more thing \extrasfrenchb needs to do is to make sure that \frenchspacing is in effect. If this is not the case the execution of \noextrasfrenchb will switch it off again.

107 \expandafter\addto\csname extras\CurrentOption\endcsname{%
108 \bbl@frenchspacing}
109 \expandafter\addto\csname noextras\CurrentOption\endcsname{%
110 \bbl@nonfrenchspacing}

\frenchb@sh@;@ We have to tune the amount of white space before ; ! ? and :. This should only happen in horizontal mode, hence the test \ifhmode. In horizontal mode, if a space has been typed before ‘;’ we remove it and put an unbreakable \thinspace instead. If no space has been typed, we add \FDP@thinspace which will be defined, up to the user’s wishes, as an automatic added thin space, or as \@empty.

111 \declare@shorthand{frenchb}{;}{%
112  \ifhmode
113  \ifdim\lastskip>\z@
114  \unskip\penalty\@M\thinspace
115  \else
116  \FDP@thinspace
117  \fi
118  \fi

Now we can insert a ; character.

119  \string;}

\frenchb@sh@!@ \frenchb@sh@?@ Because these definitions are very similar only one is displayed in a way that the definition can be easily checked.

120 \declare@shorthand{frenchb}{!}{%
121  \ifhmode
122  \ifdim\lastskip>\z@
123  \unskip\penalty\@M\thinspace
124  \else
125  \FDP@thinspace
126  \fi
127  \fi
128  \string!}

129 \declare@shorthand{frenchb}{?}{%
130  \ifhmode
131  \ifdim\lastskip>\z@
132  \unskip\penalty\@M\thinspace
133  \else
134  \FDP@thinspace
135  \fi
136  \fi
137  \string?}

\frenchb@sh@:@ The ‘:’ requires a normal space before it, instead of a \thinspace.

138 \declare@shorthand{frenchb}{:}{%
139  \ifhmode
140  \ifdim\lastskip>\z@
141  \unskip\penalty\@M\
142  \else
143  \FDP@space
144  \fi
145  \fi
146  \string:}
\AutoSpaceBeforeFDP \NoAutoSpaceBeforeFDP  \FDP@thinspace and \FDP@space are defined as unbreakable spaces by
\AutoSpaceBeforeFDP or as \@empty by \NoAutoSpaceBeforeFDP.
Default is \AutoSpaceBeforeFDP.
147 \def\AutoSpaceBeforeFDP{%
148  \def\FDP@thinspace{\penalty\@M\thinspace}%
149  \def\FDP@space{\penalty\@M\ }}
150 \def\NoAutoSpaceBeforeFDP{\let\FDP@thinspace\@empty
151  \let\FDP@space\@empty}
152 \AutoSpaceBeforeFDP

\system@sh@:@ \system@sh@!@ \system@sh@?@ \system@sh@;@ When the active characters appear in an environment where their French behaviour is not wanted they should give an ‘expected’ result. Therefore we define shorthands at system level as well.

153 \declare@shorthand{system}{:}{\string:}
154 \declare@shorthand{system}{!}{\string!}
155 \declare@shorthand{system}{?}{\string?}
156 \declare@shorthand{system}{;}{\string;}

1.5 French quotation marks

Several shapes of French quotation marks are provided for use with CM or EC/DC fonts, or PostScript fonts. CM fonts have no quotation marks built-in, so we have to emulate them using math symbols, either L^{A}TEX’s ‘lasy’ font if available, or TEX symbols \ll and \gg otherwise. EC/DC fonts and PostScript fonts have built-in quotation marks. The standard names for French quotation marks are \guillemotleft and \guillemotright, these commands are defined in t1enc.def for T1-encoding.

In L^{A}TEX 2ε formats, we first define these commands for OT1-encoding (for CM fonts), using L^{A}TEX’s ‘lasy’ font. Other local text encodings should define them too, but if they don’t, the OT1 definitions will be used. PostScript fonts should not be used together with OT1-encoding, in order to take advantage of the built-in (better looking) French quotation marks. The next step is to provide correct spacing after \guillemotleft and before \guillemotright : a space precedes and follows quotation marks but no line break is allowed neither after the opening one, nor before the closing one. \guill@spacing which does the spacing, has been fine tuned by Thierry Bouche. The top macros for quotation marks will be called \og (“\underline{o}uvrez \underline{g}uillemets”) and \fg (“\underline{f}ermez \underline{g}uillemets”). The top level definitions for French quotation marks are switched on and off through the \extrasfrenchb \noextrasfrenchb mechanism. Outside French, \og and \fg will typeset standard English opening and closing double quotes.

As \DeclareTextCommand cannot be used after the \begin{document} we intro-

duce internal definitions \begin@guill and \end@guill. We’ll try to be smart to users of D. Carlisle’s xspace package: if this package is loaded there will be no need for {} or \ to get a space after \fg.

\guillemotleft \guillemotright \og \fg \bbl@frenchguillemets \bbl@nonfrenchguillemets In L^{A}TEX 2ε we provide a dummy definition for \og and \fg, just to display an

error message in case \og or \fg have been defined elsewhere.

157 \ifx\fmtname\LaTeXeFmtName
158 \DeclareTextCommand{\guillemotleft}{OT1}{\hbox{%
159  \fontencoding{U}\fontfamily{lasy}\selectfont
160  (\kern-0.20em(}}
161 \DeclareTextCommand{\guillemotright}{OT1}{\hbox{%
162  \fontencoding{U}\fontfamily{lasy}\selectfont
163  )\kern-0.20em)}}
164 \DeclareTextSymbolDefault{\guillemotleft}{OT1}
165 \DeclareTextSymbolDefault{\guillemotright}{OT1}
166 \def\guill@spacing{\penalty\@M\hskip.8\fontdimen2\font
167  plus.3\fontdimen3\font
168  minus.8\fontdimen4\font}
169 \newcommand{\og}{\@empty}
170 \newcommand{\fg}{\@empty}
171 \DeclareRobustCommand*{\begin@guill}{\leavevmode
172  \guillemotleft\penalty\@M\guill@spacing}
173 \DeclareRobustCommand*{\end@guill}{\ifdim\lastskip>\z@\unskip\fi
174  \penalty\@M\guill@spacing\guillemotright\xspace}
175 \AtBeginDocument{\ifx\xspace\@undefined\let\xspace\relax\fi}

For PlainTEX, and L^{A}TEX-2.09 we define \begin@guill and \end@guill using math symbols \ll and \gg.

176 \else
177 \def\begin@guill{\leavevmode\raise0.25ex%
178  \hbox{$\scriptscriptstyle\ll$}%
179  \penalty\@M\hskip.8\fontdimen2\font
180  plus.3\fontdimen3\font

181  minus.3\fontdimen4\font}
182 \def\end@guill{\ifdim\lastskip>\z@\unskip\penalty\@M\fi
183  \penalty\@M\hskip.8\fontdimen2\font
184  plus.3\fontdimen3\font minus.3\fontdimen4\font
185  \raise0.25ex\hbox{$\scriptscriptstyle\gg$}}
186 \let\xspace\relax
187 \fi
188 \def\bbl@frenchguillemets{\let\og\begin@guill
189  \let\fg\end@guill}
190 \def\bbl@nonfrenchguillemets{\def\og{``}%
191  \def\fg{\ifdim\lastskip>\z@\unskip\fi ''}}
192 \expandafter\addto\csname extras\CurrentOption\endcsname{%
193 \bbl@frenchguillemets}
194 \expandafter\addto\csname noextras\CurrentOption\endcsname{%
195 \bbl@nonfrenchguillemets}

1.6 French lists

\bbl@frenchlistspacing \bbl@nonfrenchlistspacing Vertical spacing in general lists should be shorter in French texts than the defaults provided by L^{A}TEX. Note that the easy way, just changing values of vertical spacing parameters when entering French and restoring them to their defaults on exit would not work. We will redefine \@trivlist as \list and trivlist rely on \@trivlist, so that all lists have common settings. If standard LaTeX settings are prefered, it is easy to issue the command \FrenchListSpacingfalse in the preamble or in frenchb.cfg. Please note that changing the flag \FrenchListSpacing will not take effect immediately, but next time language French is switched on. The amount of vertical space before and after a list is given by \topsep + \parskip (+ \partopsep if the list starts a new paragraph). IMHO, \parskip should be added only when the list starts a new paragraph, so I subtract \parskip from \topsep and add it back to \partopsep; this will normally make no difference because \parskip’s default value is 0pt, but will be noticeable when \parskip is not null. Of course, this code is only for L^{A}TEX.

196 \newif\ifFrenchListSpacing \FrenchListSpacingtrue
197 \ifx\fmtname\PlainFmtName
198 \else
199 \let\@trivlistORI\@trivlist
200 \def\bbl@frenchlistspacing{%
201  \ifFrenchListSpacing
202  \def\@trivlist{%
203  \setlength{\itemsep}{0.4ex plus 0.2ex minus 0.2ex}%
204  \setlength{\parsep}{0.4ex plus 0.2ex minus 0.2ex}%
205  \setlength{\topsep}{0.8ex plus 0.4ex minus 0.4ex}%
206  \setlength{\partopsep}{0.4ex plus 0.2ex minus 0.2ex}%
207  \addtolength{\topsep}{-\parskip}%
208  \addtolength{\partopsep}{\parskip}%
209  \@trivlistORI}%
210  \fi}

211 \def\bbl@nonfrenchlistspacing{\let\@trivlist\@trivlistORI}
212 \expandafter\addto\csname extras\CurrentOption\endcsname{%
213  \bbl@frenchlistspacing}
214 \expandafter\addto\csname noextras\CurrentOption\endcsname{%
215  \bbl@nonfrenchlistspacing}
216 \fi

\bbl@frenchitemize \bbl@nonfrenchitemize The layout of French itemize-lists has changed between version 1.2 and 1.3. Jacques André and Thierry Bouche pointed out to me that vertical spacing between items, before and after the list, should null with no glue added. Moreover horizontal spacing was not correct either: the item labels of a first level list should be vertically aligned on the paragraph’s first character (at \parindent from the left margin). Checking the book “Lexique des règles typographiques en usage à l’Imprimerie nationale” confirmed their points, so the itemize environment has been totally redefined for French in version 1.3. Several people pointed out to me that the layout of lists can either be set by the current language or be tuned independently of the language as part of the layout of the document. So hooks should be provided to switch off the special settings

made in frenchb. Setting \FrenchItemizeSpacingfalse after loading frenchb

in the preamble switches back to settings of version 1.2 (this can be useful to process old documents). If you want all list spacings to be exactly what they are in standard L^{A}TEX 2ε, then add also \FrenchListSpacingfalse in the preamble after loading frenchb. Both switches can also be set in frenchb.cfg. Please note

that changing the flags \FrenchItemizeSpacing and \FrenchListSpacing will

not take effect immediately, but next time language French is switched on. The • is never used in French itemize-lists, a long dash ‘–’ is prefered for all levels.

217 \newif\ifFrenchItemizeSpacing \FrenchItemizeSpacingtrue
218 \ifx\fmtname\PlainFmtName
219 \else
220 \let\@ltiORI\labelitemi
221 \let\@ltiiORI\labelitemii
222 \let\@ltiiiORI\labelitemiii
223 \let\@ltivORI\labelitemiv
224 \let\itemizeORI\itemize
225 \let\enditemizeORI\enditemize
226 \def\bbl@frenchitemize{%
227  \ifFrenchItemizeSpacing
228  \renewenvironment{itemize}%
229  {\begin{list}{\textendash}%
230  {\let\@trivlist\@trivlistORI
231  \settowidth{\labelwidth}{\textendash}%
232  \setlength{\leftmargin}{\labelwidth}%
233  \addtolength{\leftmargin}{\labelsep}%
234  \ifnum\@listdepth=0
235  \setlength{\itemindent}{\parindent}%
236  \else
237  \addtolength{\leftmargin}{\parindent}%
238  \fi

239  \setlength{\itemsep}{\z@}%
240  \setlength{\parsep}{\z@}%
241  \setlength{\topsep}{\z@}%
242  \setlength{\partopsep}{\z@}%
243  \addtolength{\topsep}{-\parskip}%
244  \addtolength{\partopsep}{\parskip}%

245 }% 246 }%

247  {\end{list}}%
248  \else
249  \def\labelitemi{\textendash}%
250  \def\labelitemii{\textendash}%
251  \def\labelitemiii{\textendash}%
252  \def\labelitemiv{\textendash}%
253  \fi}
254 \def\bbl@nonfrenchitemize{\let\labelitemi\@ltiORI
255  \let\labelitemii\@ltiiORI
256  \let\labelitemiii\@ltiiiORI
257  \let\labelitemiv\@ltivORI
258  \let\itemize\itemizeORI
259  \let\enditemize\enditemizeORI}
260 \expandafter\addto\csname extras\CurrentOption\endcsname{%
261  \bbl@frenchitemize}
262 \expandafter\addto\csname noextras\CurrentOption\endcsname{%
263  \bbl@nonfrenchitemize}
264 \fi

1.7 French indentation of sections

\bbl@frenchindent \bbl@nonfrenchindent In French the first paragraph of each section should be indented, this is another difference with US-english. Add this code only in L^{A}TEX.

265 \ifx\fmtname\PlainFmtName
266 \else
267 \let\@aifORI\@afterindentfalse
268 \def\bbl@frenchindent{\let\@afterindentfalse\@afterindenttrue
269  \@afterindenttrue}
270 \def\bbl@nonfrenchindent{\let\@afterindentfalse\@aifORI
271  \@afterindentfalse}
272 \expandafter\addto\csname extras\CurrentOption\endcsname{%
273  \bbl@frenchindent}
274 \expandafter\addto\csname noextras\CurrentOption\endcsname{%
275  \bbl@nonfrenchindent}
276 \fi

1.8 Formatting numbers

In English the decimal part starts with a point and thousands should be separated by a comma: an approximation of 1000π should be inputed as

 $3{,}141.592{,}653$ in math-mode and as 3,141.592,653 in text.

In French the decimal part starts with a comma and thousands should be separated by a space; the same approximation of 1000π should be inputed as

$3\;141{,}592\;653$ in math-mode and as something like 3~141,592~653 in

text. Remember braces are mandatory around the comma in math-mode, the reason is mentioned in the TEXbook p. 134: the comma is of type \mathpunct (thus normally followed by a space) while the point is of type \mathord (no space added). Thierry Bouche suggested that a second type of comma, of type \mathord would be useful in math-mode, and proposed to introduce a command (named \decimalsep in this package), the expansion of which would depend on the current language. Vincent Jalby suggested a command \nombre to conveniently typeset numbers: inputting \nombre{3141,592653} either in text or in math-mode will format this number properly according to the current language (French or non-French). \nombre accepts an optional argument which happens to be useful with the extension ‘dcolumn’, it specifies the decimal separator used in the source code:

\newcolumntype{d}{D{,}{\decimalsep}{-1}}
\begin{tabular}{d}\hline
  3,14 \\
  \nombre[,]{123,4567} \\
  \nombre[,]{9876,543}\\\hline
\end{tabular}

will print a column of numbers aligned on the decimal point (comma or point depending on the current language), each slice of 3 digits being separated by a space or a comma according to the current language.

\decimalsep \thousandsep We need a internal definition, valid in both text and math-mode, for the comma (\@comma@) and another one for the unbreakable fixed length space (no glue) used

in French (\f@thousandsep).

The commands \decimalsep and \thousandsep get default definitions (for the English language) when frenchb is loaded; these definitions will be updated when the current language is switched to or from French.

277 %    \begin{macrocode}
278 \mathchardef\m@comma="013B
279 \def\@comma@{\ifmmode\m@comma\else,\fi}
280 \def\f@thousandsep{\ifmmode\mskip5.5mu\else\penalty\@M\kern.3em\fi}
281 \newcommand{\decimalsep}{.}
282 \newcommand{\thousandsep}{\@comma@}
283 \expandafter\addto\csname extras\CurrentOption\endcsname{%
284  \def\decimalsep{\@comma@}%
285  \def\thousandsep{\f@thousandsep}}
286 \expandafter\addto\csname noextras\CurrentOption\endcsname{%
287  \def\decimalsep{.}%
288  \def\thousandsep{\@comma@}}

Signs can now be entered inside \nombre. When \nombre is used in text-mode, signs should be text symbols to get the series, shape... from the current text-font. When signs are not available in text-mode, we provide some defaults.

289 \providecommand{\textminus}{\textendash}%
290 \providecommand{\textplusminus}{\ensuremath{\pm}}
291 \providecommand{\textminusplus}{\ensuremath{\mp}}
292 \def\fb@minus{\ifmmode-\else\textminus\fi}
293 \def\fb@plusminus{\ifmmode\pm\else\textplusminus\fi}
294 \def\fb@minusplus{\ifmmode\mp\else\textminusplus\fi}

\nombre The decimal separator used when inputing a number with \nombre has to be a comma. \nombre splits the inputed number into two parts: what comes before the first comma will be formatted by \@integerpart while the rest (if not empty) will be formatted by \@decimalpart. Both parts, once formatted separately will be merged together with between them, either the decimal separator \decimalsep or (in L^{A}TEX 2ε only) the optional argument of \nombre.

295 \if@Two@E
296 \newcommand{\nombre}[2][\decimalsep]{\def\@decimalsep{#1}%
297  \@@nombre#2\@empty,\@empty,\@nil}
298 \else
299 \def\@decimalsep{\decimalsep}
300 \newcommand{\nombre}[1]{\@nombre#1\@empty,\@empty,\@nil}
301 \fi
302 \def\@firstofmany#1#2,{#1}
303 \def\@@nombre#1,#2,#3\@nil{%
304  \def\nb@sign{}%
305  \edef\nb@first{\@firstofmany #1\@empty,}%
306  \edef\nb@suite{\@secondoftwo #1\@empty,}%
307  \if+\nb@first   \def\nb@sign{+}\fi
308  \if-\nb@first   \def\nb@sign{\fb@minus}\fi
309  \expandafter\ifx\nb@first\pm \def\nb@sign{\fb@plusminus}\fi
310  \expandafter\ifx\nb@first\mp \def\nb@sign{\fb@minusplus}\fi
311  \ifx\@empty\nb@sign
312  \let\@tmp\nb@suite\edef\nb@suite{\nb@first\@tmp}%
313  \fi
314  \nb@sign\expandafter\@nombre\nb@suite#2,#3\@nil}
315 \def\@nombre#1,#2,#3\@nil{%
316  \ifx\@empty#2%
317  \@integerpart{#1}%
318  \else
319  \@integerpart{#1}\@decimalsep\@decimalpart{#2}%
320  \fi}

The easiest bit is the decimal part: We attempt to read the first four digits of the decimal part, if it has less than 4 digits, we just have to print them, otherwise \thousandsep has to be appended after the third digit, and the algorithm is applied recursively to the rest of the decimal part.

321 \def\@decimalpart#1{\@@decimalpart#1\@empty\@empty\@empty}
322 \def\@@decimalpart#1#2#3#4{#1#2#3%
323 \ifx\@empty#4%
324 \else
325  \thousandsep\expandafter\@@decimalpart\expandafter#4%

326 \fi}

Formatting the integer part is more difficult because the slices of 3 digits start from the bottom while the number is read from the top! This (tricky) code is borrowed from David Carlisle’s comma.sty.

327 \def\@integerpart#1{\@@integerpart{}#1\@empty\@empty\@empty}
328 \def\@@integerpart#1#2#3#4{%
329 \ifx\@empty#2%
330  \@addthousandsep#1\relax
331 \else
332  \ifx\@empty#3%
333  \@addthousandsep\@empty\@empty#1#2\relax
334  \else
335  \ifx\@empty#4%
336  \@addthousandsep\@empty#1#2#3\relax
337  \else
338  \@@integerpartafterfi{#1#2#3#4}%
339  \fi
340  \fi
341 \fi}
342 \def\@@integerpartafterfi#1\fi\fi\fi{\fi\fi\fi\@@integerpart{#1}}
343 \def\@addthousandsep#1#2#3#4{#1#2#3%
344 \if#4\relax
345 \else
346  \thousandsep\expandafter\@addthousandsep\expandafter#4%
347 \fi}

1.9 Dots…

L^{A}TEX 2ε’s standard definition of \dots in text-mode is \textellipsis which includes a \kern at the end; this space is not wanted in some cases (before a closing brace for instance) and \kern breaks hyphenation of the next word. We define \Frtextellipsis for French (in L^{A}TEX 2ε only); AMSL^{A}TEX redefines \dots, as \tdots@ in text-mode, so we also overwrite \tdots@ with \Frtextellipsis in French.

\Frtextellipsis
348 \ifx\fmtname\LaTeXeFmtName
349 \let\textellipsisORI\textellipsis
350 \AtBeginDocument{\ifx\tdots@ORI\@undefined\let\tdots@ORI\tdots@\fi}
351 \DeclareTextCommandDefault{\Frtextellipsis}{%
352  .\kern\fontdimen3\font.\kern\fontdimen3\font.\xspace}
353 \def\bbl@frenchdots{\let\textellipsis\Frtextellipsis
354  \let\tdots@ORI\tdots@
355  \let\tdots@\Frtextellipsis}
356 \def\bbl@nonfrenchdots{\let\textellipsis\textellipsisORI
357  \ifx\tdots@ORI\@undefined\else\let\tdots@\tdots@ORI\fi}
358 \expandafter\addto\csname extras\CurrentOption\endcsname{%
359  \bbl@frenchdots}

360 \expandafter\addto\csname noextras\CurrentOption\endcsname{%
361  \bbl@nonfrenchdots}
362 \fi

1.10 Extra utilities

All that is left to do now is to provide the French user with some extra utilities.

{\up \atop \ieme} \up eases the typesetting of superscripts like ‘1er’. \up relies on \textsuperscript when available (i. e., in L^{A}TEX 2ε).

\up@size The internal macro \up@size holds the size at which the superscript will be typeset. The reason for this is that we have to specify it differently for different formats.

363 \ifx\sevenrm\@undefined
364 \ifx\@ptsize\@undefined
365  \let\up@size\small
366 \else
367  \ifx\selectfont\@undefined

In this case the format is the original L^{A}TEX-2.09:

368  \ifcase\@ptsize
369  \let\up@size\ixpt\or
370  \let\up@size\xpt\or
371  \let\up@size\xipt
372  \fi

When \selectfont is defined we probably have NFSS available:

373  \else
374  \ifcase\@ptsize
375  \def\up@size{\fontsize\@ixpt{10pt}\selectfont}\or
376  \def\up@size{\fontsize\@xpt{11pt}\selectfont}\or
377  \def\up@size{\fontsize\@xipt{12pt}\selectfont}
378  \fi
379  \fi
380 \fi
381 \else

If we end up here it must be a plain based TEX format, so:

382  \let\up@size\sevenrm
383 \fi

Now we can define \up. When L^{A}TEX 2ε runs in compatibility mode (L^{A}TEX-2.09 emulation), \textsuperscript is also defined, but does no good job, so we give two different definitions for \up using \if@Two@E.

384 \if@Two@E
385 \DeclareRobustCommand*{\up}[1]{\textsuperscript{#1}}
386 \else
387 \DeclareRobustCommand*{\up}[1]{\leavevmode\raise1ex\hbox{\up@size#1}}
388 \fi

\ieme is provided for compatibility with francais.sty, the other 5 for compatibility with french.sty:

389 \def\ieme{\up{\lowercase{e}}\xspace}
390 \def\iemes{\up{\lowercase{es}}\xspace}
391 \def\ier{\up{\lowercase{er}}\xspace}
392 \def\iers{\up{\lowercase{ers}}\xspace}
393 \def\iere{\up{\lowercase{re}}\xspace}
394 \def\ieres{\up{\lowercase{res}}\xspace}

\No \no \primo \fprimo) And some more macros for numbering, first two support macros.

395 \DeclareRobustCommand*{\FrenchEnumerate}[1]{%
396  #1\up{\lowercase{o}}\kern+.3em}
397 \DeclareRobustCommand*{\FrenchPopularEnumerate}[1]{%
398  #1\up{\lowercase{o}})\kern+.3em}

Typing \primo should result in ‘1^{o} ’,

399 \def\primo{\FrenchEnumerate1}
400 \def\secundo{\FrenchEnumerate2}
401 \def\tertio{\FrenchEnumerate3}
402 \def\quarto{\FrenchEnumerate4}

while typing \fprimo) gives ‘1^{o}) .

403 \def\fprimo){\FrenchPopularEnumerate1}
404 \def\fsecundo){\FrenchPopularEnumerate2}
405 \def\ftertio){\FrenchPopularEnumerate3}
406 \def\fquarto){\FrenchPopularEnumerate4}

Let’s provide two macros for the common abbreviations of “Numéro”.

407 \DeclareRobustCommand*{\No}{N\up{\lowercase{o}}\kern+.2em}
408 \DeclareRobustCommand*{\no}{n\up{\lowercase{o}}\kern+.2em}

\bsc As family names should be written in small capitals and never be hyphenated, we provide a command (its name comes from Boxed Small Caps) to input them easily; this is a simpler implementation of commands \fsc and \lsc from french.sty : no automatic uppercase/lowercase conversion is performed. Usage:

 Jean~\bsc{Duchemin}.
409 \DeclareRobustCommand*{\bsc}[1]{\leavevmode\hbox{\scshape #1}}

Some definitions for special characters. The first eight are mandatory for \oe etc. to work properly in moving arguments, the others just for convenience. We won’t define \tilde as a Text Symbol not to conflict with the macro \tilde for math-mode and use the name \tild instead. Note that \boi may not be used in math-mode, its name in math-mode is \backslash. \degre needs a special treatment: it is \char6 in T1-encoding and \char23 in OT1-encoding, both can be accessed by the command \r{} for ring accent.

410 \ifx\fmtname\LaTeXeFmtName
411 \DeclareTextSymbol{\ae}{T1}{230}
412 \DeclareTextSymbol{\ae}{OT1}{26}
413 \DeclareTextSymbol{\oe}{T1}{247}

414 \DeclareTextSymbol{\oe}{OT1}{27}
415 \DeclareTextSymbol{\AE}{T1}{198}
416 \DeclareTextSymbol{\AE}{OT1}{29}
417 \DeclareTextSymbol{\OE}{T1}{215}
418 \DeclareTextSymbol{\OE}{OT1}{30}
419 \DeclareTextSymbol{\at}{T1}{64}
420 \DeclareTextSymbol{\at}{OT1}{64}
421 \DeclareTextSymbol{\circonflexe}{T1}{94}
422 \DeclareTextSymbol{\circonflexe}{OT1}{94}
423 \DeclareTextSymbol{\tild}{T1}{126}
424 \DeclareTextSymbol{\tild}{OT1}{126}
425 \DeclareRobustCommand*{\boi}{\textbackslash}
426 \DeclareRobustCommand*{\degre}{\r{}}
427 \else
428 \def\T@one{T1}
429 \ifx\f@encoding\T@one
430  \newcommand{\degre}{\char6}
431 \else
432  \newcommand{\degre}{\char23}
433 \fi
434 \newcommand{\at}{\char64}
435 \newcommand{\circonflexe}{\char94}
436 \newcommand{\tild}{\char126}
437 \newcommand{\boi}{{$\backslash$}}
438 \fi

\degres Macro for typesetting the abbreviation for ‘degrees’ (as in ‘degrees Celsius’). As the bounding box of the character ‘degree’ has very different widths in CM/EC and PostScript fonts, we fix the width of the bounding box of \degres to 0.3 em, this lets the symbol ‘degree’ stick to the preceding (e.g., 45\degres) or following character (e.g., 20~\degres C).

439 \DeclareRobustCommand*{\degres}{%
440  \leavevmode\hbox to 0.3em{\hss\degre\hss}}

The following macros are used in the redefinition of \^and \" to handle the letter i: they allow users to type simply \^i and \"i instead of \^{\i} and \"{\i}. MlTEX’s macros dealing with accents conflict with those of L^{A}TEX 2ε, so we check whether \csubinverse is defined or not. If \csubinverse is defined, we are in MlTEX.

441 \ifx\fmtname\LaTeXeFmtName
442 \AtBeginDocument{%
443  \ifx\csubinverse\@undefined
444  \DeclareTextCompositeCommand{\^}{OT1}{i}{\^\i}%
445  \DeclareTextCompositeCommand{\"}{OT1}{i}{\"\i}%
446  \fi}
447 \fi

1.11 Date and clean up

\datefrenchb The macro \datefrenchb redefines the command \today to produce French dates.

448 \@namedef{date\CurrentOption}{%
449 \edef\today{\number\day
450  \ifnum1=\day \noexpand\ier\fi
451  \space \ifcase\month
452  \or janvier\or f\'evrier\or mars\or avril\or mai\or juin\or
453  juillet\or ao\^ut\or septembre\or octobre\or novembre\or
454  d\'ecembre\fi
455  \space \number\year}}
456 \def\datefrench{\datefrenchb}
457 \def\datefrancais{\datefrenchb}

Finally the macro-space used by some control sequences we do not need any longer, is freed.

458 \let\T@one\relax
459 \let\@FI@\relax
460 \let\PlainFmtName\relax
461 \let\LaTeXeFmtName\relax

The macro \ldf@finish takes care of looking for a configuration file, setting the main language to be switched on at \begin{document} and resetting the category code of @ to its original value. The config file searched for will always be ‘frenchb.cfg’. Remember that \CurrentOption has been set to ‘frenchb’, and that ‘francais’ and ‘french’ are aliases for ‘frenchb’.

462 \ldf@finish\CurrentOption

463 ⟨/code⟩