%\CheckSum{3294}
%
%\iffalse
%    Tell the \LaTeX\ system who we are and write an entry on the
%    transcript.
%<*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.}
%<ldf>\ProvidesLanguage{frenchb}
%\ProvidesFile{frenchb.dtx}
%<*!lua>
         [2014/06/21 v3.1a French support from the babel system]
%</!lua>
%<*internal>
\iffalse
%</internal>
%<*lua>
--
--  File `frenchb.lua' generated from frenchb.dtx [2014/06/21 v3.1a]
--
--  Copyright (C) 2014 Daniel Flipo <daniel.flipo at free.fr>
--  License LPPL: see frenchb.dtx.
--
%</lua>
%<*internal>
\fi
%</internal>
%<*dtx>
%%
%%  File `frenchb.dtx'
%</dtx>
%<*ldf>
%%
%%  File `frenchb.ldf'
%</ldf>
%<*dtx|ldf>
%%  Babel package for LaTeX version 2e
%%  Copyright (C) 1996 - 2014
%%            by Daniel Flipo <daniel.flipo at free.fr>
%%
%</dtx|ldf>
%<*dtx>
%%  This file is part of the babel system, it provides the source
%%  code for the French language definition file.
%%
%</dtx>
%<*filedriver>
\documentclass[a4paper]{ltxdoc}
\usepackage[left=42mm,right=42mm,top=40mm,bottom=40mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{bera}
\usepackage[pdftex,dvipsnames]{xcolor}
\def\PrintMacroName#1{%
  \strut\MacroFont\color{Sepia}\normalsize\string#1}
\usepackage[expansion=true,protrusion=true]{microtype}
\def\ColorArg{\color{PineGreen}}
\usepackage{url}
\usepackage[colorlinks,urlcolor=blue]{hyperref}
\newcommand*\babel{\textsf{babel}}
\newcommand*\frenchb{\textsf{frenchb}}
\newcommand*\note[1]{}
\newcommand*\Lopt[1]{\textsf{#1}}
\newcommand*\file[1]{\texttt{#1}}
\newcommand*\cls[1]{\texttt{#1}}
\newcommand*\pkg[1]{\texttt{#1}}
\newcommand*\fbo[1]{\texttt{\ColorArg #1}}
\newcommand*\fbsetup[1]{\cs{frenchbsetup\{\fbo{#1}\}}}
\renewcommand*\descriptionlabel[1]{%
   \hspace\labelsep \normalfont \fbo{#1}}
\providecommand*\eTeX{\leavevmode\hbox{$\varepsilon$}-\TeX}
\makeatletter
\newcommand*{\FBguillspace}{\penalty\@M\hskip.8\fontdimen2\font
                                         plus.3\fontdimen3\font
                                        minus.8\fontdimen4\font}
\makeatother
\hyphenation{Lua-TeX Lua-LaTeX Xe-LaTeX}
\lefthyphenmin=2 \righthyphenmin=3
\AtEndDocument{%
   \GlossaryPrologue{\section{{Change History}}}%
   \clearpage\PrintChanges
}
\begin{document}
\setlength{\parindent}{0pt}
\GetFileInfo{frenchb.dtx}
\RecordChanges
\begin{center}
  \textbf{\Large A Babel language definition file for French}\\[2mm]^^A\]
  \textbf{\large frenchb.dtx \fileversion, \filedate}\\[3mm]^^A\]
  Daniel Flipo\\
  \texttt{daniel.flipo@free.fr}
\end{center}
\vspace{2\baselineskip}
\thispagestyle{empty}
\tableofcontents
\clearpage
\DocInput{frenchb.dtx}
\end{document}
%</filedriver>
%\fi
%
%  \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ègles typographiques en usage à
%    l'Imprimerie Nationale'' troisième édition (1994),
%    ISBN-2-11-081075-0.
%
%    First version released: 1.1 (May 1996) as part of
%    \babel-3.6beta. Version~2.0a was released in February 2007 and
%    version~3.0a in February 2014.
%
%    \frenchb{} has been improved using helpful suggestions from many
%    people, mainly from Jacques André, Michel Bovani, Thierry Bouche,
%    Vincent Jalby and Denis Bitouzé.  Thanks to all of them!
%
%    \LaTeX-2.09 is no longer supported.
%    This new version (3.x) has been designed to be used only with
%    \LaTeXe{} and Plain formats based on TeX, pdfTeX, LuaTeX or XeTeX
%    engines.
%
%    Changes between version 2.0 and \fileversion{} are listed in
%    subsection~\ref{ssec-changes} p.~\pageref{ssec-changes}.
%
%    An extensive documentation is available in French here:\\
%    \url{http://daniel.flipo.free.fr/frenchb}
%
%  \subsection{Basic interface}
%
%    In a multilingual document, some typographic rules are language
%    dependent, i.e.\ spaces before `high punctuation' (|:| |;| |!|
%    |?|) in French, others modify the general layout (i.e.\ layout of
%    lists, footnotes, indentation of first paragraphs of sections) and
%    should apply to the whole document.
%
%    \frenchb{} takes account of \babel's \emph{main language} defined
%    as the \emph{last} option at \babel's loading.  When French is
%    not \babel's main language, \frenchb{} does not alter the general
%    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 \frenchb{} (see command \fbsetup{},
%       section~\ref{ssec-custom} p.~\pageref{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 \fbsetup{} (see
%          section~\ref{ssec-custom} p.~\pageref{ssec-custom});
%    \item vertical spacing in general \LaTeX{} lists is
%          shortened;
%    \item footnotes are displayed ``à la française''.
%    \item the separator following the table or figure number in
%          captions is printed as `~--~' instead of `:~'; for changing
%          this see~\ref{sssec-captions} p.~\pageref{sssec-captions}.
%    \end{enumerate}
%
%    Regarding local typography, the command |\selectlanguage{french}|
%    switches to the French language\footnote{%
%      \cs{selectlanguage\{francais\}} and
%      \cs{selectlanguage\{frenchb\}} are no longer supported.},
%    with the following effects:
%    \begin{enumerate}
%    \item French hyphenation patterns are made active;
%    \item `high punctuation' characters (|:| |;| |!| |?|)
%           automatically add correct spacing in French; this is
%           achieved using callbacks in Lua(La)TeX or `XeTeXinterchar'
%           mechanism in Xe(La)TeX; with TeX'82 and pdf(La)TeX these
%           four characters are made active in the whole document;
%    \item |\today| prints the date in French;
%    \item the caption names are translated into French
%          (\LaTeX{} only).  For customisation of caption names see
%          section~\ref{sssec-captions} p.~\pageref{sssec-captions}.
%    \item the space after |\dots| is removed in French.
%    \end{enumerate}
%
%    Some commands are provided by \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~>>|: |\og| and |\fg| provide
%          better horizontal spacing (controlled by |\FBguillspace|).
%          If French quote characters are available on your keyboard,
%          you can use them, to get proper spacing in \LaTeXe{} see
%          option \fbo{og=«, fg=»} p.~\pageref{option-og-fg}.
%
%          |\og| and |\fg| can be used outside French, they typeset
%          then English quotes `` and ''.
%
%          A new command |\frquote{}| has been added in version~3.1 to
%          enter French quotations.  |\frquote{|\textit{texte}|}| is
%          equivalent to |\og| \textit{texte} |\fg{}| for short
%          quotations.  For quotations spreading over more than one
%          paragraph, |\frquote| will add at the beginning of every
%          paragraph of the quotation either an opening French
%          guillemet («), or a closing one (») depending on option
%          \fbo{EveryParGuill=open} or \fbo{=close}, see
%          p.~\pageref{everyparguill}.\label{frquote}
%
%          |\frquote| is recommended to enter embedded quotations ``à la
%          française'', several variants are provided through options:
%          \begin{itemize}
%          \item with LuaTeX based engines, every line of the inner
%            quotation will start with a French guillemet (« or »)
%            depending on option \fbo{EveryLineGuill=open} (default) or
%            \fbo{=close} unless you explicitly set
%            \fbo{EveryLineGuill=none}, then |\frquote{}| will behave
%            as with non-LuaTeX engines;
%          \item with all other engines, the inner quotation is
%            surrounded by double quotes (``\textit{texte}'') unless
%            option \fbo{InnerGuillSingle=true}, then a) the inner
%            quotation is printed as
%            \guilsinglleft\FBguillspace\textit{texte}\FBguillspace
%            \guilsinglright{} and b) if the inner quotation
%            spreads over more than one paragraph, every paragraph
%            included in the inner quotation starts with
%            a \guilsinglleft{} or a \guilsinglright, depending on
%            option \fbo{EveryParGuill=open} or \fbo{close}.
%          \end{itemize}
%          A starred variant |\frquote*| is meant for inner quotations
%          which end together with the outer one: using |\frquote*| for
%          the inner quotation will print only one closing quote
%          character (the outer one) as recommended by the French
%          `Imprimerie Nationale'.
%
%    \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}).
%          All these commands take advantage of real superscript
%          letters when they are available in the current font.
%
%    \item Family names should be typeset in small capitals and never
%          be hyphenated, the macro |\bsc| (boxed small caps) does
%          this, e.g., |L.~\bsc{Lamport}| will print the same as
%          |L.~\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éro(s)'' and ``numéro(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é'': |\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
%          \pkg{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}
%
%     Customisation of \frenchb{} relies on command \fbsetup{},
%     options are entered  using the \file{keyval} syntax.
%     The command \fbsetup{} is to appear in the preamble only
%     (after loading \babel).
%
%  \subsubsection[\textbackslash frenchbsetup{}]
%     {\fbsetup{options}}
%  \label{sssec-frenchbsetup}
%
%     \vspace{.5\baselineskip}
%     \fbsetup{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 \fbo{ShowOptions}) can be entered as
%     \fbo{ShowOptions=true} or just \fbo{ShowOptions}, the
%     \fbo{=true} part can be omitted.
%
%     \vspace{.5\baselineskip}
%     The other options are listed below.  Their default value is
%     shown between braces, 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{description}
%     \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 can be used to avoid
%       conflicts with classes or packages which customise lists or
%       footnotes.
%     \item [GlobalLayoutFrench=false (true*)] should no longer be
%       used; it was intended to emulate, when French is the main
%       language, what prior versions of \frenchb{} (pre-2.2) did:
%       lists, and first paragraphs of sections would be displayed
%       the standard way in other languages than French, and ``à la
%       française'' in French.  Note that the layout of footnotes is
%       language independent anyway (see below \fbo{FrenchFootnotes}
%       and \fbo{AutoSpaceFootnotes}).
%     \item [ReduceListSpacing=false (true*)]; \frenchb{} reduces the
%       values of the vertical spaces used in the \emph{all} list
%       environments in French (this includes itemize, enumerate,
%       description, but also abstract, quote, quotation and verse and
%       possibly others).  Setting this option to \fbo{false}
%       reverts to the standard settings of the |list| environment.
%     \item [ListOldLayout=true (false)]; starting with version~2.6a,
%       the layout of lists has changed regarding leftmargins' sizes
%       and default itemize label (`---' instead of `--' up to~2.5k).
%       This option, provided for backward compatibility, displays
%       lists as they were up to version~2.5k.
%     \item [CompactItemize=false (true*)]; should no longer be used
%       (kept only for backward compatibility), it is replaced by the
%       next two options.
%     \item [StandardItemizeEnv=true (false*)]; \frenchb{} redefines
%       the |itemize| environment to suppress any vertical space
%       between items of |itemize| lists in French and customises
%       left margins.  Setting this option to \fbo{false} reverts to
%       the standard definition of |itemize|.
%     \item [StandardEnumerateEnv=true (false*)]; starting with
%       version~2.6 \frenchb{} redefines the |enumerate| and
%       |description| environments to make left margins match those of
%       the French version of |itemize| lists.  Setting this option to
%       \fbo{false} reverts to the standard definition of |enumerate|
%       and |description|.
%     \item [StandardItemLabels=true (false*)] when set to \fbo{true}
%       this option prevents \frenchb{} from changing the labels in
%       |itemize| lists in French.
%     \item [ItemLabels=\cs{textbullet}, \cs{textendash},
%           \cs{ding\{43\}},...(\cs{textemdash}*)];\\
%        when \fbo{StandardItemLabels=false} (the default), this option
%        enables to choose the label used in French |itemize| lists for
%        all levels.  The next four options do the same but each one for
%        a specific level only.  Note that the example |\ding{43}|
%        requires |\usepackage{pifont}|.
%       \item [ItemLabeli=\cs{textbullet}, \cs{textendash},
%           \cs{ding\{43\}},...(\cs{textemdash}*)]
%       \item [ItemLabelii=\cs{textbullet}, \cs{textendash},
%           \cs{ding\{43\}},...(\cs{textemdash}*)]
%       \item [ItemLabeliii=\cs{textbullet}, \cs{textendash},
%           \cs{ding\{43\}},..(\cs{textemdash}*)]
%       \item [ItemLabeliv=\cs{textbullet}, \cs{textendash},
%           \cs{ding\{43\}},...(\cs{textemdash}*)]
%     \item [StandardLists=true (false*)] forbids \frenchb{} to
%       customise any kind of list.  Try the option \fbo{StandardLists}
%       in case of conflicts with classes or packages that customise
%       lists too.  This option is just a shorthand setting all four
%       options \fbo{ReduceListSpacing=false},
%       \fbo{StandardItemizeEnv=true}, \fbo{StandardEnumerateEnv=true}
%       and \fbo{StandardItemLabels=true}.
%     \item [IndentFirst=false (true*)]; set this option to \fbo{false}
%       if you do not want \frenchb{} to  force indentation of the
%       first paragraph of sections.  When French is the main language,
%       this options applies to all languages.
%     \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).  Two commands |\StandardFootnotes|
%       and |\FrenchFootnotes| are available to change the layout of
%       footnotes locally; |\StandardFootnotes| can help 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 \fbo{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 \fbo{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 typeset nobreakspaces the width of which is
%       either |\FBthinspace| (defauts to |\thinspace|) before `|;|'
%       `|!|' `|?|' or |\FBcolonspace| (defauts to |\space|) before
%       `|:|'; the defaults follow the French `Imprimerie Nationale's
%       recommendations.  This is convenient in most cases but can lead
%       to addition of spurious spaces in URLs, in MS-DOS paths or in
%       timetables (10:55), except if they are typed in |\texttt| or
%       verbatim mode.  When the current font is a monospaced
%       (typewriter) font, \fbo{AutoSpacePunctuation} is locally
%       switched to \fbo{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 \fbo{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 use the provided |\NoAutoSpacing| command
%       inside a group in case an unwanted space is added by \frenchb{}
%       (i.e.\ |{\NoAutoSpacing 10:55}|).
%     \item [ThinColonSpace=true (false)] changes the inter-word
%       unbreakable space added before the colon `:' to a thin space,
%       so that the same amount of space is added before any of the
%       four `high 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
%       \fbo{false} will disable this behaviour (not recommended).
%     \item [PartNameFull=false (true)]; when true, \frenchb{} numbers
%       the title of |\part{}| commands as ``Première partie'',
%       ``Deuxième partie'' and so on.  With some classes which
%       change the |\part{}| command (AMS classes do so), you could
%       get ``Première partie~1'', ``Deuxième partie~2'' in the toc;
%       when this occurs, this option should be set to
%       \fbo{false}, part titles will then be printed as ``Partie I'',
%       ``Partie II''.
%     \item [CustomiseFigTabcaptions=false (true*)]; when \fbo{false}
%       the default separator (colon) is used instead of
%       |\CaptionSeparator|.  Anyway, \frenchb{} makes sure that the
%       colon will be typeset with proper preceeding space in French.
%     \item [OldFigTabcaptions=true (false)] is to be used when
%       figures' and tables' captions must be typeset as with pre~3.0
%       versions of \frenchb{} (with |\CaptionSeparator| in French and
%       colon otherwise). Intended for standard \LaTeX{} classes only.
%     \item [SuppressWarning=true (false)]; can be turned to \fbo{true}
%       if you are bored with \frenchb's warnings.
%     \item [INGuillSpace=true (false)] resets the dimensions of spaces
%       after opening French quotes and before closing French quotes to
%       the French `Imprimerie Nationale' standards (inter-word space).
%       \frenchb's default setting produces slightly narrower spaces
%       with lesser stretchability.
%     \item [EveryParGuill=open, close, none (open)]; sets whether
%       an opening quote (\texttt{«}) or a closing one (\texttt{»}) or
%       nothing should be printed by |\frquote{}| at the beginning of
%       every parapraph in case of a level 1 (outer) quotation
%       spreading over more than one parapraph.  This option is also
%       considered for level 2 (inner) quotations to decide between
%       \texttt{\guilsinglleft} and \texttt{\guilsinglright} when
%       \fbo{InnerGuillSingle=true} (see below). \label{everyparguill}
%     \item [EveryLineGuill=open, close, none (open in LuaTeX, none
%       otherwise)]; with engines other than LuaTeX this
%       option is set to \fbo{none} which means that nothing will be
%       printed at the beginning of every line of inner quotations,
%       trying to set this option will issue a warning in the
%       \file{.log} file.
%
%       With LuaTeX based engines, this option is set to \fbo{open} by
%       default, it ensures that a \guillemotleft{} followed by proper
%       kern will be repeated at the beginning of every line in case an
%       embedded (inner) quotation  spreads over more than one line
%       (provided that both outer and inner quotations are entered with
%       |\frquote{}|). Set this option to \fbo{close} if you want
%       a \guillemotright{} instead of a \guillemotleft.
%     \item [InnerGuillSingle=true (false)];
%       if \fbo{InnerGuillSingle=false} (default), inner quotations
%       entered with |\frquote{}| start with~\texttt{``} and end
%       with~\texttt{''}.
%       If \fbo{InnerGuillSingle=true}, \texttt{\guilsinglleft} and
%       \texttt{\guilsinglright} are used instead of British double
%       quotes. Please note that this option only makes
%       sense when \fbo{EveryLineGuill=none}.
%     \item [og=\guillemotleft, fg=\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 \label{option-og-fg}
%       \texttt{\guillemotleft{} guillemets \guillemotright} or
%       \texttt{\guillemotleft{}guillemets\guillemotright} (with or
%       without spaces) to get properly typeset French quotes.
%       This option works with LuaLaTeX and XeLaTeX; with pdfLaTeX it
%       requires \file{inputenc} to be loaded with a proper encoding:
%       8-bits encoding (latin1, latin9, ansinew, applemac,\dots) or
%       multi-byte encoding (utf8, utf8x).
%    \end{description}
%
%    \textbf{Options' order} -- Please remember that options are read
%    in the order they appear in the \fbsetup{} command.
%    Someone wishing that \frenchb{} leaves the layout of lists
%    and footnotes untouched but caring for indentation of first
%    paragraph of sections should choose\\
%    \fbsetup{StandardLayout,IndentFirst} to get the expected
%    layout.  The reverse order
%    \fbsetup{IndentFirst,StandardLayout} would lead to option
%    \fbo{IndentFirst} being overwritten by \fbo{StandardLayout}.
%
%  \subsubsection{Captions}
%  \label{sssec-captions}
%
%    Caption names can be customised in French using the simplified
%    syntax introduced by \babel~3.9, for instance:
%    |\def\frenchproofname{Preuve}|.
%    The older syntax |\addto\captionsfrench{\def\proofname{Preuve}}|
%    still works. Keep in mind that \emph{only} |french| can be used to
%    redefine captions, even if \babel{}'s option was entered as
%    |francais| or |frenchb|.
%
%    For \emph{all} languages, when French is the main language,
%    \frenchb{} changes the separator (colon) used in figures'
%    and tables' captions to |\CaptionSeparator| which defaults to
%    `~--~' and can be redefined in the preamble with\\
%    |\renewcommand*{\CaptionSeparator}{...}|.
%
%    When French is not the main language, the colon is preserved for
%    all languages but \frenchb{} makes sure that a proper space is
%    typeset before it.
%
%    Two new options are provided: if \fbo{CustomiseFigTabCaptions} is
%    set to \fbo{false} the colon will be used as separator in all
%    languages, with a proper space before the colon in French.
%    The second option \fbo{OldFigTabCaptions} can be set to \fbo{true}
%    to print figures' and tables' captions as they were with versions
%    pre~3.0 of \frenchb{} (using |\CaptionSeparator| in French and
%    colon in other languages); this option only makes sense with the
%    standard \LaTeX{} classes \cls{article}, \cls{report} and
%    \cls{book}.
%
%  \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 |pdfLaTeX| on the following file, with the encoding
%      suitable for your machine (\textit{my-encoding} will be |latin1|
%      for 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{signal container événement algèbre}|\\
%      |\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 évé-ne-ment al-gèbre}.\\
%      Do not care about how accented characters are displayed in the
%      log-file, what matters is the position of the `|-|' hyphen
%      signs \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{évé-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}
%
%  \subsection{Changes}
%  \label{ssec-changes}
%
%  \subsubsection*{What's new in version 3.1?}
%
%      New command |\frquote{}| meant to enter French quotations,
%      especially long ones (spreading over several paragraphs) and/or
%      embedded ones. see p.~\pageref{frquote} for details.
%
%  \subsubsection*{What's new in version 3.0?}
%
%      Many deep changes lead me to step \frenchb's version number
%      to~3.0a:
%      \begin{itemize}
%      \item \babel{}~3.9 is required now to process
%        \file{frenchb.ldf}, this change allows for cleaner definitions
%        of dates and captions for the Unicode engines LuaTeX and
%        XeTeX and also provides a simpler syntax for end-users, see
%       section~\ref{sssec-captions} p.\pageref{sssec-captions}.
%      \item \fbsetup{} options management has been completely
%        reworked; two new options added.
%      \item Canadian French didn't work as a normal \babel's dialect,
%        it should now; btw. the French language should now be loaded
%        as \Lopt{french}, \emph{not as} \Lopt{frenchb} or
%        \Lopt{francais} and preferably as a \emph{global} option of
%        |\documentclass|. Some tolerance still exists in v3.0, but
%        do not rely on it.
%      \item \frenchb{} no longer loads \file{frenchb.cfg}:
%        customisation should definitely be done using \fbsetup{}
%        options.
%      \item Description lists labels are now indented; set
%        |\listendentFB=0pt| to get the former layout.
%      \item The last but not least change affects the (recent)
%        LuaTeX-based engines, (this means version 0.76 as included in
%        TL2013 and up): active characters are no longer used in French
%        for `high punctuation'.  Functionalities and user interface
%        are unchanged.
%
%        Many thanks to Paul Isambert who provided the basis for the
%        lua code (see his presentation at GUT'2010) and kindly
%        reviewed my first drafts suggesting significant improvements.
%
%        Please note that this code, still experimental, is likely to
%        change until LuaTeX itself has reached version~1.0.
%      \end{itemize}
%
%      Starting with version~3.0c, \frenchb{} no longer customises
%      lists with the \cls{beamer} class and offers a new option
%      (\fbo{INGuillSpace}) to follow French `Imprimerie Nationale'
%      recommendations regarding quotes' spacing.
%
%  \subsubsection*{What's new in version 2.6?}
%
%      The way \frenchb{} handles list environments has been completely
%      redesigned in version~2.6 due to a long standing bug affecting
%      enumerate lists inside itemize lists.  Horizontal indentation of
%      itemize, enumerate and description lists differs now from
%      previous versions, an option for backward compatibility is
%      provided: \fbsetup{ListOldLayout}.
%
%      \frenchb{} is now compatible with the \pkg{paralist} package.
%
%      Regarding the layout of figures' and tables' captions, version
%      2.6c is now fully compatible with AMS and koma-script classes
%      and with \file{caption} and \pkg{floatrow} packages.
%      Starting with version 2.6c, the \file{frenchb.cfg} file is no
%      longer generated from \file{frenchb.dtx}, but it is still loaded
%      (if found) for backward compatibility.
%
%  \subsubsection*{What's new in version 2.5?}
%
%      The main change is that active characters are no longer used
%      in French with (recent) XeTeX-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 (adapted from the
%      \pkg{polyglossia} package).
%
%      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-, LuaTeX- and XeTeX-based engines.
%
%      Bug corrections: |\frenchspacing| and |\nonfrenchspacing| are no
%      longer messed up by \file{frenchb.ldf}.
%
%  \subsubsection*{What's new in version 2.4?}
%
%      A new option \fbo{SuppressWarning} has been added (desactivated
%      by default) to suppress warnings if |\@makecaption| has been
%      redefined or if the \pkg{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 \pkg{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 \fbsetup{}).
%
%  \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 (\fbo{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.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 ``à la française''
%      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.1?}
%
%      A new command |\fup| is provided to typeset better looking
%      superscripts; it was designed using ideas from Jacques André,
%      Thierry Bouche and René Fritz, thanks to all of them!
%      Former command |\up| is now defined as |\fup|, an option
%      \fbo{FrenchSuperscripts=false} is provided for
%      backward compatibility.
%
%  \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 only by command
%      \fbsetup{}, \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 tables 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 \pkg{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 ``à la française'' for the
%      whole document, except with an explicit\\
%      \fbsetup{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}
%
% \StopEventually{}
%
% \changes{v2.6c}{2013/05/20}{Dummy file frenchb.cfg is no longer
%     generated from frenchb.dtx.}
%
%  \clearpage
%  \newgeometry{left=53mm,right=25mm}
%
%  \section{The code}
%
%  \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
%<*ldf>
% \fi
%
% \changes{v3.0a}{2014/02/28}{Support for options frenchb, francais,
%    canadien, acadian changed.}
%
%    If \file{frenchb.ldf} was loaded with \babel{}'s options
%    \Lopt{francais} or \Lopt{frenchb}, we make it behave as if
%    \Lopt{french} was specified.
%    In Plain formats, \texttt{@} catcode is not `letter'.
%    \begin{macrocode}
\chardef\atcatcode=\catcode`\@
\catcode`\@=11\relax
\def\bbl@tempa{francais}
\ifx\CurrentOption\bbl@tempa
  \let\l@francais\l@french
  \def\captionsfrancais{\captionsfrench}
  \def\datefrancais{\datefrench}
  \def\extrasfrancais{\extrasfrench}
  \def\noextrasfrancais{\extrasfrench}
  \def\CurrentOption{french}
\fi
\def\bbl@tempa{frenchb}
\ifx\CurrentOption\bbl@tempa
  \let\l@frenchb\l@french
  \def\captionsfrenchb{\captionsfrench}
  \def\datefrenchb{\datefrench}
  \def\extrasfrenchb{\extrasfrench}
  \def\noextrasfrenchb{\extrasfrench}
  \def\CurrentOption{french}
\fi
\catcode`\@=\atcatcode \let\atcatcode\relax
%    \end{macrocode}
%
% \changes{v3.0a}{2014/02/19}{\cs{LdfInit} checks \cs{datefrench}
%    instead of \cs{captionsfrench} to avoid a conflict with
%    papertex.cls which loads datetime.sty.}
%
%    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\captionsfrench
%    \end{macrocode}
%
% \changes{v3.0c}{2014/03/30}{No need to define \cs{l@french} as
%    \cs{lang@french}, babel.def (3.9j) takes care for this.}
%
%    Make sure that |\l@french| is defined (possibly as 0).
%    \file{babel.def} now (3.9i) defines |\l@<languagename>| also for
%    eTeX, LuaTeX and XeTeX formats which set |\lang@<languagename>|.
%    \begin{macrocode}
\def\FB@nopatterns{%
   \ifx\l@nohyphenation\@undefined
      \edef\bbl@nulllanguage{\string\language=0}%
      \adddialect\l@french0
   \else
      \adddialect\l@french\l@nohyphenation
      \edef\bbl@nulllanguage{\string\language=nohyphenation}%
   \fi
   \@nopatterns{French}}
\ifx\l@french\@undefined
   \FB@nopatterns
\fi
%    \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}
%
% \changes{v3.0a}{2014/02/15}{In Plain, provide a substitute for
%    \cs{PackageWarning} and \cs{PackageInfo}.}
%
%    Let's provide a substitute for |\PackageError|, |\PackageWarning|
%    and |\PackageInfo| not defined in Plain:
%    \begin{macrocode}
\def\fb@error#1#2{%
    \begingroup
      \newlinechar=`\^^J
      \def\\{^^J(frenchb.ldf) }%
      \errhelp{#2}\errmessage{\\#1}%
    \endgroup}
\def\fb@warning#1{%
   \begingroup
      \newlinechar=`\^^J
      \def\\{^^J(frenchb.ldf) }%
      \message{\\#1}%
   \endgroup}
\def\fb@info#1{%
   \begingroup
      \newlinechar=`\^^J
      \def\\{^^J}%
      \wlog{#1}%
   \endgroup}
%    \end{macrocode}
%
% \changes{v3.0c}{2014/03/30}{frenchb requires babel-3.9i.}
%
%    Quit if \babel's version is less than 3.9i.
%    \begin{macrocode}
\let\bbl@tempa\relax
\ifx\babeltags\@undefined
   \let\bbl@tempa\endinput
   \ifLaTeXe
      \PackageError{frenchb.ldf}
         {frenchb requires babel v.3.9i.\MessageBreak
          Aborting here}
         {Please upgrade Babel!}
   \else
      \fb@error{frenchb requires babel v.3.9i.\\
                Aborting here}
               {Please upgrade Babel!}
   \fi
\fi
\bbl@tempa
%    \end{macrocode}
%
%    \file{frenchb.ldf} can be loaded with options \Lopt{canadien} or
%    \Lopt{acadian}, which both stand for Canadian French.  Internally,
%    \Lopt{acadian} will be the name of the corresponding \babel's
%    dialect, so we set |\CurrentOption| to \Lopt{acadian} in both
%    cases.
%    If no specific hyphenation patterns are available, Canadian French
%    will use the French ones.
%
%    TODO: Canadien French hyphenation doesn't work with LuaTeX.
%    \begin{macrocode}
\ifx\l@acadian\@undefined
   \ifx\l@canadien\@undefined
      \adddialect\l@acadian\l@french
      \adddialect\l@canadien\l@french
   \else
      \adddialect\l@acadian\l@canadien
   \fi
\else
  \adddialect\l@canadien\l@acadian
\fi
\def\bbl@tempa{canadien}
\ifx\CurrentOption\bbl@tempa
  \def\captionscanadien{\captionsacadian}
  \def\datecanadien{\dateacadian}
  \def\extrascanadien{\extrasacadian}
  \def\noextrascanadien{\extrasacadian}
  \def\CurrentOption{acadian}
\fi
%    \end{macrocode}
%
%    French uses the standard values of |\lefthyphenmin| (2)
%    and |\righthyphenmin| (3); let's provide their values though,
%    as required by \babel.
%
%    \begin{macrocode}
\expandafter\providehyphenmins\expandafter{\CurrentOption}{\tw@\thr@@}
%    \end{macrocode}
%
%  \begin{macro}{\ifFBunicode}
%  \begin{macro}{\ifFBLuaTeX}
%  \begin{macro}{\ifFBXeTeX}
%    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 three new `if': |\ifFBLuaTeX|, |\ifFBXeTeX| and
%    |\ifFBunicode| which will be true for XeTeX and LuaTeX engines
%    and false for 8-bits engines.
%
% \changes{v2.4a}{2009/11/23}{Added a new `if' \cs{FBunicode} and
%    some \cs{lccode} definitions to \cs{extrasfrench} and
%    \cs{noextrasfrench}.}
%
% \changes{v2.5d}{2011/01/17}{Added two new `if' \cs{FBXeTeX} and
%    \cs{FBLuaTeX} as XeTeX and behave differently regarding the status
%     of the French ``apostrophe''.}
%
% \changes{v2.6g}{2013/12/15}{lccode values for the French
%    ``apostrophe'' are now the same for XeTeX and LuaTeX.}
%
%    We cannot rely on \eTeX's |\ifdefined| at this stage, as it is not
%    defined in Plain \TeX{} format.
%    \begin{macrocode}
\newif\ifFBunicode
\newif\ifFBLuaTeX
\newif\ifFBXeTeX
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname luatexversion\endcsname\relax
\else
  \FBunicodetrue \FBLuaTeXtrue
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname XeTeXrevision\endcsname\relax
\else
  \FBunicodetrue \FBXeTeXtrue
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\extrasfrench}
% \changes{v3.0a}{2014/02/18}{Take advantage of babel's
%    \cs{babel@savevariable} to handle apostrophe's \cs{lccode}.}
%
% \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.
%
%    The following code ensures correct hyphenation of words like
%    |d'aventure|, |l'utopie|, with all TeX engines (XeTeX, LuaTeX,
%    pdfTeX) using \file{hyph-fr.tex} patterns.
%
%    \begin{macrocode}
\@namedef{extras\CurrentOption}{%
     \babel@savevariable{\lccode`\'}%
     \ifFBunicode
        \babel@savevariable{\lccode"2019}%
        \lccode`\'="2019\lccode"2019="2019
     \else
        \lccode`\'=`\'
     \fi
}
\@namedef{noextras\CurrentOption}{}
%    \end{macrocode}
%
%    Let's define a handy command for adding stuff to
%    |\extras\CurrentOption|,\linebreak[0] |\noextras\CurrentOption| or
%    |\captions\CurrentOption| but first let's save the value of
%    |\CurrentOption| for later use in \fbsetup{} (`AfterEndOfPackage',
%    |\CurrentOption| will be lost).
%    \begin{macrocode}
\let\FB@CurOpt\CurrentOption
\newcommand*{\FB@addto}[2]{%
    \expandafter\addto\csname #1\FB@CurOpt\endcsname{#2}}
%    \end{macrocode}
%
%    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}
\FB@addto{extras}{\bbl@frenchspacing}
\FB@addto{noextras}{\bbl@nonfrenchspacing}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%  \subsection{Punctuation}
%  \label{ssec-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 `high
%    punctuation' characters (|;| |!| |?| and |:|) have to be made
%    |\active| for an automatic control of the amount of space to be
%    inserted before them.  Both XeTeX and LuaTeX provide an
%    alternative to active characters (`XeTeXinterchar' mechanism and
%    LuaTeX's callbacks).
%
%    With LuaTeX and XeTeX engines, \frenchb{} handles French quotes
%    together with `high punctuation', a new conditional will be
%    needed:
%    \begin{macrocode}
\newif\ifFBAutoSpaceGuill  \FBAutoSpaceGuilltrue
%    \end{macrocode}
%
% \changes{v3.0a}{2014/01/10}{New flag \cs{ifFB@luatex@punct} for
%    `high punctuation' management with LuaTeX engines.}
%
%  \begin{macro}{\ifFB@active@punct}
%  \begin{macro}{\ifFB@xetex@punct}
%  \begin{macro}{\ifFB@luatex@punct}
%    Three internal flags are needed for the three different techniques
%    used for `high punctuation' management.
%
%    With LuaTeX, starting with version 0.76, callbacks are used to
%    get rid of active punctuation.  With previous versions, `high
%    punctuation' characters remain active (see below).
%    \begin{macrocode}
\newif\ifFB@active@punct  \FB@active@puncttrue
\newif\ifFB@luatex@punct
\ifFBLuaTeX
  \ifnum\luatexversion>75
    \FB@luatex@puncttrue\FB@active@punctfalse
  \fi
\fi
%    \end{macrocode}
%
%    For XeTeX, the availability of |\XeTeXinterchartokenstate|
%    decides whether the `high punctuation' characters (|;| |!| |?|
%    and |:|) have to be made |\active| or not.
%    \begin{macrocode}
\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}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\FBcolonspace}
%  \begin{macro}{\FBthinspace}
% \changes{v2.5a}{2010/08/10}{Define \cs{FBthinspace} for those who want
%    to customise the width of the space before ; and co.}
%
% \changes{v2.6d}{2013/06/19}{Rename \cs{Fthinspace} to
%    \cs{FBthinspace} and \cs{Fcolonspace} to \cs{FBcolonspace} to avoid
%    a conflict with fournier.sty.}
%
% \changes{v3.0a}{2014/01/13}{\cs{FBthinspace} is no longer a kern but
%    a skip (frenchb adds a nobreak penalty before it).}
%
%  \begin{macro}{\FBcolonskip}
%  \begin{macro}{\FBthinskip}
% \changes{v3.0a}{2014/01/10}{LuaTeX requires dimensions: two new skips
%    \cs{FBcolonskip} and \cs{FBthinskip}.}
%
%    According to the I.N.\ specifications, the `:' requires an
%    inter-word space before it, the other three require just
%    a |\thinspace|.  We define |\FBcolonspace| as |\space|
%    (inter-word space) and |\FBthinspace| as |\thinspace| (both
%    are user customisable).
%    LuaTeX requires skips instead of commands, so we define
%    |\FBcolonskip| and |\FBthinskip| to hold the specifications
%    (width/stretch/shrink) of |\space| and |\thinspace| for the
%    |lmr10| font; these parameters will be scaled for the current font
%    by the \file{frenchb.lua} script (see how p.~\pageref{lua-scaling}).
%    |\FBcolonskip| and |\FBthinskip| are also user customisable.
%    \begin{macrocode}
\newcommand*{\FBcolonspace}{\space}
\newcommand*{\FBthinspace}{\thinspace}
\newskip\FBcolonskip
\FBcolonskip=3.33pt plus 1.665pt minus 1.11pt \relax
\newskip\FBthinskip
\FBthinskip=1.66672pt \relax
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%  \subsubsection{Punctuation with LuaTeX}
%  \label{sssec-punct-luatex}
%
% \changes{v3.0a}{2014/01/10}{New handling of `high punctuation'
%    through callbacks with LuaTeX engines.}
%
%    The following part holds specific code for punctuation with modern
%    LuaTeX engines (version $\ge 0.76$).
%
% \changes{v3.0b}{2014/02/13}{Require luatexbase with LaTeXe in case
%    fontspec has not been loaded before babel.}
%
% \changes{v3.0c}{2014/03/26}{Just load luatexbase.sty instead of
%    luaotfload.sty with plain formats.}
%
% \changes{v3.1a}{2014/05/30}{Misplaced \cs{fi} for plain formats.}
%
%    We define two LuaTeX attributes to control spacing in French
%    for `high punctuation' and quotes, making sure that
%    |\newluatexattribute| is defined.
%    \begin{macrocode}
\ifFB@luatex@punct
  \ifLaTeXe
    \AtEndOfPackage{%
       \RequirePackage{luatexbase}%
       \newluatexattribute\FB@addDPspace   \FB@addDPspace=1 \relax
       \newluatexattribute\FB@addGUILspace \FB@addGUILspace=0 \relax
    }
    \PackageInfo{frenchb.ldf}{No need for active punctuation characters%
                \MessageBreak with this version of LuaTeX!%
                \MessageBreak reported}
  \else
    \begingroup\expandafter\expandafter\expandafter\endgroup
    \expandafter\ifx\csname newluatexattribute\endcsname\relax
      \input luatexbase.sty
    \fi
    \newluatexattribute\FB@addDPspace   \FB@addDPspace=1 \relax
    \newluatexattribute\FB@addGUILspace \FB@addGUILspace=0 \relax
    \fb@info{No need for active punctuation characters\\
             with this version of LuaTeX!}
  \fi
\fi
%    \end{macrocode}
%
% \iffalse
%</ldf>
%<*lua>
% \fi
%    \file{frenchb.lua} holds Lua code to deal with  `high punctuation'
%    and quotes.  This code is based on suggestions from Paul Isambert.
%
%    First we define two flags to control spacing before French `high
%    punctuation' (thin space or inter-word space).
%
% \changes{v3.1a}{2014/06/16}{frenchb.lua: codes 0x13 and 0x14 added
%    for French quotes in T1-encoding.}
%
%    \begin{macrocode}
local FB_punct_thin =
  {[string.byte("!")] = true,
   [string.byte("?")] = true,
   [string.byte(";")] = true}
local FB_punct_thick =
  {[string.byte(":")] = true}
%    \end{macrocode}
%    Managing spacing after `\guillemotleft' (U+00AB) and before
%    `\guillemotright' (U+00BB) can be done by the way; we define two
%    flags, |FB_punct_left| for characters requiring some space before
%    them and |FB_punct_right| for `\guillemotleft' which must be
%    followed by some space.  In case LuaTeX is used to output
%    T1-encoded fonts instead of OpenType fonts, codes \texttt{0x13}
%    and \texttt{0x14}  have to be added for `\guillemotleft' and
%    `\guillemotright'.
%    \begin{macrocode}
local FB_punct_left =
  {[string.byte("!")] = true,
   [string.byte("?")] = true,
   [string.byte(";")] = true,
   [string.byte(":")] = true,
   [0x14]             = true,
   [0xBB]             = true}
local FB_punct_right =
  {[0x13]             = true,
   [0xAB]             = true}
%    \end{macrocode}
%    Two more flags will be needed to avoid spurious spaces in
%    strings like !! ?? or (?)
%    \begin{macrocode}
local FB_punct_null =
  {[string.byte("!")] = true,
   [string.byte("?")] = true,
   [string.byte("[")] = true,
   [string.byte("(")] = true,
%    \end{macrocode}
%    or if the user has typed a nobreak space U+00A0 or a nobreak thin
%    space U+202F before a `high punctuation' character: no space
%    should be added by \frenchb.  Same is true inside French quotes.
%    \begin{macrocode}
   [0xA0]             = true,
   [0x202F]           = true}
local FB_guil_null =
  {[0xA0]             = true,
   [0x202F]           = true}
%    \end{macrocode}
%    Local definitions for nodes:
%    \begin{macrocode}
local new_node     = node.new
local copy_node    = node.copy
local node_id      = node.id
local KERN         = node_id("kern")
local GLUE         = node_id("glue")
local GSPEC        = node_id("glue_spec")
local GLYPH        = node_id("glyph")
local PENALTY      = node_id("penalty")
local nobreak      = new_node(PENALTY)
nobreak.penalty    = 10000
local insert_node_before = node.insert_before
local insert_node_after  = node.insert_after
local remove_node        = node.remove
%    \end{macrocode}
%    Some variables to store |\FBthinskip|, |\FBcolonskip| and
%    |\FBguillskip| (given for |lmr10|); width/stretch/shrink are
%    stored as fractions of |\fontdimen2|, |\fontdimen3| and
%    |\fontdimen4| of |lmr10| font respectively\dots
%    \label{lua-scaling}
%    \begin{macrocode}
local thin10 = tex.skip['FBthinskip']
local thinwd = thin10.width/65536/3.33
local thinst = thin10.stretch/65536/1.665
local thinsh = thin10.shrink/655.36/1.11
local coln10 = tex.skip['FBcolonskip']
local colnwd = coln10.width/65536/3.33
local colnst = coln10.stretch/65536/1.665
local colnsh = coln10.shrink/65536/1.11
local guil10 = tex.skip['FBguillskip']
local guilwd = guil10.width/65536/3.33
local guilst = guil10.stretch/65536/1.665
local guilsh = guil10.shrink/65536/1.11
%    \end{macrocode}
%    and a function to scale them for the current font:
%    \begin{macrocode}
local font_table = {}
local function new_glue_scaled (fid,width,stretch,shrink)
  local fp = font_table[fid]
  if not fp then
     font_table[fid] = font.getfont(fid).parameters
     fp = font_table[fid]
  end
  local gl = new_node(GLUE,0)
  local gl_spec = new_node(GSPEC)
  gl_spec.width = width * fp.space
  gl_spec.stretch = stretch * fp.space_stretch
  gl_spec.shrink = shrink * fp.space_shrink
  gl.spec = gl_spec
  return gl
end
%    \end{macrocode}
%    Let's catch LuaTeX attributes |\FB@addDPspace| and
%    |\FB@addGUILspace|.  Constant |FR=lang.id(french)| will be
%    defined by command |\activate@luatexpunct|.
%    \begin{macrocode}
local addDPspace   = luatexbase.attributes['FB@addDPspace']
local addGUILspace = luatexbase.attributes['FB@addGUILspace']
local has_attribute = node.has_attribute
%    \end{macrocode}
%    The following function will be added to |pre_linebreak_filter| and
%    |hpack_filter| callbacks.  It catches all nodes of type |GLYPH|
%    in the list starting at |head| and checks the language attributes
%    of the current glyph: nothing is done if the current language is
%    not French and only specific punctuation characters (those for
%    which |FB_punct_left| or |FB_punct_right| is true) need a special
%    treatment.
%    In French, local variables are defined to hold the properties of
%    the current glyph (|item|) and of the previous one (|prev|) or the
%    next one (|next|).
%    \begin{macrocode}
local function french_punctuation (head)
  for item in node.traverse_id(GLYPH, head) do
    local lang = item.lang
    local char = item.char
    local SIG  = has_attribute(item, addGUILspace)
    if lang == FR and FB_punct_left[char] then
       local fid = item.font
       local prev = item.prev
       local prev_id, prev_subtype, prev_char
       if prev then
          prev_id = prev.id
          prev_subtype = prev.subtype
          if prev_id == GLYPH then
             prev_char = prev.char
          end
       end
%    \end{macrocode}
%
% \changes{v3.0c}{2014/04/18}{Bug correction: null glues should not
%    trigger space insertion before high ponctuation.  Bug pointed out
%    by Benoit Rivet for the `lstlisting' environment of the listings
%    package.}
%
%    If the previous item is a glue, check its natural width,
%    only positive glues are to be replaced by a nobreakspace.
%    \begin{macrocode}
       local glue = prev_id == GLUE and prev_subtype == 0
       local glue_wd
       if glue then
          glue_spec = prev.spec
          glue_wd = glue_spec.width
       end
       glue = glue and glue_wd > 0
%    \end{macrocode}
%    For characters for which |FB_punct_thin| or |FB_punct_thick| is
%    \emph{true}, the amount of spacing to be typeset before them
%    is controlled by |\FBthinskip| (|thinwd|, |thinst|, |thinsh|) or
%    |\FBcolonskip| (|colnwd|, |colnst|, |colnsh|) respectively.
%    Two options: if a space has been typed in before (turned to
%    \emph{glue} in the node list), we remove the \emph{glue} and add a
%    nobreak penalty and the required \emph{glue}.
%    Otherwise (|auto| option), the penalty and the required
%    \emph{glue} are inserted \emph{only if} all three conditions are
%    satisfied: a) attribute |\FB@addDPspace| is set,
%               b) the previous character is not part of type
%               |FB_punct_null| (this avoids spurious spaces in strings
%               like |(!)| or |??|),
%               c) the punctuation mark does not start a paragraph.
%
% \changes{v3.0c}{2014/04/18}{Missing pair of braces after `and' in the
%    definition of `auto'.}
%
%    \begin{macrocode}
       if FB_punct_thin[char] or FB_punct_thick[char] then
          local SBDP = has_attribute(item, addDPspace)
          local fbglue
          if FB_punct_thick[char] then
             fbglue = new_glue_scaled(fid,colnwd,colnst,colnsh)
          else
             fbglue = new_glue_scaled(fid,thinwd,thinst,thinsh)
          end
          local auto =
              SBDP and SBDP > 0 and
              ((prev_char and not FB_punct_null[prev_char]) or
               (not prev_char and (prev_id ~= 0 or prev_subtype ~= 3))
              )
          if glue or auto then
             if glue then
                head = remove_node(head,prev,true)
             end
             insert_node_before(head, item, copy_node(nobreak))
             insert_node_before(head, item, copy_node(fbglue))
          end
%    \end{macrocode}
%    Let's consider `\guillemotright' now (the only remaining glyph of
%    |FB_punct_left| class): we just have to remove any \emph{glue}
%    possibly preceeding `\guillemotright', then insert the nobreak
%    penalty and the proper \emph{glue} (controlled by |\FBguillskip|).
%    This is done only if French quotes have been `activated' by
%    options \fbo{og=\guillemotleft, fg=\guillemotright} in
%    \fbsetup{} and can be denied locally with |\NoAutoSpacing|
%    (this is controlled by the |SIG| flag).
%
% \changes{v3.1a}{2014/06/18}{frenchb.lua: added flag addgl which must
%    also be true when prev or next is not a char (i.e. kern0 in
%    «\cs{texttt}\{a\}»).}
%
% \changes{v3.1a}{2014/06/18}{frenchb.lua: look ahead when next is a kern
%    (i.e in « \cs{texttt}\{a\} »).}
%
%    \begin{macrocode}
       elseif SIG and SIG > 0 then
          local addgl = (prev_char and not FB_guil_null[prev_char]) or
                        (not prev_char)
          if glue or addgl then
             if glue then
                head = remove_node(head,prev,true)
             end
             local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh)
             insert_node_before(head, item, copy_node(nobreak))
             insert_node_before(head, item, copy_node(fbglue))
          end
       end
    end
%    \end{macrocode}
%    Similarly, for `\guillemotleft' (unique member of the
%    |FB_punct_right| class), we check the following node looking for
%    \emph{glue} or |FB_guil_null| character, in order to remove any
%    \emph{glue} possibly following it and to insert the proper
%    \emph{glue} and nobreak penalty in this order if necessary.
%    \begin{macrocode}
    if lang == FR and FB_punct_right[char] and SIG and SIG > 0 then
       local next = item.next
       local next_id, next_subtype, next_char, kern_wd, nextnext
       if next then
          next_id = next.id
          next_subtype = next.subtype
          if next_id == GLYPH then
             next_char = next.char
%    \end{macrocode}
%    A |kern0| might hide a |glue|, so look ahead if |next| is a kern
%    (this occurs with |« \texttt{a} »|):
%    \begin{macrocode}
          elseif next_id == KERN then
             kern_wd = next.kern
             if kern_wd == 0 then
                nextnext = next.next
                if nextnext then
                   next = nextnext
                   next_id = nextnext.id
                   next_subtype = nextnext.subtype
                   next_char = nextnext.char
                end
             end
          end
       end
       local glue = next_id == GLUE and next_subtype == 0
       if glue then
          glue_spec = next.spec
          glue_wd = glue_spec.width
       end
       glue = glue and glue_wd > 0
       local addgl = (next_char and not FB_guil_null[next_char]) or
                     (not next_char)
       if glue or addgl then
          if glue then
             head = remove_node(head,next,true)
          end
          local fid = item.font
          local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh)
          insert_node_after(head, item, copy_node(fbglue))
          insert_node_after(head, item, copy_node(nobreak))
       end
    end
  end
  return head
end
return french_punctuation
%    \end{macrocode}
% \iffalse
%</lua>
%<*ldf>
% \fi
%
%    As a language tag is part of glyph nodes in LuaTeX, nothing needs
%    to be added to |\extrasfrench| and |\noextrasfrench|; we will just
%    redefine |\shorthandoff| and |\shorthandon| in French to issue a
%    warning reminding the user that active characters are no longer
%    used in French with recent LuaTeX engines.
%    \begin{macrocode}
\ifFB@luatex@punct
  \newcommand*{\FB@luatex@punct@french}{%
     \ifx\shorthandoffORI\@undefined
       \let\shorthandonORI\shorthandon
       \let\shorthandoffORI\shorthandoff
     \fi
     \def\shorthandoff##1{%
        \ifx\PackageWarning\@undefined
          \fb@warning{\noexpand\shorthandoff{;:!?} is helpless with
           LuaTeX,\\ use \noexpand\NoAutoSpacing
           *inside a group* instead.}%
        \else
          \PackageWarning{frenchb.ldf}{\protect\shorthandoff{;:!?} is
           helpless with LuaTeX,\MessageBreak use \protect\NoAutoSpacing
           \space *inside a group* instead;\MessageBreak reported}%
        \fi}%
     \def\shorthandon##1{}%
  }
  \newcommand*{\FB@luatex@punct@nonfrench}{%
     \ifx\shorthandoffORI\@undefined
     \else
       \let\shorthandon\shorthandonORI
       \let\shorthandoff\shorthandoffORI
     \fi
  }
  \FB@addto{extras}{\FB@luatex@punct@french}
  \FB@addto{noextras}{\FB@luatex@punct@nonfrench}
%    \end{macrocode}
%
% \changes{v3.0b}{2014/02/13}{frenchb.lua was not found by
%    Lua function dofile (not kpathsea aware).
%    Call function kpse.find\_file first, as suggested by Paul Gaborit.}
%
%    In \LaTeXe, file \file{frenchb.lua} will be loaded
%    `AtBeginDocument' \emph{after} processing options
%    (\fbo{ThinColonSpace} needs to be taken into account).  The next
%    definition will be used to activate Lua punctuation: it sets the
%    language number for French, loads \file{frenchb.lua} and adds
%    function |french_punctuation| to both callbacks
%    |pre_linebreak_filter| (paragraph building) and |hpack_filter|
%    (|\hbox| building).
%    \begin{macrocode}
  \def\activate@luatexpunct{%
    \directlua{%
      FR = \the\l@french
      local path = kpse.find_file("frenchb.lua", "lua")
      if path then
      local f = dofile(path)
      luatexbase.add_to_callback("pre_linebreak_filter",
                 f, "frenchb.french_punctuation",1)
      luatexbase.add_to_callback("hpack_filter",
                 f, "frenchb.french_punctuation",1)
      else
        texio.write_nl('')
        texio.write_nl('*****************************')
        texio.write_nl('Error: frenchb.lua not found.')
        texio.write_nl('*****************************')
        texio.write_nl('')
      end
     }%
  }
\fi
%    \end{macrocode}
%    End of specific code for punctuation with LuaTeX engines.
%
%  \subsubsection{Punctuation with XeTeX}
%  \label{sssec-punct-xetex}
%
%    If |\XeTeXinterchartokenstate| is available, we use the
%    ``inter char'' mechanism to provide correct spacing in French
%    before the four characters |;| |!| |?| and |:|.  The basis of the
%    following code was borrowed from the \pkg{polyglossia} package,
%    see \file{gloss-french.ldf}.  We use the same mechanism for French
%    quotes (\texttt{\guillemotleft} and \texttt{\guillemotright}),
%    when automatic spacing for quotes is required by options
%    \fbo{og=} and \fbo{fg=} in \fbsetup{} (see
%    section~\ref{ssec-keyval}).
%
%    For every character used in French text-mode (except spaces),
%    |\XeTeXcharclass| value must be 0.
%    |\XeTeXcharclass| value for spaces is assumed to be 255.
%    Otherwise, the spacing before the `high punctuation' characters
%    and inside quotes might 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.
%
% \changes{v2.5d}{2011/01/19}{Moved the \cs{newcount} command outside
%    \cs{ifFB@xetex@punct} ... \cs{fi} (it broke Plain formats).}
%
% \changes{v2.5g}{2012/01/02}{Add four \cs{newif} to control
%    spacing of quotes (characters and control sequences).}
%
%    The following part holds specific code for punctuation with XeTeX
%    engines.
%    \begin{macrocode}
\newcount\FB@interchartokenstateORI
\ifFB@xetex@punct
   \ifLaTeXe
    \PackageInfo{frenchb.ldf}{No need for active punctuation characters%
                    \MessageBreak with this version of XeTeX!%
                    \MessageBreak reported}
   \else
    \fb@info{No need for active punctuation characters\\
             with this version of XeTeX!}
   \fi
%    \end{macrocode}
%    The following code is borrowed from \file{ltcntrl.dtx}
%    (LaTeX base) for loops (|\@for| undefined in Plain):
%    \begin{macrocode}
   \ifx\@for\@undefined
     \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}}%
   \fi
%    \end{macrocode}
%
% \changes{v2.5i}{2012/04/20}{Temporary fix: as long as
%    \file{xeCJK.sty} will not use \cs{newXeTeXintercharclass} to
%    allocate its classes, we will have to define 3 fake classes.}
%
% \changes{v2.5j}{2012/05/08}{Previous fix removed: bug fixed in
%    \file{xeCJK.sty} version 3.0.4 (06-May-2012).}
%
% \changes{v2.6g}{2013/12/09}{U+00A0 (Unicode nobreakspace) and U+202F
%    (Unicode nobreakthinspace) added to class \cs{FB@punctnul}
%    to prevent frenchb from adding it's own space before `high
%    punctuation' characters.}
%
% \changes{v2.6h}{2014/01/03}{New class \cs{FB@guilnul} for characters
%    U+00A0 (Unicode nobreakspace) and U+202F (Unicode
%    nobreakthinspace), to prevent frenchb from adding spurious spaces
%    inside quotes.}
%
%    Six new character classes are defined for \frenchb.
%    \begin{macrocode}
   \newXeTeXintercharclass\FB@punctthick
   \newXeTeXintercharclass\FB@punctthin
   \newXeTeXintercharclass\FB@punctnul
   \newXeTeXintercharclass\FB@guilo
   \newXeTeXintercharclass\FB@guilf
   \newXeTeXintercharclass\FB@guilnul
%    \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}
   \def\FB@charclassesORI{}
   \def\empty{}
   \def\FB@parse#1,#2\endparse{\def\FB@class{#1}%
        \def\FB@charclassesORI{#2}}%
%    \end{macrocode}
%
%  \begin{macro}{\FB@xetex@punct@french}
%    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.
%
% \changes{v2.5g}{2011/12/31}{XeTeXcharclass(es) for French quotes will
%    be set to \cs{FB@guilo} and \cs{FB@guilf} by options
%    `og' and `fg' in \cs{frenchbsetup}.  French quotes should behave
%    as normal characters by default in XeLaTeX as in LaTeX.}
%
% \changes{v2.5i}{2012/04/20}{\file{xeCJK.sty} changes the
%    \cs{XeTeXcharclass} of ASCII chars '-' ',' '.' ')' ']' '\}'
%    '\{' '\%' opening and closing single and double quotes.
%    We set their class to 0 in French and reset their class
%    to their original value when leaving French.  See
%    \cs{FB@xetex@punct@nonfrench} below.}
%
%    \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:={`\:,`\;,`\!,`\?,"AB,"BB,%
                       `\(,`\[,`\{,`\,,`\.,`\-,`\),`\],`\},%
                       `\%,"22,"27,"60,"2019,"A0,"202F}\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@guilf \FB@punctthick = {%
                     \FDP@colonspace}%
     \XeTeXinterchartoks 255 \FB@punctthick = {%
                     \ifhmode\unskip\penalty\@M\FBcolonspace\fi}%
     \@for\FB@char:={`\;,`\!,`\?}\do
          {\XeTeXcharclass\FB@char=\FB@punctthin}%
     \XeTeXinterchartoks \z@ \FB@punctthin = {%
                     \ifhmode\FDP@thinspace\fi}%
     \XeTeXinterchartoks \FB@guilf \FB@punctthin = {%
                     \FDP@thinspace}%
     \XeTeXinterchartoks 255 \FB@punctthin = {%
                     \ifhmode\unskip\penalty\@M\FBthinspace\fi}%
     \XeTeXinterchartoks \FB@guilo \z@ = {%
                \ifFBAutoSpaceGuill\FBguillspace\fi}%
     \XeTeXinterchartoks \FB@guilo 255 = {%
                \ifFBAutoSpaceGuill\FBguillspace\ignorespaces\fi}%
     \XeTeXinterchartoks \z@ \FB@guilf = {%
                \ifFBAutoSpaceGuill\FBguillspace\fi}%
     \XeTeXinterchartoks \FB@punctthin \FB@guilf = {%
                \ifFBAutoSpaceGuill\FBguillspace\fi}%
     \XeTeXinterchartoks 255 \FB@guilf = {%
                \ifFBAutoSpaceGuill\unskip\FBguillspace\fi}%
%    \end{macrocode}
%    This will avoid spurious spaces in (!), [?] and with Unicode
%    nobreakspaces (U+00A0, U+202F):
%    \begin{macrocode}
     \@for\FB@char:={`\[,`\(,"A0,"202F}\do
          {\XeTeXcharclass\FB@char=\FB@punctnul}%
%    \end{macrocode}
%    These characters have their class changed by \file{xeCJK.sty},
%    let's reset them to 0 in French.
%    \begin{macrocode}
     \@for\FB@char:={`\{,`\,,`\.,`\-,`\),`\],`\},`\%,%
                     "22,"27,"60,"2019}\do
          {\XeTeXcharclass\FB@char=\z@}%
%    \end{macrocode}
%    With Xe(La)TeX, French defines no active shorthands.
%    \begin{macrocode}
      \def\shorthandoff##1{%
        \ifx\PackageWarning\@undefined
          \fb@warning{\noexpand\shorthandoff{;:!?} is helpless with
           XeTeX,\\ use \noexpand\NoAutoSpacing
           *inside a group* instead.}%
        \else
          \PackageWarning{frenchb.ldf}{\protect\shorthandoff{;:!?} is
           helpless with XeTeX,\MessageBreak use \protect\NoAutoSpacing
           \space *inside a group* instead;\MessageBreak reported}%
        \fi}%
      \def\shorthandon##1{}%
   }
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\FB@xetex@punct@nonfrench}
%    The following command will be executed when leaving French for
%    restoring classes 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:={`\:,`\;,`\!,`\?,"AB,"BB,%
                       `\(,`\[,`\{,`\,,`\.,`\-,`\),`\],`\},%
                       `\%,"22,"27,"60,"2019,"A0,"202F}\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
   }
   \FB@addto{extras}{\FB@xetex@punct@french}
   \FB@addto{noextras}{\FB@xetex@punct@nonfrench}
%    \end{macrocode}
%  \end{macro}
%    End of specific code for punctuation with modern XeTeX engines.
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
%  \subsubsection{Punctuation with standard (pdf)TeX}
%  \label{sssec-punct-tex}
%
%    In standard (pdf)TeX 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 |\FBthinspace| instead.  If no
%    space has been typed, we add |\FDP@thinspace| which will be
%    defined, up to the user's wishes, as |\FBthinspace|, or as
%    |\@empty|.
%    \begin{macrocode}
  \declare@shorthand{french}{;}{%
      \ifhmode
      \ifdim\lastskip>\z@
          \unskip\penalty\@M\FBthinspace
          \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\FBthinspace
        \else
          \FDP@thinspace
        \fi
      \fi
      \string!}
  \declare@shorthand{french}{?}{%
      \ifhmode
        \ifdim\lastskip>\z@
          \unskip\penalty\@M\FBthinspace
        \else
          \FDP@thinspace
        \fi
      \fi
      \string?}
  \declare@shorthand{french}{:}{%
      \ifhmode
        \ifdim\lastskip>\z@
          \unskip\penalty\@M\FBcolonspace
        \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}
  \FB@addto{extras}{\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{?}%
  }
  \FB@addto{noextras}{%
    \bbl@deactivate{:}\bbl@deactivate{;}%
    \bbl@deactivate{!}\bbl@deactivate{?}%
  }
\fi
%    \end{macrocode}
%
%  \subsubsection{Punctuation switches common to all engines}
%  \label{sssec-punct-switches}
%
%    A new `if' |\ifFBAutoSpacePunctuation| needs to be defined now to
%    control the two possible ways of dealing with `high punctuation'.
%    it's default value is true, but it can be set to false by
%    \fbsetup{AutoSpacePunctuation=false} for finer control.
%    \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}
%    |\autospace@beforeFDP| and |\noautospace@beforeFDP| are internal
%    commands.  |\autospace@beforeFDP| defines |\FDP@thinspace| and
%    |\FDP@colonspace| as unbreakable spaces and sets LuaTeX attribute
%    |\FB@addDPspace| to 1 (true), while |\noautospace@beforeFDP|
%    lets these spaces empty and  sets flag |\FB@addDPspace|
%    to 0 (false).  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{%
         \ifFB@luatex@punct\FB@addDPspace=1 \fi
         \def\FDP@thinspace{\penalty\@M\FBthinspace}%
         \def\FDP@colonspace{\penalty\@M\FBcolonspace}}
\def\noautospace@beforeFDP{%
         \ifFB@luatex@punct\FB@addDPspace=0 \fi
         \let\FDP@thinspace\@empty
         \let\FDP@colonspace\@empty}
\ifLaTeXe
    \def\AutoSpaceBeforeFDP{\autospace@beforeFDP
                            \FBAutoSpacePunctuationtrue}
    \def\NoAutoSpaceBeforeFDP{\noautospace@beforeFDP
                              \FBAutoSpacePunctuationfalse}
    \AtEndOfPackage{\AutoSpaceBeforeFDP}
\else
    \let\AutoSpaceBeforeFDP\autospace@beforeFDP
    \let\NoAutoSpaceBeforeFDP\noautospace@beforeFDP
    \AutoSpaceBeforeFDP
  \fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{v2.3a}{2008/10/10}{In LaTeX, frenchb no longer adds spaces
%     before `high 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égourié-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
%    \fbo{AutoSpacePunctuation} is \fbo{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 \fbo{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 the |; : ! ?|
%    characters, |\ttfamilyFB| also switches off insertion of spaces
%    inside French guillemets \emph{when they are typed in as
%    characters} with the `og'/`fg' options in \fbsetup{}.
%    This is also a workaround for the weird behaviour of these
%    characters in verbatim mode.
%
%    \begin{macrocode}
\ifLaTeXe
    \DeclareRobustCommand\ttfamilyFB{%
         \FBAutoSpaceGuillfalse
         \ifFB@luatex@punct\FB@addGUILspace=0 \fi
         \noautospace@beforeFDP\ttfamilyORI}%
    \DeclareRobustCommand\rmfamilyFB{%
         \FBAutoSpaceGuilltrue
         \ifFB@luatex@punct\FB@addGUILspace=1 \fi
         \ifFBAutoSpacePunctuation
           \autospace@beforeFDP
         \else
           \noautospace@beforeFDP
         \fi
         \rmfamilyORI}%
    \DeclareRobustCommand\sffamilyFB{%
         \FBAutoSpaceGuilltrue
         \ifFB@luatex@punct\FB@addGUILspace=1 \fi
         \ifFBAutoSpacePunctuation
           \autospace@beforeFDP
         \else
           \noautospace@beforeFDP
         \fi
         \sffamilyORI}%
\fi
%    \end{macrocode}
%
% \changes{v2.5a}{2010/08/14}{New command \cs{NoAutoSpacing},
%    suggested by MPG.}
%
%  \begin{macro}{\NoAutoSpacing}
%    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, LuaTeX and
%    XeTeX based engines) and is meant to be used inside a group.
%
%    \begin{macrocode}
\newcommand*{\NoAutoSpacing}{\FBAutoSpaceGuillfalse
   \ifFB@active@punct\shorthandoff{;:!?}\fi
   \ifFB@xetex@punct\XeTeXinterchartokenstate=0 \fi
   \ifFB@luatex@punct\FB@addDPspace=0 \FB@addGUILspace=0 \fi
}
%    \end{macrocode}
%  \end{macro}
%
%  \subsection{Commands for French quotation marks}
%  \label{ssec-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 French is to use the
%    command |\frquote| (see below).
%    Dummy definition of |\og| and |\fg| just to ensure that this
%    commands are not yet defined.  The default definition of |\og|
%    and |\fg| will be set later (for English) by
%    |\bbl@nonfrenchguillemets|.
%    \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 \pkg{aeguill} 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 and LuaLaTeX, |\guillemotleft| and |\guillemotright|
%    are defined by package \pkg{xunicode} loaded by \pkg{fontspec}.
%
% \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 provide the following definitions for non-LaTeX users only as
%    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.
%    |\FBguillspace| which does the spacing, has been fine tuned by
%    Thierry Bouche to 80\% of an inter-word space but with reduced
%    stretchability.  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 \pkg{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).
%
% \changes{v3.0a}{2014/01/10}{Definitions of \cs{FB@og} and \cs{FB@fg}
%    now depend on punctuation handling (LuaTeX / XeTeX / active).}
%
% \changes{v3.0a}{2014/01/10}{Added explicit \cs{FBguillskip}
%    for LuaTeX.}
%
% \changes{v3.0c}{2014/04/18}{Changed \cs{FBguill@spacing} (internal)
%    to \cs{FBguillspace} (public).}
%
%    LuaTeX which requires skips; |\FBguillskip| is computed from
%    |\FBguillspace| for the |lmr10| font, its dimensions will
%    be scaled by \file{frenchb.lua} for the current font.
%    \begin{macrocode}
\newskip\FBguillskip
\FBguillskip=2.664pt plus 0.500pt minus 0.888pt \relax
\newcommand*{\FBguillspace}{\penalty\@M\hskip.8\fontdimen2\font
                                         plus.3\fontdimen3\font
                                        minus.8\fontdimen4\font}
%    \end{macrocode}
%    |\FBguillspace| is not used with LuaTeX.
%    \begin{macrocode}
\ifFB@luatex@punct
  \DeclareRobustCommand*{\FB@og}{\leavevmode
          \bgroup\FB@addGUILspace=1 \guillemotleft\egroup}
  \DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
          \bgroup\FB@addGUILspace=1 \guillemotright\egroup\xspace}
\fi
%    \end{macrocode}
%    With XeTeX, |\FBAutoSpaceGuill| is set to |false| locally to
%    prevent the quotes characters from adding space when option
%    \fbo{og=«, fg=»} is set.
%    characters.
%    \begin{macrocode}
\ifFB@xetex@punct
  \DeclareRobustCommand*{\FB@og}{\leavevmode
        \bgroup\FBAutoSpaceGuillfalse\guillemotleft\egroup
        \FBguillspace}
  \DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
        \FBguillspace
        \bgroup\FBAutoSpaceGuillfalse\guillemotright\egroup\xspace}
\fi
\ifFB@active@punct
  \DeclareRobustCommand*{\FB@og}{\leavevmode
        \guillemotleft
        \FBguillspace}
  \DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
        \FBguillspace
        \guillemotright\xspace}
\fi
%    \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 or LuaTeX, fixed by using
%    \cs{textquotedblleft} and \cs{textquotedblright} defined above.}
%
% \changes{v3.0a}{2014/01/10}{\cs{bbl@nonfrenchguillemets} deleted,
%    use \cs{babel@save} instead.}
%
%    \begin{macrocode}
\ifLaTeXe
  \def\bbl@frenchguillemets{\renewcommand*{\og}{\FB@og}%
                            \renewcommand*{\fg}{\FB@fg}}
  \renewcommand*{\og}{\textquotedblleft}
  \renewcommand*{\fg}{\ifdim\lastskip>\z@\unskip\fi \textquotedblright}
