% \iffalse meta-comment
%
% Copyright 1989-2011 Johannes L. Braams and any individual authors
% listed elsewhere in this file.  All rights reserved.
% 
% This file is part of the Babel system.
% --------------------------------------
% 
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
% 
% This work has the LPPL maintenance status "maintained".
% 
% The Current Maintainer of this work is Johannes Braams.
% 
% The list of all files belonging to the Babel system is
% given in the file `manifest.bbl. See also `legal.bbl' for additional
% information.
% 
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
% \fi
% \CheckSum{2599}
%
% \iffalse
%    Tell the \LaTeX\ system who we are and write an entry on the
%    transcript. Nothing to write to the .cfg file, if generated.
%<*dtx>
\ProvidesFile{frenchb.dtx}
%</dtx>
% \changes{v2.1d}{2008/05/04}{Argument of \cs{ProvidesLanguage} changed
%     from `french' to `frenchb', otherwise \cs{listfiles} prints
%     no date/version information.  The bug with \cs{listfiles}
%     (introduced in v.1.5!), was pointed out by Ulrike Fischer.}
%<code>\ProvidesLanguage{frenchb}
%\ProvidesFile{frenchb.dtx}
%<*!cfg>
        [2010/08/21 v2.5a French support from the babel system]
%</!cfg>
%<*cfg>
%% frenchb.cfg: configuration file for frenchb.ldf
%% Daniel Flipo daniel.flipo at free.fr
%</cfg>
%%    File `frenchb.dtx'
%%    Babel package for LaTeX version 2e
%%    Copyright (C) 1989 - 2010
%%              by Johannes Braams, TeXniek
%
%<*!cfg>
%%    Frenchb language Definition File
%%    Copyright (C) 1989 - 2010
%%              by Johannes Braams, TeXniek
%%                 Daniel Flipo, GUTenberg
%
%%    Please report errors to: Daniel Flipo, GUTenberg
%%                             daniel.flipo at free.fr
%</!cfg>
%
%    This file is part of the babel system, it provides the source
%    code for the French language definition file.
%
%<*filedriver>
\documentclass[a4paper]{ltxdoc}
\DeclareFontEncoding{T1}{}{}
\DeclareFontSubstitution{T1}{lmr}{m}{n}
\DeclareTextCommand{\guillemotleft}{OT1}{%
  {\fontencoding{T1}\fontfamily{lmr}\selectfont\char19}}
\DeclareTextCommand{\guillemotright}{OT1}{%
  {\fontencoding{T1}\fontfamily{lmr}\selectfont\char20}}
\newcommand*\TeXhax{\TeX hax}
\newcommand*\babel{\textsf{babel}}
\newcommand*\langvar{$\langle \mathit lang \rangle$}
\newcommand*\note[1]{}
\newcommand*\Lopt[1]{\textsf{#1}}
\newcommand*\file[1]{\texttt{#1}}
\begin{document}
\setlength{\parindent}{0pt}
\begin{center}
  \textbf{\Large A Babel language definition file for French}\\[3mm]^^A\]
  Daniel \textsc{Flipo}\\
  \texttt{daniel.flipo@free.fr}
\end{center}
 \RecordChanges
 \DocInput{frenchb.dtx}
\end{document}
%</filedriver>
% \fi
% \GetFileInfo{frenchb.dtx}
%
%  \section{The French language}
%
%    The file \file{\filename}\footnote{The file described in this
%    section has version number \fileversion\ and was last revised on
%    \filedate.}, defines all the language definition macros for the
%    French language.
%
%    Customisation for the French language is achieved following the
%    book ``Lexique des r\`egles typographiques en usage \`a
%    l'Imprimerie nationale'' troisi\`eme \'edition (1994),
%    ISBN-2-11-081075-0.
%
%    First version released: 1.1 (1996/05/31) as part of
%    \babel-3.6beta.
%
%    |frenchb| has been improved using helpful suggestions from many
%    people, mainly from Jacques Andr\'e, Michel Bovani, Thierry Bouche,
%    and Vincent Jalby.  Thanks to all of them!
%
%    This new version (2.x) has been designed to be used with \LaTeXe{}
%    and Plain\TeX{} formats only. \LaTeX-2.09 is no longer supported.
%    Changes between version 1.6 and \fileversion{} are listed in
%    subsection~\ref{ssec-changes} p.~\pageref{ssec-changes}.
%
%    An extensive documentation is available in French here:\\
%    |http://daniel.flipo.free.fr/frenchb|
%
%  \subsection{Basic interface}
%
%    In a multilingual document, some typographic rules are language
%    dependent, i.e. spaces before `double punctuation' (|:| |;| |!|
%    |?|) in French, others concern the general layout (i.e. layout of
%    lists, footnotes, indentation of first paragraphs of sections) and
%    should apply to the whole document.
%
%    Starting with version~2.2, |frenchb| behaves differently according
%    to \babel's \emph{main language} defined as the \emph{last}
%    option\footnote{Its name is kept in \texttt{\textbackslash
%           bbl@main@language}.} at \babel's loading.  When French is
%    not \babel's main language, |frenchb| no longer alters the global
%    layout of the document (even in parts where French is the current
%    language): the layout of lists, footnotes, indentation of first
%    paragraphs of sections are not customised by |frenchb|.
%
%    When French is loaded as the last option of \babel, |frenchb|
%    makes the following changes to the global layout, \emph{both in
%    French and in all other languages}\footnote{%
%       For each item, hooks are provided to reset standard
%       \LaTeX{} settings or to emulate the behavior of former versions
%       of \texttt{frenchb} (see command
%       \texttt{\textbackslash frenchbsetup\{\}},
%       section~\ref{ssec-custom}).}:
%    \begin{enumerate}
%    \item the first paragraph of each section is indented
%          (\LaTeX{} only);
%    \item the default items in itemize environment are set to `--'
%          instead of `\textbullet', and all vertical spacing and glue
%          is deleted; it is possible to change `--' to something else
%          (`---' for instance) using |\frenchbsetup{}|;
%    \item vertical spacing in general \LaTeX{} lists is
%          shortened;
%    \item footnotes are displayed ``\`a la fran\c{c}aise''.
%    \end{enumerate}
%
%    Regarding local typography, the command |\selectlanguage{french}|
%    switches to the French language\footnote{%
%      \texttt{\textbackslash selectlanguage\{francais\}}
%      and \texttt{\textbackslash selectlanguage\{frenchb\}} are kept
%      for backward compatibility but should no longer be used.},
%    with the following effects:
%    \begin{enumerate}
%    \item French hyphenation patterns are made active;
%    \item `double punctuation' (|:| |;| |!| |?|) is made
%           active%\footnote{Actually, they are active in the whole
%           document, only their expansions differ in French and
%           outside French.} for correct spacing in French;
%    \item |\today| prints the date in French;
%    \item the caption names are translated into French
%          (\LaTeX{} only);
%    \item the space after |\dots| is removed in French.
%    \end{enumerate}
%
%    Some commands are provided in |frenchb| to make typesetting
%    easier:
%    \begin{enumerate}
%    \item French quotation marks can be entered using the commands
%          |\og| and |\fg| which work in \LaTeXe and Plain\TeX,
%          their appearance depending on what is available to draw
%          them; even if you use \LaTeXe{} \emph{and} |T1|-encoding,
%          you should refrain from entering them as
%          |<<~French quotation marks~>>|: |\og| and |\fg| provide
%          better horizontal spacing.
%          |\og| and |\fg| can be used outside French, they typeset
%          then English quotes `` and ''.
%    \item A command |\up| is provided to typeset superscripts like
%          |M\up{me}| (abbreviation for ``Madame''), |1\up{er}| (for
%          ``premier'').  Other commands are also provided for
%          ordinals: |\ier|, |\iere|, |\iers|, |\ieres|, |\ieme|,
%          |\iemes| (|3\iemes| prints 3\textsuperscript{es}).
%    \item Family names should be typeset in small capitals and never
%          be hyphenated, the macro |\bsc| (boxed small caps) does
%          this, e.g., |Leslie~\bsc{Lamport}| will produce
%          Leslie~\mbox{\textsc{Lamport}}. Note that composed names
%          (such as Dupont-Durant) may now be hyphenated on explicit
%          hyphens, this differs from |frenchb|~v.1.x.
%    \item Commands |\primo|, |\secundo|, |\tertio| and |\quarto|
%          print 1\textsuperscript{o}, 2\textsuperscript{o},
%          3\textsuperscript{o}, 4\textsuperscript{o}.
%          |\FrenchEnumerate{6}| prints 6\textsuperscript{o}.
%    \item Abbreviations for ``Num\'ero(s)'' and ``num\'ero(s)''
%          (N\textsuperscript{o} N\textsuperscript{os}
%          n\textsuperscript{o} and n\textsuperscript{os}~)
%          are obtained via the commands |\No|, |\Nos|, |\no|, |\nos|.
%    \item Two commands are provided to typeset the symbol for
%          ``degr\'e'': |\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 \emph{no}
%          space in French).
%    \item In math mode the comma has to be surrounded with
%          braces to avoid a spurious space being inserted after it,
%          in decimal numbers for instance (see the \TeX{}book p.~134).
%          The command |\DecimalMathComma| makes the comma be an
%          ordinary character \emph{in French only} (no space added);
%          as a counterpart, if |\DecimalMathComma| is active, an
%          explicit space has to be added in lists and intervals:
%          |$[0,\ 1]$|, |$(x,\ y)$|. |\StandardMathComma| switches back
%          to the standard behaviour of the comma.
%    \item A command |\nombre| was provided in 1.x versions to easily
%          format numbers in slices of three digits separated either
%          by a comma in English or with a space in French; |\nombre|
%          is now mapped to |\numprint| from \file{numprint.sty}, see
%          \file{numprint.pdf} for more information.
%    \item |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|,
%          |\dots|, \dots, to respect the spaces you type after them,
%          for instance typing `|1\ier juin|' will print
%          `1\textsuperscript{er} juin' (no need for a forced space
%          after |1\ier|).
%    \end{enumerate}
%
%  \subsection{Customisation}
%  \label{ssec-custom}
%
%     Up to version 1.6, customisation of |frenchb| was achieved
%     by entering commands in \file{frenchb.cfg}.  This possibility
%     remains for compatibility, but \emph{should not longer be used}.
%     Version 2.0 introduces a new command |\frenchbsetup{}| using
%     the \file{keyval} syntax which should make it easier to choose
%     among the many options available. The command |\frenchbsetup{}|
%     is to appear in the preamble only (after loading \babel).
%
%     \vspace{.5\baselineskip}
%     |\frenchbsetup{ShowOptions}| prints all available options to
%     the \file{.log} file, it is just meant as a remainder of the
%     list of offered options. As usual with \file{keyval} syntax,
%     boolean options (as |ShowOptions|) can be entered as
%     |ShowOptions=true| or just |ShowOptions|, the `|=true|' part
%     can be omitted.
%
%     \vspace{.5\baselineskip}
%     The other options are listed below. Their default value is shown
%     between brackets, sometimes followed be a `\texttt{*}'.
%     The `\texttt{*}' means that the default shown applies when
%     |frenchb| is loaded as the \emph{last} option of \babel{}
%     ---\babel's \emph{main language}---, and is toggled otherwise:
%     \begin{itemize}
%     \item |StandardLayout=true [false*]| forces |frenchb| not to
%       interfere with the layout: no action on any kind of lists,
%       first paragraphs of sections are not indented (as in English),
%       no action on footnotes. This option replaces the former
%       command |\StandardLayout|.  It can be used to avoid conflicts
%       with classes or packages which customise lists or footnotes.
%     \item |GlobalLayoutFrench=false [true*]| can be used, when French
%       is the main language, to emulate what prior versions of
%       |frenchb| (pre-2.2) did: lists, and first paragraphs
%       of sections will be displayed the standard way in other
%       languages than French, and ``\`a la fran\c{c}aise'' in French.
%       Note that the layout of footnotes is language independent
%       anyway (see below |FrenchFootnotes| and |AutoSpaceFootnotes|).
%       This option replaces the former command |\FrenchLayout|.
%     \item |ReduceListSpacing=false [true*]|; |frenchb| normally
%       reduces the values of the vertical spaces used in the
%       environment |list| in French; setting this option to |false|
%       reverts to the standard settings of |list|.  This option
%       replaces the former command |\FrenchListSpacingfalse|.
%     \item |CompactItemize=false [true*]|; |frenchb| normally
%       redefines the |itemize| environment to
%       suppresse any vertical space between items of |itemize| lists
%       in French; setting this option to |false| reverts to the
%       standard settings of |itemize| lists.  This option replaces
%       the former command |\FrenchItemizeSpacingfalse|.
%     \item |StandardItemLabels=true [false*]| when set to |true| this
%       option stops |frenchb| from changing the labels in |itemize|
%       lists in French.
%     \item |ItemLabels=\textemdash|, |\textbullet|, |\ding{43}|,
%       \dots, |[\textendash*]|; when |StandardItemLabels=false| (the
%       default), this option enables to choose the label used in
%       |itemize| lists for all levels.  The next three options do
%       the same but each one for one level only. Note that the
%       example |\ding{43}| requires |\usepackage{pifont}|.
%     \item |ItemLabeli=\textemdash|, |\textbullet|, |\ding{43}|,
%       \dots,|[\textendash*]|
%     \item |ItemLabelii=\textemdash|, |\textbullet|, |\ding{43}|,
%       \dots, |[\textendash*]|
%     \item |ItemLabeliii=\textemdash|, |\textbullet|, |\ding{43}|,
%       \dots, |[\textendash*]|
%     \item |ItemLabeliv=\textemdash|, |\textbullet|, |\ding{43}|,
%       \dots, |[\textendash*]|
%     \item |StandardLists=true [false*]| forbids |frenchb| to
%       customise any kind of list. Do activate the option
%       |StandardLists| when using classes or packages that customise
%       lists too (|enumitem|, |paralist|, \dots{}) to avoid conflicts.
%       This option is just a shorthand for |ReduceListSpacing=false|
%       and |CompactItemize=false| and |StandardItemLabels=true|.
%     \item |IndentFirst=false [true*]|; |frenchb| normally forces
%       indentation of the first paragraph of sections.
%       When this option is set to |false|, the first paragraph of
%       will look the same in French and in English (not indented).
%     \item |FrenchFootnotes=false [true*]| reverts to the standard
%       layout of footnotes. By default |frenchb| typesets leading
%       numbers as `1.\hspace{.5em}' instead of `$\hbox{}^1$', but
%       has no effect on footnotes numbered with symbols (as in the
%       |\thanks| command).  The former commands |\StandardFootnotes|
%       and |\FrenchFootnotes| are still there, |\StandardFootnotes|
%       can be useful when some footnotes are numbered with letters
%       (inside minipages for instance).
%     \item |AutoSpaceFootnotes=false [true*]| ; by default |frenchb|
%       adds a thin space in the running text before the number or
%       symbol calling the footnote.  Making this option |false|
%       reverts to the standard setting (no space added).
%     \item |FrenchSuperscripts=false [true]| ; then
%       |\up=\textsuperscript| (option added in version 2.1).
%       Should only be made |false| to recompile older documents.
%       By default |\up| now relies on |\fup| designed to produce
%       better looking superscripts.
%     \item |AutoSpacePunctuation=false [true]|; in French, the user
%       \emph{should} input a space before the four characters `|:;!?|'
%       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 recommended by
%       the French Imprimerie nationale).  This is convenient in most
%       cases but can lead to addition of spurious spaces in URLs or in
%       MS-DOS paths but only if they are no typed using |\texttt| or
%       verbatim mode. When the current font is a monospaced
%       (typewriter) font, |AutoSpacePunctuation| is locally switched
%       to |false|, no spurious space is added in that case, so the
%       default behaviour of of |frenchb| in that area should be fine
%       in most circumstances.
%
%       Choosing |AutoSpacePunctuation=false| will ensure that
%       a proper space will be added before `|:;!?|' \emph{if and only
%       if} a (normal) space has been typed in. Those who are unsure
%       about their typing in this area should stick to the default
%       option and type |\string;| |\string:| |\string!| |\string?|
%       instead of |;| |:| |!| |?| in case an unwanted space is
%       added by |frenchb|.
%     \item |ThinColonSpace=true [false]| changes the normal
%       (unbreakable) space added before the colon `:' to a thin space,
%       so that the same amount of space is added before any of the
%       four double punctuation characters. The default setting is
%       supported by the French Imprimerie nationale.
%     \item |LowercaseSuperscripts=false [true]| ; by default |frenchb|
%       inhibits the uppercasing of superscripts (for instance when they
%       are moved to page headers). Making this option |false|
%       will disable this behaviour (not recommended).
%     \item |PartNameFull=false [true]|; when true, |frenchb| numbers
%       the title of |\part{}| commands as ``Premi\`ere partie'',
%       ``Deuxi\`eme partie'' and so on. With some classes which change
%       the|\part{}| command (AMS and SMF classes do so), you will get
%       ``Premi\`ere partie~I'', ``Deuxi\`eme partie~II'' instead;
%       when this occurs, this option should be set to |false|,
%       part titles will then be printed as ``Partie I'', ``Partie II''.
%     \item |SuppressWarning=true [false]|; when true |frenchb| issues
%       no warnings if |\@makecaption| has been redefined or if the
%       bigfoot package is in use.
%     \item |og=|\texttt{\guillemotleft}, |fg=|\texttt{\guillemotright};
%       when guillemets characters are available on the keyboard
%       (through a compose key for instance), it is nice to use them
%       instead of typing |\og| and |\fg|. This option tells |frenchb|
%       which characters are opening and closing French guillemets
%       (they depend on the input encoding), then you can type either
%       \texttt{\guillemotleft{} guillemets \guillemotright}, or
%       \texttt{\guillemotleft{}guillemets\guillemotright} (with or
%       without spaces), to get properly typeset French quotes.
%       This option requires \file{inputenc} to be loaded with the
%       proper encoding, it works with 8-bits encodings (latin1,
%       latin9, ansinew,  applemac,\dots) and multi-byte encodings
%       (utf8 and utf8x).
%     \end{itemize}
%
%  \subsection{Hyphenation checks}
%  \label{ssec-hyphen}
%
%    Once you have built your format, a good precaution would be to
%    perform some basic tests about hyphenation in French. For
%    \LaTeXe{} I suggest this:
%    \begin{itemize}
%    \item run the following file, with the encoding suitable for
%      your machine (\textit{my-encoding} will be |latin1| for
%      \textsc{unix} machines, |ansinew| for PCs running~Windows,
%      |applemac| or |latin1| for Macintoshs, or |utf8|\dots\\[3mm]^^A\]
%      |%%% Test file for French hyphenation.|\\
%      |\documentclass{article}|\\
%      |\usepackage[|\textit{my-encoding}|]{inputenc}|\\
%      |\usepackage[T1]{fontenc} % Use LM fonts|\\
%      |\usepackage{lmodern}     % for French|\\
%      |\usepackage[frenchb]{babel}|\\
%      |\begin{document}|\\
%      |\showhyphens{signal container \'ev\'enement alg\`ebre}|\\
%      |\showhyphens{|\texttt{signal container \'ev\'enement
%                     alg\`ebre}|}|\\
%      |\end{document}|
%    \item check the hyphenations proposed by \TeX{} in your log-file;
%      in French you should get with both 7-bit and 8-bit encodings\\
%      \texttt{si-gnal contai-ner \'ev\'e-ne-ment al-g\`ebre}.\\
%      Do not care about how accented characters are displayed in the
%      log-file, what matters is the position of the `|-|' hyphen
%      signs \emph{only}.
%    \end{itemize}
%    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:
%    \begin{itemize}
%    \item you get |sig-nal con-tainer|, this probably means that the
%    hyphenation patterns you are using are for US-English, not for
%    French;
%    \item you get no hyphen at all in \texttt{\'ev\'e-ne-ment}, this
%    probably means that you are using CM fonts and the macro
%    |\accent| to produce accented characters.
%    Using 8-bits fonts with built-in accented characters avoids
%    this kind of mismatch.
%    \end{itemize}
%
%    \textbf{Options' order} -- Please remember that options are read
%    in the order they appear inside the |\frenchbsetup| command.
%    Someone wishing that |frenchb| leaves the layout of lists
%    and footnotes untouched but caring for indentation of first
%    paragraph of sections could choose
%    |\frenchbsetup{StandardLayout,IndentFirst}| and get the expected
%    layout. Choosing |\frenchbsetup{IndentFirst,StandardLayout}|
%    would not lead to the expected result: option |IndentFirst| would
%    be overwritten by |StandardLayout|.
%
%  \subsection{Changes}
%  \label{ssec-changes}
%
%  \subsubsection*{What's new in version 2.0?}
%
%    Here is the list of all changes:
%    \begin{itemize}
%    \item Support for \LaTeX-2.09 and for \LaTeXe{} in compatibility
%      mode has been dropped. This version is meant for \LaTeXe{} and
%      Plain based formats (like \file{bplain}). \LaTeXe{} formats
%      based on ml\TeX{} are no longer supported either (plenty of
%      good 8-bits fonts are available now, so T1 encoding should
%      be preferred for typesetting in French). A warning is issued
%      when OT1 encoding is in use at the |\begin{document}|.
%    \item Customisation should now be handled by command
%      |\frenchbsetup{}|, \file{frenchb.cfg} (kept for compatibility)
%      should no longer be used. See section~\ref{ssec-custom} for
%      the list of available options.
%    \item Captions in figures and table have changed in French: former
%      abbreviations ``Fig.'' and ``Tab.'' have been replaced by full
%      names ``Figure'' and ``Table''.  If this leads to formatting
%      problems in captions, you can add the following two commands to
%      your preamble (after loading \babel) to get the former captions\\
%      |\addto\captionsfrench{\def\figurename{{\scshape Fig.}}}|\\
%      |\addto\captionsfrench{\def\tablename{{\scshape Tab.}}}|.
%    \item The |\nombre| command is now provided by the \file{numprint}
%      package which has to be loaded \emph{after} \babel{} with the
%      option |autolanguage| if number formatting should depend on the
%      current language.
%    \item The |\bsc| command no longer uses an |\hbox| to stop
%      hyphenation of names but a |\kern0pt| instead. This change
%      enables \file{microtype} to fine tune the length of the
%      argument of |\bsc|; as a side-effect, compound names like
%      Dupont-Durand can now be hyphenated on  explicit hyphens.
%      You can get back to the former behaviour of |\bsc| by adding\\
%      |\renewcommand*{\bsc}[1]{\leavevmode\hbox{\scshape #1}}|\\
%      to the preamble of your document.
%    \item Footnotes are now displayed ``\`a la fran\c caise'' for the
%      whole document, except with an explicit\\
%      |\frenchbsetup{AutoSpaceFootnotes=false,FrenchFootnotes=false}|.\\
%      Add this command if you want standard footnotes. It is still
%      possible to revert locally to the standard layout of footnotes
%      by adding |\StandardFootnotes| (inside a |minipage| environment
%      for instance).
%    \end{itemize}
%
%  \subsubsection*{What's new in version 2.1?}
%
%      New command |\fup| to typeset better looking superscripts.
%      Former command |\up| is now defined as |\fup|, but an option
%      |\frenchbsetup{FrenchSuperscripts=false}| is provided for
%      backward compatibility.  |\fup| was designed using ideas from
%      Jacques Andr\'e, Thierry Bouche and Ren\'e Fritz, thanks to them!
%
%  \subsubsection*{What's new in version 2.2?}
%
%      Starting with version~2.2a, |frenchb| alters the layout of
%      lists, footnotes, and the indentation of first paragraphs of
%      sections) \emph{only if} French is the ``main language''
%      (i.e. babel's last language option). The layout is global for
%      the whole document: lists, etc. look the same in French and in
%      other languages, everything is typeset ``\`a la fran\c caise''
%      if French is the ``main language'', otherwise |frenchb| doesn't
%      change anything regarding lists, footnotes, and indentation of
%      paragraphs.
%
%  \subsubsection*{What's new in version 2.3?}
%
%      Starting with version~2.3a, |frenchb| no longer inserts spaces
%      automatically before `|:;!?|' when a typewriter font is in use;
%      this was suggested by Yannis Haralambous to prevent
%      spurious spaces in computer source code or expressions like
%      \texttt{C\string:/foo}, \texttt{http\string://foo.bar},
%      etc.  An option (|OriginalTypewriter|) is provided to get back
%      to the former behaviour of |frenchb|.
%
%      Another probably invisible change: lowercase conversion in
%      |\up{}| is now achieved by the \LaTeX{} command |\MakeLowercase|
%      instead of \TeX's |\lowercase| command.  This prevents error
%      messages when diacritics are used inside |\up{}| (diacritics
%      should \emph{never} be used in superscripts though!).
%
%  \subsubsection*{What's new in version 2.4?}
%
%      A new option |SuppressWarning| has been added (desactivated by
%      default) to suppress warnings if |\@makecaption| has been
%      redefined or if the bigfoot package is in use.
%
%      French hyphenation patterns are now coded in Unicode, see file
%      \file{hyph-fr.tex}.  Extra code has been added to deal with
%      hyphenation of the French ``apostrophe'' with XeTeX and LuaTeX
%      engines.
%
%      Better compatibility with the enumitem package.
%
%      When typewriter fonts are in use (hence in verbatim mode) no
%      space is added after `\guillemotleft' and before
%      `\guillemotright' when they are entered as characters
%      (see |\frenchbsetup|).
%
%  \subsubsection*{What's new in version 2.5?}
%
%      The main change is that active characters are no longer used
%      in French with (recent) Xe\TeX-based engines (they still are
%      with \TeX-based engines).  All the functionalities (automatic
%      insertion of missing spaces before |:;!?| or bare replacement
%      of typed spaces with suitable unbreabable ones, tuning of the
%      spaces width) remain available and the user interface is
%      unchanged. The use of active characters is replaced by the
%      |\XeTeXinterchartoks| mechanism (as in package
%      \file{polyglossia}).
%
%      A new command |\NoAutoSpacing| has been added. It should be used
%      \emph{inside a group} instead of |\shorthandoff{;:!?}| whenever
%      active characters or automatic spacing of French punctuation or
%      quote characters conflict with other packages; it is designed to
%      work with \TeX- and Xe\TeX-based engines.
%
%      Bug correction: \file{frenchb.ldf} no longer messes up
%      |\frenchspacing| and |\nonfrenchspacing| in other languages.
%
% \StopEventually{}
%
%  \subsection{File frenchb.cfg}
%  \label{sec-cfg}
%
%    \file{frenchb.cfg} is now a dummy file just kept for compatibility
%    with previous versions.
%
% \iffalse
%<*cfg>
% \fi
%    \begin{macrocode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%  WARNING: THIS  FILE SHOULD  NO  LONGER  BE  USED  %%%%%%%%%
%% If you want to customise frenchb, please DO NOT hack into the code!
%% Do no put any code in this file either, please use the new command
%% \frenchbsetup{} with the proper options to customise frenchb.
%%
%% Add \frenchbsetup{ShowOptions} to your preamble to see the list of
%% available options and/or read the documentation.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%    \end{macrocode}
% \iffalse
%</cfg>
% \fi
%
%  \subsection{Initial setup}
%
% \changes{v2.1d}{2008/05/02}{Argument of \cs{ProvidesLanguage} changed
%     above from `french' to `frenchb' (otherwise \cs{listfiles} prints
%     no date/version information).  The real name of current language
%     (french) as to be corrected before calling \cs{LdfInit}.}
%
% \iffalse
%<*code>
% \fi
%
%    While this file was read through the option \Lopt{frenchb} we make
%    it behave as if \Lopt{french} was specified.
%    \begin{macrocode}
\def\CurrentOption{french}
%    \end{macrocode}
%
%    The macro |\LdfInit| takes care of preventing that this file is
%    loaded more than once, checking the category code of the
%    \texttt{@} sign, etc.
%
%    \begin{macrocode}
\LdfInit\CurrentOption\datefrench
%    \end{macrocode}
%
% \changes{v2.1d}{2008/05/04}{Avoid warning ``\cs{end} occurred
%   when \cs{ifx} ... incomplete'' with LaTeX-2.09.}
%
%  \begin{macro}{\ifLaTeXe}
%    No support is provided for late \LaTeX-2.09: issue a warning
%    and exit if \LaTeX-2.09 is in use. Plain is still supported.
%    \begin{macrocode}
\newif\ifLaTeXe
\let\bbl@tempa\relax
\ifx\magnification\@undefined
   \ifx\@compatibilitytrue\@undefined
     \PackageError{frenchb.ldf}
        {LaTeX-2.09 format is no longer supported.\MessageBreak
         Aborting here}
        {Please upgrade to LaTeX2e!}
     \let\bbl@tempa\endinput
   \else
     \LaTeXetrue
   \fi
\fi
\bbl@tempa
%    \end{macrocode}
%  \end{macro}
%
%    Check if hyphenation patterns for the French language have been
%    loaded in language.dat; we allow for the names `french',
%    `francais', `canadien' or `acadian'. The latter two are both
%    names used in Canada for variants of French that are in use in
%    that country.
%
%    \begin{macrocode}
\ifx\l@french\@undefined
  \ifx\l@francais\@undefined
    \ifx\l@canadien\@undefined
      \ifx\l@acadian\@undefined
        \@nopatterns{French}
        \adddialect\l@french0
      \else
        \let\l@french\l@acadian
      \fi
    \else
      \let\l@french\l@canadien
    \fi
  \else
    \let\l@french\l@francais
  \fi
\fi
%    \end{macrocode}
%    Now |\l@french| is always defined.
%
%    The internal name for the French language is |french|;
%    |francais| and |frenchb| are synonymous for |french|:
%    first let both names use the same hyphenation patterns.
%    Later we will have to set aliases for |\captionsfrench|,
%    |\datefrench|, |\extrasfrench| and |\noextrasfrench|.
%    As French uses the standard values of |\lefthyphenmin| (2)
%    and |\righthyphenmin| (3), no special setting is required here.
%
%    \begin{macrocode}
\ifx\l@francais\@undefined
  \let\l@francais\l@french
\fi
\ifx\l@frenchb\@undefined
  \let\l@frenchb\l@french
\fi
%    \end{macrocode}
%    When this language definition file was loaded for one of the
%    Canadian versions of French we need to make sure that a suitable
%    hyphenation pattern register will be found by \TeX.
%    \begin{macrocode}
\ifx\l@canadien\@undefined
  \let\l@canadien\l@french
\fi
\ifx\l@acadian\@undefined
  \let\l@acadian\l@french
\fi
%    \end{macrocode}
%
%    This language definition can be loaded for different variants of
%    the French language. The `key' \babel\ macros are only defined
%    once, using `french' as the language name, but |frenchb| and
%    |francais| are synonymous.
%    \begin{macrocode}
\def\datefrancais{\datefrench}
\def\datefrenchb{\datefrench}
\def\extrasfrancais{\extrasfrench}
\def\extrasfrenchb{\extrasfrench}
\def\noextrasfrancais{\noextrasfrench}
\def\noextrasfrenchb{\noextrasfrench}
%    \end{macrocode}
%
% \begin{macro}{\extrasfrench}
% \begin{macro}{\noextrasfrench}
%    The macro |\extrasfrench| will perform all the extra
%    definitions needed for the French language.
%    The macro |\noextrasfrench| is used to cancel the actions of
%    |\extrasfrench|.\\
%    In French, character ``apostrophe'' is a letter in expressions
%    like |l'ambulance| (French  hyphenation 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 has to be reset to null when exiting
%    French.
%
% \changes{v2.4a}{2009/11/23}{Added a new `if' \cs{FBunicode} and
%    some \cs{lccode} definitions to \cs{extrasfrench} and
%    \cs{noextrasfrench}.}
%
%    French hyphenation patterns are now coded in Unicode, see file
%    \file{hyph-fr.tex}.  XeTeX and LuaTeX engines require some extra
%    code to deal with the French ``apostrophe''.
%    Let's define a new `if' |\FBunicode| which will be true for XeTeX
%    and LuaTeX engines and false for 8-bits engines.
%
%    \begin{macrocode}
\newif\ifFBunicode
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname luatexversion\endcsname\relax
\else
  \FBunicodetrue
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname XeTeXrevision\endcsname\relax
\else
  \FBunicodetrue
\fi
\@namedef{extras\CurrentOption}{\lccode`\'=`\'
                                \ifFBunicode\lccode"2019="2019\fi}
\@namedef{noextras\CurrentOption}{\lccode`\'=0
                                  \ifFBunicode\lccode"2019=0\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    One more thing |\extrasfrench| needs to do is to make sure that
%    ``Frenchspacing'' is in effect.  |\noextrasfrench| will switch
%    ``Frenchspacing'' off again if necessary.
%    \begin{macrocode}
\addto\extrasfrench{\bbl@frenchspacing}
\addto\noextrasfrench{\bbl@nonfrenchspacing}
%    \end{macrocode}
%
%  \subsection{Punctuation}
%  \label{sec-punct}
%
% \changes{v2.5a}{2010/08/10}{Punctation is no longer made active
%    with XeTeX-based engines.}
%
%    As long as no better solution is available, the `double
%    punctuation' characters (|;| |!| |?| and |:|) have to be made
%    |\active| for an automatic control of the amount of space to
%    insert before them.  Xe\TeX{} provides an alternative to active
%    characters and Lua\TeX{} will hopefully do so as well in the
%    (near?) future.
%
%    Before doing so, we have to save the standard definition of
%    |\@makecaption| (which includes two ':') to compare it later to
%    its definition at the |\begin{document}|.
%    \begin{macrocode}
\long\def\STD@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{#1: #2}%
  \ifdim \wd\@tempboxa >\hsize
    #1: #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
%    \end{macrocode}
%
% \changes{v2.5a}{2010/08/10}{Define \cs{Fthinspace} for those who want
%   to customise the width of the space before ; ! and ?.}
%
%    According to the I.N. specifications, the `:' requires a normal
%    space before it, but some people prefer a |\thinspace| (just
%    like the other three). We define |\Fcolonspace| to hold the
%    required amount of space (user customisable). In case some users
%    are not satisfied with |\thinspace|'s width, it is also
%    customisable.
%    \begin{macrocode}
\newcommand*{\Fcolonspace}{\space}
\newcommand*{\Fthinspace}{\thinspace}
%    \end{macrocode}
%
%    Check the availability of |\XeTeXinterchartokenstate| and decide
%    whether the `double punctuation' characters (|;| |!| |?| and |:|)
%    have to be made |\active| or not.
%    \begin{macrocode}
\newif\ifFB@active@punct  \FB@active@puncttrue
\newif\ifFB@xetex@punct
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname XeTeXinterchartokenstate\endcsname\relax
\else
  \FB@xetex@puncttrue\FB@active@punctfalse
\fi
%    \end{macrocode}
%
%    If |\XeTeXinterchartokenstate| is available, we use the
%    ``inter char'' mechanism (as in  polyglossia, see
%    \file{gloss-french.ldf}) to provide correct spacing in French
%    before the four characters |;| |!| |?| and |:| and for French
%    quotes (\texttt{\guillemotleft} and \texttt{\guillemotright}).
%
%    It is assumed that for every character used in French text-mode
%    (except spaces), |\XeTeXcharclass| value is 0 before entering
%    French.  |\XeTeXcharclass| value for spaces is assumed to be 255.
%    Otherwise, the spacing before the `double punctuation' characters
%    will not be correct.
%
%    We switch |\XeTeXinterchartokenstate| to 1 and change the
%    |\XeTeXcharclass| values of |;| |!| |?| |:| |(| |]|
%    \texttt{\guillemotleft} and \texttt{\guillemotright} when
%    entering French. Special care is taken to restore them to their
%    inital values when leaving French.
%    \begin{macrocode}
\newif\ifFBAutoSpaceGuill        \FBAutoSpaceGuilltrue
\ifFB@xetex@punct
   \PackageInfo{frenchb.ldf}{No need for active punctuation characters
                    \MessageBreak with this version of XeTeX! reported}
%    \end{macrocode}
%    We will need the following code (borrowed from
%    \file{zhsusefulmacros.sty}) for loops:
%    \begin{macrocode}
   \@ifundefined{@for}{%
     \def\@nnil{\@nil}%
     \def\@empty{}%
     \def\@fornoop#1\@@#2#3{}%
     \long\def\@for#1:=#2\do#3{%
       \expandafter\def\expandafter\@fortmp\expandafter{#2}%
       \ifx\@fortmp\@empty \else
         \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}\fi}%
     \long\def\@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else
       #5\def#4{#2}\ifx #4\@nnil \else#5\@iforloop #3\@@#4{#5}\fi\fi}%
     \long\def\@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
            \expandafter\@fornoop \else
       #4\relax\expandafter\@iforloop\fi#2\@@#3{#4}}%
     \def\@tfor#1:={\@tf@r#1 }%
     \long\def\@tf@r#1#2\do#3{\def\@fortmp{#2}\ifx\@fortmp\space\else
         \@tforloop#2\@nil\@nil\@@#1{#3}\fi}%
     \long\def\@tforloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
            \expandafter\@fornoop \else
           #4\relax\expandafter\@tforloop\fi#2\@@#3{#4}}%
     }{}%
%    \end{macrocode}
%    New character classes,
%    \begin{macrocode}
   \newcount\FB@interchartokenstateORI
   \newXeTeXintercharclass\FB@punctthick
   \newXeTeXintercharclass\FB@punctthin
   \newXeTeXintercharclass\FB@punctnul
   \newXeTeXintercharclass\FB@punctguilo
   \newXeTeXintercharclass\FB@punctguilf
%    \end{macrocode}
%    We define a command to store the |\XeTeXcharclass| values which
%    will be modified for French (as a comma separated list) and a
%    command to retrieve them.
%    \begin{macrocode}
%   \newcommand*{\FB@charclassesORI}{}
   \def\FB@charclassesORI{}
   \def\empty{}
   \def\FB@parse#1,#2\endparse{\def\FB@class{#1}%
        \def\FB@charclassesORI{#2}}%
%    \end{macrocode}
%
%    The following command will be executed when entering French, it
%    first saves the values to be modified, then fits them to our
%    needs. It also redefines |\shorthandoff| and |\shorthandon|
%    (locally) to avoid error messages with XeTeX-based engines.
%    \begin{macrocode}
   \newcommand*{\FB@xetex@punct@french}{%
%    \end{macrocode}
%    Saving must not be repeated if saved values are already in.
%    \begin{macrocode}
     \ifx\FB@charclassesORI\empty
       \FB@interchartokenstateORI=\XeTeXinterchartokenstate
       \@for\FB@char:={`\:,`\;,`\!,`\?,`\[,`\(,"00AB,"00BB}\do
           {\edef\FB@charclassesORI{\FB@charclassesORI%
                                    \the\XeTeXcharclass\FB@char,}}%
       \let\shorthandonORI\shorthandon
       \let\shorthandoffORI\shorthandoff
     \fi
%    \end{macrocode}
%    Set the classes and interactions between classes.
%    \begin{macrocode}
      \XeTeXinterchartokenstate=1
      \XeTeXcharclass `\: = \FB@punctthick
      \XeTeXinterchartoks \z@ \FB@punctthick = {%
                     \ifhmode\FDP@colonspace\fi}%
      \XeTeXinterchartoks \FB@punctguilf \FB@punctthick = {%
                     \FDP@colonspace}%
      \XeTeXinterchartoks 255 \FB@punctthick = {%
                     \ifhmode\unskip\penalty\@M\Fcolonspace\fi}%
      \@for\FB@char:={`\;,`\!,`\?}\do
          {\XeTeXcharclass\FB@char=\FB@punctthin}%
      \XeTeXinterchartoks \z@ \FB@punctthin = {%
                     \ifhmode\FDP@thinspace\fi}%
      \XeTeXinterchartoks \FB@punctguilf \FB@punctthin = {%
                     \FDP@thinspace}%
      \XeTeXinterchartoks 255 \FB@punctthin = {%
                     \ifhmode\unskip\penalty\@M\Fthinspace\fi}%
%    \end{macrocode}
%    This avoids spurious spaces in (!), (???), etc.
%    \begin{macrocode}
     \@for\FB@char:={`\[,`\(}\do
          {\XeTeXcharclass\FB@char=\FB@punctnul}%
      \XeTeXinterchartoks \FB@punctnul \FB@punctthin = {}%
      \XeTeXcharclass"00AB = \FB@punctguilo
      \XeTeXinterchartoks \FB@punctguilo \z@ = {%
                \ifFBAutoSpaceGuill\FBguill@spacing\fi}%
      \XeTeXinterchartoks \FB@punctguilo 255 = {%
                \ifFBAutoSpaceGuill\FBguill@spacing\ignorespaces\fi}%
      \XeTeXcharclass"00BB = \FB@punctguilf
      \XeTeXinterchartoks \z@ \FB@punctguilf = {%
                \ifFBAutoSpaceGuill\FBguill@spacing\fi}%
      \XeTeXinterchartoks \FB@punctthin \FB@punctguilf = {%
                \ifFBAutoSpaceGuill\FBguill@spacing\fi}%
      \XeTeXinterchartoks 255 \FB@punctguilf = {%
                \ifFBAutoSpaceGuill\unskip\FBguill@spacing\fi}%
%    \end{macrocode}
%    With Xe(La)TeX, French defines no active shorthands.
%    \begin{macrocode}
      \def\shorthandoff##1{%
        \PackageWarning{frenchb.ldf}{\protect\shorthandoff{;:!?} is
          helpless with XeTeX,\MessageBreak use \protect\NoAutoSpacing
          \space *inside a group* instead;\MessageBreak reported}%
      }%
      \def\shorthandon##1{}%
   }
%    \end{macrocode}
%
%    The following command will be executed when leaving French for
%    restoring values and commands modified in French.
%    When French is not the main language,  |\noextrasfrench| is
%    executed `AtBeginDocument', so the test on
%    |\FB@charclassesORI| is mandatory.
%    \begin{macrocode}
   \newcommand*{\FB@xetex@punct@nonfrench}{%
     \ifx\FB@charclassesORI\empty
     \else
       \@for\FB@char:={`\:,`\;,`\!,`\?,`\[,`\(,"00AB,"00BB}\do
            {\expandafter\FB@parse\FB@charclassesORI\endparse
             \XeTeXcharclass\FB@char=\FB@class}%
        \def\FB@charclassesORI{}%
        \XeTeXinterchartokenstate=\FB@interchartokenstateORI
        \let\shorthandon\shorthandonORI
       \let\shorthandoff\shorthandoffORI
     \fi
   }
   \addto\extrasfrench{\FB@xetex@punct@french}
   \addto\noextrasfrench{\FB@xetex@punct@nonfrench}
\fi
%    \end{macrocode}
%
%    Otherwise we need to make the four characters |;| |!| |?| and |:|
%    `active' and provide their definitions.
%    \begin{macrocode}
\ifFB@active@punct
  \initiate@active@char{:}%
  \initiate@active@char{;}%
  \initiate@active@char{!}%
  \initiate@active@char{?}%
%    \end{macrocode}
%    We first tune the amount of space before \texttt{;}
%    \texttt{!}  \texttt{?} and \texttt{:}.  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|.
%    \begin{macrocode}
  \declare@shorthand{french}{;}{%
      \ifhmode
      \ifdim\lastskip>\z@
          \unskip\penalty\@M\Fthinspace
          \else
            \FDP@thinspace
        \fi
      \fi
%    \end{macrocode}
%    Now we can insert a |;| character.
%    \begin{macrocode}
      \string;}
%    \end{macrocode}
%    The next three definitions are very similar.
%    \begin{macrocode}
  \declare@shorthand{french}{!}{%
      \ifhmode
        \ifdim\lastskip>\z@
          \unskip\penalty\@M\Fthinspace
        \else
          \FDP@thinspace
        \fi
      \fi
      \string!}
  \declare@shorthand{french}{?}{%
      \ifhmode
        \ifdim\lastskip>\z@
          \unskip\penalty\@M\Fthinspace
        \else
          \FDP@thinspace
        \fi
      \fi
      \string?}
  \declare@shorthand{french}{:}{%
      \ifhmode
        \ifdim\lastskip>\z@
          \unskip\penalty\@M\Fcolonspace
        \else
          \FDP@colonspace
        \fi
      \fi
      \string:}
%    \end{macrocode}
%    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.
%    \begin{macrocode}
  \declare@shorthand{system}{:}{\string:}
  \declare@shorthand{system}{!}{\string!}
  \declare@shorthand{system}{?}{\string?}
  \declare@shorthand{system}{;}{\string;}
%}
%    \end{macrocode}
%    We specify that the French group of shorthands should be used when
%    switching to French.
%    \begin{macrocode}
  \addto\extrasfrench{%
     \languageshorthands{french}%
%    \end{macrocode}
%    These characters are `turned on' once, later their definition may
%    vary. Don't misunderstand the following code: they keep being
%    active all along the document, even when leaving French.
%    \begin{macrocode}
    \bbl@activate{:}\bbl@activate{;}%
    \bbl@activate{!}\bbl@activate{?}%
  }
  \addto\noextrasfrench{%
    \bbl@deactivate{:}\bbl@deactivate{;}%
    \bbl@deactivate{!}\bbl@deactivate{?}}
\fi
%    \end{macrocode}
%
%    A new `if' |\FBAutoSpacePunctuation| needs to be defined now.
%    \begin{macrocode}
\newif\ifFBAutoSpacePunctuation  \FBAutoSpacePunctuationtrue
%    \end{macrocode}
%
% \changes{v2.3a}{2008/10/10}{\cs{NoAutoSpaceBeforeFDP} and
%    \cs{AutoSpaceBeforeFDP} now set the flag
%    \cs{ifFBAutoSpacePunctuation} accordingly (LaTeX only).}
%
% \changes{v2.3e}{2009/10/10}{Execute \cs{AutoSpaceBeforeFDP}
%    also in LaTeX to define \cs{FDP@colonspace}: needed for
%    tex4ht, pointed out by MPG.}
%
%  \begin{macro}{\AutoSpaceBeforeFDP}
%  \begin{macro}{\NoAutoSpaceBeforeFDP}
%    |\FDP@thinspace| and |\FDP@colonspace| are defined as unbreakable
%    spaces by |\autospace@beforeFDP| or as |\@empty| by
%    |\noautospace@beforeFDP| (internal commands), user commands
%    |\AutoSpaceBeforeFDP| and |\NoAutoSpaceBeforeFDP| do the same and
%    take care of the flag |\ifFBAutoSpacePunctuation| in \LaTeX{}.
%    Set the default now for Plain (done later for \LaTeX).
%    \begin{macrocode}
\def\autospace@beforeFDP{%
          \def\FDP@thinspace{\penalty\@M\Fthinspace}%
          \def\FDP@colonspace{\penalty\@M\Fcolonspace}}
\def\noautospace@beforeFDP{\let\FDP@thinspace\@empty
                            \let\FDP@colonspace\@empty}
\ifLaTeXe
    \def\AutoSpaceBeforeFDP{\autospace@beforeFDP
                            \FBAutoSpacePunctuationtrue}
    \def\NoAutoSpaceBeforeFDP{\noautospace@beforeFDP
                              \FBAutoSpacePunctuationfalse}
\else
    \let\AutoSpaceBeforeFDP\autospace@beforeFDP
    \let\NoAutoSpaceBeforeFDP\noautospace@beforeFDP
  \fi
\AutoSpaceBeforeFDP
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{v2.3a}{2008/10/10}{In LaTeX, frenchb no longer adds spaces
%     before `double punctuation' characters in computer code.
%     Suggested by Yannis Haralambous.}
%
% \changes{v2.3c}{2009/02/07}{Commands \cs{ttfamily}, \cs{rmfamily}
%    and \cs{sffamily} have to be robust.  Bug introduced in 2.3a,
%    pointed out by Manuel P\'egouri\'e-Gonnard.}
%
%    In \LaTeXe{} |\ttfamily| (and hence |\texttt|) will be redefined
%    `AtBeginDocument' as |\ttfamilyFB| so that no space
%    is added before the four |; : ! ?| characters, even if
%    |AutoSpacePunctuation| is true.  |\rmfamily| and |\sffamily| need
%    to be redefined also (|\ttfamily| is not always used inside a
%    group, its effect can be cancelled by |\rmfamily| or |\sffamily|).
%
%    These redefinitions can be canceled if necessary, for instance to
%    recompile older documents, see option |OriginalTypewriter| below.
%
% \changes{v2.4c}{2010/05/23}{In \cs{ttfamilyFB}, also cancel
%    automatic spaces inside French guillemets entered as characters
%    (see \cs{frenchbsetup}).}
%
%    To be consistent with what is done for `double punctuation'
%    characters, |\ttfamilyFB| also switches off insertion of spaces
%    inside French guillemets \emph{when they are typed in as
%    characters} with the `og'/`fg' option in |\frenchbsetup{}|.
%    This is also a workaround for the weird behaviour of these
%    characters in verbatim mode.
%    \begin{macrocode}
\ifLaTeXe
    \let\ttfamilyORI\ttfamily
    \let\rmfamilyORI\rmfamily
    \let\sffamilyORI\sffamily
    \DeclareRobustCommand\ttfamilyFB{%
         \FBAutoSpaceGuillfalse
         \noautospace@beforeFDP\ttfamilyORI}%
    \DeclareRobustCommand\rmfamilyFB{%
         \FBAutoSpaceGuilltrue
         \ifFBAutoSpacePunctuation
           \autospace@beforeFDP\rmfamilyORI
         \else
           \noautospace@beforeFDP\rmfamilyORI
         \fi}%
    \DeclareRobustCommand\sffamilyFB{%
         \FBAutoSpaceGuilltrue
         \ifFBAutoSpacePunctuation
           \autospace@beforeFDP\sffamilyORI
         \else
           \noautospace@beforeFDP\sffamilyORI
         \fi}%
\fi
%    \end{macrocode}
%
% \changes{v2.5a}{2010/08/14}{New command \cs{NoAutoSpacing},
%    suggested by MPG.}
%
%    The following command will switch off active punctuation
%    characters (if any) and disable automatic spacing for French quote
%    characters. It is engine independent (works for \TeX{} and
%    Xe\TeX{} based engines) and is meant to be used inside a group.
%  \begin{macro}{\NoAutoSpacing}
%    \begin{macrocode}
\newcommand*{\NoAutoSpacing}{\FBAutoSpaceGuillfalse
   \ifFB@active@punct\shorthandoff{;:!?}\fi
   \ifFB@xetex@punct\XeTeXinterchartokenstate=0\fi}
%    \end{macrocode}
%  \end{macro}
%
%  \subsection{Commands for French quotation marks}
%  \label{sec-quotes}
%
%  \begin{macro}{\og}
%  \begin{macro}{\fg}
%    The top macros for quotation marks will be called |\og|
%    (``\underline{o}uvrez \underline{g}uillemets'') and |\fg|
%    (``\underline{f}ermez \underline{g}uillemets'').
%    Another option for typesetting quotes in multilingual texts
%    is to use the package \file{csquotes.sty} and its command
%    |\enquote|.
%
%    \begin{macrocode}
\newcommand*{\og}{\@empty}
\newcommand*{\fg}{\@empty}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\guillemotleft}
%  \begin{macro}{\guillemotright}
%  \begin{macro}{\textquoteddblleft}
%  \begin{macro}{\textquoteddblright}
%    \LaTeX{} users are supposed to use 8-bit output encodings (T1,
%    LY1,\dots) to typeset French, those who still stick to OT1 should
%    call |aeguill.sty| or a similar package. In both cases the
%    commands |\guillemotleft| and |\guillemotright| will print the
%    French opening and closing quote characters from the output font.
%    For XeLaTeX, |\guillemotleft| and |\guillemotright| are defined
%    by package \file{xunicode.sty}.
%    We will check `AtBeginDocument' that the proper output encodings
%    are in use (see end of section~\ref{sec-keyval}).
%
% \changes{v2.5a}{2010/08/20}{Change \cs{guillemotleft} and
%    \cs{guillemotright} definitions for Unicode anf provide
%    definitions for \cs{textquotedblleft} and
%    \cs{textquotedbright}.  Insures correct printing of quotes
%    by \cs{og} and \cs{fg} in French and outside.}

%    We give the following definitions for non-LaTeX users only as a
%    fall-back, they are welcome to change them for anything better.
%    \begin{macrocode}
\ifLaTeXe
\else
  \ifFBunicode
     \def\guillemotleft{\char"00AB}
     \def\guillemotright{\char"00BB}
     \def\textquotedblleft{\char"201C}
     \def\textquotedblright{\char"201D}
  \else
    \def\guillemotleft{\leavevmode\raise0.25ex
                       \hbox{$\scriptscriptstyle\ll$}}
    \def\guillemotright{\raise0.25ex
                        \hbox{$\scriptscriptstyle\gg$}}
    \def\textquotedblleft{``}
    \def\textquotedblright{''}
  \fi
  \let\xspace\relax
\fi
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%    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 \emph{after}
%    the opening one, nor \emph{before} the closing one.
%    |\FBguill@spacing| which does the spacing, has been fine tuned by
%    Thierry Bouche.  French quotes (including spacing) are printed by
%    |\FB@og| and |\FB@fg|, the expansion of the top level commands
%    |\og| and |\og| is different in and outside French.
%    We'll try to be smart to users of David~Carlisle's \file{xspace}
%    package: if this package is loaded there will be no need for |{}|
%    or |\ | to get a space after |\fg|, otherwise |\xspace| will be
%    defined as |\relax| (done at the end of this file).
%
%    \begin{macrocode}
\newcommand*{\FBguill@spacing}{\penalty\@M\hskip.8\fontdimen2\font
                                            plus.3\fontdimen3\font
                                           minus.8\fontdimen4\font}
\DeclareRobustCommand*{\FB@og}{\leavevmode\guillemotleft
                               \ifFB@xetex@punct\else\FBguill@spacing\fi}
\DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
                               \ifFB@xetex@punct\else\FBguill@spacing\fi
                               \guillemotright\xspace}
%    \end{macrocode}
%
%    The top level definitions for French quotation marks are switched
%    on and off through the |\extrasfrench| |\noextrasfrench|
%    mechanism. Outside French, |\og| and |\fg| will typeset standard
%    English opening and closing double quotes.
%
% \changes{v2.5a}{2010/08/20}{\cs{og} and \cs{fg} do not print
%    correctly in English when using XeTeX, fixed by using
%    \cs{textquotedblleft} and \cs{textquotedblright} defined above.}
%
%    \begin{macrocode}
\ifLaTeXe
  \def\bbl@frenchguillemets{\renewcommand*{\og}{\FB@og}%
                            \renewcommand*{\fg}{\FB@fg}}
  \def\bbl@nonfrenchguillemets{\renewcommand*{\og}{\textquotedblleft}%
            \renewcommand*{\fg}{\ifdim\lastskip>\z@\unskip\fi
                                   \textquotedblright}}
\else
  \def\bbl@frenchguillemets{\let\og\FB@og
                            \let\fg\FB@fg}
  \def\bbl@nonfrenchguillemets{\def\og{\textquotedblleft}%
              \def\fg{\ifdim\lastskip>\z@\unskip\fi\textquotedblright}}
\fi
\addto\extrasfrench{\bbl@frenchguillemets}
\addto\noextrasfrench{\bbl@nonfrenchguillemets}
%    \end{macrocode}
%
%  \subsection{Date in French}
%
% \begin{macro}{\datefrench}
%    The macro |\datefrench| redefines the command |\today| to
%    produce French dates.
%
% \changes{v2.0}{2006/11/06}{2 '\cs{relax}' added in
%    \cs{today}'s definition.}
%
% \changes{v2.1a}{2008/03/25}{\cs{today} changed (correction in 2.0
%    was wrong: \cs{today} was printed without spaces in toc).}
%
% \changes{v2.5a}{2010/08/20}{Replaced \cs{'}e and \cs{\char94}u
%    by c.s. to work with XeTeX.}
%
%    \begin{macrocode}
\@namedef{date\CurrentOption}{%
  \def\today{{\number\day}\ifnum1=\day {\ier}\fi \space
    \ifcase\month
      \or janvier\or f{\FBeacute}vrier\or mars\or avril\or mai\or
      juin\or juillet\or ao{\FBucirconflexe}t\or septembre\or
      octobre\or novembre\or d{\FBeacute}cembre\fi
    \space \number\year}}
%    \end{macrocode}
% \end{macro}
%
%  \subsection{Extra utilities}
%
%    Let's provide the French user with some extra utilities.
%
% \changes{v2.1a}{2008/03/24}{Command \cs{fup} added to produce
%    better superscripts than \cs{textsuperscript}.}
%
%  \begin{macro}{\up}
%
% \changes{v2.1c}{2008/04/29}{Provide a temporary definition
%    (hyperref safe) of \cs{up} in case it has to be expanded in
%    the preamble (by beamer's \cs{title} command for instance).}
%
% \changes{v2.4d}{2010/07/28}{Command \cs{up} defined with
%    \cs{providecommand} instead of \cs{newcommand} as \cs{up} may be
%    defined elsewhere (catalan.ldf).
%    Bug pointed out by Felip Many\'e i Ballester.}
%
% \changes{v2.5a}{2010/08/21}{Test \cs{@ifundefined} leaves the
%    tested control sequence defined as \cs{relax} when TRUE.
%    Changed \cs{relax} to \cs{undefined} when testing
%    \cs{realsuperscript}.}
%
%  \begin{macro}{\fup}
%
% \changes{v2.1b}{2008/04/02}{Command \cs{fup} changed to use
%    real superscripts from fourier v. 1.6.}
%
% \changes{v2.2a}{2008/05/08}{\cs{newif} and \cs{newdimen} moved
%    before \cs{ifLaTeXe} to avoid an error with plainTeX.}
%
% \changes{v2.3a}{2008/09/30}{\cs{lowercase} changed to
%    \cs{MakeLowercase} as the former doesn't work for non ASCII
%    characters in encodings like applemac, utf-8,\dots}
%
%    |\up| eases the typesetting of superscripts like
%    `1\textsuperscript{er}'.  Up to version 2.0 of |frenchb| |\up| was
%    just a shortcut for |\textsuperscript| in \LaTeXe, but several
%    users complained that |\textsuperscript| typesets superscripts
%    too high and too big, so we now define |\fup| as an attempt to
%    produce better looking superscripts.  |\up| is defined as |\fup|
%    but can be redefined by |\frenchbsetup{FrenchSuperscripts=false}|
%    as |\textsuperscript| for compatibility with previous versions.
%
%    When a font has built-in superscripts, the best thing to do is
%    to just use them, otherwise |\fup| has to simulate superscripts
%    by scaling and raising ordinary letters.  Scaling is done using
%    package \file{scalefnt} which will be loaded at the end of
%    \babel's loading (|frenchb| being an option of babel, it cannot
%    load a package while being read).
%
%    \begin{macrocode}
\newif\ifFB@poorman
\newdimen\FB@Mht
\ifLaTeXe
  \AtEndOfPackage{\RequirePackage{scalefnt}}
%    \end{macrocode}
%    |\FB@up@fake| holds the definition of fake superscripts.
%    The scaling ratio is 0.65, raising is computed to put the top of
%    lower case letters (like `m') just under the top  of upper case
%    letters (like `M'), precisely 12\% down.  The chosen settings
%    look correct for most fonts, but can be tuned by the end-user
%    if necessary by changing |\FBsupR| and |\FBsupS| commands.
%
%    |\FB@lc| is defined as |\MakeLowercase| to inhibit the uppercasing
%    of superscripts (this may happen in page headers with the standard
%    classes but is wrong); |\FB@lc| can be redefined to do nothing
%    by option |LowercaseSuperscripts=false| of |\frenchbsetup{}|.
%    \begin{macrocode}
  \newcommand*{\FBsupR}{-0.12}
  \newcommand*{\FBsupS}{0.65}
  \newcommand*{\FB@lc}[1]{\MakeLowercase{#1}}
  \DeclareRobustCommand*{\FB@up@fake}[1]{%
    \settoheight{\FB@Mht}{M}%
    \addtolength{\FB@Mht}{\FBsupR \FB@Mht}%
    \addtolength{\FB@Mht}{-\FBsupS ex}%
    \raisebox{\FB@Mht}{\scalefont{\FBsupS}{\FB@lc{#1}}}%
    }
%    \end{macrocode}
%    The only packages I currently know to take advantage of real
%    superscripts are a) \file{xltxtra} used in conjunction with
%    XeLaTeX and OpenType fonts having the font feature
%    'VerticalPosition=Superior' (\file{xltxtra} defines
%    |\realsuperscript| and |\fakesuperscript|) and b) \file{fourier}
%    (from version 1.6) when Expert Utopia fonts are available.
%
%    |\FB@up| checks whether the current font is a Type1 `Expert'
%    (or `Pro') font with real superscripts or not (the code works
%    currently only with \file{fourier-1.6} but could work with any
%    Expert Type1 font with built-in superscripts, see below), and
%    decides to use real or fake superscripts.
%    It works as follows: the content of |\f@family| (family name of
%    the current font) is split by |\FB@split| into two pieces, the
%    first three characters (`|fut|' for Fourier, `|ppl|' for Adobe's
%    Palatino, \dots) stored in |\FB@firstthree| and the rest stored
%    in |\FB@suffix| which is expected to be `|x|' or `|j|' for expert
%    fonts.
%    \begin{macrocode}
  \def\FB@split#1#2#3#4\@nil{\def\FB@firstthree{#1#2#3}%
                             \def\FB@suffix{#4}}
  \def\FB@x{x}
  \def\FB@j{j}
  \DeclareRobustCommand*{\FB@up}[1]{%
    \bgroup \FB@poormantrue
      \expandafter\FB@split\f@family\@nil
%    \end{macrocode}
%    Then |\FB@up| looks for a \file{.fd} file named \file{t1fut-sup.fd}
%    (Fourier) or \file{t1ppl-sup.fd} (Palatino), etc. supposed to
%    define the subfamily (|fut-sup| or |ppl-sup|, etc.) giving access
%    to the built-in superscripts.  If the \file{.fd} file is not found
%    by |\IfFileExists|, |\FB@up| falls back on fake superscripts,
%    otherwise |\FB@suffix| is checked to decide whether to use fake or
%    real superscripts.
%    \begin{macrocode}
      \edef\reserved@a{\lowercase{%
         \noexpand\IfFileExists{\f@encoding\FB@firstthree -sup.fd}}}%
      \reserved@a
        {\ifx\FB@suffix\FB@x \FB@poormanfalse\fi
         \ifx\FB@suffix\FB@j \FB@poormanfalse\fi
         \ifFB@poorman \FB@up@fake{#1}%
         \else         \FB@up@real{#1}%
         \fi}%
        {\FB@up@fake{#1}}%
    \egroup}
%    \end{macrocode}
%    |\FB@up@real| just picks up the superscripts from the subfamily
%    (and forces lowercase).
%    \begin{macrocode}
  \newcommand*{\FB@up@real}[1]{\bgroup
       \fontfamily{\FB@firstthree -sup}\selectfont \FB@lc{#1}\egroup}
%    \end{macrocode}
%    |\fup| is now defined as |\FB@up| unless |\realsuperscript| is
%    defined (occurs with XeLaTeX calling \file{xltxtra.sty}).
%    \begin{macrocode}
  \DeclareRobustCommand*{\fup}[1]{%
    \@ifundefined{realsuperscript}%
      {\FB@up{#1}\let\realsuperscript\undefined}%
      {\bgroup\let\fakesuperscript\FB@up@fake
            \realsuperscript{\FB@lc{#1}}\egroup}}
%    \end{macrocode}
%    Temporary definition of |\up|, redefined `AtBeginDocument'as
%    |\fup| or |\textsuperscript| later on while processing the options
%    of |\frenchbsetup{}|.
%    \begin{macrocode}
  \providecommand*{\up}{\relax}
%    \end{macrocode}
%    Poor man's definition of |\up| for Plain.
%    \begin{macrocode}
\else
  \providecommand*{\up}[1]{\leavevmode\raise1ex\hbox{\sevenrm #1}}
\fi
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\ieme}
%  \begin{macro}{\ier}
%  \begin{macro}{\iere}
%  \begin{macro}{\iemes}
%  \begin{macro}{\iers}
%  \begin{macro}{\ieres}
%  Some handy macros for those who don't know how to abbreviate ordinals:
%    \begin{macrocode}
\def\ieme{\up{\lowercase{e}}\xspace}
\def\iemes{\up{\lowercase{es}}\xspace}
\def\ier{\up{\lowercase{er}}\xspace}
\def\iers{\up{\lowercase{ers}}\xspace}
\def\iere{\up{\lowercase{re}}\xspace}
\def\ieres{\up{\lowercase{res}}\xspace}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
% \changes{v2.1c}{2008/04/29}{Added commands \cs{Nos} and \cs{nos}.}
%
%  \begin{macro}{\No}
%  \begin{macro}{\no}
%  \begin{macro}{\Nos}
%  \begin{macro}{\nos}
%  \begin{macro}{\primo}
%  \begin{macro}{\fprimo)}
%    And some more macros relying on |\up| for numbering,
%    first two support macros.
%    \begin{macrocode}
\newcommand*{\FrenchEnumerate}[1]{%
                       #1\up{\lowercase{o}}\kern+.3em}
\newcommand*{\FrenchPopularEnumerate}[1]{%
                       #1\up{\lowercase{o}})\kern+.3em}
%    \end{macrocode}
%
%    Typing |\primo| should result in `$1^{\rm o}$\kern+.3em',
%    \begin{macrocode}
\def\primo{\FrenchEnumerate1}
\def\secundo{\FrenchEnumerate2}
\def\tertio{\FrenchEnumerate3}
\def\quarto{\FrenchEnumerate4}
%    \end{macrocode}
%    while typing |\fprimo)| gives `1$^{\rm o}$)\kern+.3em.
%    \begin{macrocode}
\def\fprimo){\FrenchPopularEnumerate1}
\def\fsecundo){\FrenchPopularEnumerate2}
\def\ftertio){\FrenchPopularEnumerate3}
\def\fquarto){\FrenchPopularEnumerate4}
%    \end{macrocode}
%
%    Let's provide four macros for the common abbreviations
%    of ``Num\'ero''.
%    \begin{macrocode}
\DeclareRobustCommand*{\No}{N\up{\lowercase{o}}\kern+.2em}
\DeclareRobustCommand*{\no}{n\up{\lowercase{o}}\kern+.2em}
\DeclareRobustCommand*{\Nos}{N\up{\lowercase{os}}\kern+.2em}
\DeclareRobustCommand*{\nos}{n\up{\lowercase{os}}\kern+.2em}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\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.  Note that this command has changed
%    with version~2 of |frenchb|: a |\kern0pt| is used instead of |\hbox|
%    because |\hbox| would break microtype's font expansion; as a
%    (positive?) side effect, composed names (such as Dupont-Durand)
%    can now be hyphenated on explicit hyphens.
%    Usage: |Jean~\bsc{Duchemin}|.
%
% \changes{v2.0}{2006/11/06}{\cs{hbox} dropped, replaced by
%    \cs{kern0pt}.}
%
%    \begin{macrocode}
\DeclareRobustCommand*{\bsc}[1]{\leavevmode\begingroup\kern0pt
                                           \scshape #1\endgroup}
\ifLaTeXe\else\let\scshape\relax\fi
%    \end{macrocode}
%  \end{macro}
%
%    Some definitions for special characters.  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
%    \emph{not} be used in math mode, its name in math mode is
%    |\backslash|.  |\degre|  can be accessed by the command |\r{}|
%    for ring accent.
%
%    \begin{macrocode}
\ifLaTeXe
  \DeclareTextSymbol{\at}{T1}{64}
  \DeclareTextSymbol{\circonflexe}{T1}{94}
  \DeclareTextSymbol{\tild}{T1}{126}
  \DeclareTextSymbolDefault{\at}{T1}
  \DeclareTextSymbolDefault{\circonflexe}{T1}
  \DeclareTextSymbolDefault{\tild}{T1}
  \DeclareRobustCommand*{\boi}{\textbackslash}
  \DeclareRobustCommand*{\degre}{\r{}}
\else
  \def\T@one{T1}
  \ifx\f@encoding\T@one
    \newcommand*{\degre}{\char6}
  \else
    \newcommand*{\degre}{\char23}
  \fi
  \newcommand*{\at}{\char64}
  \newcommand*{\circonflexe}{\char94}
  \newcommand*{\tild}{\char126}
  \newcommand*{\boi}{$\backslash$}
\fi
%    \end{macrocode}
%
% \changes{v2.5a}{2010/08/20}{New definitions needed for XeTeX to print
%    properly some dates and captions: using c.s. like \cs{'e} do not
%    work with XeTeX (OK with XeLaTeX).}
%
%    French dates and captions make use of four non-ascii characters
%    (\texttt{\`a}, \texttt{\`e},  \texttt{\'e} and \texttt{\^u}).
%    This is fine except for (plain) XeTeX (|\accent| commands are not
%    implemented), so we define four new commands to deal with this
%    issue; we also redefine |\degre| (it is an accent in LaTeX).
%    \begin{macrocode}
\newcommand*{\FBagrave}{\`a}
\newcommand*{\FBegrave}{\`e}
\newcommand*{\FBeacute}{\'e}
\newcommand*{\FBucirconflexe}{\^u}
\ifFBunicode
  \ifLaTeXe
  \else
    \def\degre{\char"00B0}
    \def\FBagrave{\char"00E0}
    \def\FBegrave{\char"00E8}
    \def\FBeacute{\char"00E9}
    \def\FBucirconflexe{\char"00FB}
  \fi
\fi
%    \end{macrocode}
%
%  \begin{macro}{\degres}
%    We now define a macro |\degres| for typesetting the abbreviation
%    for `degrees' (as in `degrees Celsius'). As the bounding box of
%    the character `degree' has \emph{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|).
%
%    If the \TeX{} Companion fonts are available (\file{textcomp.sty}),
%    we pick up |\textdegree| from them instead of using emulating
%    `degrees' from the |\r{}| accent. Otherwise we overwrite the
%    (poor) definition of |\textdegree| given in \file{latin1.def},
%    \file{applemac.def} etc. (called by  \file{inputenc.sty}) by
%    our definition of |\degres|. We also advice the user (once only)
%    to use TS1-encoding.
%
% \changes{v2.1c}{2008/04/29}{Provide a temporary definition (hyperref
%    safe) of \cs{degres} in case it has to be expanded in the preamble
%    (by beamer's \cs{title} command for instance).}
%
%    \begin{macrocode}
\ifLaTeXe
  \newcommand*{\degres}{\degre}
  \def\Warning@degree@TSone{%
        \PackageWarning{frenchb.ldf}{%
           Degrees would look better in TS1-encoding:
           \MessageBreak add \protect
           \usepackage{textcomp} to the preamble.
           \MessageBreak Degrees used}}
  \ifFBunicode\global\let\Warning@degree@TSone\relax\fi
  \AtBeginDocument{\expandafter\ifx\csname M@TS1\endcsname\relax
                     \DeclareRobustCommand*{\degres}{%
                       \leavevmode\hbox to 0.3em{\hss\degre\hss}%
                       \Warning@degree@TSone
                       \global\let\Warning@degree@TSone\relax}%
                     \let\textdegree\degres
                   \else
                     \DeclareRobustCommand*{\degres}{%
                         \hbox{\UseTextSymbol{TS1}{\textdegree}}}%
                   \fi}
\else
  \newcommand*{\degres}{%
    \leavevmode\hbox to 0.3em{\hss\degre\hss}}
\fi
%    \end{macrocode}
%  \end{macro}
%
%  \subsection{Formatting numbers}
%  \label{sec-numbers}
%
%  \begin{macro}{\DecimalMathComma}
%  \begin{macro}{\StandardMathComma}
%    As mentioned in the \TeX{}book p.~134, the comma is of type
%    |\mathpunct| in math mode: it is automatically followed by a
%    space. This is convenient in lists and intervals but
%    unpleasant when the comma is used as a decimal separator
%    in French: it has to be entered as |{,}|.
%    |\DecimalMathComma| makes the comma be an ordinary character
%    (of type |\mathord|) in French \emph{only} (no space added);
%    |\StandardMathComma| switches back to the standard behaviour
%    of the comma.
%    \begin{macrocode}
\newcount\std@mcc
\newcount\dec@mcc
\std@mcc=\mathcode`\,
\dec@mcc=\std@mcc
\@tempcnta=\std@mcc
\divide\@tempcnta by "1000
\multiply\@tempcnta by "1000
\advance\dec@mcc by -\@tempcnta
\newcommand*{\DecimalMathComma}{\iflanguage{french}%
                                 {\mathcode`\,=\dec@mcc}{}%
   \addto\extrasfrench{\mathcode`\,=\dec@mcc}}
\newcommand*{\StandardMathComma}{\mathcode`\,=\std@mcc
   \addto\extrasfrench{\mathcode`\,=\std@mcc}}
\addto\noextrasfrench{\mathcode`\,=\std@mcc}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\nombre}
%
% \changes{v2.0}{2006/11/06}{\cs{nombre} requires now numprint.sty.}
%
%    The command |\nombre| is now borrowed from \file{numprint.sty} for
%    \LaTeXe.  There is no point to maintain the former tricky code
%    when a package is dedicated to do the same job and more.
%    For Plain based formats, |\nombre| no longer formats numbers,
%    it prints them as is and issues a warning about the change.
%
%    Fake command |\nombre| for Plain based formats, warning users of
%    |frenchb| v.1.x. of the change.
%    \begin{macrocode}
\newcommand*{\nombre}[1]{{#1}\message{%
     *** \noexpand\nombre no longer formats numbers\string! ***}}%
%    \end{macrocode}
%  \end{macro}
%
%    The next definitions only make sense for \LaTeXe. Let's cleanup
%    and exit if the format in Plain based.
%
%    \begin{macrocode}
\let\FBstop@here\relax
\def\FBclean@on@exit{\let\ifLaTeXe\undefined
                     \let\LaTeXetrue\undefined
                     \let\LaTeXefalse\undefined}
\ifx\magnification\@undefined
\else
   \def\FBstop@here{\let\STD@makecaption\relax
                    \FBclean@on@exit
                    \ldf@quit\CurrentOption\endinput}
\fi
\FBstop@here
%    \end{macrocode}
%
%    What follows now is for \LaTeXe{} \emph{only}.
%    We redefine |\nombre| for \LaTeXe. A warning is issued
%    at the first call of |\nombre| if |\numprint| is not
%    defined, suggesting what to do.  The package \file{numprint}
%    is \emph{not} loaded automatically by |frenchb| because of
%    possible options conflict.
%
% \changes{v2.5a}{2010/08/21}{Test \cs{@ifundefined} leaves the
%    tested control sequence defined as \cs{relax} when TRUE.
%    Changed \cs{relax} to \cs{undefined} when testing
%    \cs{numprint}.}
%
%    \begin{macrocode}
\renewcommand*{\nombre}[1]{\Warning@nombre\numprint{#1}}
\newcommand*{\Warning@nombre}{%
   \@ifundefined{numprint}%
      {\PackageWarning{frenchb.ldf}{%
         \protect\nombre\space now relies on package numprint.sty,
         \MessageBreak add \protect
         \usepackage[autolanguage]{numprint}\MessageBreak
         to your preamble *after* loading babel, \MessageBreak
         see file numprint.pdf for other options.\MessageBreak
         \protect\nombre\space called}%
       \global\let\Warning@nombre\relax
       \global\let\numprint\undefined
      }{}%
}
%    \end{macrocode}
%
% \changes{v2.0c}{2007/06/25}{There is no need to define here
%    numprint's command \cs{npstylefrench}, it will be redefined
%    `AtBeginDocument' by \cs{FBprocess@options}.}
%
% \changes{v2.0c}{2007/06/25}{\cs{ThinSpaceInFrenchNumbers} added
%     for compatibility with frenchb-1.x.}
%
%    \begin{macrocode}
\newcommand*{\ThinSpaceInFrenchNumbers}{%
   \PackageWarning{frenchb.ldf}{%
         Type \protect\frenchbsetup{ThinSpaceInFrenchNumbers}
         \MessageBreak Command \protect\ThinSpaceInFrenchNumbers\space
         is no longer\MessageBreak  defined in frenchb v.2,}}
%    \end{macrocode}
%
%  \subsection{Caption names}
%
%    The next step consists of defining the French equivalents for
%    the \LaTeX{} caption names.
%
% \begin{macro}{\captionsfrench}
%    Let's first define  |\captionsfrench| which sets all strings used
%    in the four standard document classes provided with \LaTeX.
%
% \changes{v2.0}{2006/11/06}{`Fig.' changed to `Figure' and
%     `Tab.' to `Table'.}
%
% \changes{v2.0}{2006/12/15}{Set \cs{CaptionSeparator} in
%     \cs{extrasfrench} now instead of \cs{captionsfrench}
%     because it has to be reset when leaving French.}
%
% \changes{v2.5a}{2010/08/16}{\cs{emph} deleted in \cs{seename}
%     and \cs{alsoname} to match what is done for the other languages.
%     Suggested by Marc Baudoin.}
%
% \changes{v2.5a}{2010/08/20}{Replaced \cs{'e}, \cs{`e} and \cs{`a}
%    by c.s. to work with XeTeX.}
%
%    \begin{macrocode}
\@namedef{captions\CurrentOption}{%
   \def\refname{R{\FBeacute}f{\FBeacute}rences}%
   \def\abstractname{R{\FBeacute}sum{\FBeacute}}%
   \def\bibname{Bibliographie}%
   \def\prefacename{Pr{\FBeacute}face}%
   \def\chaptername{Chapitre}%
   \def\appendixname{Annexe}%
   \def\contentsname{Table des mati{\FBegrave}res}%
   \def\listfigurename{Table des figures}%
   \def\listtablename{Liste des tableaux}%
   \def\indexname{Index}%
   \def\figurename{{\scshape Figure}}%
   \def\tablename{{\scshape Table}}%
%    \end{macrocode}
%   ``Premi\`ere partie'' instead of ``Part I''.
%    \begin{macrocode}
   \def\partname{\protect\@Fpt partie}%
   \def\@Fpt{{\ifcase\value{part}\or Premi{\FBegrave}re\or
       Deuxi{\FBegrave}me\or Troisi{\FBegrave}me\or
       Quatri{\FBegrave}me\or Cinqui{\FBegrave}me\or
       Sixi{\FBegrave}me\or Septi{\FBegrave}me\or Huiti{\FBegrave}me\or
       Neuvi{\FBegrave}me\or Dixi{\FBegrave}me\or Onzi{\FBegrave}me\or
       Douzi{\FBegrave}me\or Treizi{\FBegrave}me\or
       Quatorzi{\FBegrave}me\or Quinzi{\FBegrave}me\or
       Seizi{\FBegrave}me\or Dix-septi{\FBegrave}me\or
       Dix-huiti{\FBegrave}me\or Dix-neuvi{\FBegrave}me\or
       Vingti{\FBegrave}me\fi}\space\def\thepart{}}%
   \def\pagename{page}%
   \def\seename{voir}%
   \def\alsoname{voir aussi}%
   \def\enclname{P.~J. }%
   \def\ccname{Copie {\FBagrave} }%
   \def\headtoname{}%
   \def\proofname{D{\FBeacute}monstration}%
   \def\glossaryname{Glossaire}%
   }
%    \end{macrocode}
% \end{macro}
%
%    As some users who choose |frenchb| or |francais| as option of
%    \babel, might customise |\captionsfrenchb| or |\captionsfrancais|
%    in the preamble, we merge their changes at the |\begin{document}|
%    when they do so.
%    The other variants of French (canadien, acadian) are defined by
%    checking if the relevant option was used and then adding one extra
%    level of expansion.
%
%    \begin{macrocode}
\AtBeginDocument{\let\captions@French\captionsfrench
                 \@ifundefined{captionsfrenchb}%
                    {\let\captions@Frenchb\relax}%
                    {\let\captions@Frenchb\captionsfrenchb}%
                 \@ifundefined{captionsfrancais}%
                    {\let\captions@Francais\relax}%
                    {\let\captions@Francais\captionsfrancais}%
                 \def\captionsfrench{\captions@French
                        \captions@Francais\captions@Frenchb}%
                 \def\captionsfrancais{\captionsfrench}%
                 \def\captionsfrenchb{\captionsfrench}%
                 \iflanguage{french}{\captionsfrench}{}%
                }
\@ifpackagewith{babel}{canadien}{%
  \def\captionscanadien{\captionsfrench}%
  \def\datecanadien{\datefrench}%
  \def\extrascanadien{\extrasfrench}%
  \def\noextrascanadien{\noextrasfrench}%
  }{}
\@ifpackagewith{babel}{acadian}{%
  \def\captionsacadian{\captionsfrench}%
  \def\dateacadian{\datefrench}%
  \def\extrasacadian{\extrasfrench}%
  \def\noextrasacadian{\noextrasfrench}%
  }{}
%    \end{macrocode}
%
% \begin{macro}{\CaptionSeparator}
%    Let's consider now captions in figures and tables.
%    In French, captions in figures and tables should be printed with
%    endash (`--') instead of the standard `:'.
%
%    The standard definition of |\@makecaption| (e.g., the one provided
%    in article.cls, report.cls, book.cls which is frozen for \LaTeXe{}
%    according to Frank Mittelbach), has been saved in
%    |\STD@makecaption| before making `:' active
%    (see section~\ref{sec-punct}). `AtBeginDocument' we compare it to
%    its current definition (some classes like koma-script classes,
%    AMS classes, ua-thesis.cls\dots change it).
%    If they are identical, |frenchb| just adds a hook called
%    |\CaptionSeparator| to |\@makecaption|, |\CaptionSeparator|
%    defaults to `: ' as in the standard |\@makecaption|, and will be
%    changed to ` -- ' in French.
%    If the definitions differ, |frenchb| doesn't overwrite the changes,
%    but prints a message in the .log file.
%
% \changes{v2.4a}{2009/11/23}{\cs{PackageWarning} changed to
%     \cs{FBWarning} (in case \cs{@makecaption} has been customized).
%     \cs{FBWarning} is defined as \cs{PackageWarning} by default but
%     can be made silent using \cs{frenchbsetup}, (suggested by MPG).}
%
%    \begin{macrocode}
\newcommand{\FBWarning}[2]{\PackageWarning{#1}{#2}}
\def\CaptionSeparator{\string:\space}
\long\def\FB@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{#1\CaptionSeparator #2}%
  \ifdim \wd\@tempboxa >\hsize
    #1\CaptionSeparator #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
\AtBeginDocument{%
  \ifx\@makecaption\STD@makecaption
      \global\let\@makecaption\FB@makecaption
  \else
    \@ifundefined{@makecaption}%
       {\let\@makecaption\undefined}%
       {\FBWarning{frenchb.ldf}%
        {The definition of \protect\@makecaption\space
         has been changed,\MessageBreak
         frenchb will NOT customise it;\MessageBreak reported}%
       }%
  \fi
  \let\FB@makecaption\relax
  \let\STD@makecaption\relax
}
\addto\extrasfrench{%
   \def\CaptionSeparator{\space\textendash\space}}
\addto\noextrasfrench{%
   \def\CaptionSeparator{\string:\space}}
%    \end{macrocode}
% \end{macro}
%
%  \subsection{French lists}
%  \label{sec-lists}
%
%  \begin{macro}{\listFB}
%  \begin{macro}{\listORI}
%    Vertical spacing in general lists should be shorter in French
%    texts than the defaults provided by \LaTeX.
%    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; as most lists are based on
%    |\list| we will define a variant of |\list| (|\listFB|) to
%    be used in French.
%
%    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 \emph{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 \emph{not} null.
%
%    |\endlist| is not redefined, but |\endlistORI| is provided for
%    the users who prefer to define their own lists from the original
%    command, they can code: |\begin{listORI}{}{} \end{listORI}|.
%    \begin{macrocode}
\let\listORI\list
\let\endlistORI\endlist
\def\FB@listsettings{%
      \setlength{\itemsep}{0.4ex plus 0.2ex minus 0.2ex}%
      \setlength{\parsep}{0.4ex plus 0.2ex minus 0.2ex}%
      \setlength{\topsep}{0.8ex plus 0.4ex minus 0.4ex}%
      \setlength{\partopsep}{0.4ex plus 0.2ex minus 0.2ex}%
%    \end{macrocode}
%    |\parskip| is of type `skip', its mean value only (\emph{not
%    the glue}) should be subtracted from |\topsep| and added to
%    |\partopsep|, so convert |\parskip| to a `dimen' using
%    |\@tempdima|.
%    \begin{macrocode}
      \@tempdima=\parskip
      \addtolength{\topsep}{-\@tempdima}%
      \addtolength{\partopsep}{\@tempdima}}%
\def\listFB#1#2{\listORI{#1}{\FB@listsettings #2}}%
\let\endlistFB\endlist
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\itemizeFB}
%  \begin{macro}{\itemizeORI}
%  \begin{macro}{\bbl@frenchlabelitems}
%  \begin{macro}{\bbl@nonfrenchlabelitems}
%    Let's now consider French itemize lists.  They differ from those
%    provided by the standard \LaTeXe{} classes:
%    \begin{itemize}
%      \item vertical spacing between items, before and after
%         the list, should be \emph{null} with \emph{no glue} added;
%      \item the item labels of a first level list should be vertically
%          aligned on the paragraph's first character (i.e. at
%          |\parindent| from the left margin);
%      \item the `\textbullet' is never used in French itemize-lists,
%          a long dash `--' is preferred for all levels. The item label
%          used in French is stored in |\FrenchLabelItem}|, it defaults
%          to `--' and can be changed using |\frenchbsetup{}| (see
%          section~\ref{sec-keyval}).
%    \end{itemize}
%
%    \begin{macrocode}
\newcommand*{\FrenchLabelItem}{\textendash}
\newcommand*{\Frlabelitemi}{\FrenchLabelItem}
\newcommand*{\Frlabelitemii}{\FrenchLabelItem}
\newcommand*{\Frlabelitemiii}{\FrenchLabelItem}
\newcommand*{\Frlabelitemiv}{\FrenchLabelItem}
%    \end{macrocode}
%    |\bbl@frenchlabelitems| saves current itemize labels and changes
%    them to their value in French. This code should never be executed
%    twice in a row, so we need a new flag that will be set and reset
%    by |\bbl@nonfrenchlabelitems| and |\bbl@frenchlabelitems|.
%    \begin{macrocode}
\newif\ifFB@enterFrench  \FB@enterFrenchtrue
\def\bbl@frenchlabelitems{%
  \ifFB@enterFrench
    \let\@ltiORI\labelitemi
    \let\@ltiiORI\labelitemii
    \let\@ltiiiORI\labelitemiii
    \let\@ltivORI\labelitemiv
    \let\labelitemi\Frlabelitemi
    \let\labelitemii\Frlabelitemii
    \let\labelitemiii\Frlabelitemiii
    \let\labelitemiv\Frlabelitemiv
    \FB@enterFrenchfalse
  \fi
}
\let\itemizeORI\itemize
\let\enditemizeORI\enditemize
\let\enditemizeFB\enditemize
\def\itemizeFB{%
    \ifnum \@itemdepth >\thr@@\@toodeep\else
      \advance\@itemdepth\@ne
      \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
      \expandafter
      \listORI
      \csname\@itemitem\endcsname
      {\settowidth{\labelwidth}{\csname\@itemitem\endcsname}%
       \setlength{\leftmargin}{\labelwidth}%
       \addtolength{\leftmargin}{\labelsep}%
       \ifnum\@listdepth=0
         \setlength{\itemindent}{\parindent}%
       \else
         \addtolength{\leftmargin}{\parindent}%
       \fi
       \setlength{\itemsep}{\z@}%
       \setlength{\parsep}{\z@}%
       \setlength{\topsep}{\z@}%
       \setlength{\partopsep}{\z@}%
%    \end{macrocode}
%    |\parskip| is of type `skip', its mean value only (\emph{not
%    the glue}) should be subtracted from |\topsep| and added to
%    |\partopsep|, so convert |\parskip| to a `dimen' using
%    |\@tempdima|.
%    \begin{macrocode}
       \@tempdima=\parskip
       \addtolength{\topsep}{-\@tempdima}%
       \addtolength{\partopsep}{\@tempdima}}%
    \fi}
%    \end{macrocode}
%    The user's changes in labelitems are saved when leaving French for
%    further use when switching back to French.  This code should never
%    be executed twice in a row (toggle with |\bbl@frenchlabelitems|).
%    \begin{macrocode}
\def\bbl@nonfrenchlabelitems{%
  \ifFB@enterFrench
  \else
      \let\Frlabelitemi\labelitemi
      \let\Frlabelitemii\labelitemii
      \let\Frlabelitemiii\labelitemiii
      \let\Frlabelitemiv\labelitemiv
      \let\labelitemi\@ltiORI
      \let\labelitemii\@ltiiORI
      \let\labelitemiii\@ltiiiORI
      \let\labelitemiv\@ltivORI
      \FB@enterFrenchtrue
  \fi
}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%  \subsection{French indentation of sections}
%  \label{sec-indent}
%
%  \begin{macro}{\bbl@frenchindent}
%  \begin{macro}{\bbl@nonfrenchindent}
%    In French the first paragraph of each section should be indented,
%    this is another difference with US-English. This is controlled by
%    the flag |\if@afterindent|.
%
% \changes{v2.3d}{2009/03/16}{Bug correction: previous versions of
%    frenchb set the flag \cs{if@afterindent} to false outside
%    French which is correct for English but wrong for some languages
%    like Spanish.  Pointed out by Juan Jos\'e Torrens.}
%
%    We will need to save the value of the flag |\if@afterindent|
%    `AtBeginDocument' before eventually changing its value.
%
%    \begin{macrocode}
\def\bbl@frenchindent{\let\@afterindentfalse\@afterindenttrue
                      \@afterindenttrue}
\def\bbl@nonfrenchindent{\let\@afterindentfalse\@aifORI
                         \@afterindentfalse}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \subsection{Formatting footnotes}
%  \label{sec-footnotes}
%
% \changes{v2.0}{2006/11/06}{Footnotes are now printed
%     by default `\`a la fran\c caise' for the whole document.}
%
% \changes{v2.0b}{2007/04/18}{Footnotes: Just do nothing
%    (except warning) when the bigfoot package is loaded.}
%
%    The \file{bigfoot} package deeply changes the way footnotes are
%    handled. When |bigfoot| is loaded, we just warn the user that
%    |frenchb| will drop the customisation of footnotes.
%
%    The layout of footnotes is controlled by two flags
%    |\ifFBAutoSpaceFootnotes| and |\ifFBFrenchFootnotes| which are
%    set by options of |\frenchbsetup{}| (see section~\ref{sec-keyval}).
%    Notice that the layout of footnotes \emph{does not depend} on the
%    current language (just think of two footnotes on the same page
%    looking different because one was called in a French part, the
%    other one in English!).
%
%    When |\ifFBAutoSpaceFootnotes| is true, |\@footnotemark| (whose
%    definition is saved at the |\begin{document}| in order to include
%    any customisation that packages might have done) is redefined to
%    add a thin space before the number or symbol calling a footnote
%    (any space typed in is removed first).  This has no effect on
%    the layout of the footnote itself.
%
% \changes{v2.4a}{2009/11/23}{\cs{PackageWarning} changed to
%      \cs{FBWarning} (when bigfoot package in use).}
%
%    \begin{macrocode}
\AtBeginDocument{\@ifpackageloaded{bigfoot}%
                   {\FBWarning{frenchb.ldf}%
                     {bigfoot package in use.\MessageBreak
                      frenchb will NOT customise footnotes;\MessageBreak
                      reported}}%
                   {\let\@footnotemarkORI\@footnotemark
                    \def\@footnotemarkFB{\leavevmode\unskip\unkern
                                         \,\@footnotemarkORI}%
                    \ifFBAutoSpaceFootnotes
                      \let\@footnotemark\@footnotemarkFB
                    \fi}%
                }
%    \end{macrocode}
%
%    We then define |\@makefntextFB|, a variant of |\@makefntext|
%    which is responsible for the layout of footnotes, to match the
%    specifications of the French `Imprimerie Nationale':  footnotes
%    will be indented by |\parindentFFN|, numbers (if any) typeset on
%    the baseline (instead of superscripts) and followed by a dot
%    and an half quad space. Whenever symbols are used to number
%    footnotes (as in |\thanks| for instance), we switch back to the
%    standard layout (the French layout of footnotes is meant for
%    footnotes numbered by Arabic or Roman digits).
%
% \changes{v2.0}{2006/11/06}{\cs{parindentFFN} not changed if
%    already defined (required by JA for cah-gut.cls).}
%
% \changes{v2.3b}{2008/12/06}{New commands \cs{dotFFN} and
%    \cs{kernFFN} for more flexibility (suggested by JA).}
%
%    The value of |\parindentFFN| will be redefined at the
%    |\begin{document}|, as the maximum of |\parindent| and 1.5em
%    \emph{unless} it has been set in the preamble (the weird value
%    10in is just for testing whether |\parindentFFN| has been set
%    or not).
%
%    \begin{macrocode}
\newcommand*{\dotFFN}{.}
\newcommand*{\kernFFN}{\kern .5em}
\newdimen\parindentFFN
\parindentFFN=10in
\def\ftnISsymbol{\@fnsymbol\c@footnote}
\long\def\@makefntextFB#1{\ifx\thefootnote\ftnISsymbol
                            \@makefntextORI{#1}%
                          \else
                            \parindent=\parindentFFN
                            \rule\z@\footnotesep
                            \setbox\@tempboxa\hbox{\@thefnmark}%
                            \ifdim\wd\@tempboxa>\z@
                              \llap{\@thefnmark}\dotFFN\kernFFN
                            \fi #1
                          \fi}%
%    \end{macrocode}
%
%    We save the standard definition of |\@makefntext| at the
%    |\begin{document}|, and then redefine |\@makefntext| according to
%    the value of flag |\ifFBFrenchFootnotes| (true or false).
%
%    \begin{macrocode}
\AtBeginDocument{\@ifpackageloaded{bigfoot}{}%
                  {\ifdim\parindentFFN<10in
                   \else
                      \parindentFFN=\parindent
                      \ifdim\parindentFFN<1.5em\parindentFFN=1.5em\fi
                   \fi
                   \let\@makefntextORI\@makefntext
                   \long\def\@makefntext#1{%
                      \ifFBFrenchFootnotes
                         \@makefntextFB{#1}%
                      \else
                         \@makefntextORI{#1}%
                      \fi}%
                  }%
                }
%    \end{macrocode}
%
%    For compatibility reasons, we provide definitions for the commands
%    dealing with the layout of footnotes in |frenchb| version~1.6.
%    |\frenchbsetup{}| (see in section \ref{sec-keyval}) should be
%    preferred for setting these options.  |\StandardFootnotes| may
%    still be used locally (in minipages for instance), that's why the
%    test |\ifFBFrenchFootnotes| is done inside |\@makefntext|.
%    \begin{macrocode}
\newcommand*{\AddThinSpaceBeforeFootnotes}{\FBAutoSpaceFootnotestrue}
\newcommand*{\FrenchFootnotes}{\FBFrenchFootnotestrue}
\newcommand*{\StandardFootnotes}{\FBFrenchFootnotesfalse}
%    \end{macrocode}
%
%  \subsection{Global layout}
%  \label{sec-global}
%
%    In multilingual documents, some typographic rules must depend
%    on the current language (e.g., hyphenation, typesetting of
%    numbers, spacing before double punctuation\dots), others should,
%    IMHO, be kept global to the document: especially the layout of
%    lists (see~\ref{sec-lists}) and footnotes
%    (see~\ref{sec-footnotes}), and the indentation of the first
%    paragraph of sections (see~\ref{sec-indent}).
%
%    From version 2.2 on, if |frenchb| is \babel's ``main language''
%    (i.e. last language option at \babel's loading), |frenchb|
%    customises the layout (i.e. lists, indentation of the first
%    paragraphs of sections and footnotes) in the whole document
%    regardless the current language.   On the other hand, if |frenchb|
%    is \emph{not} \babel's ``main language'', it leaves the layout
%    unchanged both in French and in other languages.
%
%  \begin{macro}{\FrenchLayout}
%  \begin{macro}{\StandardLayout}
%    The former commands |\FrenchLayout| and |\StandardLayout| are kept
%    for compatibility reasons but should no longer be used.
%
% \changes{v2.0g}{2008/03/23}{Flag \cs{ifFBStandardLayout} not checked
%     by \cs{FBprocess@options}, low-level flags have to be set
%     one by one.}
%
%    \begin{macrocode}
\newcommand*{\FrenchLayout}{%
    \FBGlobalLayoutFrenchtrue
    \PackageWarning{frenchb.ldf}%
    {\protect\FrenchLayout\space is obsolete.  Please use\MessageBreak
     \protect\frenchbsetup{GlobalLayoutFrench} instead.}%
}
\newcommand*{\StandardLayout}{%
  \FBReduceListSpacingfalse
  \FBCompactItemizefalse
  \FBStandardItemLabelstrue
  \FBIndentFirstfalse
  \FBFrenchFootnotesfalse
  \FBAutoSpaceFootnotesfalse
  \PackageWarning{frenchb.ldf}%
    {\protect\StandardLayout\space is obsolete.  Please use\MessageBreak
    \protect\frenchbsetup{StandardLayout} instead.}%
}
\@onlypreamble\FrenchLayout
\@onlypreamble\StandardLayout
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \subsection{Dots\dots}
%  \label{sec-dots}
%
%  \begin{macro}{\FBtextellipsis}
%    \LaTeXe'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 |\FBtextellipsis| for French (in \LaTeXe{} only).
%
%    The |\if| construction in the \LaTeXe{} definition of |\dots|
%    doesn't allow the use of |xspace| (|xspace| is always followed
%    by a |\fi|), so we use the AMS-\LaTeX{} construction of |\dots|;
%    this has to be done `AtBeginDocument' not to be overwritten
%    when \file{amsmath.sty} is loaded after \babel.
%
% \changes{v2.0}{2006/11/06}{Added special case for LY1 encoding,
%    see  bug report from Bruno Voisin (2004/05/18).}
%
%    LY1 has a ready made character for |\textellipsis|, it should be
%    used in French too (pointed out by Bruno Voisin).
%
%    \begin{macrocode}
\DeclareTextSymbol{\FBtextellipsis}{LY1}{133}
\DeclareTextCommandDefault{\FBtextellipsis}{%
    .\kern\fontdimen3\font.\kern\fontdimen3\font.\xspace}
%    \end{macrocode}
%    |\Mdots@| and |\Tdots@ORI| hold the definitions of |\dots| in
%    Math and Text mode. They default to those of amsmath-2.0, and
%    will revert to standard \LaTeX{} definitions `AtBeginDocument',
%    if amsmath has not been loaded. |\Mdots@| doesn't change when
%    switching from/to French, while |\Tdots@| is |\FBtextellipsis|
%    in French and |\Tdots@ORI| otherwise.
%    \begin{macrocode}
\newcommand*{\Tdots@ORI}{\@xp\textellipsis}
\newcommand*{\Tdots@}{\Tdots@ORI}
\newcommand*{\Mdots@}{\@xp\mdots@}
\AtBeginDocument{\DeclareRobustCommand*{\dots}{\relax
                 \csname\ifmmode M\else T\fi dots@\endcsname}%
                 \@ifundefined{@xp}{\let\@xp\relax}{}%
                 \@ifundefined{mdots@}{\let\Tdots@ORI\textellipsis
                                       \let\Mdots@\mathellipsis
                                       \let\mdots@\undefined}{}}
\def\bbl@frenchdots{\let\Tdots@\FBtextellipsis}
\def\bbl@nonfrenchdots{\let\Tdots@\Tdots@ORI}
\addto\extrasfrench{\bbl@frenchdots}
\addto\noextrasfrench{\bbl@nonfrenchdots}
%    \end{macrocode}
%  \end{macro}
%
%  \subsection{Setup options: keyval stuff}
%  \label{sec-keyval}
%
% \changes{v2.0}{2006/11/06}{New command \cs{frenchbsetup} added
%     for global customisation.}
%
% \changes{v2.0c}{2007/06/25}{Option ThinSpaceInFrenchNumbers added.}
%
% \changes{v2.0d}{2007/07/15}{Options og and fg changed: limit
%     the definition to French so that quote characters can be used
%     in German.}
%
% \changes{v2.0e}{2007/10/05}{New option: StandardLists.}
%
% \changes{v2.0f}{2008/03/23}{Two typos corrected in
%    option StandardLists: [false] $\to$ [true] and
%    StandardLayout $\to$ StandardLists.}
%
% \changes{v2.0f}{2008/03/23}{StandardLayout option had no
%     effect on lists.  Test moved to \cs{FBprocess@options}.}
%
% \changes{v2.0g}{2008/03/23}{Revert previous change to
%     StandardLayout. This option must set the three flags
%     \cs{FBReduceListSpacingfalse}, \cs{FBCompactItemizefalse},
%     and \cs{FBStandardItemLabeltrue} instead of
%     \cs{FBStandardListstrue}, so that later options can still
%     change their value before executing \cs{FBprocess@options}.
%     Same thing for option StandardLists.}
%
% \changes{v2.1a}{2008/03/24}{New option: FrenchSuperscripts
%     to define \cs{up} as \cs{fup} or as \cs{textsuperscript}.}
%
% \changes{v2.1a}{2008/03/30}{New option: LowercaseSuperscripts.}
%
% \changes{v2.2a}{2008/05/08}{The global layout of the document is
%     no longer changed when frenchb is not the last option of babel
%     (\cs{bbl@main@language}). Suggested by Ulrike Fischer.}
%
% \changes{v2.2a}{2008/05/08}{Values of flags
%     \cs{ifFBReduceListSpacing}, \cs{ifFBCompactItemize},
%     \cs{ifFBStandardItemLabels}, \cs{ifFBIndentFirst},
%     \cs{ifFBFrenchFootnotes}, \cs{ifFBAutoSpaceFootnotes} changed:
%     default now means `StandardLayout', it will be changed to
%     `FrenchLayout' AtEndOfPackage only if french is
%     \cs{bbl@main@language}.}
%
% \changes{v2.2a}{2008/05/08}{When frenchb is babel's last option,
%     French becomes the document's main language, so
%     GlobalLayoutFrench applies.}
%
% \changes{v2.3a}{2008/10/10}{New option: OriginalTypewriter. Now
%    frenchb switches to \cs{noautospace@beforeFDP} when a tt-font is
%    in use.  When OriginalTypewriter is set to true, frenchb behaves
%    as in pre-2.3 versions.}
%
% \changes{v2.4a}{2009/11/23}{New option SuppressWarning.}
%
%    We first define a collection of conditionals with their defaults
%    (true or false).
%
%    \begin{macrocode}
\newif\ifFBStandardLayout           \FBStandardLayouttrue
\newif\ifFBGlobalLayoutFrench       \FBGlobalLayoutFrenchfalse
\newif\ifFBReduceListSpacing        \FBReduceListSpacingfalse
\newif\ifFBCompactItemize           \FBCompactItemizefalse
\newif\ifFBStandardItemLabels       \FBStandardItemLabelstrue
\newif\ifFBStandardLists            \FBStandardListstrue
\newif\ifFBIndentFirst              \FBIndentFirstfalse
\newif\ifFBFrenchFootnotes          \FBFrenchFootnotesfalse
\newif\ifFBAutoSpaceFootnotes       \FBAutoSpaceFootnotesfalse
\newif\ifFBOriginalTypewriter       \FBOriginalTypewriterfalse
\newif\ifFBThinColonSpace           \FBThinColonSpacefalse
\newif\ifFBThinSpaceInFrenchNumbers \FBThinSpaceInFrenchNumbersfalse
\newif\ifFBFrenchSuperscripts       \FBFrenchSuperscriptstrue
\newif\ifFBLowercaseSuperscripts    \FBLowercaseSuperscriptstrue
\newif\ifFBPartNameFull             \FBPartNameFulltrue
\newif\ifFBSuppressWarning          \FBSuppressWarningfalse
\newif\ifFBShowOptions              \FBShowOptionsfalse
%    \end{macrocode}
%
%    The defaults values of these flags have been set so that |frenchb|
%    does not change anything regarding the global layout.
%    |\bbl@main@language| (set by the last option of babel) controls
%    the global layout of the document.  We check the current language
%    `AtEndOfPackage' (it is |\bbl@main@language|); if it is French,
%    the values of some flags have to be changed to ensure a French
%    looking layout for the whole document (even in parts written in
%    languages other than French); the end-user will then be able to
%    customise the values of all these flags with |\frenchbsetup{}|.
%    \begin{macrocode}
\AtEndOfPackage{%
   \iflanguage{french}{\FBReduceListSpacingtrue
                       \FBCompactItemizetrue
                       \FBStandardItemLabelsfalse
                       \FBIndentFirsttrue
                       \FBFrenchFootnotestrue
                       \FBAutoSpaceFootnotestrue
                       \FBGlobalLayoutFrenchtrue}%
                      {}%
}
%    \end{macrocode}
%
%  \begin{macro}{\frenchbsetup}
%    From version 2.0 on, all setup options are handled by \emph{one}
%    command |\frenchbsetup| using the keyval syntax.
%    Let's now define this command which reads and sets the options
%    to be processed later (at |\begin{document}|) by
%    |\FBprocess@options|. It  can only be called in the preamble.
%    \begin{macrocode}
\newcommand*{\frenchbsetup}[1]{%
  \setkeys{FB}{#1}%
}%
\@onlypreamble\frenchbsetup
%    \end{macrocode}
%    |frenchb| being an option of babel, it cannot load a package
%    (keyval) while |frenchb.ldf| is read, so we defer the loading of
%    \file{keyval} and the options setup at the end of \babel's loading.
%
%    |StandardLayout| resets the layout in French to the standard layout
%    defined par the \LaTeX{} class and packages loaded. It deals with
%    lists, indentation of first paragraphs of sections and footnotes.
%    Other keys, entered \emph{after} |StandardLayout| in
%    |\frenchbsetup|, can overrule some of the |StandardLayout|
%     settings.
%
%    When French is the main language, |GlobalLayoutFrench| forces the
%    layout in French and (as far as possible) outside French to meet
%    the French typographic standards.
%
% \changes{v2.3d}{2009/03/16}{Warning added to \cs{GlobalLayoutFrench}
%    when French is not the main language.}
%
%    \begin{macrocode}
\AtEndOfPackage{%
    \RequirePackage{keyval}%
    \define@key{FB}{StandardLayout}[true]%
                      {\csname FBStandardLayout#1\endcsname
                       \ifFBStandardLayout
                         \FBReduceListSpacingfalse
                         \FBCompactItemizefalse
                         \FBStandardItemLabelstrue
                         \FBIndentFirstfalse
                         \FBFrenchFootnotesfalse
                         \FBAutoSpaceFootnotesfalse
                         \FBGlobalLayoutFrenchfalse
                       \else
                         \FBReduceListSpacingtrue
                         \FBCompactItemizetrue
                         \FBStandardItemLabelsfalse
                         \FBIndentFirsttrue
                         \FBFrenchFootnotestrue
                         \FBAutoSpaceFootnotestrue
                       \fi}%
    \define@key{FB}{GlobalLayoutFrench}[true]%
                      {\csname FBGlobalLayoutFrench#1\endcsname
                       \ifFBGlobalLayoutFrench
                          \iflanguage{french}%
                            {\FBReduceListSpacingtrue
                             \FBCompactItemizetrue
                             \FBStandardItemLabelsfalse
                             \FBIndentFirsttrue
                             \FBFrenchFootnotestrue
                             \FBAutoSpaceFootnotestrue}%
                            {\PackageWarning{frenchb.ldf}%
                              {Option `GlobalLayoutFrench' skipped:
                               \MessageBreak French is *not*
                               babel's last option.\MessageBreak}%
                             \FBGlobalLayoutFrenchfalse}%
                       \fi}%
    \define@key{FB}{ReduceListSpacing}[true]%
                      {\csname FBReduceListSpacing#1\endcsname}%
    \define@key{FB}{CompactItemize}[true]%
                      {\csname FBCompactItemize#1\endcsname}%
    \define@key{FB}{StandardItemLabels}[true]%
                      {\csname FBStandardItemLabels#1\endcsname}%
    \define@key{FB}{ItemLabels}{%
        \renewcommand*{\FrenchLabelItem}{#1}}%
    \define@key{FB}{ItemLabeli}{%
        \renewcommand*{\Frlabelitemi}{#1}}%
    \define@key{FB}{ItemLabelii}{%
        \renewcommand*{\Frlabelitemii}{#1}}%
    \define@key{FB}{ItemLabeliii}{%
        \renewcommand*{\Frlabelitemiii}{#1}}%
    \define@key{FB}{ItemLabeliv}{%
        \renewcommand*{\Frlabelitemiv}{#1}}%
    \define@key{FB}{StandardLists}[true]%
                      {\csname FBStandardLists#1\endcsname
                       \ifFBStandardLists
                         \FBReduceListSpacingfalse
                         \FBCompactItemizefalse
                         \FBStandardItemLabelstrue
                       \else
                         \FBReduceListSpacingtrue
                         \FBCompactItemizetrue
                         \FBStandardItemLabelsfalse
                       \fi}%
    \define@key{FB}{IndentFirst}[true]%
                      {\csname FBIndentFirst#1\endcsname}%
    \define@key{FB}{FrenchFootnotes}[true]%
                      {\csname FBFrenchFootnotes#1\endcsname}%
    \define@key{FB}{AutoSpaceFootnotes}[true]%
                      {\csname FBAutoSpaceFootnotes#1\endcsname}%
    \define@key{FB}{AutoSpacePunctuation}[true]%
                      {\csname FBAutoSpacePunctuation#1\endcsname}%
    \define@key{FB}{OriginalTypewriter}[true]%
                      {\csname FBOriginalTypewriter#1\endcsname}%
    \define@key{FB}{ThinColonSpace}[true]%
                      {\csname FBThinColonSpace#1\endcsname}%
    \define@key{FB}{ThinSpaceInFrenchNumbers}[true]%
                      {\csname FBThinSpaceInFrenchNumbers#1\endcsname}%
    \define@key{FB}{FrenchSuperscripts}[true]%
                      {\csname FBFrenchSuperscripts#1\endcsname}
    \define@key{FB}{LowercaseSuperscripts}[true]%
                      {\csname FBLowercaseSuperscripts#1\endcsname}
    \define@key{FB}{PartNameFull}[true]%
                      {\csname FBPartNameFull#1\endcsname}%
    \define@key{FB}{SuppressWarning}[true]%
                      {\csname FBSuppressWarning#1\endcsname
                       \ifFBSuppressWarning
                         \renewcommand{\FBWarning}[2]{\relax}%
                       \else
                         \renewcommand{\FBWarning}[2]{%
                                          \PackageWarning{##1}{##2}}%
                       \fi}
    \define@key{FB}{ShowOptions}[true]%
                      {\csname FBShowOptions#1\endcsname}%
%    \end{macrocode}
%    Inputing French quotes as \emph{single characters} when they are
%    available on the keyboard (through a compose key for instance)
%    is more comfortable than typing |\og| and |\fg|.
%    The purpose of the following code is to map the French quote
%    characters to |\og\ignorespaces| and |{\fg}| respectively when
%    the current language is French, and to |\guillemotleft| and
%    |\guillemotright| otherwise (think of German quotes); thus correct
%    unbreakable spaces will be added automatically to French quotes.
%    The quote characters typed in depend on the input encoding,
%    it can be single-byte (latin1, latin9, applemac,\dots) or
%    multi-bytes (utf-8, utf8x).  We first check whether XeTeX is used
%    or not, if not the package \file{inputenc} has to be loaded before
%    the |\begin{document}| with the proper coding option, so we check
%    if |\DeclareInputText| is defined.
%
% \changes{v2.4c}{2010/05/23}{In \cs{ttfamilyFB}, also cancel
%    automatic spaces inside French guillemets coded as characters
%    (see \cs{frenchbsetup}).}
%
% \changes{v2.5a}{2010/08/21}{Test \cs{@ifundefined} leaves the
%    tested control sequence defined as \cs{relax} when TRUE.
%    Changed \cs{relax} to \cs{undefined} when testing
%    \cs{XeTeXrevision}, \cs{DeclareInputText}, \cs{uc@dclc},
%    \cs{DeclareUnicodeCharacter}, \cs{mule@def} in \cs{og} and
%    \cs{fg}.}
%
%    \begin{macrocode}
    \define@key{FB}{og}{%
       \newcommand*{\FB@@og}{%
          \iflanguage{french}%
             {\ifFBAutoSpaceGuill\FB@og\ignorespaces
              \else\guillemotleft
              \fi}%
             {\guillemotleft}}%
       \@ifundefined{XeTeXrevision}%
         {\AtBeginDocument
           {\@ifundefined{DeclareInputText}%
             {\PackageWarning{frenchb.ldf}%
               {Option `og' requires package inputenc.\MessageBreak}%
              \let\DeclareInputText\undefined
             }%
             {\@ifundefined{uc@dclc}%
%    \end{macrocode}
%    if |\uc@dclc| is undefined, utf8x is not loaded\dots
%    \begin{macrocode}
               {\@ifundefined{DeclareUnicodeCharacter}%
%    \end{macrocode}
%    if |\DeclareUnicodeCharacter| is undefined, utf8 is not loaded
%    either, we assume 8-bit character input encoding.
%    Package \file{MULEenc.sty} (from CJK) defines |\mule@def| to map
%    characters to control sequences.
%    \begin{macrocode}
                  {\@tempcnta`#1\relax
                     \@ifundefined{mule@def}%
                       {\DeclareInputText{\the\@tempcnta}{\FB@@og}%
                        \let\mule@def\undefined}%
                       {\mule@def{11}{{\FB@@og}}}%
                   \let\DeclareUnicodeCharacter\undefined
                  }%
%    \end{macrocode}
%    utf8 loaded, use |\DeclareUnicodeCharacter|,
%    \begin{macrocode}
                  {\DeclareUnicodeCharacter{00AB}{\FB@@og}}%
                \let\uc@dclc\undefined
               }%
%    \end{macrocode}
%    utf8x loaded, use |\uc@dclc|,
%    \begin{macrocode}
               {\uc@dclc{171}{default}{\FB@@og}}%
             }%
           }%
          \let\XeTeXrevision\undefined
         }%
%    \end{macrocode}
%    XeTeX in use,
%    \begin{macrocode}
         {\ifFB@xetex@punct
%    \end{macrocode}
%    |XeTeXinterchartokenstate| is defined, nothing to do here, see
%    subsection~\ref{sec-punct}.
%    \begin{macrocode}
          \else
%    \end{macrocode}
%    then an old XeTeX in use, the following trick for defining the
%    active quote character is borrowed from \file{inputenc.dtx}.
%    \begin{macrocode}
            \catcode`#1=\active
            \bgroup
              \uccode`\~`#1%
              \uppercase{%
            \egroup
            \def~%
            }{\FB@@og}%
          \fi
         }%
    }%
%    \end{macrocode}
%    Same code for the closing quote.
%    \begin{macrocode}
    \define@key{FB}{fg}{%
       \newcommand*{\FB@@fg}{%
          \iflanguage{french}%
             {\ifFBAutoSpaceGuill\FB@fg
              \else\guillemotright
              \fi}%
             {\guillemotright}}%
       \@ifundefined{XeTeXrevision}%
         {\AtBeginDocument
           {\@ifundefined{DeclareInputText}%
             {\PackageWarning{frenchb.ldf}%
               {Option `fg' requires package inputenc.\MessageBreak}%
              \let\DeclareInputText\undefined
             }%
             {\@ifundefined{uc@dclc}%
               {\@ifundefined{DeclareUnicodeCharacter}%
                  {\@tempcnta`#1\relax
                     \@ifundefined{mule@def}%
                       {\DeclareInputText{\the\@tempcnta}{{\FB@@fg}}%
                        \let\mule@def\undefined
                       }%
                       {\mule@def{27}{{\FB@@fg}}}%
                   \let\DeclareUnicodeCharacter\undefined
                  }%
                  {\DeclareUnicodeCharacter{00BB}{{\FB@@fg}}%
                  }%
                \let\uc@dclc\undefined
               }%
               {\uc@dclc{187}{default}{{\FB@@fg}}}%
             }%
           }%
          \let\XeTeXrevision\undefined
         }%
         {\ifFB@xetex@punct
          \else
            \catcode`#1=\active
            \bgroup
              \uccode`\~`#1%
              \uppercase{%
            \egroup
            \def~%
            }{{\FB@@fg}}%
          \fi
         }%
    }%
}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\FBprocess@options}
%    |\FBprocess@options| processes the options, it is called \emph{once}
%    at |\begin{document}|.
%    \begin{macrocode}
\newcommand*{\FBprocess@options}{%
%    \end{macrocode}
%    Nothing has to be done here for |StandardLayout| and
%    |StandardLists| (the involved flags have already been set in
%    |\frenchbsetup{}| or before (at babel's EndOfPackage).
%
%    The next three options deal with the layout of lists in French.
%
%    |ReduceListSpacing| reduces the vertical spaces between list
%    items in French (done by changing |\list| to |\listFB|).
%    When |GlobalLayoutFrench| is true (the default), the same is
%    done outside French except for languages that force a different
%    setting.
%    \begin{macrocode}
  \ifFBReduceListSpacing
    \addto\extrasfrench{\let\list\listFB
                        \let\endlist\endlistFB}%
    \addto\noextrasfrench{\ifFBGlobalLayoutFrench
                            \let\list\listFB
                            \let\endlist\endlistFB
                          \else
                            \let\list\listORI
                            \let\endlist\endlistORI
                          \fi}%
  \else
    \addto\extrasfrench{\let\list\listORI
                        \let\endlist\endlistORI}%
    \addto\noextrasfrench{\let\list\listORI
                          \let\endlist\endlistORI}%
  \fi
%    \end{macrocode}
%
%    |CompactItemize| suppresses the vertical spacing between list
%    items in French (done by changing |\itemize| to |\itemizeFB|).
%    When |GlobalLayoutFrench| is true the same is done outside French.
%
% \changes{v2.4b}{2010/04/30}{Set flag CompactItemize=false when the
%    enumitem package is loaded (ensures compatibility).}
%
%    \begin{macrocode}
  \@ifpackageloaded{enumitem}{%
      \FBCompactItemizefalse
      \FBWarning{frenchb.ldf}%
         {Setting CompactItemize=false for compatibility\MessageBreak
                   with enumitem package,}}%
                             {}%
  \ifFBCompactItemize
     \addto\extrasfrench{\let\itemize\itemizeFB
                        \let\enditemize\enditemizeFB}%
     \addto\noextrasfrench{\ifFBGlobalLayoutFrench
                             \let\itemize\itemizeFB
                             \let\enditemize\enditemizeFB
                           \else
                             \let\itemize\itemizeORI
                             \let\enditemize\enditemizeORI
                           \fi}%
  \else
    \addto\extrasfrench{\let\itemize\itemizeORI
                        \let\enditemize\enditemizeORI}%
    \addto\noextrasfrench{\let\itemize\itemizeORI
                          \let\enditemize\enditemizeORI}%
  \fi
%    \end{macrocode}
%
%    |StandardItemLabels| resets labelitems in French to their
%    standard values set by the \LaTeX{} class and packages loaded.
%    When |GlobalLayoutFrench| is true labelitems are identical inside
%    and outside French.
%    \begin{macrocode}
  \ifFBStandardItemLabels
    \addto\extrasfrench{\bbl@nonfrenchlabelitems}%
    \addto\noextrasfrench{\bbl@nonfrenchlabelitems}%
  \else
    \addto\extrasfrench{\bbl@frenchlabelitems}%
    \addto\noextrasfrench{\ifFBGlobalLayoutFrench
                            \bbl@frenchlabelitems
                          \else
                            \bbl@nonfrenchlabelitems
                          \fi}%
  \fi
%    \end{macrocode}
%
%    |IndentFirst| forces the first paragraphs of sections to be
%    indented just like the other ones in French.
%    When |GlobalLayoutFrench| is true, the same is done outside French
%    except for languages that force a different setting.
%    |\bbl@nonfrenchindent| has been designed to be smart with other
%    languages (like Spanish) who also indent every first paragraphs of
%    sections (see section~\ref{sec-indent}).
%    \begin{macrocode}
  \ifFBIndentFirst
    \addto\extrasfrench{\bbl@frenchindent}%
    \addto\noextrasfrench{\ifFBGlobalLayoutFrench
                            \bbl@frenchindent
                          \else
                            \bbl@nonfrenchindent
                          \fi}%
  \else
    \addto\extrasfrench{\bbl@nonfrenchindent}%
    \addto\noextrasfrench{\bbl@nonfrenchindent}%
  \fi
%    \end{macrocode}
%
%    The layout of footnotes is handled at the |\begin{document}|
%    depending on the values of flags |FrenchFootnotes|
%    and |AutoSpaceFootnotes| (see section~\ref{sec-footnotes}),
%    nothing has to be done here for footnotes.
%
%    |AutoSpacePunctuation| adds an unbreakable space (in French only)
%    before the four active characters (:;!?) even if none has been
%    typed before them.
%    \begin{macrocode}
  \ifFBAutoSpacePunctuation
     \autospace@beforeFDP
  \else
     \noautospace@beforeFDP
  \fi
%    \end{macrocode}
%
%    When |OriginalTypewriter| is set to |false| (the default),
%    |\ttfamily|, |\rmfamily| and |\sffamily| are redefined as
%    |\ttfamilyFB|, |\rmfamilyFB| and |\sffamilyFB| respectively
%    to prevent addition of automatic spaces before the four active
%    characters in computer code.
%    \begin{macrocode}
  \ifFBOriginalTypewriter
  \else
     \let\ttfamily\ttfamilyFB
     \let\rmfamily\rmfamilyFB
     \let\sffamily\sffamilyFB
  \fi
%    \end{macrocode}
%
%    |ThinColonSpace| changes the normal unbreakable space typeset in
%     French before `:' to a thin space.
%    \begin{macrocode}
  \ifFBThinColonSpace\renewcommand*{\Fcolonspace}{\Fthinspace}\fi
%    \end{macrocode}
%
%    When |true|, |ThinSpaceInFrenchNumbers| redefines |numprint.sty|'s
%    command |\npstylefrench| to set |\npthousandsep| to |\,|
%    (thinspace) instead of |~| (default) . This option has no effect
%    if package \file{numprint.sty} is not loaded with `|autolanguage|'.
%    As old versions of \file{numprint.sty} did not define
%    |\npstylefrench|, we have to provide this command.
%    \begin{macrocode}
  \@ifpackageloaded{numprint}%
  {\ifnprt@autolanguage
     \providecommand*{\npstylefrench}{}%
     \ifFBThinSpaceInFrenchNumbers
       \renewcommand*\npstylefrench{%
          \npthousandsep{\,}%
          \npdecimalsign{,}%
          \npproductsign{\cdot}%
          \npunitseparator{\,}%
          \npdegreeseparator{}%
          \nppercentseparator{\nprt@unitsep}%
          }%
     \else
       \renewcommand*\npstylefrench{%
          \npthousandsep{~}%
          \npdecimalsign{,}%
          \npproductsign{\cdot}%
          \npunitseparator{\,}%
          \npdegreeseparator{}%
          \nppercentseparator{\nprt@unitsep}%
          }%
     \fi
     \npaddtolanguage{french}{french}%
   \fi}{}%
%    \end{macrocode}
%
%    |FrenchSuperscripts|: if |true| |\up=\fup|, else
%    |\up=\textsuperscript|. Anyway |\up*=\FB@up@fake|. The star-form
%    |\up*{}| is provided for fonts that lack some superior letters:
%    Adobe Jenson Pro and Utopia Expert have no ``g superior'' for
%    instance.
%    \begin{macrocode}
  \ifFBFrenchSuperscripts
    \DeclareRobustCommand*{\up}{\@ifstar{\FB@up@fake}{\fup}}%
  \else
    \DeclareRobustCommand*{\up}{\@ifstar{\FB@up@fake}%
                                        {\textsuperscript}}%
  \fi
%    \end{macrocode}
%
%    |LowercaseSuperscripts|: if |true| let |\FB@lc| be |\lowercase|,
%     else |\FB@lc| is redefined to do nothing.
%    \begin{macrocode}
  \ifFBLowercaseSuperscripts
  \else
    \renewcommand*{\FB@lc}[1]{##1}%
  \fi
%    \end{macrocode}
%
%    |PartNameFull|: if |false|, redefine |\partname|.
%    \begin{macrocode}
  \ifFBPartNameFull
  \else\addto\captionsfrench{\def\partname{Partie}}\fi
%    \end{macrocode}
%
%    |ShowOptions|: if |true|, print the list of all options to the
%    \file{.log} file.
%    \begin{macrocode}
  \ifFBShowOptions
    \GenericWarning{* }{%
     * **** List of possible options for frenchb ****\MessageBreak
     [Default values between brackets when frenchb is loaded *LAST*]%
     \MessageBreak
     ShowOptions=true [false]\MessageBreak
     StandardLayout=true [false]\MessageBreak
     GlobalLayoutFrench=false [true]\MessageBreak
     StandardLists=true [false]\MessageBreak
     IndentFirst=false [true]\MessageBreak
     ReduceListSpacing=false [true]\MessageBreak
     CompactItemize=false [true]\MessageBreak
     StandardItemLabels=true [false]\MessageBreak
     ItemLabels=\textemdash, \textbullet,
        \protect\ding{43},... [\textendash]\MessageBreak
     ItemLabeli=\textemdash, \textbullet,
        \protect\ding{43},... [\textendash]\MessageBreak
     ItemLabelii=\textemdash, \textbullet,
        \protect\ding{43},... [\textendash]\MessageBreak
     ItemLabeliii=\textemdash, \textbullet,
        \protect\ding{43},... [\textendash]\MessageBreak
     ItemLabeliv=\textemdash, \textbullet,
        \protect\ding{43},... [\textendash]\MessageBreak
     FrenchFootnotes=false [true]\MessageBreak
     AutoSpaceFootnotes=false [true]\MessageBreak
     AutoSpacePunctuation=false [true]\MessageBreak
     OriginalTypewriter=true [false]\MessageBreak
     ThinColonSpace=true [false]\MessageBreak
     ThinSpaceInFrenchNumbers=true [false]\MessageBreak
     FrenchSuperscripts=false [true]\MessageBreak
     LowercaseSuperscripts=false [true]\MessageBreak
     PartNameFull=false [true]\MessageBreak
     SuppressWarning=true [false]\MessageBreak
     og= <left quote character>, fg= <right quote character>
     \MessageBreak
     *********************************************
     \MessageBreak\protect\frenchbsetup{ShowOptions}}
  \fi
}
%    \end{macrocode}
%  \end{macro}
%
% \changes{v2.0}{2006/12/15}{AtBeginDocument, save again the
%    definitions of the `list' and `itemize' environments and the
%    values of labelitems.  As of frenchb v.1.6, `ORI' values were
%    set when reading frenchb.ldf, later changes were ignored.}
%
% \changes{v2.0}{2006/12/06}{Added warning for OT1 encoding.}
%
% \changes{v2.1b}{2008/04/07}{Disable some commands in bookmarks.}
%
% \changes{v2.5a}{2010/08/21}{Test \cs{@ifundefined} leaves the
%    tested control sequence defined as \cs{relax} when TRUE.
%    Changed \cs{relax} to \cs{undefined} when testing
%    \cs{pdfstringdefDisableCommands} AtBeginDocument.}
%
%    At |\begin{document}| we save again the value of |\if@afterindent|
%    and definitions of the `list' and `itemize' environments and the
%    values of labelitems so that all changes made in the preamble are
%    taken into account in languages other than French and in French
%    with the StandardLayout option.
%    We also have to provide an |\xspace| command in case the
%    \file{xspace.sty} package is not loaded.
%
%    \begin{macrocode}
\AtBeginDocument{%
   \ifx\@afterindentfalse\@afterindenttrue
         \let\@aifORI\@afterindenttrue
   \else \let\@aifORI\@afterindentfalse
   \fi
   \let\listORI\list
   \let\endlistORI\endlist
   \let\itemizeORI\itemize
   \let\enditemizeORI\enditemize
   \let\@ltiORI\labelitemi
   \let\@ltiiORI\labelitemii
   \let\@ltiiiORI\labelitemiii
   \let\@ltivORI\labelitemiv
   \providecommand*{\xspace}{\relax}%
%    \end{macrocode}
%    Let's redefine some commands in \file{hyperref}'s bookmarks.
%    \begin{macrocode}
   \@ifundefined{pdfstringdefDisableCommands}{}%
     {\pdfstringdefDisableCommands{%
        \let\up\relax
        \def\ieme{e\xspace}%
        \def\iemes{es\xspace}%
        \def\ier{er\xspace}%
        \def\iers{ers\xspace}%
        \def\iere{re\xspace}%
        \def\ieres{res\xspace}%
        \def\FrenchEnumerate#1{#1\degre\space}%
        \def\FrenchPopularEnumerate#1{#1\degre)\space}%
        \def\No{N\degre\space}%
        \def\no{n\degre\space}%
        \def\Nos{N\degre\space}%
        \def\nos{n\degre\space}%
        \def\og{\guillemotleft\space}%
        \def\fg{\space\guillemotright}%
        \let\bsc\textsc
        \let\degres\degre
        }%
      \let\pdfstringdefDisableCommands\undefined}%
%    \end{macrocode}
%
%    It is time to process the options set with |\frenchboptions{}|.
%    Then we need to execute either |\extrasfrench| and
%    |\captionsfrench| or |\noextrasfrench| according to the current
%    language at the |\begin{document}| (these three commands have been
%    updated by |\FBprocess@options|). \emph{But}, when French is the
%    main language, |\extrasfrench| is executed \emph{again} now
%    (French has been switched on `AtBeginDocument' some time before).
%    This is harmless, except for |\bbl@frenchspacing| which will
%    redefine |\bbl@nonfrenchspacing| to |\relax|, this will be
%    wrong if the user switches to English.
%    When French is \emph{not} the main language, |\noextrasfrench|
%    executes |\bbl@nonfrenchspacing| (=|\nonfrenchspacing|), thus
%    eventually overwriting a |\frenchspacing| command issued by the
%    main language (German, Spanish, etc.).
%    So we have to define |\bbl@nonfrenchspacing| as |\relax| here
%    and restore it's meaning afterwards.
%
% \changes{v2.5a}{2010/08/15}{Define \cs{bbl@nonfrenchspacing} locally
%    as \cs{relax}, otherwise the \cs{bbl@frenchspacing} command
%    included in germanb.ldf is overwritten here by
%    \cs{noextrasfrench}.  Bug pointed out by Ulrike Fischer.}
%
%    \begin{macrocode}
   \FBprocess@options
   \let\bbl@nonfrenchspacingORI\bbl@nonfrenchspacing
   \let\bbl@nonfrenchspacing\relax
   \iflanguage{french}{\extrasfrench\captionsfrench}{\noextrasfrench}%
   \let\bbl@nonfrenchspacing\bbl@nonfrenchspacingORI
%    \end{macrocode}
%    Some warnings are issued when output font encodings are not
%    properly set. With XeLaTeX, \file{fontspec.sty} and
%    \file{xunicode.sty} should be loaded; with (pdf)\LaTeX, a warning
%    is issued when OT1 encoding is in use at the |\begin{document}|.
%    Mind that |\encodingdefault| is defined as `long', defining
%    |\FBOTone| with |\newcommand*| would fail!
%    \begin{macrocode}
   \@ifundefined{XeTeXrevision}%
     {\begingroup \newcommand{\FBOTone}{OT1}%
      \ifx\encodingdefault\FBOTone
        \PackageWarning{frenchb.ldf}%
           {OT1 encoding should not be used for French.
            \MessageBreak
            Add \protect\usepackage[T1]{fontenc} to the
            preamble\MessageBreak of your document,}%
      \fi
      \endgroup
      \let\XeTeXrevision\undefined
     }%
     {\@ifundefined{DeclareUTFcharacter}%
        {\PackageWarning{frenchb.ldf}%
          {Add \protect\usepackage{xltxtra} to the\MessageBreak
           preamble of your document,}%
         \let\DeclareUTFcharacter\undefined}%
        {}%
     }%
}
%    \end{macrocode}
%
%  \subsection{Clean up and exit}
%
%    Load |frenchb.cfg| (should do nothing, just for compatibility).
%    \begin{macrocode}
\loadlocalcfg{frenchb}
%    \end{macrocode}
%    Final cleaning.
%    The macro |\ldf@quit| takes care for setting the main language
%    to be switched on at |\begin{document}| and resetting the
%    category code of \texttt{@} to its original value.
%    The config file searched for has to be |frenchb.cfg|, and
%    |\CurrentOption| has been set to `french', so
%    |\ldf@finish\CurrentOption| cannot be used: we first load
%    |frenchb.cfg|, then call |\ldf@quit\CurrentOption|.
%    \begin{macrocode}
\FBclean@on@exit
\ldf@quit\CurrentOption
%    \end{macrocode}
% \iffalse
%</code>
%<*dtx>
% \fi
%%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
% \iffalse
%</dtx>
% \fi
%
% \Finale
\endinput