\else
  \def\bbl@frenchguillemets{\let\og\FB@og
                            \let\fg\FB@fg}
  \def\og{\textquotedblleft}
  \def\fg{\ifdim\lastskip>\z@\unskip\fi\textquotedblright}
\fi
\FB@addto{extras}{\babel@save\og \babel@save\fg \bbl@frenchguillemets}
%    \end{macrocode}
%
% \changes{v3.1a}{2014/05/20}{New command \cs{frquote} for imbedded or
%    long French quotations.}
%
%    \begin{macro}{\frquote}
%    Maximum two levels are supported by |\frquote{}|.
%    Let's define the default quote characters to be used for level one
%    or two of quotes\dots{}
%    \begin{macrocode}
\newcommand*{\ogi}{\FB@og}
\newcommand*{\fgi}{\FB@fg}
\newcommand*{\ogii}{\textquotedblleft}
\newcommand*{\fgii}{\textquotedblright}
%    \end{macrocode}
%    and the needed technical stuff to handle options:
%    \begin{macrocode}
\newcount\FBguill@level
\newif\ifFBcloseguill  \FBcloseguilltrue
\newif\ifFBInnerGuillSingle
\def\FBguillopen{\bgroup\NoAutoSpacing\guillemotleft\egroup}
\def\FBguillclose{\bgroup\NoAutoSpacing\guillemotright\egroup}
\let\FBguillnone\relax
\let\FBeveryparguill\FBguillopen
\ifFB@luatex@punct
   \let\FBeverylineguill\FBguillopen
   \ifLaTeXe
      \let\local@leftbox\luatexlocalleftbox
   \else
      \let\local@leftbox\localleftbox
   \fi
\else
   \let\FBeverylineguill\FBguillnone
\fi
%    \end{macrocode}
%    The main command |\frquote| accepts (in \LaTeXe{} only) a starred
%    version which suppresses the closing quote; it is meant to be used
%    for inner quotations which end together with the outer one, then
%    only one closing guillemet (the outer one) should be printed.
%    \begin{macrocode}
\ifLaTeXe
   \DeclareRobustCommand\frquote{%
       \@ifstar{\FBcloseguillfalse\fr@quote}%
               {\FBcloseguilltrue\fr@quote}}
\else
   \newcommand\frquote[1]{\fr@quote{#1}}
\fi
%    \end{macrocode}
%    The internal command |\fr@quote| takes one (long) argument: the
%    quotation text.
%    \begin{macrocode}
\newcommand{\fr@quote}[1]{%
  \bgroup
    \ifnum\FBguill@level=2
      \PackageWarning{frenchb.ldf}{%
              \protect\frquote\space accepts no more than two levels
              \MessageBreak of quotations.  Reported}
    \else
      \advance\FBguill@level by \@ne
    \fi
    \ifnum\FBguill@level=1
%    \end{macrocode}
%    Set |\FBeverypar@quote| for level 1 quotations:
%    \begin{macrocode}
      \ifx\FBeveryparguill\relax
         \let\FBeverypar@quote\relax
      \else
         \def\FBeverypar@quote{\FBeveryparguill
                               \kern.8\fontdimen2\font}%
      \fi
      \expandafter\csname og\romannumeral\FBguill@level\endcsname
      \everypar \expandafter{\the\everypar \FBeverypar@quote}%
      #1%
      \expandafter\csname fg\romannumeral\FBguill@level\endcsname
    \else
%    \end{macrocode}
%    This for level 2 (inner) quotations: Omega's command
%    |\localleftbox| (included in LuaTeX, renamed |\luatexlocalleftbox|
%    in LuaLaTeX) is convenient for repeating guillemets at the
%    beginning of every line.
%    \begin{macrocode}
      \ifx\FBeverylineguill\FBguillopen
         \local@leftbox{\guillemotleft\kern.8\fontdimen2\font}%
         \let\FBeverypar@quote\relax
         \FB@og #1\ifFBcloseguill\FB@fg\fi
      \else
        \ifx\FBeverylineguill\FBguillclose
           \local@leftbox{\guillemotright\kern.8\fontdimen2\font}%
           \let\FBeverypar@quote\relax
           \FB@og #1\ifFBcloseguill\FB@fg\fi
        \else
%    \end{macrocode}
%    otherwise we need to redefine |\FBeverypar@quote| (and eventually
%    |\ogii|, |\fgii|) for level 2 quotations:
%    \begin{macrocode}
           \let\FBeverypar@quote\relax
           \ifFBInnerGuillSingle
              \def\ogii{\leavevmode
                        \guilsinglleft\FBguillspace}%
              \def\fgii{\ifdim\lastskip>\z@\unskip\fi
                        \FBguillspace\guilsinglright}%
              \ifx\FBeveryparguill\FBguillopen
                  \def\FBeverypar@quote{\guilsinglleft
                                        \kern.8\fontdimen2\font}%
              \fi
              \ifx\FBeveryparguill\FBguillclose
                  \def\FBeverypar@quote{\guilsinglright
                                        \kern.8\fontdimen2\font}%
              \fi
           \fi
           \expandafter\csname og\romannumeral\FBguill@level\endcsname
           #1%
           \ifFBcloseguill\expandafter
              \csname fg\romannumeral\FBguill@level\endcsname
           \fi
        \fi
      \fi
    \fi
  \egroup
}
%    \end{macrocode}
%    \end{macro}
%
%  \subsection{Date in French}
% \label{sssec-date}
%
% \begin{macro}{\datefrench}
%    The macro |\datefrench| redefines the command |\today| to
%    produce French dates. This new implementation requires \babel~3.9i
%    or newer but, as of 3.9k, doesn't work with Plain based formats,
%    so |\date\CurrentOption| is defined the old way for these formats.
%
% \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{v3.0a}{2014/02/18}{Take advantage of babel's \cs{SetString}
%    commands for \cs{datefrench}.  Doesn't work with Plain (yet?).}
%
% \changes{v3.0c}{2014/03/26}{\cs{SetString} still does not work for
%    Plain with babel 3.9k.  Need to define \cs{datefrench}.}
%
%    \begin{macrocode}
\ifLaTeXe
  \def\BabelLanguages{french,acadian}
  \StartBabelCommands*{\BabelLanguages}{date}
      [unicode, fontenc=EU1 EU2, charset=utf8]
    \SetString\monthiiname{février}
    \SetString\monthviiiname{août}
    \SetString\monthxiiname{décembre}
  \StartBabelCommands*{\BabelLanguages}{date}
    \SetStringLoop{month#1name}{%
        janvier,f\'evrier,mars,avril,mai,juin,juillet,%
        ao\^ut,septembre,octobre,novembre,d\'ecembre}
    \SetString\today{{\number\day}\ifnum1=\day {\ier}\fi\space
        \csname month\romannumeral\month name\endcsname \space
        \number\year
       }
  \EndBabelCommands
\else
  \ifFBunicode
    \@namedef{date\CurrentOption}{%
      \def\today{{\number\day}\ifnum1=\day {\ier}\fi \space
          \ifcase\month
            \or janvier\or février\or mars\or avril\or mai\or
            juin\or juillet\or août\or septembre\or
            octobre\or novembre\or décembre\fi
          \space \number\year}}
  \else
    \@namedef{date\CurrentOption}{%
      \def\today{{\number\day}\ifnum1=\day {\ier}\fi \space
        \ifcase\month
          \or janvier\or f\'evrier\or mars\or avril\or mai\or
          juin\or juillet\or ao\^ut\or septembre\or
          octobre\or novembre\or d\'ecembre\fi
        \space \number\year}}
  \fi
\fi
%    \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é i Ballester.}
%
%  \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 \fbsetup{FrenchSuperscripts=false} redefines |\up|
%    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 \pkg{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 \fbo{LowercaseSuperscripts=false} of \fbsetup{}.
%    \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) \pkg{realscripts} used in conjunction with
%    XeLaTeX or LuaLaTeX and OpenType fonts having the font feature
%    'VerticalPosition=Superior' and b) \pkg{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 defined as |\FB@up| unless |\realsuperscript| is
%    defined by \file{realscripts.sty}.
%    \begin{macrocode}
  \DeclareRobustCommand*{\fup}[1]{%
    \ifx\realsuperscript\@undefined
       \FB@up{#1}%
    \else
      \bgroup\let\fakesuperscript\FB@up@fake
             \realsuperscript{\FB@lc{#1}}\egroup
    \fi}
%    \end{macrocode}
%    Let's provide a temporary definition for |\up| (redefined
%    `AtBeginDocument' as |\fup| or |\textsuperscript| according to
%    \fbsetup{} options).
%    \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éro''.
%    \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.
%
% \changes{v2.5f}{2011/07/18}{Changed definitions of \cs{at},
%    \cs{circonflexe}, \cs{tild}, \cs{boi} and \cs{degre} for
%    Unicode based engines.}
%
%    \begin{macrocode}
\ifFBunicode
    \newcommand*{\at}{{\char"0040}}
    \newcommand*{\circonflexe}{{\char"005E}}
    \newcommand*{\tild}{{\char"007E}}
    \newcommand*{\boi}{\textbackslash}
    \newcommand*{\degre}{{\char"00B0}}
\else
  \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
\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|).
%
% \changes{v2.6e}{2013/07/06}{Refrain from redefining \cs{textdegree}
%    from latin1.def, applemac.def, etc. as \cs{degres} because it
%    loops in hyperref's bookmarks.  Pointed out by Eddy Flas on fctt.}
%
%    If \TeX{} Companion fonts are available (\file{textcomp.sty}),
%    we pick up |\textdegree| from them instead of emulating `degrees'
%    from the |\r{}| accent.  Otherwise we advise 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).}
%
% \changes{v2.5h}{2012/03/21}{textcomp.sty has changed.  The test
%    about \cs{M@TS1} is no longer relevant, let's change it.}
%
%    \begin{macrocode}
\ifLaTeXe
  \newcommand*{\degres}{\degre}
  \ifFBunicode
    \DeclareRobustCommand*{\degres}{\degre}
  \else
    \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}}
    \AtBeginDocument{\ifx\DeclareEncodingSubset\@undefined
                        \DeclareRobustCommand*{\degres}{%
                           \leavevmode\hbox to 0.3em{\hss\degre\hss}%
                        \Warning@degree@TSone
                        \global\let\Warning@degree@TSone\relax}%
                     \else
                        \DeclareRobustCommand*{\degres}{%
                          \hbox{\UseTextSymbol{TS1}{\textdegree}}}%
                     \fi
                     }
  \fi
\else
  \newcommand*{\degres}{%
    \leavevmode\hbox to 0.3em{\hss\degre\hss}}
\fi
%    \end{macrocode}
%  \end{macro}
%
%  \subsection{Formatting numbers}
%  \label{ssec-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}{}%
   \FB@addto{extras}{\mathcode`\,=\dec@mcc}%
}
\newcommand*{\StandardMathComma}{\mathcode`\,=\std@mcc
   \FB@addto{extras}{\mathcode`\,=\std@mcc}%
}
\FB@addto{noextras}{\mathcode`\,=\std@mcc}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\nombre}
%
% \changes{v2.0}{2006/11/06}{\cs{nombre} now requires 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}\fb@warning{*** \noexpand\nombre
                                no longer formats numbers\string! ***}}
%    \end{macrocode}
%  \end{macro}
%
%    The next definitions only make sense for \LaTeXe.
%    For Plain based formats, let's activate LuaTeX punctuation if
%    necessary, then cleanup and exit. Temporary fix: |\l@french| is
%    not properly set by \babel~3.9h with Plain LuaTeX format.
%
%    \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{\ifFB@luatex@punct
                       \activate@luatexpunct
                    \fi
                    \FBclean@on@exit
                    \ldf@quit\CurrentOption\endinput}
\fi
\FBstop@here
%    \end{macrocode}
%
%    What follows is for \LaTeXe{} \emph{only}; as all \LaTeXe{}
%    based formats include \eTeX, we can use |\ifdefined| now.
%    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 \pkg{numprint}
%    is \emph{not} loaded automatically by \frenchb{} because of
%    possible options conflict.
%
%    \begin{macrocode}
\renewcommand*{\nombre}[1]{\Warning@nombre\numprint{#1}}
\newcommand*{\Warning@nombre}{%
   \ifdefined\numprint
   \else
      \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 more options.\MessageBreak
         \protect\nombre\space called}%
      \global\let\Warning@nombre\relax
   \fi
}
%    \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}.}
%
%  \subsection{Caption names}
%
%    The next step consists in 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.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{v3.0a}{2014/02/18}{Take advantage of babel's \cs{SetString}
%    commands for captionnames.}
%
%   New implementation for caption names (requires \babel's~3.9 or up).
%    \begin{macrocode}
\StartBabelCommands*{\BabelLanguages}{captions}
      [unicode, fontenc=EU1 EU2, charset=utf8]
   \SetString{\refname}{Références}
   \SetString{\abstractname}{Résumé}
   \SetString{\prefacename}{Préface}
   \SetString{\contentsname}{Table des matières}
   \SetString{\ccname}{Copie à }
   \SetString{\proofname}{Démonstration}
   \SetStringLoop{ordinal#1}{%
       Première,Deuxième,Troisième,Quatrième,Cinquième,%
       Sixième,Septième,Huitième,Neuvième,Dixième,Onzième,%
       Douzième,Treizième,Quatorzième,Quinzième,Seizième,%
       Dix-septième,Dix-huitième,Dix-neuvième,Vingtième}
\StartBabelCommands*{\BabelLanguages}{captions}
   \SetString{\refname}{R\'ef\'erences}
   \SetString{\abstractname}{R\'esum\'e}
   \SetString{\bibname}{Bibliographie}
   \SetString{\prefacename}{Pr\'eface}
   \SetString{\chaptername}{Chapitre}
   \SetString{\appendixname}{Annexe}
   \SetString{\contentsname}{Table des mati\`eres}
   \SetString{\listfigurename}{Table des figures}
   \SetString{\listtablename}{Liste des tableaux}
   \SetString{\indexname}{Index}
   \SetString{\figurename}{{\scshape Figure}}
   \SetString{\tablename}{{\scshape Table}}
   \SetString{\pagename}{page}
   \SetString{\seename}{voir}
   \SetString{\alsoname}{voir aussi}
   \SetString{\enclname}{P.~J. }
   \SetString{\ccname}{Copie \`a }
   \SetString{\headtoname}{}
   \SetString{\proofname}{D\'emonstration}
   \SetString{\glossaryname}{Glossaire}
%    \end{macrocode}
%   ``Première partie'' instead of ``Part I''.
%    \begin{macrocode}
   \SetStringLoop{ordinal#1}{%
       Premi\`ere,Deuxi\`eme,Troisi\`eme,Quatri\`eme,Cinqui\`eme,%
       Sixi\`eme,Septi\`eme,Huiti\`eme,Neuvi\`eme,Dixi\`eme,Onzi\`eme,%
       Douzi\`eme,Treizi\`eme,Quatorzi\`eme,Quinzi\`eme,Seizi\`eme,%
       Dix-septi\`eme,Dix-huiti\`eme,Dix-neuvi\`eme,Vingti\`eme}
   \AfterBabelCommands{%
       \DeclareRobustCommand*{\FB@emptypart}{\def\thepart{}}%
       \DeclareRobustCommand*{\FB@Rpart}{\def\thepart{\Roman{part}}}%
      }
   \SetString{\partname}{%
       \csname ordinal\romannumeral\value{part}\endcsname\space
       partie\FB@emptypart}
\EndBabelCommands
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.0a}{2014/02/28}{Merging of \cs{captionsfrenchb},
%    \cs{captionsfrancais} with \cs{captionsfrench} deleted in favor
%    of new babel 3.9 syntax.}
%
%    Up to v2.6h \frenchb{} used to merge |\captionsfrenchb| and
%    |\captionsfrancais| into |\captionsfrench| at |\begin{document}|.
%    This is deprecated in favor of the new (much simpler!) syntax
%    introduced in \babel~3.9.  No need to define |\captionscanadien|
%    and |\captionsacadian| either.
%
% \begin{macro}{\CaptionSeparator}
%    Let's consider now captions in figures and tables.
%    In French, captions in figures and tables should never be printed
%    as `Figure 1:' which is the default in standard \LaTeXe{} classes;
%    the `:' is made active too late, no space is added before it.
%    With LuaLaTeX and XeLaTeX, this glitch doesn't occur, you get
%    `Figure 1~:' which is correct in French.  With pdfLaTeX \frenchb{}
%    provides the following workaround.
%
%    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), is saved in |\STD@makecaption|.
%    `AtBeginDocument' we compare it to its current definition (some
%    classes like \cls{memoir}, koma-script classes, AMS classes,
%    ua-thesis.cls\dots change it).
%    If they are identical, \frenchb{} just adds a hook called
%    |\FBCaption@Separator| to |\@makecaption|; |\FBCaption@Separator|
%    defaults to `: ' as in the standard |\@makecaption| and will be
%    changed to ` : ' in French `AtBeginDocument'; it can be also set to
%    |\CaptionSeparator| (` -- ') using \fbo{CustomiseFigTabCaptions}.
%
% \changes{v2.4a}{2009/11/23}{\cs{PackageWarning} changed to
%     \cs{FBWarning} (in case \cs{@makecaption} has been customised).
%     \cs{FBWarning} is defined as \cs{PackageWarning} by default but
%     can be made silent using \cs{frenchbsetup}, (suggested by MPG).}
%
% \changes{v2.6c}{2013/05/18}{Former \cs{CaptionSeparator}
%     has been renamed as \cs{FBCaption@Separator};
%     Newif \cs{if@FBwarning@capsep} added.}
%
% \changes{v2.6h}{2014/01/03}{No active catcodes in
%    \cs{STD@makecaption}'s definition.}
%
% \changes{v3.0a}{2014/02/28}{Remove \cs{CaptionSeparatorORI}, use
%    \cs{babel@save} instead.}
%
%    While saving the standard definition of |\@makecaption| we have to
%    make sure that characters `:' and `|>|' have |\catcode| 12
%    (\frenchb{} makes `:' active and \file{spanish.ldf} makes `|>|'
%    active).
%    \begin{macrocode}
\bgroup
  \catcode`:=12 \catcode`>=12 \relax
  \long\gdef\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}
\egroup
%    \end{macrocode}
%
%    The \pkg{caption} and \pkg{floatrow} packages are compatible
%    with \frenchb{} if they are loaded after \babel{} (a warning is
%    printed in the .log file when they are loaded too early).
%
%    No warning is issued for SMF and AMS classes as their layout of
%    captions is compatible with French typographic standards.
%
%    With \cls{memoir} and koma-script classes, \frenchb{} customises
%    |\captiondelim| or |\captionformat| in French (unless option
%    \fbo{CustomiseFigTabcaptions} is set to \fbo{false}) and issues
%    no warning.
%
%    When |\@makecaption| has been changed by another class
%    or package, a warning is printed in the .log file.
%
%    \begin{macrocode}
\newif\if@FBwarning@capsep
\@FBwarning@capseptrue
\newcommand{\FBWarning}[2]{\PackageWarning{#1}{#2}}
\newcommand*{\CaptionSeparator}{\space\textendash\space}
\def\FBCaption@Separator{:\space}
\long\def\FB@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{#1\FBCaption@Separator #2}%
  \ifdim \wd\@tempboxa >\hsize
    #1\FBCaption@Separator #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
%    \end{macrocode}
% \end{macro}
%
% \changes{v2.6c}{2013/05/18}{No warning about \cs{@makecaption} for
%     AMS classes.}
%
% \changes{v3.0a}{2014/02/20}{No warning about \cs{@makecaption} for
%     SMF classes. No warning either with LuaTeX or XeTeX engines.}
%
%    Disable the standard warning with AMS and SMF classes.
%    \begin{macrocode}
\@ifclassloaded{amsart}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{amsbook}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{amsdtx}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{amsldoc}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{amproc}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{smfart}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{smfbook}{\@FBwarning@capsepfalse}{}
%    \end{macrocode}
%
%    Disable the standard warning unless high punctuation is active.
%    \begin{macrocode}
\ifFB@active@punct\else\@FBwarning@capsepfalse\fi
%    \end{macrocode}
%
% \changes{v2.6c}{2013/05/18}{No warning about \cs{@makecaption} for
%    koma-script classes. \cs{captionformat} customised in French.}
%
% \changes{v2.6h}{2014/01/05}{If \cs{@makecaption} is undefined, no
%     warning.}
%
%    No warning with \cls{memoir} or koma-script classes: they change
%    |\@makecaption| but we will manage to customise them  in French
%    later on (see below after executing |\FBprocess@options|).
%    No warning either if |\@makecaption| is undefined.
%    \begin{macrocode}
\newif\ifFB@koma
\@ifclassloaded{memoir}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{scrartcl}{\@FBwarning@capsepfalse\FB@komatrue}{}
\@ifclassloaded{scrbook}{\@FBwarning@capsepfalse\FB@komatrue}{}
\@ifclassloaded{scrreprt}{\@FBwarning@capsepfalse\FB@komatrue}{}
\ifdefined\@makecaption\else\@FBwarning@capsepfalse\fi
%    \end{macrocode}
%
% \changes{v2.6c}{2013/05/18}{Warning added when the caption
%    or floatrow package is loaded before babel/frenchb.}
%
%    Check if package \pkg{caption} is loaded now (before
%    \babel/\frenchb), then issue a warning advising to load it
%    after \babel/\frenchb{} and disable the standard warning.
%    \begin{macrocode}
\@ifpackageloaded{caption}
    {\FBWarning{frenchb.ldf}%
        {Please load the "caption" package\MessageBreak
         AFTER babel/frenchb; reported}%
     \@FBwarning@capsepfalse}%
     {}
%    \end{macrocode}
%
%    Same for package \file{floatrow}.
%    \begin{macrocode}
\@ifpackageloaded{floatrow}
    {\FBWarning{frenchb.ldf}%
        {Please load the "floatrow" package\MessageBreak
         AFTER babel/frenchb; reported}%
     \@FBwarning@capsepfalse}%
     {}
%    \end{macrocode}
%
% \changes{v3.0a}{2014/02/20}{More informative, less TeXnical warning
%    about \cs{@makecaption}.}
%
%    First check the definition of |\@makecaption|, change it or issue
%    a warning in case it has been changed by a class or package not
%    (yet) compatible with \frenchb; then change the definition of
%    |\FBCaption@Separator|, taking care that the colon is typeset
%    correctly in French (\emph{not} `Figure~1: légende').
%
%    \begin{macrocode}
\AtBeginDocument{%
  \ifx\@makecaption\STD@makecaption
      \global\let\@makecaption\FB@makecaption
%    \end{macrocode}
%    Do not overwrite |\FBCaption@Separator| if already saved
%    as ': '  for other languages and set to |\CaptionSeparator| by
%    |\extrasfrench| when French is the main language.
%    \begin{macrocode}
      \ifFBOldFigTabCaptions
      \else
        \def\FBCaption@Separator{\iflanguage{french}{ : }{: }}%
      \fi
      \ifFBCustomiseFigTabCaptions
         \ifx\bbl@main@language\FB@french
            \def\FBCaption@Separator{\CaptionSeparator}%
         \fi
      \fi
      \@FBwarning@capsepfalse
  \fi
  \if@FBwarning@capsep
    \FBWarning{frenchb.ldf}%
       {Figures' and tables' captions might look like\MessageBreak
        `Figure 1:' which is wrong in French.\MessageBreak
        Check your class or packages to change this;\MessageBreak
        reported}%
  \fi
  \let\FB@makecaption\relax
  \let\STD@makecaption\relax
}
%    \end{macrocode}
%
%  \subsection{Dots\dots}
%  \label{ssec-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).}
%
% \changes{v2.5f}{2011/06/18}{Unicode fonts also provide a ready made
%    character for \cs{textellipsis}, let's just use it!
%    (reported by Maxime Chupin, 2011/06/04).}
%
%    LY1 has a ready made character for |\textellipsis|, it should be
%    used in French too.  The same is true for Unicode fonts in use
%    with XeTeX and LuaTeX.
%
%    \begin{macrocode}
\ifFBunicode
  \let\FBtextellipsis\textellipsis
\else
  \DeclareTextSymbol{\FBtextellipsis}{LY1}{133}
  \DeclareTextCommandDefault{\FBtextellipsis}{%
    .\kern\fontdimen3\font.\kern\fontdimen3\font.\xspace}
\fi
%    \end{macrocode}
%    |\Mdots@| and |\Tdots@| 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@}{\@xp\textellipsis}
\newcommand*{\Mdots@}{\@xp\mdots@}
\AtBeginDocument{\DeclareRobustCommand*{\dots}{\relax
                 \csname\ifmmode M\else T\fi dots@\endcsname}%
                 \ifdefined\@xp\else\let\@xp\relax\fi
                 \ifdefined\mdots@\else\let\Mdots@\mathellipsis\fi
                }
\def\bbl@frenchdots{\babel@save\Tdots@ \let\Tdots@\FBtextellipsis}
\FB@addto{extras}{\bbl@frenchdots}
%    \end{macrocode}
%  \end{macro}
%
%  \subsection{Setup options: keyval stuff}
%  \label{ssec-keyval}
%
% \changes{v2.0}{2006/11/06}{New command \cs{frenchbsetup} added
%     for global customisation.}
%
% \changes{v3.0a}{2014/02/24}{Options processing completely
%    reorganised.}
%
%    All setup options are handled by command \fbsetup{} using the
%    keyval syntax.  A list of flags is defined and set to a default
%    value which will possibly be changed `AtEndOfPackage' if French is
%    the main language.  After this, \fbsetup{} eventually modifies the
%    preset values of these flags.
%
%    Option processing can occur either in \fbsetup{}, but \emph{only
%    for options explicitly set} by \fbsetup{}, or `AtBeginDocument';
%    any option affecting |\extrasfrench{}| \emph{must} be processed by
%    \fbsetup{}: when French is the main language, |\extrasfrench{}| is
%    executed by \babel{} when it switches the main language and this
%    occurs \emph{before} reading the stuff postponed by \frenchb{}
%    `AtBeginDocument'.  Reexecuting |\extrasfrench{}| is a possibility
%    which was used up to v2.6h, it has been dropped in v3.0a because
%    of its side-effects (f.i. |\babel@save| and |\babel@savevariable|
%    no longer work).
%
%  \begin{macro}{\frenchbsetup}
%    Let's now define this command which reads and sets the options
%    to be processed either immediately (i.e. just after setting the
%    key) or later (at |\begin{document}|) by |\FBprocess@options|.
%    \fbsetup{} can only be called in the preamble.
%
% \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}{Default values of flags changed:
%     default now means `StandardLayout', they 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.}
%
% \changes{v2.6a}{2013/01/30}{New options ListOldLayout,
%    StandardItemizeEnv and StandardEnumerateEnv (CompactItemize is
%    deprecated).}
%
% \changes{v3.0a}{2014/02/28}{New options OldFigTabCaptions and
%    CustomiseFigTabCaptions.}
%
% \changes{v3.0c}{2014/04/18}{New option INGuillSpace.}
%
% \changes{v3.1a}{2014/05/20}{New options InnerGuillSingle,
%    EveryParGuill and EveryLineGuill to control \cs{frquote}.}
%
%    \begin{macrocode}
\newcommand*{\frenchbsetup}[1]{%
  \setkeys{FB}{#1}%
}%
\@onlypreamble\frenchbsetup
%    \end{macrocode}
%  \end{macro}
%
%    We define a collection of conditionals with their defaults
%    (true or false).
%
%    \begin{macrocode}
\newif\ifFBShowOptions              \FBShowOptionsfalse
\newif\ifFBStandardLayout           \FBStandardLayouttrue
\newif\ifFBGlobalLayoutFrench       \FBGlobalLayoutFrenchtrue
\newif\ifFBReduceListSpacing        \FBReduceListSpacingfalse
\newif\ifFBListOldLayout            \FBListOldLayoutfalse
\newif\ifFBCompactItemize           \FBCompactItemizefalse
\newif\ifFBStandardItemizeEnv       \FBStandardItemizeEnvtrue
\newif\ifFBStandardEnumerateEnv     \FBStandardEnumerateEnvtrue
\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\ifFBCustomiseFigTabCaptions  \FBCustomiseFigTabCaptionsfalse
\newif\ifFBOldFigTabCaptions        \FBOldFigTabCaptionsfalse
\newif\ifFBSuppressWarning          \FBSuppressWarningfalse
\newif\ifFBINGuillSpace             \FBINGuillSpacefalse
%    \end{macrocode}
%
%    The defaults values of these flags have been choosen 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.  `AtEndOfPackage' we check the
%    main language in |\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 \fbsetup{}.
%    When the \cls{beamer} is loaded, lists are not customised at all
%    to ensure compatibility.
%
% \changes{v2.5b}{2010/10/30}{Do not use the
%    test \cs{iflanguage}\{french\} to check whether French is the
%    main language or not, as it might be be erroneously positive
%    when English is the main language and no hyphenation patterns
%    are available for French.
%    In this case \cs{l@french} and \cs{l@english} are 0.
%    Pointed out by Günter Milde.}
%
% \changes{v3.0c}{2014/03/30}{Activate option StandardLists when beamer
%    class is loaded.}
%
%    \begin{macrocode}
\edef\FB@french{\CurrentOption}
\AtEndOfPackage{%
  \ifx\bbl@main@language\FB@french
    \FBGlobalLayoutFrenchtrue
    \@ifclassloaded{beamer}%
      {\PackageInfo{frenchb.ldf}{%
          No list customisation for the beamer class,%
          \MessageBreak reported}}%
      {\FBReduceListSpacingtrue
       \FBStandardItemizeEnvfalse
       \FBStandardEnumerateEnvfalse
       \FBStandardItemLabelsfalse}%
    \FBIndentFirsttrue
    \FBFrenchFootnotestrue
    \FBAutoSpaceFootnotestrue
    \FBCustomiseFigTabCaptionstrue
  \else
    \FBGlobalLayoutFrenchfalse
  \fi
%    \end{macrocode}
%    \frenchb{} being an option of \babel, it cannot load a package
%    (\pkg{keyval}) while \file{frenchb.ldf} is read, so we defer the
%    loading of \file{keyval} and the options setup at the end of
%    \babel's loading.
%    \begin{macrocode}
  \RequirePackage{keyval}%
  \define@key{FB}{ShowOptions}[true]%
                      {\csname FBShowOptions#1\endcsname}%
  \define@key{FB}{StandardLayout}[true]%
                      {\csname FBStandardLayout#1\endcsname
                       \ifFBStandardLayout
                         \FBReduceListSpacingfalse
                         \FBStandardItemizeEnvtrue
                         \FBStandardItemLabelstrue
                         \FBStandardEnumerateEnvtrue
                         \FBIndentFirstfalse
                         \FBFrenchFootnotesfalse
                         \FBAutoSpaceFootnotesfalse
                         \FBGlobalLayoutFrenchfalse
                       \else
                         \FBReduceListSpacingtrue
                         \FBStandardItemizeEnvfalse
                         \FBStandardItemLabelsfalse
                         \FBStandardEnumerateEnvfalse
                         \FBIndentFirsttrue
                         \FBFrenchFootnotestrue
                         \FBAutoSpaceFootnotestrue
                       \fi}%
  \define@key{FB}{GlobalLayoutFrench}[true]%
                      {\csname FBGlobalLayoutFrench#1\endcsname
%    \end{macrocode}
%    If this key is set to \fbo{true} when French is the main language,
%    nothing to do: all flags keep their default value.
%    If this key is set to \fbo{false}, nothing to do either:
%    |\babel@save| will do the job.
%    \begin{macrocode}
                      \ifFBGlobalLayoutFrench
                         \ifx\bbl@main@language\FB@french
                         \else
                            \PackageWarning{frenchb.ldf}%
                              {Option `GlobalLayoutFrench' skipped:%
                               \MessageBreak French is *not*
                               babel's last option.\MessageBreak}%
                         \fi
                       \fi}%
  \define@key{FB}{ReduceListSpacing}[true]%
                      {\csname FBReduceListSpacing#1\endcsname}%
  \define@key{FB}{ListOldLayout}[true]%
                      {\csname FBListOldLayout#1\endcsname
                       \ifFBListOldLayout
                         \FBStandardEnumerateEnvtrue
                         \renewcommand*{\FrenchLabelItem}{\textendash}%
                       \fi}%
  \define@key{FB}{CompactItemize}[true]%
                      {\csname FBCompactItemize#1\endcsname
                       \ifFBCompactItemize
                         \FBStandardItemizeEnvfalse
                         \FBStandardEnumerateEnvfalse
                       \else
                         \FBStandardItemizeEnvtrue
                         \FBStandardEnumerateEnvtrue
                       \fi}%
  \define@key{FB}{StandardItemizeEnv}[true]%
                      {\csname FBStandardItemizeEnv#1\endcsname}%
  \define@key{FB}{StandardEnumerateEnv}[true]%
                      {\csname FBStandardEnumerateEnv#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
                         \FBStandardItemizeEnvtrue
                         \FBStandardEnumerateEnvtrue
                         \FBStandardItemLabelstrue
                       \else
                         \FBReduceListSpacingtrue
                         \FBCompactItemizetrue
                         \FBStandardItemizeEnvfalse
                         \FBStandardEnumerateEnvfalse
                         \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
                      \ifFBPartNameFull
                      \else
                        \FB@addto{captions}{%
                            \def\partname{Partie\protect\FB@Rpart}}%
                      \fi}%
  \define@key{FB}{CustomiseFigTabCaptions}[true]%
          {\csname FBCustomiseFigTabCaptions#1\endcsname}%
  \define@key{FB}{OldFigTabCaptions}[true]%
          {\csname FBOldFigTabCaptions#1\endcsname
%    \end{macrocode}
%    |\CurrentOption| no longer defined.  It's value has been saved
%    in |\FB@CurOpt| while reading \file{frenchb.ldf}.
%    \begin{macrocode}
             \ifFBOldFigTabCaptions
                \FB@addto{extras}{\babel@save\FBCaption@Separator
                         \def\FBCaption@Separator{\CaptionSeparator}}%
             \fi}%
  \define@key{FB}{SuppressWarning}[true]%
                      {\csname FBSuppressWarning#1\endcsname
                       \ifFBSuppressWarning
                         \renewcommand{\FBWarning}[2]{\relax}%
                       \fi}%
%    \end{macrocode}
%    Here are the options controlling French guillemets spacing
%    and the output of |\frquote{}|.
%    \begin{macrocode}
  \define@key{FB}{INGuillSpace}[true]%
                      {\csname FBINGuillSpace#1\endcsname}%
  \define@key{FB}{InnerGuillSingle}[true]%
                     {\csname FBInnerGuillSingle#1\endcsname}%
  \define@key{FB}{EveryParGuill}{\expandafter\let\expandafter
                 \FBeveryparguill\csname FBguill#1\endcsname}%
  \define@key{FB}{EveryLineGuill}{\expandafter\let\expandafter
                 \FBeverylineguill\csname FBguill#1\endcsname
                    \ifFB@luatex@punct
                    \else
                      \let\FBeverylineguill\FBguillnone
                      \PackageWarning{frenchb.ldf}%
                         {Option `EveryLineGuill' skipped:%
                          \MessageBreak this option is for
                          LuaTeX *only*.\MessageBreak Reported}%
                    \fi}%
%    \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|.
%
%    With pdfTeX (or old LuaTeX and XeTeX engines), quote characters
%    are made active and expand to |\og\ignorespaces| and |{\fg}|
%    respectively if the current language is French, and to
%    |\guillemotleft| and |\guillemotright| otherwise (think of German
%    quotes), this is done by |\FB@@og| and |\FB@@fg|; 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); the \pkg{inputenc} package has to
%    be loaded before the |\begin{document}| with the proper coding
%    option, so we check if |\DeclareInputText| is defined.
%
%    Life is much simpler here with modern LuaTeX or XeTeX engines: we
%    just have to activate the |\FB@addGUILspace| attribute for LuaTeX
%    or set |\XeTeXcharclass| of quotes to the proper value for XeTeX.
%
% \changes{v2.4c}{2010/05/23}{In \cs{ttfamilyFB}, also cancel
%    automatic spaces inside French guillemets coded as characters
%    (see \cs{frenchbsetup}).}
%
% \changes{v2.5c}{2011/01/16}{The code meant for XeTeX also works for
%    LuaTeX, we just need to change the test.}
%
% \changes{v2.5g}{2011/12/31}{When \cs{ifFB@xetex@punct} is true,
%   `og' and `fg' options now set XeTeXcharclasses of these characters
%   to \cs{FB@guilo} and \cs{FB@guilf}.  Otherwise French
%   quotes behave as normal characters (their XeTeXcharclass is 0).}
%
% \changes{v2.6h}{2014/01/03}{\cs{FG@og}  and \cs{FG@fg} changed:
%   former clumsy code removed.}
%
% \changes{v3.1a}{2014/06/16}{Codes "13 and "14 added for French
%    quotes in T1-encoding.  Support for older versions of LuaTeX and
%    XeTeX dropped.}
%
%    \begin{macrocode}
  \define@key{FB}{og}{%
      \ifFBunicode
%    \end{macrocode}
%    LuaTeX or XeTeX in use, first try modern LuaTeX: we just need
%    to set LuaTeX's attribute |\FB@addGUILspace| to 1,
%    \begin{macrocode}
         \ifFB@luatex@punct
           \FB@addGUILspace=1 \relax
         \fi
%    \end{macrocode}
%    then with XeTeX it is a bit more tricky:
%    \begin{macrocode}
         \ifFB@xetex@punct
%    \end{macrocode}
%    |\XeTeXinterchartokenstate| is defined, we just need to set
%    |\XeTeXcharclass| to |\FB@guilo| for the French opening quote
%    in T1 and Unicode encoding (see subsection~\ref{ssec-punct}).
%    \begin{macrocode}
           \XeTeXcharclass"13   = \FB@guilo
           \XeTeXcharclass"AB   = \FB@guilo
           \XeTeXcharclass"A0   = \FB@guilnul
           \XeTeXcharclass"202F = \FB@guilnul
         \fi
      \else
%    \end{macrocode}
%    This is for conventional TeX engines:
%    \begin{macrocode}
         \newcommand*{\FB@@og}{%
            \iflanguage{french}%
              {\ifFBAutoSpaceGuill\FB@og\ignorespaces
               \else\guillemotleft
               \fi}%
              {\guillemotleft}}%
         \AtBeginDocument{%
           \ifdefined\DeclareInputText
              \ifdefined\uc@dclc
%    \end{macrocode}
%    Package \pkg{inputenc} with utf8x encoding loaded, use |\uc@dclc|,
%    \begin{macrocode}
                 \uc@dclc{171}{default}{\FB@@og}%
              \else
%    \end{macrocode}
%    if encoding is not utf8x, try utf8\dots
%    \begin{macrocode}
                 \ifdefined\DeclareUnicodeCharacter
%    \end{macrocode}
%    utf8 loaded, use |\DeclareUnicodeCharacter|,
%    \begin{macrocode}
                    \DeclareUnicodeCharacter{00AB}{\FB@@og}%
                 \else
%    \end{macrocode}
%    if utf8 is not loaded either, we assume 8-bit character input
%    encoding.  Package \pkg{MULEenc} (from CJK) defines |\mule@def|
%    to map characters to control sequences.
%    \begin{macrocode}
                    \@tempcnta`#1\relax
                    \ifdefined\mule@def
                       \mule@def{11}{\FB@@og}%
                    \else
                       \DeclareInputText{\the\@tempcnta}{\FB@@og}%
                    \fi
                 \fi
              \fi
           \else
%    \end{macrocode}
%    Package \pkg{inputenc} not loaded, no way\dots{}
%    \begin{macrocode}
              \PackageWarning{frenchb.ldf}%
                {Option `og' requires package inputenc.\MessageBreak}%
           \fi
         }%
      \fi
  }%
%    \end{macrocode}
%
%    Same code for the closing quote.
%    \begin{macrocode}
  \define@key{FB}{fg}{%
      \ifFBunicode
         \ifFB@luatex@punct
           \FB@addGUILspace=1 \relax
         \fi
         \ifFB@xetex@punct
           \XeTeXcharclass"14   = \FB@guilf
           \XeTeXcharclass"BB   = \FB@guilf
           \XeTeXcharclass"A0   = \FB@guilnul
           \XeTeXcharclass"202F = \FB@guilnul
         \fi
      \else
         \newcommand*{\FB@@fg}{%
            \iflanguage{french}%
              {\ifFBAutoSpaceGuill\FB@fg
               \else\guillemotright
               \fi}%
              {\guillemotright}}%
         \AtBeginDocument{%
           \ifdefined\DeclareInputText
              \ifdefined\uc@dclc
                 \uc@dclc{187}{default}{\FB@@fg}%
              \else
                 \ifdefined\DeclareUnicodeCharacter
                   \DeclareUnicodeCharacter{00BB}{\FB@@fg}%
                 \else
                    \@tempcnta`#1\relax
                     \ifdefined\mule@def
                        \mule@def{27}{{\FB@@fg}}%
                     \else
                        \DeclareInputText{\the\@tempcnta}{\FB@@fg}%
                     \fi
                 \fi
              \fi
           \else
              \PackageWarning{frenchb.ldf}%
                {Option `fg' requires package inputenc.\MessageBreak}%
           \fi
         }%
      \fi
  }%
}
%    \end{macrocode}
%
% \begin{macro}{\FBprocess@options}
%    |\FBprocess@options| will be executed at |\begin{document}|:
%    it first checks about packages loaded in the preamble (possibly
%    after \babel) which customise lists: currently \pkg{enumitem},
%    \pkg{paralist} and \pkg{enumerate}; then it processes the options
%    as set by \fbsetup{} or forced for compatibility with packages
%    loaded in the preamble.
%
%    When French is the main language, |\extrasfrench| and
%    |\captionsfrench| \emph{have already been processed} by \babel{}
%    at |\begin{document}| \emph{before} |\FBprocess@options|.
%    \begin{macrocode}
\newcommand*{\FBprocess@options}{%
%    \end{macrocode}
%    Update flags if a package customising lists has been loaded,
%    currently: \pkg{enumitem}, \pkg{paralist}, \pkg{enumerate}.
%    \begin{macrocode}
  \@ifpackageloaded{enumitem}{%
     \ifFBStandardItemizeEnv
     \else
        \FBStandardItemizeEnvtrue
        \PackageInfo{frenchb.ldf}%
          {Setting StandardItemizeEnv=true for\MessageBreak
           compatibility with enumitem package,\MessageBreak}%
     \fi
     \ifFBStandardEnumerateEnv
     \else
        \FBStandardEnumerateEnvtrue
        \PackageInfo{frenchb.ldf}%
          {Setting StandardEnumerateEnv=true for\MessageBreak
           compatibility with enumitem package,\MessageBreak}%
     \fi}{}%
  \@ifpackageloaded{paralist}{%
     \ifFBStandardItemizeEnv
     \else
        \FBStandardItemizeEnvtrue
        \PackageInfo{frenchb.ldf}%
          {Setting StandardItemizeEnv=true for\MessageBreak
           compatibility with paralist package,\MessageBreak}%
     \fi
     \ifFBStandardEnumerateEnv
     \else
        \FBStandardEnumerateEnvtrue
        \PackageInfo{frenchb.ldf}%
          {Setting StandardEnumerateEnv=true for\MessageBreak
           compatibility with paralist package,\MessageBreak}%
     \fi}{}%
  \@ifpackageloaded{enumerate}{%
     \ifFBStandardEnumerateEnv
     \else
        \FBStandardEnumerateEnvtrue
        \PackageInfo{frenchb.ldf}%
          {Setting StandardEnumerateEnv=true for\MessageBreak
           compatibility with enumerate package,\MessageBreak}%
     \fi}{}%
%    \end{macrocode}
%    Reset |\FB@ufl|'s normal meaning and update lists' settings
%    in case French is the main language: \label{FB@ufl}
%    \begin{macrocode}
  \def\FB@ufl{\update@frenchlists}
  \ifx\bbl@main@language\FB@french
     \update@frenchlists
  \fi
%    \end{macrocode}
%    The layout of footnotes is handled at the |\begin{document}|
%    depending on the values of flags \fbo{FrenchFootnotes}
%    and \fbo{AutoSpaceFootnotes} (see section~\ref{ssec-footnotes}),
%    nothing has to be done here for footnotes.
%
%    \fbo{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 \fbo{OriginalTypewriter} is set to \fbo{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\ttfamilyORI\ttfamily
     \let\rmfamilyORI\rmfamily
     \let\sffamilyORI\sffamily
     \let\ttfamily\ttfamilyFB
     \let\rmfamily\rmfamilyFB
     \let\sffamily\sffamilyFB
  \fi
%    \end{macrocode}
%
% \changes{v3.0a}{2014/01/10}{Changed option ThinColonSpace to make it
%    work also with LuaTeX.}
%
%    \fbo{ThinColonSpace} changes the normal unbreakable space typeset
%    in French before `:' to a thin space.
%    \begin{macrocode}
  \ifFBThinColonSpace
    \ifFB@luatex@punct
       \FBcolonskip=\FBthinskip\relax
    \else
       \renewcommand*{\FBcolonspace}{\FBthinspace}%
    \fi
  \fi
%    \end{macrocode}
%    When \fbo{true}, \fbo{INGuillSpace} resets the dimensions of skips
%    after opening French quotes and before closing French quotes to
%    I.N. standards.
%    \begin{macrocode}
  \ifFBINGuillSpace
    \ifFB@luatex@punct
       \FBguillskip=3.33pt plus 1.665pt minus 1.11pt \relax
    \else
       \renewcommand*{\FBguillspace}{\space}%
    \fi
  \fi
%    \end{macrocode}
%    When \fbo{true}, \fbo{ThinSpaceInFrenchNumbers} redefines
%    |numprint.sty|'s command |\npstylefrench| to set |\npthousandsep|
%    to |\,| (thinspace) instead of |~| (default) .  This option has no
%    effect if package \pkg{numprint} is not loaded with
%    `|autolanguage|'.  As old versions of \pkg{numprint} 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}
%    \fbo{FrenchSuperscripts}: if \fbo{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}
%    \fbo{LowercaseSuperscripts}: if \fbo{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}
%
% \changes{v3.0a}{2014/02/20}{With koma-script and memoir class,
%    customise \cs{captionformat} and \cs{captiondelim}.}
%
%    Use French |\CaptionSeparator| for koma-script and \cls{memoir}
%    classes unless \fbo{CustomiseFigTabCaptions} has been set to
%    \fbo{false} (the default).
%    \begin{macrocode}
   \ifFBCustomiseFigTabCaptions
     \ifFB@koma
        \let\captionformat\CaptionSeparator
     \fi
     \@ifclassloaded{memoir}%
       {\captiondelim{\CaptionSeparator}}{}%
   \else
%    \end{macrocode}
%    When \fbo{CustomiseFigTabCaptions} is \fbo{false}, have the colon
%    behave properly in French.
%    \begin{macrocode}
     \ifFB@koma
        \def\captionformat{\iflanguage{french}{ : }{: }}%
     \fi
     \@ifclassloaded{memoir}%
        {\captiondelim{\iflanguage{french}{ : }{: }}}{}%
   \fi
%    \end{macrocode}
%    \fbo{ShowOptions}: if \fbo{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
     ListOldLayout=true [false]\MessageBreak
     StandardItemizeEnv=true [false]\MessageBreak
     StandardEnumerateEnv=true [false]\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
     CustomiseFigTabCaptions=false [true]\MessageBreak
     OldFigTabCaptions=true [false]\MessageBreak
     INGuillSpace=true [false]\MessageBreak
     InnerGuillSingle=true [false]\MessageBreak
     EveryParGuill=open, close, none [open]\MessageBreak
     EveryLineGuill=open, close, none
                   [open in LuaTeX, none otherwise]\MessageBreak
     og= <left quote character>, fg= <right quote character>%
     \MessageBreak
     *********************************************%
     \MessageBreak\protect\frenchbsetup{ShowOptions}}
  \fi
}
%    \end{macrocode}
%  \end{macro}
%
% \changes{v2.0}{2006/12/06}{Added warning for OT1 encoding.}
%
% \changes{v2.1b}{2008/04/07}{Disable some commands in bookmarks.}
%
% \changes{v2.5e}{2011/04/03}{\cs{pdfstringdefDisableCommands} should
%    redefine \cs{FB@og} and \cs{FB@fg} instead of \cs{og} and \cs{fg}
%    so that it works also when quotes are entered as characters.
%    Reported by Sébastien Gouezel.}
%
%    At |\begin{document}|, we have to provide an |\xspace| command
%    in case the \pkg{xspace} package is not loaded, do some setup for
%    \file{hyperref}'s bookmarks, execute |\FBprocess@options|, switch
%    LuaTeX punctuation on and issue some warnings if necessary.
%    \begin{macrocode}
\AtBeginDocument{%
   \providecommand*{\xspace}{\relax}%
%    \end{macrocode}
%
% \changes{v2.5g}{2011/11/13}{Redefine \cs{degre}, \cs{degres} \cs{at}
%    \cs{circonflexe} and \cs{tild} for bookmarks.  Add \cs{fup} also.}
%
%    Let's redefine some commands in \file{hyperref}'s bookmarks.
%    \begin{macrocode}
   \ifdefined\pdfstringdefDisableCommands
      \pdfstringdefDisableCommands{%
        \let\up\relax
        \let\fup\relax
        \let\degre\textdegree
        \let\degres\textdegree
        \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\FB@og{\guillemotleft\space}%
        \def\FB@fg{\space\guillemotright}%
        \def\at{@}%
        \def\circonflexe{\string^}%
        \def\tild{\string~}%
        \let\bsc\textsc
       }%
   \fi
%    \end{macrocode}
%    It is time to process the options set with \fbsetup{} or later.
%    \begin{macrocode}
   \FBprocess@options
%    \end{macrocode}
%    With LuaTeX engines it is time to load file \file{frenchb.lua}
%    (|\FBthinskip| and |\FBcolonskip| values are set now).
%    \begin{macrocode}
  \ifFB@luatex@punct
    \activate@luatexpunct
  \fi
%    \end{macrocode}
%
% \changes{v3.0a}{2014/01/28}{Test \cs{ifXeTeX} changed to
%    \cs{ifFBunicode} and `xltxtra' changed to `fontspec'.}
%
% \changes{v3.1a}{2014/06/14}{fontspec is not required for T1 fonts
%    used be with the luainputenc.sty package.}
%
%    Some warnings are issued when output font encodings are not
%    properly set.  With XeLaTeX or LuaLaTeX, \file{fontspec.sty} and
%    \file{xunicode.sty} should be loaded unless T1 encoded fonts are
%    used through \file{luainputenc}, in the latter case |\FB@og| and
%    |\FB@fg| have to be redefined; 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}
   \ifFBunicode
      \ifdefined\DeclareUTFcharacter
      \else
         \@ifpackageloaded{luainputenc}{}%
           {\PackageWarning{frenchb.ldf}%
            {Add \protect\usepackage{fontspec} to the\MessageBreak
            preamble of your document,}%
           }%
      \fi
   \else
      \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
   \fi
}
%    \end{macrocode}
%
%  \subsection{French lists}
%  \label{ssec-lists}
%
% \changes{v2.6a}{2013/01/30}{Bug correction: changing \cs{leftmargin}
%    cannot be done only for itemize-lists: it messes up
%    embedded enumerate lists.  Pointed out by Denis Bitouzé.
%    Lists have been completely redesigned in frenchb v.~2.6a.
%    An option for backward compatibility is provided.}
%
%  \begin{macro}{\listFB}
%  \begin{macro}{\listORI}
%  \begin{macro}{\FB@listVsettings}
%    Vertical spacing in 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; so we define the command
%    |\FB@listVsettings| to hold the settings to be used by
%    the French variant |\listFB| of |\list|.  Note that switching
%    to |\listFB| reduces vertical spacing in \emph{all} environments
%    built on |\list|: |itemize|, |enumerate|, |description|, but also
%    |abstract|, |quotation|, |quote| and |verse|\dots{}
%
%    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.
%
%    \begin{macrocode}
\let\listORI\list
\let\endlistORI\endlist
\def\FB@listVsettings{%
      \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@listVsettings #2}}
\let\endlistFB\endlist
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%    Let's now consider French itemize-lists.  They differ from those
%    provided by the standard \LaTeXe{} classes:
%    \begin{itemize}
%      \item The `\textbullet' is never used in French itemize-lists,
%          an emdash `---' or an endash  `--' is preferred for all
%          levels.  The item label to be used in French is stored in
%          |\FrenchLabelItem}|, it defaults to `---' and can be changed
%          using \fbsetup{} (see section~\ref{ssec-keyval}).
%      \item Vertical spacing between items, before and after
%         the list, should be \emph{null} with \emph{no glue} added;
%      \item In French the labels of itemize-lists are vertically
%         aligned as follows:\\
%          \fbox{\parbox[t]{.5\textwidth}{%
%            \parindent=1.5em
%            Text starting at `parindent' \\
%            \noindent$\Leftarrow$ Leftmargin\\
%            \hspace*{\parindent}\textendash{} first item\dots{}\\
%            \hspace*{\parindent}\hspace*{\labelsep}%
%                 \textendash{} first second level item\\
%            \hspace*{\parindent}\hspace*{\labelsep}%
%                 \textendash{} next one\dots{}\\
%            \hspace*{\parindent}\textendash{} second item\dots{}
%          }}
%    \end{itemize}
%
%  \begin{macro}{\FrenchLabelItem}
% \changes{v2.6a}{2013/01/30}{defaults to \cs{textemdash} instead of
%    \cs{textendash} up to v.~2.5k.}
%  \begin{macro}{\Frlabelitemi}
%  \begin{macro}{\Frlabelitemii}
%  \begin{macro}{\Frlabelitemiii}
%  \begin{macro}{\Frlabelitemiv}
%    Default labels for French itemize-lists (same label for all levels):
%    \begin{macrocode}
\newcommand*{\FrenchLabelItem}{\textemdash}
\newcommand*{\Frlabelitemi}{\FrenchLabelItem}
\newcommand*{\Frlabelitemii}{\FrenchLabelItem}
\newcommand*{\Frlabelitemiii}{\FrenchLabelItem}
\newcommand*{\Frlabelitemiv}{\FrenchLabelItem}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\listindentFB}
%  \begin{macro}{\labelwidthFB}
%    Let's define two lengths |\listindentFB| and |\labelwidthFB| to
%    customise lists' horizontal indentations.  They are given
%    silly values here ($-1$\,pt) in order to eventually
%    enable their customisation in the preamble.  They will get
%    reasonnable defaults later when entering French (see
%    |\bbl@frenchlabelitems|) unless they have been customised.
%    \begin{macrocode}
\newlength\listindentFB
\setlength{\listindentFB}{-1pt}
\newlength\labelwidthFB
\setlength{\labelwidthFB}{-1pt}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\FB@listHsettings}
%  \begin{macro}{\leftmarginFB}
%    |\FB@listHsettings| holds the new horizontal settings chosen for
%    French lists itemize and enumerate starting with version~2.6a.
%    They are based on the look resquested in French for
%    itemize-lists.
%    \begin{macrocode}
\newlength\leftmarginFB
\def\FB@listHsettings{%
   \leftmarginFB\labelwidthFB
   \advance\leftmarginFB \labelsep
   \leftmargini\leftmarginFB
   \advance\leftmargini \listindentFB
   \leftmarginii\leftmarginFB
   \leftmarginiii\leftmarginFB
   \leftmarginiv\leftmarginFB
   \leftmargin\csname leftmargin\romannumeral\the\@listdepth\endcsname
}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\itemizeFB}
%  \begin{macro}{\FB@itemizesettings}
%
% \changes{v2.6f}{2013/11/25}{\cs{labelwidth} must be reset, f.i. when
%    an itemize list occurs inside environments based on trivlist which
%    set \cs{labelwidth} to 0 (see proof environment in amsthm.sty).
%    Bug pointed out by Julien Hauseux.}
%
% \changes{v2.6g}{2013/12/30}{Suppress all vertical spaces only if
%    ReduceListSpacing is true.  Pointed out by Pierre Willaime.}
%
%    New environment for French itemize-lists.\\ |\FB@itemizesettings|
%    does two things: first suppress all vertical spaces including glue
%    when option \fbo{ReduceListSpacing} is set, then set horizontal
%    indentations according to |\FB@listHsettings| unless option
%    \fbo{ListOldLayout} is \fbo{true} (compatibility with lists up to
%    v.~2.5k).
%    \begin{macrocode}
\def\FB@itemizesettings{%
    \ifFBReduceListSpacing
       \setlength{\itemsep}{\z@}%
       \setlength{\parsep}{\z@}%
       \setlength{\topsep}{\z@}%
       \setlength{\partopsep}{\z@}%
       \@tempdima=\parskip
       \addtolength{\topsep}{-\@tempdima}%
       \addtolength{\partopsep}{\@tempdima}%
    \fi
    \settowidth{\labelwidth}{\csname\@itemitem\endcsname}%
    \ifFBListOldLayout
       \setlength{\leftmargin}{\labelwidth}%
       \addtolength{\leftmargin}{\labelsep}%
       \addtolength{\leftmargin}{\parindent}%
    \else
       \FB@listHsettings
    \fi
}
%    \end{macrocode}
%    The definition of |\itemizeFB| follows the one of |\itemize|
%    in standard \LaTeXe{} classes (see \file{ltlists.dtx}),
%    spaces are customised by |\FB@itemizesettings|.
%
%    \begin{macrocode}
\def\itemizeFB{%
    \ifnum \@itemdepth >\thr@@\@toodeep\else
      \advance\@itemdepth\@ne
      \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
      \expandafter
      \listORI
      \csname\@itemitem\endcsname
      \FB@itemizesettings
    \fi
}
\let\enditemizeFB\endlistORI
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%    \begin{macrocode}
\def\labelitemsFB{%
    \let\labelitemi\Frlabelitemi
    \let\labelitemii\Frlabelitemii
    \let\labelitemiii\Frlabelitemiii
    \let\labelitemiv\Frlabelitemiv
    \ifdim\labelwidthFB<\z@
      \settowidth{\labelwidthFB}{\FrenchLabelItem}%
    \fi
    \ifdim\listindentFB<\z@
      \ifdim\parindent=\z@
        \setlength{\listindentFB}{1.5em}%
      \else
        \setlength{\listindentFB}{\parindent}%
      \fi
    \fi
}
%    \end{macrocode}
%
%  \begin{macro}{\enumerateFB}
%    The definition of |\enumerateFB|, new to version~2.6a, follows
%    the one of |\enumerate| in standard \LaTeXe{} classes (see
%    \file{ltlists.dtx}), vertical spaces are customised (or not)
%    via |\list| (=|\listFB| or |\listORI|) and horizontal spaces
%    (leftmargins) are borrowed from |itemize| lists via
%    |\FB@listHsettings|.
%
%    \begin{macrocode}
\def\enumerateFB{%
  \ifnum \@enumdepth >\thr@@\@toodeep\else
    \advance\@enumdepth\@ne
    \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
    \expandafter
    \list
      \csname label\@enumctr\endcsname
      {\FB@listHsettings
       \usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
  \fi
}
\let\endenumerateFB\endlistORI
%    \end{macrocode}
%    \end{macro}
%
%  \begin{macro}{\descriptionFB}
% \changes{v2.6b}{2013/02/10}{Settings of \cs{FB@listHsettings} should
%    apply to description lists too.}
%
% \changes{v3.0a}{2014/02/28}{Add \cs{listindentFB} to
%    \cs{itemindent}.  Suggested by Denis Bitouzé.}
%
%    Same tuning for the |description| environment (see the original
%    definition in \file{classes.dtx}).  Customisable |\listindentFB|
%    added to |\itemindent| (first level only).
%
%    \begin{macrocode}
\def\descriptionFB{%
      \list{}{\FB@listHsettings
              \labelwidth\z@
              \itemindent-\leftmargin
              \ifnum\@listdepth=1
                 \advance\itemindent by \listindentFB
              \fi
              \let\makelabel\descriptionlabel}%
}
\let\enddescriptionFB\endlistORI
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\update@frenchlists}
%    \begin{macro}{\bbl@frenchlistlayout}
%    \begin{macro}{\bbl@nonfrenchlistlayout}
%    |\update@frenchlists| will setup lists according to the options
%    of \fbsetup{}.
%    \begin{macrocode}
\def\update@frenchlists{%
  \ifFBReduceListSpacing \let\list\listFB \fi
  \ifFBStandardItemizeEnv
  \else \let\itemize\itemizeFB \fi
  \ifFBStandardItemLabels
  \else \labelitemsFB \fi
  \ifFBStandardEnumerateEnv
  \else \let\enumerate\enumerateFB \let\description\descriptionFB \fi
}
%    \end{macrocode}
%    In order to ensure compatibility with packages customising lists,
%    the command |\update@frenchlists| should not be included in
%    |\extrasfrench| yet, so we also define |\FB@ufl| as |\relax|,
%    it will be redefined as |\update@frenchlists| in due time
%    `AtBeginDocument' by |\FBprocess@options|,
%     see p.~\pageref{FB@ufl}.
%    \begin{macrocode}
\def\FB@ufl{\relax}
\def\bbl@frenchlistlayout{%
  \ifFBGlobalLayoutFrench
  \else
    \babel@save\list         \babel@save\itemize
    \babel@save\enumerate    \babel@save\description
    \babel@save\labelitemi   \babel@save\labelitemii
    \babel@save\labelitemiii \babel@save\labelitemiv
  \fi
  \FB@ufl
}
\def\bbl@nonfrenchlistlayout{%
  \ifFBGlobalLayoutFrench
     \update@frenchlists
  \fi
}
\FB@addto{extras}{\bbl@frenchlistlayout}
\FB@addto{noextras}{\bbl@nonfrenchlistlayout}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%  \subsection{French indentation of sections}
%  \label{ssec-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é Torrens.}
%
%    We will need to save the value of the flag |\if@afterindent|
%    `AtBeginDocument' before eventually changing its value.
%
%    \begin{macrocode}
\def\bbl@frenchindent{%
  \ifFBGlobalLayoutFrench\else\babel@save\@afterindentfalse\fi
  \ifFBIndentFirst
     \let\@afterindentfalse\@afterindenttrue
     \@afterindenttrue
  \fi}
\def\bbl@nonfrenchindent{%
  \ifFBGlobalLayoutFrench
     \ifFBIndentFirst
        \@afterindenttrue
     \fi
  \fi}
\FB@addto{extras}{\bbl@frenchindent}
\FB@addto{noextras}{\bbl@nonfrenchindent}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \subsection{Formatting footnotes}
%  \label{ssec-footnotes}
%
% \changes{v2.0}{2006/11/06}{Footnotes are now printed
%     by default `à la française' for the whole document.}
%
% \changes{v2.0b}{2007/04/18}{Footnotes: Just do nothing
%    (except warning) when the bigfoot package is loaded.}
%
%    The \pkg{bigfoot} package deeply changes the way footnotes are
%    handled.  When \file{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 \fbsetup{} (see section~\ref{ssec-keyval}).
%    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| (the
%    definition of which 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}%
                   {\PackageInfo{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.
%    \fbsetup{} (see in section \ref{ssec-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{Clean up and exit}
%
% \changes{v3.0a}{2014/02/20}{french.cfg will be loaded (if found)
%    instead of frenchb.cfg.  NO NEED for .cfg files in French anyway.}
%
%    Final cleaning.
%    The macro |\ldf@finish| 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.
%    \begin{macrocode}
\FBclean@on@exit
\ldf@finish\CurrentOption
%    \end{macrocode}
% \iffalse
%</ldf>
%<*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
