% \iffalse meta-comment
%
% This program can be distributed and/or modified under the terms
% of the LaTeX Project Public License either version 1.3c of this
% license or (at your option) any later version.
% The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% Please report errors to: daniel (dot) flipo (at) free (dot) fr
%
%<*batch>
%<*gobble>
\ifx\jobname\relax\let\documentclass\undefined\fi
\ifx\documentclass\undefined
\csname fi\endcsname
%</gobble>
\input docstrip.tex
\keepsilent
\let\MetaPrefix\relax
\preamble
This is a generated file part of the babel-french bundle
to be used with the Babel system.
-------------------------------------------------------------

It may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3c
of this license or (at your option) any later version.
The latest version of this license is in
  http://www.latex-project.org/lppl.txt
and version 1.3c or later is part of all distributions of LaTeX
version 2003/12/01 or later.

This work has the LPPL maintenance status "maintained".

The Current Maintainer of this work is Daniel Flipo.

Please report errors to: <daniel (dot) flipo (at) free (dot) fr>

\endpreamble
\postamble
\endpostamble
\let\MetaPrefix\DoubleperCent
\askforoverwritefalse
\generate{\file{french.ldf}{\from{frenchb.dtx}{french}}
          \file{acadian.ldf}{\from{frenchb.dtx}{acadian}}
          \file{canadien.ldf}{\from{frenchb.dtx}{canadien}}
          \file{frenchb.ldf}{\from{frenchb.dtx}{frenchb}}
          \file{francais.ldf}{\from{frenchb.dtx}{francais}}
         }
\def\MetaPrefix{-- }
\def\luapostamble{\MetaPrefix\space End of File frenchb.lua.}
\usepostamble\luapostamble
\nopreamble
\generate{\file{frenchb.lua}{\from{frenchb.dtx}{lua}}
         }
\endbatchfile
%</batch>
%<*gobble>
\fi
\expandafter\ifx\csname @currname\endcsname\empty
\csname fi\endcsname
%</gobble>
%
%<*dtx>
\ProvidesFile{frenchb.dtx}
%</dtx>
%<acadian>\ProvidesLanguage{acadian}
%<canadien>\ProvidesLanguage{canadien}
%<francais>\ProvidesLanguage{francais}
%<french>\ProvidesLanguage{french}
%<frenchb>\ProvidesLanguage{frenchb}
%<lua>--[[
%<lua>   File `frenchb.lua’ generated from frenchb.dtx
         [2024-07-25 v3.6c French support from the babel system]
%<lua>   Copyright © 2014-2024 Daniel Flipo
%<lua>   <daniel (dot) flipo (at) free (dot) fr>
%<lua>   License LPPL: see french.ldf.
%<lua>--]]
%
%<*dtx|french>
%%
%%  Babel package for LaTeX version 2e
%%  Copyright © 1996-2024
%%            by Daniel Flipo <daniel (dot) flipo (at) free (dot) fr>
%%
%</dtx|french>
%<*dtx>
%%  This file is part of the babel system, it provides the source
%%  code for the French language definition file.
%%
%</dtx>
%
%<*driver>
\DocumentMetadata{pdfstandard=A-2b, lang=en-US}
\documentclass[a4paper]{ltxdoc}
\usepackage[left=38mm,right=38mm,top=30mm,bottom=50mm]{geometry}
\usepackage[dvipsnames]{xcolor}
\usepackage[no-math]{fontspec}
\usepackage{realscripts}
\usepackage{setspace}
\setstretch{1.15}
\setmainfont{SourceSansPro}[
    Scale          = 1.13 ,
    Extension      = .otf ,
    UprightFont    = *-Regular ,
    ItalicFont     = *-RegularIt ,
    BoldFont       = *-Bold ,
    BoldItalicFont = *-BoldIt ]
\setmonofont{iosevka}[%
    Scale          = MatchLowercase ,
    FakeStretch    = 1.05 ,
    Extension      = .ttf,
    UprightFont    = *-medium,
    BoldFont       = *-bold,
    ItalicFont     = *-italic,
    BoldItalicFont = *-bolditalic,
%   RawFeatures    = -dlig;-clig        % ligature >= (l.1314)
  ]
%
\def\PrintMacroName#1{%
  \strut\MacroFont\color{Sepia}\normalsize\string#1}
\def\ColorArg{\color{Sepia}}
\usepackage[verbose=silent]{microtype}
\usepackage{array,url}
\usepackage[numbered]{hypdoc}
\hypersetup{colorlinks,urlcolor=Blue,linkcolor=Blue}
\newcommand*{\hlabel}[1]{\phantomsection\label{#1}}
\newcommand*\babel{\texttt{Babel}}
\newcommand*\frenchb{\texttt{babel-french}}
\newcommand*\file[1]{\texttt{#1}}
\newcommand*\cls[1]{\texttt{#1}}
\newcommand*\pkg[1]{\texttt{#1}}
\newcommand*\opt[1]{\texttt{#1}}
\newcommand*\env[1]{\texttt{#1}}
\newcommand*\exe[1]{\texttt{#1}}
\newcommand*\fbo[1]{\texttt{\ColorArg #1}}
\newcommand*\fbsetup[1]{\cs{frenchsetup}\{\fbo{#1}\}}
\renewcommand\meta[1]{\textit{<#1>}}  % no math mode (see doc.sty)
\let\Module\meta                      % no math mode (see doc.sty)
\renewcommand*\descriptionlabel[1]{%
   \hspace{\labelsep}\normalfont \fbo{#1}}
\NewCommandCopy{\up}{\textsuperscript}
\newcommand*{\FRguillspace}{\penalty 10000
                            \hskip.8\fontdimen2\font
                              plus.3\fontdimen3\font
                             minus.8\fontdimen4\font}
\hyphenation{Lua-TeX Lua-LaTeX Xe-LaTeX}
\lefthyphenmin=2 \righthyphenmin=3
\setlength{\parindent}{0pt}
\RecordChanges
\AtEndDocument{%
   \clearpage
   \section{Change History}%
   \GlossaryPrologue{}%
   Changes listed in reverse order (latest first) and not older
    than~v3.3 (2018).
   \PrintChanges
}
\begin{document}
\GetFileInfo{frenchb.dtx}
\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}
%</driver>
%<*gobble>
\fi
%</gobble>
% \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, Denis Bitouzé, Ulrike Fisher and Marcel Krüger.
%    Thanks to all of them!
%
%    LaTeX-2.09 is no longer supported.
%    Version 3.0  has been designed to be used only with
%    LaTeX2e and Plain formats based on TeX, pdfTeX, LuaTeX or XeTeX
%    engines.
%
%    Changes between version 3.0 and \fileversion{} are listed in
%    subsection~\ref{ssec-changes} p.~\pageref{ssec-changes}.
%
%    An extensive documentation in French (file \file{frenchb-doc.pdf}) is
%    now included in \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.
%
%    The French language can be loaded with \babel{} by a command like:
%    \\ |\usepackage[german,spanish,french,british]{babel}|%
%    \footnote{\emph{Always} use \opt{french} as option name for the
%    French language, former aliases \opt{frenchb} or \opt{francais}
%    are \emph{depreciated}; expect them to be removed sooner or later!}
%
%    A variant \opt{acadian} of \opt{french} is provided; it is
%    originally identical to \opt{french} but can be customised
%    independently in terms of patterns, punctuation spacing, captions,
%    etc.  Both variants can be used together inside the same 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-fig}
%          p.~\pageref{sssec-captions-fig}.
%    \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%
%           \footnote{Well, the automatic insertion may add unwanted
%           spaces in some cases, for correction see
%           \fbo{AutoSpacePunctuation} option and \cs{NoAutoSpacing}
%           command p.~\pageref{autospacepunctuation}.}
%           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-name}
%          p.~\pageref{sssec-captions-name}.
%    \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 command
%      |\frquote{}|: |\frquote{some text}| will output
%      «~some text~».  Former commands |\og| and |\fg| are kept
%      for backward compatibility: |\og some text\fg{}| is an
%      alternative to |\frquote{some text}|.\hlabel{frquote}
%
%      If French quote characters are available on your keyboard,
%      you can use them, to get proper spacing in LaTeX2e see
%      option \fbo{og=«, fg=»} p.~\pageref{option-og-fg}.
%
%      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 (») or nothing depending on option
%      \fbo{EveryParGuill=open} or \fbo{=close} or \fbo{=none},
%      see p.~\pageref{everyparguill}.\\
%      The command |\NoEveryParQuote| is provided to locally suppress
%      unwanted guillemets (typically when lists are embedded in
%      |\frquote{}|), it is meant to be used inside an environment
%      or a group.
%
%      |\frquote| is recommended to enter embedded quotations ``à la
%      française’’, several variants are provided through options.
%      \begin{itemize}
%        \item with all 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\FRguillspace\textit{texte}\FRguillspace
%           \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{} or nothing,
%            depending on option \fbo{EveryParGuill=open} (default)
%            or \fbo{=close} or \fbo{=none}.
%          \item with LuaTeX based engines, it is possible to add a
%            French opening or closing guillemet (« or ») at the
%            beginning of every line of the inner quotation using
%            option \fbo{EveryLineGuill=open} or \fbo{=close}; note
%            that with any of these options, the inner quotation is
%            surrounded by French guillemets (« and ») regardless
%            option \fbo{InnerGuillSingle};
%            the default is \fbo{EveryLineGuill=none} so that
%            |\frquote{}| behaves as with non-LuaTeX engines.
%      \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 |\frenchdate|\marg{year}\marg{month}\marg{day} helps
%          typesetting dates in French: |\frenchdate{2001}{01}{01}|
%          will print 1\up{er} janvier 2001 in a box without any
%          linebreak.\label{frenchdate}
%
%    \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\up{es}).
%          All these commands take advantage of real superscript
%          letters when they are available in the current font.
%
%    \item Command |\bname{}| (boxed name) is provided to typeset
%          family names: its argument will not be hyphenated except on
%          explicit hyphens.  |\bsc{}| (boxed small caps) is a variant
%          that prints its argument in small capitals, it is meant for
%          bibliographies, signatures, etc.
%          Usage: |Albert~\bsc{Camus}|.
%
%    \item Commands |\primo|, |\secundo|, |\tertio| and |\quarto|
%          print 1\up{o}, 2\up{o}, 3\up{o}, 4\up{o}.\linebreak
%          |\FrenchEnumerate{6}| prints 6\up{o}.
%    \item Abbreviations for ``Numéro(s)’’ and ``numéro(s)’’
%          (N\up{o} N\up{os} n\up{o} and n\up{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 a non-breaking space), or for
%          alcohols’’ strengths (e.g., ``|45\degres|’’ with \emph{no}
%          space in French) or for angles in math mode.
%
%    \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 behave as an
%          ordinary character \emph{when the current language is French}
%          (no space added);
%          as a counterpart, if |\DecimalMathComma| is active, an
%          explicit thin space has to be added in lists and intervals:
%          |$(x,\,y)$|, |$[0,\,1]$|.  |\StandardMathComma| switches
%          back to the standard behaviour of the comma in French.
%
%          The \pkg{icomma} package is an alternative workaround.
%
%    \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}, which
%          should be loaded \emph{after} \babel, 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|, …, to respect
%          the spaces you type after them, for instance typing
%          `|1\ier juin|’ will print `1\up{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{}
%    (formerly called |\frenchbsetup{}|, the latter name will be kept
%    for ever to ensure backwards compatibility), options are entered
%    using the \file{l3keys} syntax.
%    The command \fbsetup{} is to appear in the preamble only
%    (after loading \babel).
%
%     \subsubsection[\textbackslash frenchsetup{}]
%     {\fbsetup{options}}
%  \label{sssec-frenchbsetup}
%
%    \vspace{.5\baselineskip}
%    |\frenchbsetup{}| and |\frenchsetup{}| are synonymous;
%    the latter should be preferred as the language name for
%    French in \babel{} is no longer |frenchb| but |french|.
%
%    \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{l3keys} 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}
%    \setlength{\labelsep}{0.1666em}
%    \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; it useless unless French is the main
%      language.  This option can be used to avoid conflicts with
%      classes or packages which customise lists or footnotes.
%
%    \item [GlobalLayoutFrench=false (true*)] can only be used when
%      French is the main language; setting it to \fbo{false} will
%      emulate what prior versions of \frenchb{} (pre-2.2) did:
%      lists, and first paragraphs of sections will be displayed
%      the standard way in other languages than French, and ``à la
%      française’’ in French (changing the layout inside a document
%      is a bad practice imho).  Note that the layout of footnotes is
%      language independent anyway (see below \fbo{FrenchFootnotes}
%      and \fbo{AutoSpaceFootnotes}).
%
%    \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 option applies to all languages.
%
%    \item [PartNameFull=false (true)]; when true (the default),
%      \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 [ListItemsAsPar=true (false)] setting this option to
%      \fbo{true} is recommended: list items will be displayed as
%      paragraphs with indented labels (in the ``Imprimerie Nationale’’
%      way) instead of having labels hanging into the left margin.
%      How these two layouts differ is shown below:\\[.5\baselineskip]
%          \fbox{\parbox[t]{.4\textwidth}{\raggedright
%            \parindent=1.5em
%            \def\FBlabel{\textemdash}%
%            \settowidth{\labelwidth}{\FBlabel}%
%            Text starting at `parindent’ \\
%            \noindent<= Leftmargin\par
%            \textemdash{} first item running on two
%              \hspace*{\parindent}\hspace*{\labelwidth}
%                lines or more…\par
%              \hspace*{\labelwidth} \textemdash{} first second level
%                item \hspace*{\parindent}\hspace*{\labelwidth}%
%                  \hspace*{\labelwidth} on two lines…\par
%              \hspace*{\labelwidth} \textemdash{} next one…\par
%            \textemdash{} second item…
%          }}
%          \hfill \hlabel{ListAsPar}%
%          \fbox{\parbox[t]{.4\textwidth}{\raggedright
%            \parindent=1.5em
%            \def\FBlabel{\textemdash}%
%            \settowidth{\labelwidth}{\FBlabel}%
%            Text starting at `parindent’ \\
%            \noindent<= Leftmargin\par
%            \textemdash{} first item running on two
%                lines or more…\par
%              \hspace*{\labelwidth} \textemdash{} first second level
%                item \hspace*{\parindent}on two lines…\par
%              \hspace*{\labelwidth} \textemdash{} next one…\par
%            \textemdash{} second item…
%          }}\par
%            \hspace*{3em} Default French layout%
%            \hspace{\fill}With \fbo{ListItemsAsPar=true} \hspace*{1em}
%
%    \item [StandardListSpacing=true (false*)]%
%      \footnote{This option should be used instead of former option
%      \fbo{ReduceListSpacing} (kept for backward compatibility) which
%      could be misleading: with some classes (smfart, smfbook f.i.)
%      you had to set \fbo{ReduceListSpacing=false} to revert to the
%      class settings which actually reduce list’s spacings even more
%      than \frenchb! \fbo{StandardListSpacing=true} replaces
%      \fbo{ReduceListSpacing=false}.}; \frenchb{} usually customises
%      the vertical spaces in the \env{list} environment, this affects
%      all lists, including \env{itemize}, \env{enumerate},
%      \env{description}, but also \env{abstract}, \env{quote},
%      \env{quotation}, \env{verse}, etc. which are based on \env{list}.
%      Setting this option to \fbo{true} reverts to the standard
%      settings of the \env{list} environment as defined by the document
%      class.
%
%    \item [StandardItemizeEnv=true (false*)]; \frenchb{} redefines
%      the \env{itemize} environment to suppress any vertical space
%      between items of \env{itemize} lists in French and customises
%      left margins.  Setting this option to \fbo{true} reverts to
%      the standard definition of \env{itemize}.
%
%    \item [StandardEnumerateEnv=true (false*)]; \frenchb{} redefines
%      \env{enumerate} and \env{description} environments to make
%      left margins match those of the French version of \env{itemize}
%      lists.  Setting this option to \fbo{true} reverts to the standard
%      definition of \env{enumerate} and \env{description}.
%
%    \item [StandardItemLabels=true (false*)] when set to \fbo{true}
%      this option prevents \frenchb{} from changing the labels in
%      \env{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 \env{itemize} lists
%      for all levels.  The next four options do the same but each
%      one for a specific level only.  Note that \fbo{\cs{ding\{43\}}}
%      requires loading the \pkg{pifont} package.
%
%    \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}*)]\hfill
%
%    \item [StandardLists=true (false*)] forbids \frenchb{} to
%      customise any kind of list.  The option \fbo{StandardLists=true}
%      should be used in case of conflicts with classes or packages that
%      customise
%      lists too.  This option is just a shorthand setting all four
%      options \fbo{StandardListSpacing=true},
%      \fbo{StandardItemizeEnv=true},\linebreak
%      \fbo{StandardEnumerateEnv=true} and
%      \fbo{StandardItemLabels=true}.
%
%    \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 [FrenchFootnotes=false (true*)] reverts to the standard
%      layout of footnotes.  By default \frenchb{} typesets leading
%      numbers as `1.\hspace{.5em}’ instead of `\up{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 (customisable) 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).
%      The default definition of this thin space is:\\
%      |\newcommand*{\FBfnmarkspace}{\kern .5\fontdimen2\font}|
%
%    \item [AutoSpacePunctuation=false (true)]; in French, the user
%      \hlabel{autospacepunctuation}
%      \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 non-breaking spaces the width of which is
%      either |\FBthinspace| (defauts to a thin space) 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) ---this no longer occurs with LuaTeX---,
%      except if they are typed in |\texttt| or verbatim mode.
%      When the current font is a monospaced (typewriter) font,
%      no spurious space is added in that case%
%      \footnote{Unless option \fbo{OriginalTypewriter} is set,
%        \cs{ttfamily} is redefined in French to switch off space
%        tuning, see below.},
%      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 is added before `|:;!?|’ \emph{if and only if}
%      a (normal) space has been typed in.  This option gives full
%      control on space insertion before `|:;!?|’.  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 http://mysite}|%
%      \footnote{Actually, this is needed only with the XeTeX and
%        pdfTeX engines. LuaTeX no longer inserts any space in strings
%        like http://mysite, C:\textbackslash Foo, 10:55…}
%      or |{\NoAutoSpacing ???}| (needed for pdfTeX only).
%
%    \item [ThinColonSpace=true (false)] changes the
%      non-breaking 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 [OriginalTypewriter=true (false)] prevents any
%      customisation of |\ttfamily| and |\texttt{}| in French.
%      This option should only be used to ensure backward compatibility.
%      The current default behaviour is to switch off any addition of
%      space before high punctuation with typewriter fonts
%      (\textit{e.g.} verbatim).
%
%    \item [UnicodeNoBreakSpaces=true (false)];\hlabel{ucs-nbsp}
%      (experimental) this option should be set to \fbo{true}
%      \emph{only while converting LuaLaTeX files} to HTML.
%      It ensures that non-breaking spaces added by \frenchb{} are
%      inserted in the PDF file as U+A0 or U+202F (thin) instead of
%      penalties and glues.
%      Note that \exe{lwarp} (v.~0.37 and up) is fully compatible with
%      \frenchb{} for translating PDFLaTeX or XeLaTeX files to HTML.
%
%    \item [og=«, fg=»]; when guillemets characters are available on
%      the keyboard (through a compose key for instance), it is nice
%      to use them instead of typing |\frquote{}|.  This option
%      tells \frenchb{} which characters are opening and closing
%      French guillemets (they depend on the input encoding), then
%      you can type either \hlabel{option-og-fg}
%      \texttt{« guillemets »} or \texttt{«guillemets»}%
%      \footnote{Or even
%         \texttt{«\textasciitilde{}guillemets\textasciitilde{}»},
%         but \emph{only} with LuaLaTeX.}
%      (with or without spaces) to get properly typeset French quotes.
%      This option works with LuaLaTeX, XeLaTeX and with pdfLaTeX
%      (default encoding: utf8); with pdflatex other 8-bits encodings
%      (latin1, latin9, ansinew, applemac,…) are also supported
%      when properly declared with \file{inputenc}.
%
%    \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 less 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 included in a level 1 (outer) quotation.
%      This option is also considered for level 2 (inner) quotations
%      to decide between \texttt{\guilsinglleft} and
%      \texttt{\guilsinglright} when \fbo{InnerGuillSingle=true}
%      (see below). \hlabel{everyparguill}
%    \item [EveryLineGuill=open, close, none (none)]; with LuaTeX
%      based engines \emph{only}, it is possible to set this option
%      to \fbo{open} [resp. \fbo{close}]; this ensures that a `«’
%      [resp. `»’] followed by a proper space will be inserted at the
%      beginning of every line of embedded (inner) quotations
%      spreading over more than one line (provided that both outer
%      and inner quotations are entered with |\frquote{}|). When
%      \fbo{EveryLineGuill=open} or \fbo{=close} the inner quotation is
%      always surrounded by « and », the next option is ineffective.
%
%    \item [InnerGuillSingle=true (false)];
%      if \fbo{InnerGuillSingle=false} (the 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; moreover if option \fbo{EveryParGuill=open} (or
%      \fbo{close}) is set, a \texttt{\guilsinglleft} (or
%      \texttt{\guilsinglright}) is added at the beginning of every
%      parapraph included in the inner quotation.
%
%    \item [ThinSpaceInFrenchNumbers=true (false)]; if \pkg{numprint}
%      has been loaded with the \opt{autolanguage} option, while
%      typesetting numbers with the |\numprint{}| command,
%      |\npthousandsep| is defined as a non-breaking space (|~|)%
%      \footnote{Actually without stretch nor shrink.} in French;
%      when set to true, this option redefines |\npthousandsep|
%      as a thin space (|\FBthinspace|).
%
%    \item [SmallCapsFigTabCaptions=false (true*)]; when set to
%      \fbo{false}, |\figurename| and |\tablename| will be printed in
%      French captions as ``Figure’’ and ``Table’’ instead of being
%      printed in small caps (the default). The same result can be
%      achieved by defining |\FBfigtabshape| as |\relax| before
%      loading \frenchb{} (in a document class f.i.).
%
%    \item [CustomiseFigTabCaptions=false (true*)]; when set to
%     \fbo{false} the default separator (colon) is used instead of
%      |\CaptionSeparator|.  Anyway, \frenchb{} tries hard to insert
%      a proper space before it in French and warns if it fails to do
%      so.
%
%    \item [OldFigTabCaptions=true (false)] is to be used \emph{only}
%      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 [FrenchSuperscripts=false (true)]; then
%      |\up=\textsuperscript|. % (option added in version 2.1).
%      Should only be made \fbo{false} to recompile documents written
%      before 2008 without changes: by default |\up| now relies on
%      |\fup| designed to produce better looking superscripts.
%
%    \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 [SuppressWarning=true (false)]; can be turned to \fbo{true}
%      if you are bored with \frenchb’s warnings; use this option as
%      \emph{first} option of \fbsetup{} to cancel warnings launched
%      by other options.
%    \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}\par
%    The reverse order \fbsetup{IndentFirst,StandardLayout}
%    would lead to option \fbo{IndentFirst} being overwritten by
%    \fbo{StandardLayout}.
%
%  \subsubsection{Caption names}
%  \label{sssec-captions-name}
%
%    {\sloppy All caption names can easily be customised in French
%    using the simplified syntax introduced by \babel~3.9,
%    for instance |\def\frenchproofname{Preuve}| or
%    |\def\acadianproofname{Preuve}| for the \opt{acadian} dialect.
%    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
%    |frenchb| or |francais|.\par}
%
%  \subsubsection{Figure and table captions}
%  \label{sssec-captions-fig}
%
%    \enlargethispage{-\baselineskip}
%    In French, captions in figures and tables should never be printed
%    as ‘Figure~1: ’ which is the default in standard LaTeX2e
%    classes (a space should \emph{always} preceed a colon in French),
%    anyway ‘Figure 1 -- ’ is preferred.
%
%    When French is the main language, the default behaviour of
%    \frenchb{} is to change the separator (colon) used in figures’ and
%    tables’ captions \emph{for all languages} to |\CaptionSeparator|
%    which defaults to ` -- ’ and can be redefined in the preamble with
%    |\renewcommand*{\CaptionSeparator}{...}|.
%    This works for the standard LaTeX2e classes, for the \cls{memoir}
%    koma-script and beamer classes.
%    In case this procedure fails a warning is issued.
%
%    When French is not the main language, the colon is preserved for
%    all languages including French but \frenchb{} tries hard to insert
%    a proper space before it and warns if it fails to do so.
%
%    Three options are provided to customise figure and table captions:
%    \begin{itemize}
%    \item \fbo{CustomiseFigTabCaptions} is set to \fbo{true} when
%      French is the main language (hence separator = ` -- ’) and to
%      \fbo{false} otherwise (hence separator = `: ’ with a proper
%      space before the colon in French if possible); toogle this option
%      if needed;
%    \item 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};
%    \item the last option, \fbo{SmallCapsFigTabCaptions}, can be set
%      to \fbo{false} to typeset |\figurename| and |\tablename| in
%      French as ``Figure’’ and ``Table’’ rather than in small caps
%      (the default).
%    \end{itemize}
%
%  \subsection{Hyphenation checks}
%  \label{ssec-hyphen}
%
%    Once you have built your format, a good precaution would be to
%    perform some basic tests about hyphenation in French.
%    For LaTeX2e I suggest this:
%    \begin{itemize}
%    \item run |pdfLaTeX| on the following file:\\[3mm]^^A\]
%      |%%% Test file for French hyphenation.|\\
%      |\documentclass[french]{article}|\\
%      |\usepackage[utf8]{inputenc} % utf8, what else?|\\
%      |\usepackage[T1]{fontenc}    % mandatory for French|\\
%      |\usepackage{lmodern}        % or erewhon, palatino…|\\
%      |\usepackage{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}
%
%  \newpage
%  \subsection{Changes}
%  \label{ssec-changes}
%
%  \subsubsection*{What’s new in version 3.6?}
%
%    Version 3.6a no longer loads the \pkg{keyval} package, replaced by
%    core LaTeX commands (\pkg{l3keys}). The thin space added before
%    footnote’s calls is now customisable (suggested by Thomas Savary),
%    the command’s name is |\FBfnmarkspace|.
%
%  \subsubsection*{What’s new in version 3.5?}
%
%    Version 3.5a offers a new option \fbo{ListItemsAsPar}.  The default
%    layout of lists is unchanged (for backward compatibility), but
%    users should try this new option which ensures a layout of lists
%    closer to French typographic standards: see f.i.\ how lists are
%    typeset in the book ``Lexique des règles typographiques en usage
%    à l’Imprimerie Nationale’’.
%
%    Version 3.5b fixes a bug due to wrong |\everypar|’s management in
%    |\frquote{}|; it showed up when |\frquote{}| immediately followed
%    a sectionning command.
%
%    Starting with version 3.5d, a new option \fbo{StandardListSpacing}
%    has been added to supersede \fbo{ReduceListSpacing}.
%
%    A new command |\NoEveryParQuote| has been added in version 3.5e:
%    it is meant to be used inside a group or environment to suppress
%    unwanted guillemets (typically when lists are embedded in
%    |\frquote{}|).
%
%    Version 3.5g fixes a long standing bug affecting LuaTeX: legacy
%    kerning was disabled for Type1 fonts since v3.1g (2015).
%
%    Version 3.5j also fixes a long standing bug affecting koma-script,
%    \cls{memoir} and \cls{beamer} classes: redefintions of the caption
%    separator (commands |\captionformat|, |\captiondelim|, etc.) are
%    now taken into account properly.
%
%    Version 3.5k is a cleanup release:
%    \begin{itemize}
%    \item the translations in French of |\figurename| and |\tablename|
%      no longer hold font changing commands (switch to small caps), the
%      font switch has been moved to |\fnum@figure| and |\fnum@table| as
%      suggested by Axel Sommerfeldt.
%    \item Package \pkg{caption} can now be loaded whether before
%      or after \pkg{babel}, indifferently.
%    \item |\pdfstringdefDisableCommands| is no longer used: as
%      suggested by the LaTeX3 team, all commands requiring special care
%      in \pkg{hyperref}’s bookmarks are now defined using
%      |\textorpdfstring{}{}|.
%    \end{itemize}
%
%    Version 3.5n introduces a new command |\bname{}| (an alternative to
%    |\bsc{}|).
%
%    Version 3.5q corrects a bug in lists layout: |\listparindent|
%    (formely 0pt) is  defined as |\parindent| and if |\parskip > 0pt|,
%    |\parsep| is now defined as |\parskip|.  This ensures that
%    paragraphs included in lists are now visible. The former behaviour
%    can be recovered by adding |\parskip=0pt|, |\parindent=0pt|
%    \emph{inside} the list environment.
%
%    Version 3.5r is compatible with \pkg{ucharclasses} which is now
%    loaded by \pkg{fontsetup} with the XeTeX engine.
%    The \file{frenchb.ins} file is no longer needed to extract the
%    \file{.ldf} files from \file{frenchb.dtx} (see~\file{README.md}).
%
%    \subsubsection*{What’s new in version 3.4?}
%
%    Version 3.4a adds a new command |\frenchdate| (see
%    p.~\pageref{frenchdate}) and slightly changes number formatting:
%    |\FBthousandsep| is now a \textit{kern} instead of a rubber
%    length.  |\renewcommand*{\FBthousandsep}{~}| will switch back
%    to the former (wrong) behaviour.
%
%    Both options \opt{french} and \opt{acadian} can now be used
%    simultaneously in a document; currently \opt{french} and
%    \opt{acadian} are identical, it is up to the user to customise
%    \opt{acadian} in terms of hyphenation patterns, captionnames,
%    date format or high punctuation and quotes spacing if he/she
%    needs a variant for French.
%
%    A new command |\FBsetspaces| has been added for easy customising of
%    spacing before high punctuation and inside quotes independently for
%    \opt{french} and \opt{acadian}, see p.~\pageref{FBsetspaces}.
%
%    Version 3.4 requires eTeX and LuaTeX 1.0.4 or newer.
%
%  \subsubsection*{What’s new in version 3.3?}
%
%    In version~3.3d the automatic insertion of non-breaking spaces
%    before the colon character has been improved \emph{with engine
%    LuaTeX only}: a spurious space is no longer inserted in strings
%    like http://mysite, C:\textbackslash Program Files or 10:55.
%    Unfortunately, my attempts to do the same with XeTeX or pdfTeX
%    were unsuccessful.
%
%    A few internal changes have been made in version~3.3c to improve
%    the convertion into HTML of non-breaking spaces added by \frenchb.
%    Usage of \exe{lwarp} (v.0.37 and up) is recommended for HTML
%    output, it works fine on files compiled with XeLaTeX or pdfLaTeX
%    formats.
%    A new experimental option \fbo{UnicodeNoBreakSpaces} has been
%    added for LuaLaTeX in version~3.3c, see p.~\pageref{ucs-nbsp}.
%
%    According to current \babel’s standards, every dialect should
%    have it’s own \file{.ldf} file; starting with version~3.3b,
%    the main support for French is in \file{french.ldf}, portmanteau
%    files \file{frenchb.ldf},\file{francais.ldf}, \file{acadian.ldf}
%    and \file{canadien.ldf} have been added.  Recommended options are
%    \opt{french} or \opt{acadian}, all other are deprecated.
%    BTW, options \opt{french} and \opt{acadian} are currently
%    strictly identical.
%
%    Release 3.3a is compatible with LuaTeX v.~0.95 (TL2016) and up.
%    Former skips |\FBcolonskip|, |\FBthinskip| and |\FBguillskip|
%    controlling punctuation spacings in LuaTeX have been removed;
%    all three engines now rely on the same commands |\FBcolonspace|,
%    |\FBthinspace| and |\FBguillspace|.
%
%    An alias |\frenchsetup{}| for |\frenchbsetup{}| has been added
%    in version 3.3a, it might appear more relevant in the future as
%    the language name |frenchb| should vanish.
%
%    Further customisation of the |\part{}| command is provided via
%    three new commands |\frenchpartfirst|, |\frenchpartsecond| and
%    |\frenchpartnameord|.
%
% \StopEventually{}
%
% \changes{v2.6c}{2013/05/20}{Dummy file frenchb.cfg is no longer
%    generated from frenchb.dtx.}
%
%  \clearpage
%  \newgeometry{left=50mm,right=23mm}
%
%  \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}.}
%
% \changes{v3.0a}{2014/02/28}{Support for options frenchb, francais,
%    canadien, acadian changed.}
%
% \changes{v3.0a}{2014/02/19}{\cs{LdfInit} checks \cs{captionsfrench}
%    instead of \cs{datefrench} to avoid a conflict with papertex.cls
%    which loads datetime.sty.}
%
% \changes{v3.4a}{2018/01/14}{\cs{LdfInit} checks \cs{FBclean@on@exit}
%    instead of \cs{captionsfrench} (undefined in PLain).
%    Prevents loading french.ldf again with acadian option.}
%
%    The macro |\LdfInit| takes care of preventing that this file is
%    loaded more than once (even if both options \opt{french} and
%    \opt{acadian} are used in the same document), checking the
%    category code of the \texttt{@} sign, etc.
%
%    \begin{macrocode}
%<*french>
\LdfInit\CurrentOption{FBclean@on@exit}
%    \end{macrocode}
%
% \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(french.ldf) }%
      \errhelp{#2}\errmessage{\\#1^^J}%
    \endgroup}
\def\fb@warning#1{%
   \begingroup
      \newlinechar=`\^^J
      \def\\{^^J(french.ldf) }%
      \message{\\#1^^J}%
   \endgroup}
\def\fb@info#1{%
   \begingroup
      \newlinechar=`\^^J
      \def\\{^^J}%
      \wlog{#1}%
   \endgroup}
%    \end{macrocode}
%
% \changes{v3.4a}{2018/01/04}{babel-french now requires eTeX.}
%
%    Quit if eTeX is not available.
%    \begin{macrocode}
\let\bbl@tempa\relax
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname eTeXversion\endcsname\relax
  \let\bbl@tempa\endinput
  \fb@error{babel-french requires eTeX.\\
            Aborting here}
           {Orignal PlainTeX is not supported,\\
            please use LuaTeX or XeTeX engines.}
\fi
\bbl@tempa
%    \end{macrocode}
%
% \changes{v3.0c}{2014/03/30}{babel-french requires babel-3.9i.}
%
%    Quit if \babel’s version is less than 3.9i.
%    \begin{macrocode}
\let\bbl@tempa\relax
\ifdefined\babeltags
\else
   \let\bbl@tempa\endinput
   \ifdefined\PackageError
      \PackageError{french.ldf}
         {babel-french requires babel v.3.16.\MessageBreak
          Aborting here}
         {Please upgrade Babel!}
   \else
      \fb@error{babel-french requires babel v.3.16.\\
                Aborting here}
               {Please upgrade Babel!}
   \fi
\fi
\bbl@tempa
%    \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 (fallbacks are
%    |\l@nohyphenation| if available or~0).
%    \file{babel.def} (3.9i and up) defines |\l@<languagename>| also for
%    eTeX, LuaTeX and XeTeX formats which set |\lang@<languagename>|.
%    \begin{macrocode}
\def\FB@nopatterns{%
   \ifdefined\l@nohyphenation
      \adddialect\l@french\l@nohyphenation
      \edef\bbl@nulllanguage{\string\language=nohyphenation}%
   \else
      \edef\bbl@nulllanguage{\string\language=0}%
      \adddialect\l@french0
   \fi
   \@nopatterns{French}}
\ifdefined\l@french \else \FB@nopatterns \fi
%    \end{macrocode}
%
%    Babel’s French language can be loaded with option \opt{acadian}
%    which stands for Canadian French.
%    If no specific hyphenation patterns are available, Canadian French
%    will use the French ones.
%
% \changes{v3.5f}{2019/09/04}{\cs{l@canadien} was defined too early
%    in file `canadien.ldf': \cs{l@acadian} might not be defined.}
%
%    \begin{macrocode}
\ifdefined\l@acadian
  \adddialect\l@canadien\l@acadian
\else
  \adddialect\l@acadian\l@french
  \adddialect\l@canadien\l@french
\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}
\providehyphenmins{french}{\tw@\thr@@}
\providehyphenmins{acadian}{\tw@\thr@@}
%    \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
\ifdefined\magnification
\else
   \ifdefined\@compatibilitytrue
     \LaTeXetrue
   \else
     \PackageError{french.ldf}
        {LaTeX-2.09 format is no longer supported.\MessageBreak
         Aborting here}
        {Please upgrade to LaTeX2e!}
     \let\bbl@tempa\endinput
   \fi
\fi
\bbl@tempa
%    \end{macrocode}
% \end{macro}
%
%\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.}
%
% \changes{v3.4c}{2018/02/16}{Reverting to former test, beware of
%    \cs{XeTeXrevision} left as \cs{relax} by careless testing.}
%
%    \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}
%
% \changes{v3.3b}{2017/07/08}{New `if’ \cs{ifFBfrench} to replace
%    \cs{iflanguage} test which is based on patterns.}
%
% \begin{macro}{\ifFBfrench}
%    True when the current language is French or any of its dialects;
%    will be set to true by |\extrasfrench| and to false by
%    |\noextrasfrench|.  Used in |\DecimalMathComma| and
%    |frenchsetup{og=«, fg=»}|.
%    \begin{macrocode}
\newif\ifFBfrench
%    \end{macrocode}
% \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}.}
%
% \changes{v3.4a}{2018/01/06}{Change \cs{(no)extras}\cs{CurrentOption}
%    to \cs{(no)extrasfrench}. \cs{(no)extrasacadian} will be defined
%    as \cs{(no)extrasfrench} in file acadian.ldf.}
%
% \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’’ (U+27 or U+2019) 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.
%
% \changes{v3.5c}{2018/09/11}{\cs{lccode} of quote 0x27 changed from
%     0x2019 to 0x27 for Unicode engines.}
%
%    \begin{macrocode}
\def\extrasfrench{%
     \FBfrenchtrue
     \babel@savevariable{\lccode"27}%
     \lccode"27="27
     \ifFBunicode
       \babel@savevariable{\lccode"2019}%
       \lccode"2019="2019
     \fi
}
\def\noextrasfrench{\FBfrenchfalse}
%    \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}
\addto\extrasfrench{\bbl@frenchspacing}
\addto\noextrasfrench{\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).
%
% \changes{v3.0a}{2014/01/10}{New flag \cs{ifFB@luatex@punct} for
%    `high punctuation’ management with LuaTeX engines.}
%
% \begin{macro}{\ifFB@active@punct}
%    Three internal flags are needed for the three different techniques
%    used for `high punctuation’ management.
%    \begin{macrocode}
\newif\ifFB@active@punct \FB@active@puncttrue
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifFB@luatex@punct}
%    With LuaTeX, starting with version 1.0.4, callbacks are used to
%    get rid of active punctuation.  With previous versions, `high
%    punctuation’ characters remain active (see below).
%    \begin{macrocode}
\newif\ifFB@luatex@punct
\ifFBLuaTeX
  \ifnum\luatexversion<100
    \ifx\PackageWarning\@undefined
      \fb@warning{Please upgrade LuaTeX to version 1.0.4 or above!\\%
         babel-french will make high punctuation characters (;:!?)\\%
         active with LuaTeX < 1.0.4.}%
    \else
      \PackageWarning{french.ldf}{Please upgrade LuaTeX
         to version 1.0.4 or above!\MessageBreak
         babel-french will make high punctuation characters%
         \MessageBreak (;:!?) active with LuaTeX < 1.0.4;%
         \MessageBreak reported}%
    \fi
  \else
    \FB@luatex@puncttrue\FB@active@punctfalse
  \fi
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifFB@xetex@punct}
%    For XeTeX, the availability of |\XeTeXinterchartokenstate|
%    decides whether the `high punctuation’ characters (|;| |!| |?|
%    and |:|) have to be made |\active| or not.
%
% \changes{v3.2b}{2016/04/18}{New counter \cs{FB@nonchar} needed for
%    non characters: it’s value will be 4095 for new engines and 255
%    for older ones.}
%
%    The number of available character classes has been increased from
%    256 to 4096 in XeTeX v.~0.99994, the class for non-characters is
%    now 0xFFF=4095 (formerly 0xFF=255). The class for standard
%    characters is 0.
%    \begin{macrocode}
\newcount\FB@stdchar
\newif\ifFB@xetex@punct
\ifdefined\XeTeXinterchartokenstate
  \FB@xetex@puncttrue\FB@active@punctfalse
  \ifdim\the\XeTeXversion\XeTeXrevision\p@ < 0.99994\p@
    \chardef\FB@nonchar="FF \relax
  \else
    \chardef\FB@nonchar="FFF \relax
  \fi
  \FB@stdchar=\z@
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FBguillspace}
% \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.1f}{2015/05/31}{\cs{FBthinspace} is no longer a kern but
%    a skip (babel-french adds a nobreak penalty before it).}
%
% \changes{v3.2c}{2016/05/14}{Change .16667em to
%    .5\cs{fontdimen2}\cs{font} to get in XeTeX and pdfTeX
%    the same spacing as in LuaTeX.}
%
% \changes{v3.3a}{2016/04/30}{Skips \cs{FBcolonskip} and
%    \cs{FBthinskip} replaced by toks \cs{FBcolonsp} and
%    \cs{FBthinsp}.}
%
%    These three commands are meant for basic French.  Other French
%    dialects can use different settings, see below.
%    According to the I.N.\ specifications, the `:’ requires an
%    inter-word space before it, the other three require just a thin
%    space.  We define |\FBcolonspace| as |\space| (inter-word space)
%    and |\FBthinspace| as an half inter-word space with no shrink nor
%    stretch.
%    |\FBguillspace| is defined btw. as spacing for French quotes is
%    handled together with high punctuation for LuaTeX and XeTeX.
%    |\FBguillspace| has been fine tuned by Thierry Bouche to 80\% of an
%    inter-word space with reduced stretchability.
%    All three are user customisable in the preamble, best using the
%    |\FBsetspaces| command described below.
%    A penalty will be added before these spaces to prevent line
%    breaking.
%    \begin{macrocode}
\newcommand*{\FBguillspace}{\hskip .8\fontdimen2\font
                              plus .3\fontdimen3\font
                             minus .8\fontdimen4\font \relax}
\newcommand*{\FBcolonspace}{\space}
\newcommand*{\FBthinspace}{\hskip .5\fontdimen2\font \relax}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \changes{v3.3a}{2016/04/30}{Skip \cs{FBguillskip} for LuaTeX
%    replaced by toks \cs{FBguillsp}.}
%
% \changes{v3.4a}{2018/01/15}{Toks \cs{FBcolonsp}, \cs{FBthinsp} and
%    \cs{FBguillsp} removed.}
%
% \changes{v3.4a}{2018/01/26}{New command \cs{FBsetspaces} to fine tune
%    spacing independently in French and in French dialects.}
%
% \begin{macro}{\FBsetspaces}
%    This command makes it easy to fine tune |\FBguillspace|,
%    |\FBcolonspace| and\linebreak |\FBthinspace| in French (defaut)
%    or independently in a French dialect using the optional argument.
%    They are meant for LaTeX2e \emph{only} and can only be used
%    in the preamble.
%    Four mandatory arguments are expected besides the optional one:
%    the first one is a \textit{string} either "guill", "colon", or
%    "thin", the last four are decimal numbers specifying
%    \textit{width}, \textit{stretch} and \textit{shrink} relative to
%    \textit{fontdimens}.\hlabel{FBsetspaces}
%    For \kern0pt instance |\FBsetspaces[acadian]{colon}{0.5}{0}{0}|
%    defines |\acadianFBcolonspace| as a thinspace which will be used for
%    the Acadian dialect only.  When used without optional argument or
%    with argument `french’, the same command would tune the basic
%    |\FBcolonspace| command.
%    \begin{macrocode}
\ifLaTeXe
  \newcommand*{\FBsetspaces}[5][french]{%
    \def\bbl@tempa{french}\def\bbl@tempb{#1}%
    \ifx\bbl@tempa\bbl@tempb \def\bbl@tempb{}\fi
    \@namedef{\bbl@tempb FB#2space}{\hskip #3\fontdimen2\font
                                      plus #4\fontdimen3\font
                                     minus #5\fontdimen4\font \relax}%
%    \end{macrocode}
%    With option "acadian", fill the corresponding LuaTeX table.
%    All unset values in the "acadian" subtables will be filled
%    `AtBeginDocument’ by |\set@glue@table| with the value available
%    for "french".
%    \begin{macrocode}
    \ifFB@luatex@punct
      \ifx\bbl@tempb\FB@acadian
        \directlua{
          FBsp.#2.gl.ac[1] = #3
          FBsp.#2.gl.ac[2] = #4
          FBsp.#2.gl.ac[3] = #5
          if #3 > 0.6 then
             FBsp.#2.ch.ac = 0xA0
          elseif #3 > 0.2 then
             FBsp.#2.ch.ac = 0x202F
          else
             FBsp.#2.ch.ac = 0x200B
          end
        }%
      \fi
    \fi
  }
  \@onlypreamble\FBsetspaces
\fi
%    \end{macrocode}
% \end{macro}
%
%    Remember that the \emph{same} |\extrasfrench| command is executed
%    when switching to French or to a French dialect (Acadian).
%    Acadian and French may share the same patterns (or not), and may
%    use different spacing for high punctuation and/or quotes.
%    Basically, for pdfLaTeX and XeLaTeX, the spacing is set for French,
%    then potentially tuned differently for Acadian.
%    LuaTeX relies on an attribute |\FB@dialect| to decide what spacing
%    is needed for French or Acadian (see LuaTeX table |FBsp|).
%    \hlabel{extrapunct}
%    As a rough test on |\languagename| would be unreliable to set the
%    value of |\FB@dialect| (see \file{babel.pdf}), we use a trick
%    based on |\detokenize|; another option would be to use the
%    |\IfLanguageName| command from Oberdiek’s package \file{iflang}.
%    \begin{macrocode}
\ifLaTeXe
  \addto\extrasfrench{%
    \ifFB@luatex@punct
      \edef\bbl@tempa{\detokenize\expandafter{\languagename}}%
      \edef\bbl@tempb{\detokenize{french}}%
      \ifx\bbl@tempa\bbl@tempb \FB@dialect=\z@
      \else                    \FB@dialect=\@ne
      \fi
%    \end{macrocode}
%    When first entering French, we must set the LuaTeX
%    tables for French (|\FB@dialect=0|) \emph{before} any dialect
%    redefines any |\FB...space| command.  Doing this `AtBeginDocument’
%    would be too late: if French or a French dialect is the main
%    language, |\extrasfrench| has been executed before!
%    \begin{macrocode}
      \ifdefined\FB@once\else
        \set@glue@table{colon}%
        \set@glue@table{thin}%
        \set@glue@table{guill}%
        \def\FB@once{}%
      \fi
    \fi
%    \end{macrocode}
%    Any dialect dependent customisation done using
%    |\FBsetspaces[|\textit{dialect}|]| command or alike is now
%    taken into account: the value of |\FBthinspace| (meant for French,
%    i.e.|\FB@dialect=0|) is first saved then changed (for Acadian).
%    \begin{macrocode}
    \ifcsname\languagename FBthinspace\endcsname
      \babel@save\FBthinspace
      \renewcommand*{\FBthinspace}{%
              \csname\languagename FBthinspace\endcsname}%
    \fi
%    \end{macrocode}
%    Same for |\FBcolonspace|:
%    \begin{macrocode}
    \ifcsname\languagename FBcolonspace\endcsname
      \babel@save\FBcolonspace
      \renewcommand*{\FBcolonspace}{%
              \csname\languagename FBcolonspace\endcsname}%
    \fi
%    \end{macrocode}
%    And for |\FBguillspace|:
%    \begin{macrocode}
    \ifcsname\languagename FBguillspace\endcsname
      \babel@save\FBguillspace
      \renewcommand*{\FBguillspace}{%
              \csname\languagename FBguillspace\endcsname}%
    \fi
  }
\fi
%    \end{macrocode}
%
% \changes{v3.2c}{2016/05/14}{Newif \cs{ifFB@spacing} and new commands
%    \cs{FB@spacingon}, \cs{FB@spacingoff} to control space tuning in
%    French.}
%
%    The conditional |\ifFB@spacing| will be used by pdfTeX and XeTeX
%    engines to switch on or off space tuning before high punctuation
%    and inside French quotes.
%    A matching attribute will be defined later for LuaTeX.
%    \begin{macrocode}
\newif\ifFB@spacing \FB@spacingtrue
%    \end{macrocode}
%
% \begin{macro}{\FB@spacing@off}
% \begin{macro}{\FB@spacing@on}
%    Two internal commands to switch on and off all space tuning
%    for all six characters `;:!?«»’.
%    They will be triggered by user command |\NoAutoSpacing| and by
%    font family switching commands |\ttfamilyFB| |\rmfamilyFB| and
%    |\sffamilyFB|. These four commands will now behave the same with
%    any engine (up to version 3.2b, results were engine dependent).
%    \begin{macrocode}
\ifFB@luatex@punct
  \newcommand*{\FB@spacing@on}{\FB@spacing=\@ne}
  \newcommand*{\FB@spacing@off}{\FB@spacing=\z@}
\else
  \newcommand*{\FB@spacing@on}{\FB@spacingtrue}
  \newcommand*{\FB@spacing@off}{\FB@spacingfalse}
\fi
%    \end{macrocode}
% \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, i.e. version 1.0.4 (included in TL2017) or newer.
%
% \changes{v3.0b}{2014/02/13}{Require luatexbase with LaTeX2e 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.}
%
% \changes{v3.1j}{2015/10/16}{Loading luatexbase.sty is no longer
%    needed with LaTeX release 2015/10/01 or later.}
%
% \changes{v3.2b}{2016/04/18}{Load ltluatex.tex for plain LuaTeX to
%    ensure \cs{newattribute} is defined.}
%
% \changes{v3.2c}{2016/05/14}{New LuaTeX attribute \cs{FB@spacing}.}
%
% \changes{v3.3a}{2017/04/30}{Compatibility code for pre
%    2015/10/01 LaTeX release removed, see ltnews23.tex.}
%
% \changes{v3.4a}{2018/01/15}{New attribute \cs{FB@dialect} for the
%    French dialect acadian.}
%
%    \begin{macrocode}
\ifFB@luatex@punct
  \ifdefined\newluafunction\else
%    \end{macrocode}
%    This code is for Plain: load \file{ltluatex.tex} if it hasn’t been
%    loaded before \babel.
%    \begin{macrocode}
    \input ltluatex.tex
  \fi
%    \end{macrocode}
%    We define five LuaTeX attributes to control spacing in French
%    and/or Acadian for `high punctuation’ and quotes, making sure
%    that |\newattribute| is defined.
%
%    |\FB@spacing=0| switches off any space tuning both before high
%    punctuation characters and inside French quotes (i.e.\ function
%    |french_punctuation| doesn’t alter the node list at all).
%
%    |\FB@addDPspace=0| switches off automatic insertion of spaces
%    before high punctuation characters (but typed spaces are still
%    turned into non-breaking thin- or word-spaces).
%
%    |\FB@addGUILspace| will be set to~1 by option \fbo{og=«, fg=»},
%    thus enabling automatic insertion of proper spaces after `«’ and
%    before `»’.
%
%    |\FB@ucsNBSP| triggers the replacement of glues by characters, it
%    is controlled by option \fbo{UnicodeNoBreakSpaces}.
%
%    |\FB@dialect| is 0 for French and 1 for Acadian; its value controls
%    which parts of the glue table (|.fr| or |.ac|) are taken into
%    account.
%    \begin{macrocode}
  \newattribute\FB@spacing      \FB@spacing=\@ne
  \newattribute\FB@addDPspace   \FB@addDPspace=\@ne
  \newattribute\FB@addGUILspace \FB@addGUILspace=\z@
  \newattribute\FB@ucsNBSP      \FB@ucsNBSP=\z@
  \newattribute\FB@dialect      \FB@dialect=\z@
  \ifLaTeXe
    \PackageInfo{french.ldf}{No need for active punctuation
                 characters\MessageBreak with this version
                 of LuaTeX!\MessageBreak reported}
  \else
    \fb@info{No need for active punctuation characters\\
             with this version of LuaTeX!}
  \fi
%    \end{macrocode}
%
%    {\sloppy The next command will be used in the first call of
%    |\extrasfrench| to convert |\FBcolonspace|, |\FBthinspace| and
%    |\FBguillspace| into a table usable by LuaTeX.
%    This way, any customisation done in the preamble (by \fbsetup{},
%    redefinitions or |\FBsetspaces| commands) are taken into account.
%    Values not explicitly set for Acadian by
%    |\FBsetspaces[|\textit{acadian}|]| commands are copied from the
%    French ones.\par}

%    In case parsing by the Lua function |FBget_glue| (defined in file
%    \file{frenchb.lua}) fails due to unexpected syntax in |\FB...space|
%    the table remains unchanged and a warning is issued.
%    The matching space characters for option \fbo{UnicodeNoBreakSpaces}
%    are set as word space, thin space or null space according to the
%    \textit{width} parameter.
%
% \changes{v3.4a}{2018/01/30}{Lua function token.get\_meaning requires
%    LuaTeX 1.0.}
%
%    \begin{macrocode}
  \newcommand*{\set@glue@table}[1]{%
    \directlua {
      local s = token.get_meaning("FB#1space")
      local t = FBget_glue(s)
      if t then
         FBsp.#1.gl.fr = t
         if not FBsp.#1.gl.ac[1] then
            FBsp.#1.gl.ac =  t
         end
         if FBsp.#1.gl.fr[1] > 0.6 then
            FBsp.#1.ch.fr = 0xA0
         elseif FBsp.#1.gl.fr[1] > 0.2 then
            FBsp.#1.ch.fr = 0x202F
         else
            FBsp.#1.ch.fr = 0x200B
         end
         if not FBsp.#1.ch.ac then
            FBsp.#1.ch.ac = FBsp.#1.ch.fr
         end
      else
         texio.write_nl('term and log', '')
         texio.write_nl('term and log',
           '*** french.ldf warning: Unexpected syntax in FB#1space,')
         texio.write_nl('term and log',
           '*** french.ldf warning: LuaTeX table FBsp unchanged.')
         texio.write_nl('term and log',
           '*** french.ldf warning: Consider using FBsetspaces to ')
         texio.write('term and log', 'customise FB#1space.')
         texio.write_nl('term and log', '')
      end
    }%
  }
\fi
%</french>
%    \end{macrocode}
%
%    \begin{environment}{frenchb.lua}
%    This is \file{frenchb.lua}. It 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}{Codes 0x13 and 0x14 added for French
%    quotes in T1-encoding.}
%
% \changes{v3.3c}{2017/09/07}{Function `get\_glue’ robustified.
%    `french\_punctuation’ can insert Unicode characters instead
%    of glues.}
%
%    \begin{macrocode}
%<*lua>
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 `«’ (U+00AB) and before `»’ (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 `«’ 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 `«’ and `»’.
%    \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 non-breaking space U+00A0 or U+202F
%    (thin) 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}
% \changes{v3.1g}{2015/06/17}{Node HLIST added; node TEMP added
%    for the first node of \cs{hbox}es.}
%
%    Local definitions for nodes:
%    \begin{macrocode}
local new_node     = node.new
local copy_node    = node.copy
local node_id      = node.id
local HLIST        = node_id("hlist")
local TEMP         = node_id("temp")
local DISC         = node_id("disc")
local KERN         = node_id("kern")
local GLUE         = node_id("glue")
local GLYPH        = node_id("glyph")
local PENALTY      = node_id("penalty")
local nobreak      = new_node(PENALTY)
nobreak.penalty    = 10000
local nbspace      = new_node(GLYPH)
local insert_node_before = node.insert_before
local insert_node_after  = node.insert_after
local remove_node        = node.remove
%    \end{macrocode}
%
%\changes{v3.4a}{2018/01/26}{Global `FBsp’ table added; local function
%    `get\_glue’ changed into global `FBget\_glue’.}
%
%    Commands |\FBthinspace|, |\FBcolonspace| and |\FBguillspace| are
%    converted `AtBeginDocument’ by the next function |FBget_glue| into
%    tables of three values which are fractions of |\fontdimen2|,
%    |\fontdimen3| and |\fontdimen4|. \hlabel{lua-scaling}
%    If parsing fails due to unexpected syntax, the function returns
%    \textit{nil} instead of a table.
%    \begin{macrocode}
function FBget_glue(toks)
  local t = nil
  local f = string.match(toks,
                         "[^%w]hskip%s*([%d%.]*)%s*[^%w]fontdimen 2")
  if f == "" then f = 1 end
  if tonumber(f) then
     t = {tonumber(f), 0, 0}
     f = string.match(toks,    "plus%s*([%d%.]*)%s*[^%w]fontdimen 3")
     if f == "" then f = 1 end
     if tonumber(f) then
        t[2] = tonumber(f)
        f = string.match(toks, "minus%s*([%d%.]*)%s*[^%w]fontdimen 4")
        if f == "" then f = 1 end
        if tonumber(f) then
           t[3] = tonumber(f)
        end
     end
  elseif string.match(toks, "[^%w]F?B?thinspace") then
     t = {0.5, 0, 0}
  elseif string.match(toks, "[^%w]space") then
     t = {1, 1, 1}
  end
  return t
end
%    \end{macrocode}
%    Let’s initialize the global LuaTeX table |FBsp|: it holds the
%    characteristics of the glues used in French and Acadian for
%    high punctuation and quotes and the corresponding no-breaking
%    space characters for option \fbo{UnicodeNoBreakSpaces}.
%    \begin{macrocode}
FBsp = {}
FBsp.thin = {}
FBsp.thin.gl = {}
FBsp.thin.gl.fr = {.5,  0,  0}  ; FBsp.thin.gl.ac = {}
FBsp.thin.ch = {}
FBsp.thin.ch.fr = 0x202F        ; FBsp.thin.ch.ac = nil
FBsp.colon = {}
FBsp.colon.gl = {}
FBsp.colon.gl.fr = { 1,  1,  1} ; FBsp.colon.gl.ac = {}
FBsp.colon.ch = {}
FBsp.colon.ch.fr = 0xA0         ; FBsp.colon.ch.ac = nil
FBsp.guill = {}
FBsp.guill.gl = {}
FBsp.guill.gl.fr = {.8, .3, .8} ; FBsp.guill.gl.ac = {}
FBsp.guill.ch = {}
FBsp.guill.ch.fr = 0xA0         ; FBsp.guill.ch.ac = nil
%    \end{macrocode}
%    The next function converts the glue table returned by function
%    |FBget_glue| into sp for the current font; beware of null values
%    for fid, see |\nullfont| in TikZ, and of special fonts like
%    lcircle1.pfb for which |font.getfont(fid)| does not return a proper
%    font table, in such cases the function returns |nil|.
%
% \changes{v3.1l}{2016/02/13}{font.getfont(fid) possibly
%    returns nil even for a positive fid (i.e. AMS lcircle1.pfb).
%    Reported by François Legendre.}
%
% \changes{v3.1m}{2016/02/16}{new\_glue\_scaled returns
%    nil in case of invalid font table (i.e. lcircle1.pfb).  In such
%    cases babel-french leaves the node list unchanged.}
%
% \changes{v3.2b}{2016/04/18}{glue\_spec removed;
%    starting with LuaTeX 0.95, glue specifications fit in glue.}
%
%    \begin{macrocode}
local font_table = {}
local function new_glue_scaled (fid,table)
  if fid > 0 and table[1] then
     local fp = font_table[fid]
     if not fp then
        local ft = font.getfont(fid)
        if ft then
           font_table[fid] = ft.parameters
           fp = font_table[fid]
        end
     end
     local gl = new_node(GLUE,0)
     if fp then
        node.setglue(gl, table[1]*fp.space,
                         table[2]*fp.space_stretch,
                         table[3]*fp.space_shrink)
        return gl
     else
        return nil
     end
  else
     return nil
  end
end
%    \end{macrocode}
%    Let’s catch LuaTeX attributes |\FB@spacing|, |\FB@addDPspace|
%    and |\FB@addGUILspace|.
%    \begin{macrocode}
local FBspacing    = luatexbase.attributes['FB@spacing']
local addDPspace   = luatexbase.attributes['FB@addDPspace']
local addGUILspace = luatexbase.attributes['FB@addGUILspace']
local FBucsNBSP    = luatexbase.attributes['FB@ucsNBSP']
local FBdialect    = luatexbase.attributes['FB@dialect']
local has_attribute = node.has_attribute
%    \end{macrocode}
%    The following function will be added to |kerning| callback.
%    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|).  Constants |FR_fr| (french) and |FR_ca|
%    (acadian) are defined by command |\activate@luatexpunct|.
%
% \changes{v3.1b}{2014/09/16}{Add a check for null fid
%    in french\_punctuation (Tikz \cs{nullfont}).
%    Bug pointed out by Paul Gaborit.}
%
% \changes{v3.5g}{2020/01/30}{The kerning callback is a bit specific:
%    adding code with add\_to\_callback actually deletes the legacy
%    kerning as pointed out by Marcel Krüger on SE.}
%
% \changes{v3.5h}{2020/03/28}{Added glues and penalties should inherit
%    attributes from the related punctuation character; this is
%    mandatory for Lua-UL to underline and highlight them.
%    Thanks to Marcel Krüger for providing the fix.}
%
% \changes{v3.5h}{2020/04/10}{Code reorganised for better efficiency.}
%
%    \begin{macrocode}
-- Main function (to be added to the kerning callback).
local function french_punctuation (head)
%    \end{macrocode}
%    Restore the built-in kerning for 8-bits fonts.
%    \begin{macrocode}
  node.kerning(head)
  for item in node.traverse_id(GLYPH, head) do
    local lang = item.lang
    local char = item.char
%    \end{macrocode}
%    Skip glyphs not concerned by French kernings.
%    \begin{macrocode}
    if (lang == FR_fr or lang == FR_ca) and
         (FB_punct_left[char] or FB_punct_right[char]) then
       local fid  = item.font
       local attr = item.attr
       local FRspacing = has_attribute(item, FBspacing)
       FRspacing = FRspacing and FRspacing > 0
       local FRucsNBSP = has_attribute(item, FBucsNBSP)
       FRucsNBSP = FRucsNBSP and FRucsNBSP > 0
       local FRdialect = has_attribute(item, FBdialect)
       FRdialect = FRdialect and FRdialect > 0
       local SIG  = has_attribute(item, addGUILspace)
       SIG = SIG and SIG >0
       if FRspacing and fid > 0 then
          if FB_punct_left[char] then
             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}{Null glues should not trigger space
%    insertion before high ponctuation.  Bug pointed out by Benoit
%    Rivet for the `lstlisting’ environment of the listings package.}
%
% \changes{v3.1c}{2014/10/25}{Previous bug fix for null glues
%    (v3.0c) did not work properly.  Fixed now (I hope!).
%    Pointed out by Jacques André.}
%
%    If the previous node is a glue, check its natural width, only
%    positive glues (actually glues > 1 sp, for tabular `l’
%    columns) are to be replaced by a non-breaking space.
%    \begin{macrocode}
             local is_glue = prev_id == GLUE
             local glue_wd
             if is_glue then
                glue_wd = prev.width
             end
             local realglue = is_glue and glue_wd > 1
%    \end{macrocode}
%
% \changes{v3.3d}{2017/10/17}{In default mode, for `:’ only, check
%    if next node is a glyph or not.  If it is, turn the `auto’ flag
%    to false (avoids spurious spaces in URLs, MSDOS paths or 10:35).}
%
% \changes{v3.5s}{2024/02/28}{A `:’ followed by `-’ or a ligature
%    should not trigger spacing.}
%
%    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 commands |\FBthinspace| and |\FBcolonspace|
%    respectively.
%    Two options: if a space has been typed in before (turned into
%    \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 if attribute |\FB@addDPspace| is set,
%    unless any of these four conditions is met:
%    a) node is `:’ and the next one is of type GLYPH (avoids spurious
%       spaces in http://mysite, C:\textbackslash{} or 10:35);
%    b) the previous character is part of type |FB_punct_null|
%       (avoids spurious spaces in strings like |(!)| or |??|);
%    c) a null glue (actually <= 1 sp for tabulars, possibly < 0)
%       preceeds the punctuation character (for tabulars and listings);
%    d) the punctuation character starts a paragraph or an |\hbox{}|.
%
%    When option \fbo{UnicodeNoBreakSpaces} is set to \fbo{true},
%    a Unicode character U+00A0 or U+202F is inserted instead of
%    penalty and glue.
%    \begin{macrocode}
             if FB_punct_thin[char] or FB_punct_thick[char] then
                local SBDP = has_attribute(item, addDPspace)
                local auto = SBDP and SBDP > 0
                if FB_punct_thick[char] and auto then
                   local next = item.next
                   local next_id
                   if next then
                      next_id = next.id
                   end
                   if next_id and
                      (next_id == GLYPH or next_id == DISC) then
                      auto = false
                   end
                end
                if auto then
                   if (prev_char and FB_punct_null[prev_char]) or
                      (is_glue and glue_wd <= 1) or
                      (prev_id == HLIST and prev_subtype == 3) or
                      (prev_id == TEMP) then
                      auto = false
                   end
                end
                local fbglue
                local t
                if FB_punct_thick[char] then
                   if FRdialect then
                      t = FBsp.colon.gl.ac
                      nbspace.char = FBsp.colon.ch.ac
                   else
                      t = FBsp.colon.gl.fr
                      nbspace.char = FBsp.colon.ch.fr
                   end
                else
                   if FRdialect then
                      t = FBsp.thin.gl.ac
                      nbspace.char = FBsp.thin.ch.ac
                   else
                      t = FBsp.thin.gl.fr
                      nbspace.char = FBsp.thin.ch.fr
                   end
                end
                fbglue = new_glue_scaled(fid, t)
%    \end{macrocode}
%    In case |new_glue_scaled| fails (returns |nil|) the node list
%    remains unchanged.
%    \begin{macrocode}
                if (realglue or auto) and fbglue then
                   if realglue then
                      head = remove_node(head,prev,true)
                   end
                   if (FRucsNBSP) then
                      nbspace.font = fid
                      nbspace.attr = attr
                      insert_node_before(head,item,copy_node(nbspace))
                   else
                      nobreak.attr = attr
                      fbglue.attr  = attr
                      insert_node_before(head,item,copy_node(nobreak))
                      insert_node_before(head,item,copy_node(fbglue))
                   end
                end
%    \end{macrocode}
%    Let’s consider `»’ now (the only remaining glyph of
%    |FB_punct_left| class): we just have to remove any \emph{glue}
%    possibly preceeding `»’, then to insert the nobreak penalty and
%    the proper \emph{glue} (controlled by |\FBguillspace|).
%    This is done only if French quotes have been `activated’ by
%    options \fbo{og=«, fg=»} in \fbsetup{} and can be denied locally
%    with |\NoAutoSpacing| (this is controlled by the |SIG| flag).
%    If either a) the preceding glyph is member of |FB_guil_null|, or
%    b) `»’ is the first glyph of an |\hbox{}| or a paragraph, nothing
%    is done, this is controlled by the |addgl| flag.
%
% \changes{v3.1a}{2014/06/18}{Added flag addgl which must also be true
%    when prev or next is not a char (i.e. \cs{kern}0 in
%    «\cs{texttt}\{a\}»).}
%
% \changes{v3.1g}{2015/06/26}{flag addgl set to false for `»’
%    at the beginning of an \cs{hbox} or a paragraph or a tabular
%    `l’ and `c’ columns.}
%
%    \begin{macrocode}
             elseif SIG then
                local addgl = (prev_char and
                               not FB_guil_null[prev_char])
                              or
                              (not prev_char and
                               prev_id ~= TEMP and
                               not (prev_id == HLIST and
                                    prev_subtype == 3)
                              )
%    \end{macrocode}
%    Correction for tabular `c’ (glue 0 plus 1 fil) and `l’ (glue 1sp)
%    columns:
%    \begin{macrocode}
                if is_glue and glue_wd <= 1 then
                   addgl = false
                end
                local t = FBsp.guill.gl.fr
                nbspace.char = FBsp.guill.ch.fr
                if FRdialect then
                   t = FBsp.guill.gl.ac
                   nbspace.char = FBsp.guill.ch.ac
                end
                local fbglue = new_glue_scaled(fid, t)
                if addgl and fbglue then
                   if is_glue then
                      head = remove_node(head,prev,true)
                   end
                   if (FRucsNBSP) then
                      nbspace.font = fid
                      nbspace.attr = attr
                      insert_node_before(head,item,copy_node(nbspace))
                   else
                      nobreak.attr = attr
                      fbglue.attr  = attr
                      insert_node_before(head,item,copy_node(nobreak))
                      insert_node_before(head,item,copy_node(fbglue))
                   end
                end
             end
%    \end{macrocode}
%    Similarly, for `«’ (unique member of the |FB_punct_right| class):
%    unless either a) the next glyph is member of |FB_guil_null|, or
%    b) `«’ is the last glyph of an |\hbox{}| or a paragraph (then the
%    |addgl| flag is false, nothing is done), we remove any \emph{glue}
%    possibly following it and insert first the proper \emph{glue} then
%    a nobreak penalty so that finally the penalty preceeds the
%    \emph{glue}.
%
% \changes{v3.1a}{2014/06/18}{Look ahead when next is a kern
%    (i.e. in « \cs{texttt}\{a\} »).}
%
% \changes{v3.1g}{2015/06/26}{Flag addgl set to false for
%    `«’ at the end of an \cs{hbox} or a paragraph or when followed by
%    a null glue (i.e. springs).}
%
% \changes{v3.5o}{2022/10/11}{Opening guill.: look ahead when next is
%    a penalty (nobreak space).}
%
%    \begin{macrocode}
          elseif SIG then
             local next = item.next
             local next_id, next_subtype, next_char, nextnext, kern_wd
             if next then
                next_id = next.id
                next_subtype = next.subtype
%    \end{macrocode}
%    In case of coding |«~| remove the penalty and the glue:
%    \begin{macrocode}
                if next_id == PENALTY then
                   nextnext = next.next
                   if nextnext and nextnext.id == GLUE then
                      head = remove_node(head,nextnext,true)
                      head = remove_node(head,next,true)
                      next = item.next
                      if next then
                         next_id = next.id
                         next_subtype = next.subtype
                         if next_id == GLYPH then
                            next_char = next.char
                         end
                     end
                   end
                end
%    \end{macrocode}
%    A |kern0| might hide a |penalty| and/or |glue|, so look ahead if
%    |next| is a kern (this occurs with |« \texttt{a} »| and
%    |«~\texttt{a}~»|):
%    \begin{macrocode}
                if 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
                         if next_id == PENALTY then
                            nextnext = next.next
                            if nextnext and nextnext.id == GLUE then
                               head = remove_node(head,next,true)
                               head = remove_node(head,nextnext,true)
                               next = item.next
                               if next then
                                  next_id = next.id
                                  next_subtype = next.subtype
                               end
                            end
                         end
                      end
                   end
                end
                if next_id == GLYPH then
                   next_char = next.char
                end
             end
             local is_glue = next_id == GLUE
             if is_glue then
                glue_wd = next.width
             end
%    \end{macrocode}
%    The |addgl| flag only depends on |next_char| and |is_glue|:
%    \begin{macrocode}
             local addgl = (next_char and not FB_guil_null[next_char])
                           or (next and not next_char)
%    \end{macrocode}
%    Correction for tabular `c’ columns.  For `r’ columns, a final
%    `«’ character needs to be coded as |\mbox{«}| for proper spacing
%    (|\NoAutoSpacing| is another option).
%    \begin{macrocode}
             if is_glue and glue_wd == 0 then
                addgl = false
             end
             local fid = item.font
             local t = FBsp.guill.gl.fr
             nbspace.char = FBsp.guill.ch.fr
             if FRdialect then
                t = FBsp.guill.gl.ac
                nbspace.char = FBsp.guill.ch.ac
             end
             local fbglue = new_glue_scaled(fid, t)
             if addgl and fbglue then
                if is_glue then
                   head = remove_node(head,next,true)
                end
                if (FRucsNBSP) then
                   nbspace.font = fid
                   nbspace.attr = attr
                   insert_node_after(head, item, copy_node(nbspace))
                else
                   nobreak.attr = attr
                   fbglue.attr  = attr
                   insert_node_after(head, item, copy_node(fbglue))
                   insert_node_after(head, item, copy_node(nobreak))
                end
             end
          end
       end
    end
  end
  return head
end
return french_punctuation
%</lua>
%    \end{macrocode}
%    \end{environment}
%
% \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.}
%
% \changes{v3.1g}{2015/06/17}{Lua function french\_punctuation is now
%    inserted at the end of the `kerning’ callback (no priority)
%    instead of `hpack\_filter’ and `pre\_linebreak\_filter’.}
%
% \changes{v3.5o}{2022/11/03}{\cs{shorthandon} and \cs{shorthandoff}
%    are no longer redefined in LuaTeX (it broke \cs{shorthandoff*}).}
%
%    As a language tag is part of glyph nodes in LuaTeX, no more
%    switching has to be done in |\extrasfrench|, setting the dialect
%    attribute has already be done (see above, p.~\pageref{extrapunct}).
%
%    The next  definition will be used to activate Lua punctuation: it
%    loads \file{frenchb.lua} and adds function |french_punctuation|
%    to the |kerning| callback; "adding" anything actually disables
%    the built-in kerning for Type1 fonts (which is now added to
%    |french_punctuation|).
%    \begin{macrocode}
%<*french>
\ifFB@luatex@punct
  \def\activate@luatexpunct{%
    \directlua{%
      FR_fr = \the\l@french ; FR_ca = \the\l@acadian ;
      local path = kpse.find_file("frenchb.lua", "lua")
      if path then
         local f = dofile(path)
         luatexbase.add_to_callback("kerning",
                    f, "frenchb.french_punctuation")
      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{«} and \texttt{»}), when automatic spacing for
%    quotes is required by options \fbo{og=«} and \fbo{fg=»} in
%    \fbsetup{} (see section~\ref{ssec-keyval}).
%
%    Unless \pkg{ucharclass} is loaded, the default value for
%    |\XeTeXcharclass| is 0 for characters tokens and |\FB@nonchar| for
%    all other tokens (glues, kerns, math and box boundaries, etc.).
%    \pkg{ucharclass} defines a XeTeX class for every range of Unicode
%    characters in order to facilitate font switching.  Most French
%    characters belong to range ["20, "7F] (class |\BasicLatinClass|)
%    some (accented chars, diacritics,…) to range ["80, "FF] (class
%    |\LatinSupplementClass|) and three (œ, Œ, and the long-s) to
%    ["100, "17F] (class |\LatinExtendedAClass|).
%
%    We check AtBeginDocument whether \pkg{ucharclass} is loaded; if so,
%    when switching to French, the class |\FB@stdchar| of all characters
%    possibly used in French (except punctuation) will be forced to
%    |\BasicLatinClass| which is the default for most of them, the class
%    of the others (accented chars, ligatures, diacritics, etc.)  will
%    be saved and changed locally in French, then restored to their
%    original value when leaving French.
%
%    We switch |\XeTeXinterchartokenstate| to 1 and change the
%    |\XeTeXcharclass| values of |;| |!| |?| |:| |(| |]|
%    \texttt{«} and \texttt{»} when entering French.
%    Their inital values will be restored 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{v3.1g}{2015/06/14}{Use Babel defined loops \cs{bbl@for}
%    instead of \cs{@for} borrowed from file ltcntrl.dtx
%    (\cs{@for} is undefined in Plain).}
%
% \changes{v3.5r}{2023/12/19}{Compatibility with \pkg{ucharclasses}
%    package added.}
%
%    The following part holds specific code for punctuation with XeTeX
%    engines.
%
%    \begin{macrocode}
\ifFB@xetex@punct
  \ifLaTeXe
    \PackageInfo{french.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}
%
% \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}
%
% \changes{v3.1l}{2016/02/07}{Add a variant of \cs{babel@savevariable}
%    to save \cs{XeTeXcharclass}(es) in a loop.}
%
%    As |\babel@savevariable| doesn’t work inside a |\bbl@for| loop,
%    we define a variant to save the |\XeTeXcharclass| values which
%    will be modified in French.
%    \begin{macrocode}
   \def\FBsavevariable@loop#1#2{\begingroup
     \toks@\expandafter{\originalTeX #1}%
     \edef\x{\endgroup
       \def\noexpand\originalTeX{\the\toks@ #2=\the#1#2\relax}}%
     \x}
%    \end{macrocode}
%    |\FB@charlistsave| holds the all list of characters which have their
%    |\XeTeXcharclass| value modified in French: it always includes
%    high punctuation, French quotes, opening delimiters and no-break
%    spaces. If \pkg{ucharclasses} is loaded, non-\textsc{ascii}
%    characters used in French have to be added; as \pkg{xeCJK}
%    changes the class of some characters used in French, these have to
%    be saved too if \pkg{xeCJK} is loaded.
%
%    \begin{macrocode}
   \def\FB@charlist{"21,"3A,"3B,"3F,"AB,"BB,"28,"5B,"A0,"202F}
   \def\FB@charlistUCC{}
   \def\FB@charlistxeCJK{}
   \edef\FB@charlistsave{\FB@charlist}
   \ifLaTeXe
     \AtBeginDocument{%
       \@ifpackageloaded{ucharclasses}%
         {\ifdefined\BasicLatinClass
            \RenewCommandCopy{\FB@stdchar}{\BasicLatinClass}%
            \def\FB@charlistUCC{"C0,"C2,"C6,"C7,"C8,"C9,"CA,"CB,"CE,"CF,%
              "D4,"D6,"D9,"DB,"DC,"E0,"E2,"E6,"E7,"E8,"E9,"EA,"EB,"EE,%
              "EF,"F4,"F6,"F9,"FB,"FC,"152,"153,"17F,"2019}%
            \addto\FB@charlist{,\FB@charlistUCC}%
            \edef\FB@charlistsave{\FB@charlist}%
          \fi
         }{}%
       \@ifpackageloaded{xeCJK}%
         {\def\FB@charlistxeCJK{%
                  "29,"5D,"7B,"7D,"2C,"2D,"2E,"22,"25,"27,"60,"2019}%
          \addto\FB@charlist{,\FB@charlistxeCJK}%
          \edef\FB@charlistsave{\FB@charlist}%
         }{}%
     }
   \fi
%    \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.
%
% \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.}
%
% \changes{v3.1k}{2015/12/05}{Thin glues (less than 1sp) should not
%    trigger space insertion before high ponctuation. Add a check on
%    \cs{lastkip}.}
%
% \changes{v3.1l}{2016/02/07}{Save and restore
%    \cs{XeTeXinterchartokenstate}, \cs{shorthandon}, \cs{shorthandoff}
%    using \cs{babel@savevariable} and \cs{babel@save},
%    \cs{XeTeXcharclass}(es) using \cs{FB@savevariable@loop}.}
%
% \changes{v3.2c}{2016/05/14}{Switch \cs{ifFB@spacing} added to all
%    \cs{XeTeXinterchartoks} commands.}
%
% \changes{v3.5o}{2022/11/03}{\cs{shorthandon} and \cs{shorthandoff}
%    are no longer redefined (it broke \cs{shorthandoff*}).}
%
%    \begin{macrocode}
   \newcommand*{\FB@xetex@punct@french}{%
     \babel@savevariable{\XeTeXinterchartokenstate}%
     \bbl@for\FB@char\FB@charlistsave
          {\FBsavevariable@loop{\XeTeXcharclass}{\FB@char}}%
%    \end{macrocode}
%    If \pkg{ucharclasses} is loaded, force non-\textsc{ascii} used
%    in French to class |\FB@stdchar| (=|\BasicLatinClass|).
%    \begin{macrocode}
     \ifx\FB@charlistUCC\@empty\else
        \bbl@for\FB@char\FB@charlistUCC
          {\XeTeXcharclass \FB@char \FB@stdchar}%
     \fi
%    \end{macrocode}
%    These characters have their class changed by \file{xeCJK.sty},
%    let’s reset their class in French.
%    \begin{macrocode}
     \ifx\FB@charlistxeCJK\@empty\else
       \bbl@for\FB@char\FB@charlistxeCJK
               {\XeTeXcharclass\FB@char=\FB@stdchar}%
     \fi
%    \end{macrocode}
%    This will avoid spurious spaces in (!), [?] and with Unicode
%    non-breaking spaces (U+00A0, U+202F):
%    \begin{macrocode}
     \bbl@for\FB@char {`\[,`\(,"A0,"202F}%
             {\XeTeXcharclass\FB@char=\FB@punctnul}%
%    \end{macrocode}
%    Let’s now define specific classes for punctuation and interactions
%    between classes.
%    When false, the flag |\ifFB@spacing| switches off any interaction
%    between classes (this flag is controlled by user-level command
%    |\NoAutoSpacing|; this flag is also set to false when the current
%    font is a typewriter font).
%    \begin{macrocode}
     \XeTeXinterchartokenstate=\@ne
     \XeTeXcharclass `\: = \FB@punctthick
     \XeTeXinterchartoks \FB@stdchar \FB@punctthick = {%
           \ifFB@spacing\ifhmode\FDP@colonspace\fi\fi}%
     \XeTeXinterchartoks \FB@guilf \FB@punctthick = {%
           \ifFB@spacing\FDP@colonspace\fi}%
%    \end{macrocode}
%    Small glues such as ``glue 1sp’’ in tabular `l’ columns or ``glue
%    0 plus 1 fil’’ in tabular `c’ columns or \env{lstlisting}
%    environment should not trigger any extra space; they will still do
%    when \fbo{AutoSpacePunctuation} is true:
%    |\XeTeXcharclass=\FB@nonchar| isn’t specific to glue tokens (this
%    class includes box and math boundaries f.i.), so the |\else| part
%    cannot be omitted.
%    \begin{macrocode}
     \XeTeXinterchartoks \FB@nonchar \FB@punctthick = {%
           \ifFB@spacing
             \ifhmode
               \ifdim\lastskip>1sp
                 \unskip\penalty\@M\FBcolonspace
               \else
                 \FDP@colonspace
               \fi
             \fi
           \fi}%
     \bbl@for\FB@char {`\;,`\!,`\?}%
             {\XeTeXcharclass\FB@char=\FB@punctthin}%
     \XeTeXinterchartoks \FB@stdchar \FB@punctthin = {%
           \ifFB@spacing\ifhmode\FDP@thinspace\fi\fi}%
     \XeTeXinterchartoks \FB@guilf \FB@punctthin = {%
           \ifFB@spacing\FDP@thinspace\fi}%
     \XeTeXinterchartoks \FB@nonchar \FB@punctthin = {%
           \ifFB@spacing
             \ifhmode
               \ifdim\lastskip>1sp
                 \unskip\penalty\@M\FBthinspace
               \else
                 \FDP@thinspace
               \fi
             \fi
           \fi}%
     \XeTeXinterchartoks \FB@guilo \FB@stdchar = {%
           \ifFB@spacing\FB@guillspace\fi}%
     \XeTeXinterchartoks \FB@guilo \FB@nonchar = {%
           \ifFB@spacing\FB@guillspace\ignorespaces\fi}%
     \XeTeXinterchartoks \FB@stdchar \FB@guilf = {%
           \ifFB@spacing\FB@guillspace\fi}%
     \XeTeXinterchartoks \FB@punctthin \FB@guilf = {%
           \ifFB@spacing\FB@guillspace\fi}%
     \XeTeXinterchartoks \FB@nonchar \FB@guilf = {%
           \ifFB@spacing\unskip\FB@guillspace\fi}%
   }
   \addto\extrasfrench{\FB@xetex@punct@french}
%    \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}
%
% \changes{v3.5j}{2020/07/02}{For memoir, koma-script and beamer
%    captions, \cs{FB@std@sep} has to be defined before activating
%    the colon.}
%
%    In standard (pdf)TeX we need to make the four characters |;| |!| |?|
%    and |:| `active’ and provide their definitions. \hlabel{ifFB@koma}
%    Before doing so, we have to save some definitions involving |:|.
%    \begin{macrocode}
\newif\ifFB@koma
\ifLaTeXe
  \@ifclassloaded{scrartcl}{\FB@komatrue}{}
  \@ifclassloaded{scrbook}{\FB@komatrue}{}
  \@ifclassloaded{scrreprt}{\FB@komatrue}{}
  \ifFB@koma\def\FB@std@capsep{:\ }\fi
  \@ifclassloaded{beamer}{\def\FB@std@capsep{:\ }}{}
  \@ifclassloaded{memoir}{\def\FB@std@capsep{: }}{}
\fi
%    \end{macrocode}
%    \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 a non-breaking |\FBthinspace| instead.
%    If no space has been typed, we add |\FDP@thinspace| which will be
%    defined, up to the user’s wishes, as a non-breaking |\FBthinspace|
%    or as |\@empty|.
%
% \changes{v3.1k}{2015/12/05}{(pdfTeX shorthands) test on \cs{lastskip}
%    changed from 0pt to 1sp for active punctuation for consistency
%    with XeTeX and LuaTeX.}
%
% \changes{v3.2c}{2016/05/14}{Switch \cs{ifFB@spacing} added to the
%    four French shorthands.}
%
%    \begin{macrocode}
  \declare@shorthand{french}{;}{%
    \ifFB@spacing
      \ifhmode
        \ifdim\lastskip>1sp
          \unskip\penalty\@M\FBthinspace
        \else
          \FDP@thinspace
        \fi
      \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}{!}{%
    \ifFB@spacing
      \ifhmode
        \ifdim\lastskip>1sp
          \unskip\penalty\@M\FBthinspace
        \else
          \FDP@thinspace
        \fi
      \fi
    \fi
    \string!}
  \declare@shorthand{french}{?}{%
    \ifFB@spacing
      \ifhmode
        \ifdim\lastskip>1sp
          \unskip\penalty\@M\FBthinspace
        \else
          \FDP@thinspace
        \fi
      \fi
    \fi
    \string?}
  \declare@shorthand{french}{:}{%
    \ifFB@spacing
      \ifhmode
        \ifdim\lastskip>1sp
          \unskip\penalty\@M\FBcolonspace
        \else
          \FDP@colonspace
        \fi
      \fi
    \fi
    \string:}
%    \end{macrocode}
%    When the active characters appear in an environment where their
%    French behaviour is not wanted they should give an `expected’
%    result.  Therefore we define shorthands at system level as well.
%    \begin{macrocode}
  \declare@shorthand{system}{:}{\string:}
  \declare@shorthand{system}{!}{\string!}
  \declare@shorthand{system}{?}{\string?}
  \declare@shorthand{system}{;}{\string;}
%    \end{macrocode}
%    We specify that the French group of shorthands should be used when
%    switching to French.
%    \begin{macrocode}
  \addto\extrasfrench{\languageshorthands{french}%
%    \end{macrocode}
%    These characters are `turned on’ once, later their definition may
%    vary.  Don’t misunderstand the following code: they keep being
%    active all along the document, even when leaving French.
%    \begin{macrocode}
    \bbl@activate{:}\bbl@activate{;}%
    \bbl@activate{!}\bbl@activate{?}%
  }
  \addto\noextrasfrench{%
    \bbl@deactivate{:}\bbl@deactivate{;}%
    \bbl@deactivate{!}\bbl@deactivate{?}%
  }
\fi
%    \end{macrocode}
%
%  \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}
%
% \begin{macro}{\AutoSpaceBeforeFDP}
% \begin{macro}{\NoAutoSpaceBeforeFDP}
%
% \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.}
%
%    {\sloppypar |\autospace@beforeFDP| and |\noautospace@beforeFDP| are
%    internal commands.  |\autospace@beforeFDP| defines commands
%    |\FDP@thinspace| and |\FDP@colonspace| as non-breaking spaces and
%    sets LuaTeX attribute |\FB@addDPspace| to 1 (true), while
%    |\noautospace@beforeFDP| makes them no-op 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{}.\par}
%
%    Set the default now for Plain (done later for LaTeX).
%    \begin{macrocode}
\def\autospace@beforeFDP{%
  \ifFB@luatex@punct \FB@addDPspace=\@ne \fi
  \def\FDP@thinspace{\penalty\@M\FBthinspace}%
  \def\FDP@colonspace{\penalty\@M\FBcolonspace}}
\def\noautospace@beforeFDP{%
  \ifFB@luatex@punct \FB@addDPspace=\z@ \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.}
%
% \begin{macro}{\rmfamilyFB}
% \begin{macro}{\sffamilyFB}
% \begin{macro}{\ttfamilyFB}
%
% \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 LaTeX2e |\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}.  When
%    \fbo{AutoSpacePunctuation} is \fbo{false}, the eventually typed
%    spaces are left unchanged (not turned into thin spaces, no penalty
%    added).  |\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}).}
%
% \changes{v3.2c}{2016/05/14}{New definitions of \cs{ttfamilyFB} and
%    co, common to all engines, based on \cs{FB@spacing@off}
%    and\cs{FB@spacing@on}.}
%
%    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{\FB@spacing@off \ttfamilyORI}
  \DeclareRobustCommand\rmfamilyFB{\FB@spacing@on  \rmfamilyORI}
  \DeclareRobustCommand\sffamilyFB{\FB@spacing@on  \sffamilyORI}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \changes{v2.5a}{2010/08/14}{New command \cs{NoAutoSpacing},
%    suggested by MPG.}
%
% \begin{macro}{\NoAutoSpacing}
%    The following command disables automatic spacing for high
%    punctuation and French quote characters; it also switches off
%    active punctuation characters (if any).
%    It is engine independent (works for TeX, LuaTeX and
%    XeTeX based engines) and is meant to be used inside a group.
%    The faked definition of |\texorpdfstring| will be overwritten
%    by \file{hyperref.sty}.
%
% \changes{v3.2b}{2016/04/18}{\cs{NoAutoSpacing} made robust.}
%
% \changes{v3.2c}{2016/05/14}{New definition based on
%    \cs{FB@spacing@off} common to all engines.}
%
% \changes{v3.6b}{2024/06/26}{\cs{NoAutoSpacing} must be inhibited
%    in bookmarks.}
%
%    \begin{macrocode}
\providecommand\texorpdfstring[2]{#1}
\DeclareRobustCommand*{\NoAutoSpacing}{%
  \texorpdfstring{\FB@spacing@off
                  \ifFB@active@punct\shorthandoff{;:!?}\fi}{}%
}
%    \end{macrocode}
% \end{macro}
%
%  \subsection{Commands for French quotation marks}
%  \label{ssec-quotes}
%
% \begin{macro}{\guillemotleft}
% \begin{macro}{\guillemotright}
% \begin{macro}{\textquoteddblleft}
% \begin{macro}{\textquoteddblright}
%    pdfLaTeX users are supposed to use 8-bit output
%    encodings (T1, LY1,…) to typeset French, those who still
%    stick to OT1 should load \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{fontspec} (v.~2.5d and up).
%
% \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}
%
% \changes{v3.4a}{2018/01/18}{New \cs{FBgspchar} to customise the
%    space character to be used for \cs{og}  and\cs{fg} with the
%    UnicodeNoBreakSpaces option.}
%
% \begin{macro}{\FBgspchar}
% \begin{macro}{\FB@og}
% \begin{macro}{\FB@fg}
%    The next step is to provide correct spacing after `«’ and before
%    `»’; no line break is allowed neither \emph{after} the opening
%    one, nor \emph{before} the closing one.
%    French quotes (including spacing) are printed by |\FB@og| and
%    |\FB@fg|, the expansion of the top level commands |\og| and |\fg|
%    is different in and outside French.
%
% \changes{v3.5k}{2020/07/17}{\cs{FB@og} and \cs{FB@fg} now rely
%    on \cs{texorpdfstring} to be safe in bookmarks.}
%
%    |\FB@og| and |\FB@fg| are now designed to work in bookmarks.
%    \begin{macrocode}
\newcommand*{\FB@og}{\texorpdfstring{\@FB@og}{\guillemotleft\space}}
\newcommand*{\FB@fg}{\texorpdfstring{\@FB@fg}{\space\guillemotright}}
%    \end{macrocode}
%
%\changes{v3.0a}{2014/01/10}{Definitions of \cs{FB@og} and \cs{FB@fg}
%    now depend on punctuation handling (LuaTeX / XeTeX / active).}
%
%    The internal definitions |\@FB@og| and |\@FB@fg| need some
%    engine-dependent tuning: for LuaTeX, |\FB@spacing| is set to~0
%    locally to prevent the quotes characters from adding space when
%    option \fbo{og=«, fg=»} is set.
%    \begin{macrocode}
\newcommand*{\FB@guillspace}{\penalty\@M\FBguillspace}
\newcommand*{\FBgspchar}{\char"A0\relax}
\newif\ifFBucsNBSP
\ifFB@luatex@punct
  \DeclareRobustCommand*{\@FB@og}{\leavevmode
          \bgroup\FB@spacing=\z@ \guillemotleft\egroup
          \ifFBucsNBSP\FBgspchar\else\FB@guillspace\fi}
  \DeclareRobustCommand*{\@FB@fg}{\ifdim\lastskip>\z@\unskip\fi
          \ifFBucsNBSP\FBgspchar\else\FB@guillspace\fi
          \bgroup\FB@spacing=\z@ \guillemotright\egroup}
\fi
%    \end{macrocode}
%    With XeTeX, |\ifFB@spacing| is set to |false| locally for the
%    same reason.
%    \begin{macrocode}
\ifFB@xetex@punct
  \DeclareRobustCommand*{\@FB@og}{\leavevmode
        \bgroup\FB@spacingfalse\guillemotleft\egroup
        \FB@guillspace}
  \DeclareRobustCommand*{\@FB@fg}{\ifdim\lastskip>\z@\unskip\fi
        \FB@guillspace
        \bgroup\FB@spacingfalse\guillemotright\egroup}
\fi
\ifFB@active@punct
  \DeclareRobustCommand*{\@FB@og}{\leavevmode
        \guillemotleft
        \FB@guillspace}
  \DeclareRobustCommand*{\@FB@fg}{\ifdim\lastskip>\z@\unskip\fi
        \FB@guillspace
        \guillemotright}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\og}
% \begin{macro}{\fg}
%
%    The user level macros for quotation marks are named |\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.
%    \begin{macrocode}
\newcommand*{\og}{\@empty}
\newcommand*{\fg}{\@empty}
%    \end{macrocode}
%
%    The definitions of |\og| and |\fg| for 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.
%    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{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.2a}{2016/03/18}{\cs{xspace} moved from \cs{FB@fg} to
%    \cs{fg}: \cs{xspace} messes up \cs{frquote}, pointed out by Sonia
%    Labetoulle.  As a side effect \cs{xspace} is now active in \cs{fg}
%    in and outside French.}
%
%    \begin{macrocode}
\ifLaTeXe
  \def\bbl@frenchguillemets{%
        \renewcommand*{\og}{\FB@og}%
        \renewcommand*{\fg}{\FB@fg\xspace}}
  \renewcommand*{\og}{\textquotedblleft}
  \renewcommand*{\fg}{\ifdim\lastskip>\z@\unskip\fi
                      \textquotedblright\xspace}
\else
  \def\bbl@frenchguillemets{\let\og\FB@og
                            \let\fg\FB@fg}
  \def\og{\textquotedblleft}
  \def\fg{\ifdim\lastskip>\z@\unskip\fi\textquotedblright}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{v3.0a}{2014/01/10}{\cs{bbl@nonfrenchguillemets} deleted,
%    use \cs{babel@save} instead.}
%
%    \begin{macrocode}
\addto\extrasfrench{\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}
%    Another way of entering French quotes relies on |\frquote{}|
%    with supports up to two levels of quotes.
%    Let’s define the default quote characters to be used for level one
%    or two of quotes…
%    \begin{macrocode}
\newcommand*{\ogi}{\FB@og}
\newcommand*{\fgi}{\FB@fg}
\newcommand*{\@ogi}{\ifmmode\hbox{\ogi}\else\ogi\fi}
\newcommand*{\@fgi}{\ifmmode\hbox{\fgi}\else\fgi\fi}
\newcommand*{\ogii}{\textquotedblleft}
\newcommand*{\fgii}{\textquotedblright}
\newcommand*{\@ogii}{\ifmmode\hbox{\ogii}\else\ogii\fi}
\newcommand*{\@fgii}{\ifmmode\hbox{\fgii}\else\fgii\fi}
%    \end{macrocode}
%    and the needed technical stuff to handle options:
%
% \changes{v3.2g}{2017/01/30}{Default options of \cs{frquote} are no
%    longer engine-dependent.}
%
% \changes{v3.5b}{2018/07/15}{New command \cs{FB@addquote@everypar} to
%    manage \cs{everypar}: \cs{frquote} failed when used immediately
%    after a sectionning command.}
%
%    \begin{macrocode}
\newcount\FBguill@level
\newtoks\FBold@everypar
%    \end{macrocode}
%    |\FB@addquote@everypar| was borrowed from \file{csquotes.sty}.
%    \begin{macrocode}
\def\FB@addquote@everypar{%
  \let\FBnew@everypar\everypar
  \FBold@everypar=\expandafter{\the\everypar}%
  \FBnew@everypar={\the\FBold@everypar\FBeverypar@quote}%
  \let\everypar\FBold@everypar
  \let\FB@addquote@everypar\relax
}
\newif\ifFBcloseguill  \FBcloseguilltrue
\newif\ifFBInnerGuillSingle
\def\FBguillopen{\bgroup\NoAutoSpacing\guillemotleft\egroup}
\def\FBguillclose{\bgroup\NoAutoSpacing\guillemotright\egroup}
\let\FBguillnone\empty
\let\FBeveryparguill\FBguillopen
\let\FBeverylineguill\FBguillnone
\let\FBeverypar@quote\relax
\let\FBeveryline@quote\empty
%    \end{macrocode}
%
% \changes{v3.5k}{2020/07/18}{\cs{frquote} now relies on
%    \cs{texorpdfstring} to be safe in bookmarks.}
%
%    The main command |\frquote| accepts (in LaTeX2e 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.
%    |\frquote| (without star) is now designed to work in bookmarks too.
%    \begin{macrocode}
\ifLaTeXe
  \DeclareRobustCommand\frquote{%
    \texorpdfstring{\@ifstar{\FBcloseguillfalse\fr@quote}%
                            {\FBcloseguilltrue \fr@quote}}%
                   {\bm@fr@quote}%
  }
  \newcommand{\bm@fr@quote}[1]{%
    \guillemotleft\space #1\space\guillemotright}
\else
  \newcommand\frquote[1]{\fr@quote{#1}}
\fi
%    \end{macrocode}
%
% \changes{v3.1j}{2015/11/25}{\cs{fr@quote} completely rewritten:
%    \cs{leavevmode} added and explicitly save/retore \cs{everypar} and
%    \cs{localleftbox} instead of using a group in order to ensure
%    compatibility with package wrapfig.}
%
% \changes{v3.1j}{2015/11/21}{\cs{PackageWarning} is undefined in
%    Plain, use \cs{fb@warning} instead.}
%
% \changes{v3.3a}{2017/04/30}{\cs{FB@quotespace} (kern), changed
%    into \cs{FB@guillspace}.}
%
%    The internal command |\fr@quote| takes one (long) argument: the
%    quotation text.
%    \begin{macrocode}
\newcommand{\fr@quote}[1]{%
  \leavevmode
  \advance\FBguill@level by \@ne
  \ifcase\FBguill@level
  \or
%    \end{macrocode}
%    This for level 1 (outer) quotations: set |\FBeverypar@quote|
%    for level 1 quotations and add it to |\everypar| using
%    |\FB@addquote@everypar|, then print the quotation:
%    \begin{macrocode}
    \ifx\FBeveryparguill\FBguillnone
    \else
      \def\FBeverypar@quote{\FBeveryparguill\FB@guillspace}%
      \FB@addquote@everypar
    \fi
    \@ogi #1\@fgi
  \or
%    \end{macrocode}
%    This for level 2 (inner) quotations: Omega’s command
%    |\localleftbox| included in LuaTeX, is convenient for repeating
%    guillemets at the beginning of every line.\hlabel{cs:localleftbox}
%
% \changes{v3.1i}{2015/10/04}{\cs{luatexlocalleftbox} changed to
%    \cs{localleftbox} by new LaTeX release 2015/10/01.}
%
% \changes{v3.5c}{2018/09/14}{\cs{FBeverypar@quote}’s value now properly
%    reset across level changes.}
%
% \changes{v3.5e}{2019/03/23}{reset \cs{FB@addGUILspace} attribute
%    inside \cs{localleftbox} (LuaTeX).}
%
% \changes{v3.5p}{2022/12/04}{\cs{FBeveryline@quote}: no need for
%    a penalty inside a \cs{localleftbox}.}
%
%    \begin{macrocode}
    \ifx\FBeverylineguill\FBguillopen
      \def\FBeveryline@quote{\FB@addGUILspace=\z@
                             \guillemotleft\FBguillspace}%
      \localleftbox{\FBeveryline@quote}%
      \let\FBeverypar@quote\relax
      \@ogi #1\ifFBcloseguill\@fgi\fi
    \else
      \ifx\FBeverylineguill\FBguillclose
        \def\FBeveryline@quote{\FB@addGUILspace=\z@
                               \guillemotright\FBguillspace}%
        \localleftbox{\FBeveryline@quote}%
        \let\FBeverypar@quote\relax
        \@ogi #1\ifFBcloseguill\@fgi\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\FB@guillspace}%
          \def\fgii{\ifdim\lastskip>\z@\unskip\fi
                    \FB@guillspace\guilsinglright}%
          \ifx\FBeveryparguill\FBguillopen
            \def\FBeverypar@quote{\guilsinglleft\FB@guillspace}%
          \fi
          \ifx\FBeveryparguill\FBguillclose
            \def\FBeverypar@quote{\guilsinglright\FB@guillspace}%
          \fi
        \fi
        \@ogii #1\ifFBcloseguill \@fgii \fi
      \fi
    \fi
  \else
%    \end{macrocode}
%    Warn if |\FBguill@level| >~2:
%    \begin{macrocode}
    \ifx\PackageWarning\@undefined
      \fb@warning{\noexpand\frquote\space handles up to
                  two levels.\\ Quotation not printed.}%
    \else
      \PackageWarning{french.ldf}{%
         \protect\frquote\space handles up to two levels.
         \MessageBreak Quotation not printed.  Reported}
    \fi
  \fi
%    \end{macrocode}
%
% \changes{v3.5e}{2019/03/14}{Make resettings global on exit.}
%
%    Closing: step down |\FBguill@level| and clean on exit.
%    Changes made global in case |\frquote{}| ends inside an
%    environment.
%    \begin{macrocode}
  \global\advance\FBguill@level by \m@ne
  \ifcase\FBguill@level \global\let\FBeverypar@quote\relax
  \or \gdef\FBeverypar@quote{\FBeveryparguill\FB@guillspace}%
      \global\let\FBeveryline@quote\empty
      \ifx\FBeverylineguill\FBguillnone\else\localleftbox{}\fi
  \fi
}
%    \end{macrocode}
% \changes{v3.5e}{2019/03/14}{new command \cs{NoEveryParQuote}.}
%
%    The next command is intended to be used in list environments to
%    suppress quotes which might be added by |\FBeverypar@quote| after
%    items for instance.
%    \begin{macrocode}
\newcommand*{\NoEveryParQuote}{\let\FBeveryparguill\FBguillnone}
%    \end{macrocode}
% \end{macro}
%
%  \subsection{Date in French}
% \label{sssec-date}
%
% \begin{macro}{\frenchtoday}
% \begin{macro}{\frenchdate}
% \begin{macro}{\datefrench}
%    The following code creates a macro |\datefrench| which in turn
%    defines command |\frenchtoday| (|\today| is defined as
%    |\frenchtoday| in French).
%    The corresponding commands for the French dialect, |\dateacadian|
%    and |\acadiantoday| are also created btw.
%    This new implementation relies on commands |\SetString| and
%    |\SetStringLoop|, therefore requires \babel~3.10 or newer.
%
% \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.4a}{2018/01/04}{Specific code for Plain finally removed
%    (babel bug reported).}
%
% \changes{v3.4b}{2018/02/04}{Do not redefine \cs{date} as
%    \cs{frenchdate} in French.}
%
%    Explicitly defining |\BabelLanguages| as the list of all French
%    dialects defines \emph{both} |\datefrench| and |\dateacadian|;
%    this is required as \file{french.ldf} is read only once even if
%    both language options \opt{french} and \opt{acadian} are supplied
%    to \babel.  Coding |\StartBabelCommands*{french,acadian}|
%    would \emph{only} define |\date\CurrentOption|,
%    leaving the second language undefined in \babel’s sens.
%
%    \begin{macrocode}
\def\BabelLanguages{french,acadian}
\StartBabelCommands*{\BabelLanguages}{date}
    [unicode, fontenc=TU 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{\FB@date{\year}{\month}{\day}}
\EndBabelCommands
%    \end{macrocode}
%    |\frenchdate| (which produces an unbreakable string) and
%    |\frenchtoday| (breakable) both rely on |\FB@date|, the inner
%    group is needed for |\hbox|.
%    \begin{macrocode}
\newcommand*{\FB@date}[3]{%
  {{\number#3}\ifnum1=#3{\ier}\fi\FBdatespace
  \csname month\romannumeral#2name\endcsname
  \ifx#1\@empty\else\FBdatespace\number#1\fi}}
\newcommand*{\FBdatebox}{\hbox}
\newcommand*{\FBdatespace}{\space}
\newcommand*{\frenchdate}{\FBdatebox\FB@date}
\newcommand*{\acadiandate}{\FBdatebox\FB@date}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \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,…}
%
% \changes{v3.5k}{2020/07/18}{\cs{up} and \cs{fup} now rely on
%    \cs{texorpdfstring} to be safe in bookmarks.}
%
%    |\up| eases the typesetting of superscripts like
%    `1\up{er}’.  Up to version 2.0 of \frenchb{} |\up| was just a
%    shortcut for |\textsuperscript| in LaTeX2e, 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, …) 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}. |\fup| just prints its argument
%    in bookmarks.
%    \begin{macrocode}
  \DeclareRobustCommand*{\fup}[1]{%
    \texorpdfstring{\ifx\realsuperscript\@undefined
                      \FB@up{#1}%
                    \else
                      \bgroup\let\fakesuperscript\FB@up@fake
                        \realsuperscript{\FB@lc{#1}}\egroup
                    \fi
                    }{#1}%
  }
%    \end{macrocode}
%    Let’s provide a temporary definition for |\up| (redefined
%    `AtBeginDocument’ as |\fup| or |\textsuperscript| according to
%    \fbsetup{} options).
%    \begin{macrocode}
  \providecommand*{\up}{\fup}
%    \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}
% \changes{v3.1b}{2014/06/23}{Removed \cs{lowercase} from definitions
%    of \cs{ieme} and co: \cs{up} already does the conversion.}
%
%    Some handy macros for those who don’t know how to abbreviate
%    ordinals:
%    \begin{macrocode}
\def\ieme{\up{e}\xspace}
\def\iemes{\up{es}\xspace}
\def\ier{\up{er}\xspace}
\def\iers{\up{ers}\xspace}
\def\iere{\up{re}\xspace}
\def\ieres{\up{res}\xspace}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \changes{v3.3c}{2017/07/23}{New configurable kerns \cs{FBmedkern},
%    and \cs{FBthickkern} suitable for HTML translation.}
%
% \begin{macro}{\FBmedkern}
% \begin{macro}{\FBthickkern}
%    \begin{macrocode}
\newcommand*{\FBmedkern}{\kern+.2em}
\newcommand*{\FBthickkern}{\kern+.3em}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{v2.1c}{2008/04/29}{Added commands \cs{Nos} and \cs{nos}.}
%
% \begin{macro}{\primo}
% \begin{macro}{\fprimo)}
% \begin{macro}{\nos}
% \begin{macro}{\Nos}
% \begin{macro}{\No}
% \begin{macro}{\no}
% \changes{v3.1b}{2014/06/23}{Removed \cs{lowercase} from definitions
%    of \cs{FrenchEnumerate}, … \cs{No} and co: \cs{up} already
%    does the conversion.}
%
% \changes{v3.5k}{2020/07/18}{\cs{no}, \cs{nos}, \cs{No}, \cs{Nos},
%    \cs{primo}, \cs{fprimo}, now rely on \cs{texorpdfstring} to be
%    safe in bookmarks.}
%
%    Some support macros relying on |\up| for numbering,
%    \begin{macrocode}
\newcommand*{\FrenchEnumerate}[1]{%
   #1\texorpdfstring{\up{o}\FBthickkern}{\textdegree\space}}
\newcommand*{\FrenchPopularEnumerate}[1]{%
   #1\texorpdfstring{\up{o})\FBthickkern}{\textdegree\space}}
%    \end{macrocode}
%
%    Typing |\primo| should result in `\up{o}\kern+.3em’ (except in
%    bookmarks where |\textdegree| is used instead of o-superior),
%    \begin{macrocode}
\def\primo{\FrenchEnumerate1}
\def\secundo{\FrenchEnumerate2}
\def\tertio{\FrenchEnumerate3}
\def\quarto{\FrenchEnumerate4}
%    \end{macrocode}
%    while typing |\fprimo)| gives `\up{o})\kern+.3em (except in
%     bookmarks where |\textdegree| is used instead),.
%    \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’’. In bookmarks ° is used instead of o-superior.
%    \begin{macrocode}
\DeclareRobustCommand*{\No}{%
  \texorpdfstring{N\up{o}\FBmedkern}{N\textdegree\space}}
\DeclareRobustCommand*{\no}{%
    \texorpdfstring{n\up{o}\FBmedkern}{n\textdegree\space}}
\DeclareRobustCommand*{\Nos}{%
    \texorpdfstring{N\up{os}\FBmedkern}{N\textdegree\space}}
\DeclareRobustCommand*{\nos}{%
    \texorpdfstring{n\up{os}\FBmedkern}{n\textdegree\space}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\bname}
% \begin{macro}{\bsc}
%    These commands are meant to easily enter family names (in small
%    capitals for the latter) while avoidind hyphenation.
%    A |\kern0pt| is used instead of |\mbox| because |\mbox| would break
%    microtype’s font expansion; as a positive side effect, composed
%    names (such as Dupont-Durand) can now be hyphenated on explicit
%    hyphens.
%
% \changes{v2.0}{2006/11/06}{\cs{hbox} dropped, replaced by
%    \cs{kern0pt}.}
%
% \changes{v3.5k}{2020/07/18}{\cs{bsc} now relies on
%    \cs{texorpdfstring} to be safe in bookmarks.}
%
% \changes{v3.5n}{2022/04/01}{Added command \cs{bname} (no small caps).}
%
%    \begin{macrocode}
\ifLaTeXe
  \DeclareRobustCommand*{\bname}[1]{%
    \texorpdfstring{\leavevmode\begingroup\kern0pt #1\endgroup}{#1}%
  }
  \DeclareRobustCommand*{\bsc}[1]{%
    \texorpdfstring{\leavevmode\begingroup\kern0pt \scshape #1\endgroup}%
                   {\textsc{#1}}%
  }
\else
  \newcommand*{\bname}[1]{\leavevmode\begingroup\kern0pt #1\endgroup}
  \let\bsc\bname
\fi
%    \end{macrocode}
% \end{macro}
% \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.}
%
% \changes{v3.2g}{2017/01/24}{Changed Unicode definition of \cs{boi}.}
%
% \changes{v3.5k}{2020/07/30}{\cs{degre}, \cs{degres}, \cs{circonflexe},
%    \cs{tild}, \cs{boi} and \cs{at} are now safe in bookmarks.}
%
%    \begin{macrocode}
\ifFBunicode
  \providecommand*{\textbackslash}{{\char"005C}}
  \providecommand*{\textasciicircum}{{\char"005E}}
  \providecommand*{\textasciitilde}{{\char"007E}}
  \DeclareRobustCommand*{\degre}{°}
\else
  \DeclareRobustCommand*{\degre}{\textdegree}
\fi
\DeclareRobustCommand*{\boi}{\textbackslash}
\DeclareRobustCommand*{\circonflexe}{\textasciicircum}
\DeclareRobustCommand*{\tild}{\textasciitilde}
\newcommand*{\at}{@}
%    \end{macrocode}
%
% \begin{macro}{\degres}
%    We now define a macro |\degres| for typesetting the abbreviation
%    for `degrees’ (as in `°C’ or `°K’) in text fonts which also works
%    in math mode for angles.
%
% \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.}
%
% \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{v3.6a}{2024/05/20}{Simplify \cs{degres} definition for text
%    and math mode: \cs{textdegree} always defined (TS1) since 2019.}
%
%    \begin{macrocode}
\DeclareRobustCommand*{\degres}{\degre}
\ifLaTeXe
  \AtBeginDocument{%
    \@ifpackageloaded{fontspec}{}%
        {\DeclareRobustCommand*{\degres}{%
          \texorpdfstring{\hbox{\UseTextSymbol{TS1}{\textdegree}}}%
                         {\textdegree}}%
        }%
  }
\fi
%    \end{macrocode}
% \end{macro}
%
%  \subsection{Formatting numbers}
%  \label{ssec-numbers}
%
% \begin{macro}{\StandardMathComma}
% \begin{macro}{\DecimalMathComma}
%    As mentioned in the \TeX{}book p.~134, the comma is of type
%    |\mathpunct| in math mode: it is automatically followed by a
%    thin 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 (or Acadian) \emph{only}
%    (no space added); |\StandardMathComma| switches back to the
%    standard behaviour of the comma.
%
% \changes{v3.2e}{2017/01/09}{\cs{DecimalMathComma} didn’t work
%    with LuaTeX.  Fixed now.}
%
% \changes{v3.2f}{2017/01/15}{Fixed conflict with the icomma
%    package.}
%
% \changes{v3.5f}{2019/09/07}{Fixed bug with the acadian language.
%    Warning added if used with the icomma package.}
%
% \changes{v3.5p}{2023/01/02}{\cs{DecimalMathComma} can again be
%    used in the preamble for a global action.  It now works as
%    expected inside a group.}
%
%    Unfortunately, |\newcount| inside |\if| breaks Plain formats.
%    \begin{macrocode}
\newif\ifFB@icomma
\newcount\mc@charclass
\newcount\mc@charfam
\newcount\mc@charslot
\newcount\std@mcc
\newcount\dec@mcc
\ifFBLuaTeX
  \mc@charclass=\Umathcharclass`\,
  \newcommand*{\dec@math@comma}{%
    \mc@charfam=\Umathcharfam`\,
    \mc@charslot=\Umathcharslot`\,
    \Umathcode`\,= 0 \mc@charfam \mc@charslot
  }
  \newcommand*{\std@math@comma}{%
    \mc@charfam=\Umathcharfam`\,
    \mc@charslot=\Umathcharslot`\,
    \Umathcode`\,= \mc@charclass \mc@charfam \mc@charslot
  }
\else
  \std@mcc=\mathcode`\,
  \dec@mcc=\std@mcc
  \@tempcnta=\std@mcc
  \divide\@tempcnta by "1000
  \multiply\@tempcnta by "1000
  \advance\dec@mcc by -\@tempcnta
  \newcommand*{\dec@math@comma}{\mathcode`\,=\dec@mcc}
  \newcommand*{\std@math@comma}{\mathcode`\,=\std@mcc}
\fi
\let\dec@m@c\relax
%    \end{macrocode}
%    If |\DecimalMathComma| is issued in the document body
%    (when the current language is French or Acadian) its effect will
%    survive to a language switch, unless issued inside a group
%    (see |\dec@m@c|’s expansion).
%    The \pkg{icomma} inhibits |\DecimalMathComma|.
%    \begin{macrocode}
\newif\if@FBpreamble
\ifLaTeXe \@FBpreambletrue \fi
\newif\if@preamble@DecimalMathComma
\newcommand*{\DecimalMathComma}{%
  \if@FBpreamble \@preamble@DecimalMathCommatrue
  \else
    \ifFB@icomma
      \PackageWarning{french.ldf}{%
        icomma package loaded, \protect\DecimalMathComma\MessageBreak
        does nothing.  Reported}%
    \else
      \ifFBfrench
        \dec@math@comma
        \let\dec@m@c\dec@math@comma
        \expandafter\addto\csname extras\languagename\endcsname
          {\dec@m@c}%
      \fi
    \fi
  \fi
}
\newcommand*{\StandardMathComma}{%
  \ifFB@icomma
    \PackageWarning{french.ldf}{%
      icomma package loaded, \protect\StandardMathComma\MessageBreak
      does nothing.  Reported}%
  \else
    \ifFBfrench
      \std@math@comma
      \let\dec@m@c\relax
    \fi
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%    This is for Plain formats \emph{only} (see below).
%    \begin{macrocode}
\ifLaTeXe\else
  \addto\noextrasfrench{\std@math@comma}
\fi
%    \end{macrocode}
%
%    Fake command |\nombre| for Plain based formats, warning users of
%    \frenchb{} v.~1.x.\ about the change:
%    \begin{macrocode}
\newcommand*{\nombre}[1]{{#1}\fb@warning{*** \noexpand\nombre
                               no longer formats numbers\string! ***}}
%    \end{macrocode}
%
%    Let’s activate LuaTeX punctuation if necessary (LaTeX or Plain)
%    so that |\FBsetspaces| commands can be used in the preamble,
%    then cleanup and exit without loading any \file{.cfg} file
%    in case of Plain formats.
%
%    \begin{macrocode}
\ifFB@luatex@punct
  \activate@luatexpunct
\fi
\let\FBstop@here\relax
\def\FBclean@on@exit{%
  \let\ifLaTeXe\iffalse
  \let\LaTeXetrue\undefined
  \let\LaTeXefalse\undefined
  \let\FB@llc\loadlocalcfg
  \let\loadlocalcfg\@gobble}
\ifx\magnification\@undefined
\else
  \def\FBstop@here{%
    \FBclean@on@exit
    \ldf@finish\CurrentOption
    \let\loadlocalcfg\FB@llc
    \endinput}
\fi
\FBstop@here
%    \end{macrocode}
%
%    What follows is for LaTeX2e \emph{only}: the next piece of  code
%    would break Plain formats.
%    If issued in the preamble, |\DecimalMathComma| works globally on
%    all parts of the document that are typeset in a French dialect.
%    Can be canceled anytime by |\StandardMathComma|.
%    \begin{macrocode}
\AtBeginDocument{%
  \@FBpreamblefalse
  \@ifpackageloaded{icomma}%
     {\FB@icommatrue
      \if@preamble@DecimalMathComma
        \PackageWarning{french.ldf}{%
          icomma package loaded, \protect\DecimalMathComma%
          \MessageBreak does nothing.  Reported}%
      \fi
     }%
     {\if@preamble@DecimalMathComma
        \ifFB@mainlanguage@FR \dec@math@comma \fi
        \let\dec@m@c\dec@math@comma
        \addto\extrasfrench{\dec@m@c}%
        \ifdefined\extrasacadian
          \addto\extrasacadian{\dec@m@c}%
        \fi
      \fi
%    \end{macrocode}
%    The comma is reset to type |\mathpunct| when leaving French
%    dialects (only if the icomma package is not loaded).
%    \begin{macrocode}
      \addto\noextrasfrench{\std@math@comma}%
      \ifdefined\noextrasacadian
         \addto\noextrasacadian{\std@math@comma}%
      \fi
     }%
  }
%    \end{macrocode}
%
% \begin{macro}{nombre}
%   We redefine |\nombre| for LaTeX2e.  The command |\nombre| is now
%   borrowed from \file{numprint.sty} for LaTeX2e.  There is no point to
%   maintain the former tricky code when a package is dedicated to do
%   the same job and more.  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.
%
% \changes{v3.1i}{2015/10/03}{\cs{nombre} command changed when
%    numprint.sty is not loaded: only one warning, no error.}
%    \begin{macrocode}
\renewcommand*{\nombre}[1]{\Warning@nombre{#1}}
\newcommand*{\Warning@nombre}[1]{%
   \ifdefined\numprint
     \numprint{#1}%
   \else
     \PackageWarning{french.ldf}{%
        \protect\nombre\space now relies on package numprint.sty,%
        \MessageBreak add \protect
        \usepackage[autolanguage]{numprint},\MessageBreak
        see file numprint.pdf for more options.\MessageBreak
        \protect\nombre\space called}%
     \global\let\Warning@nombre\relax
     {#1}%
   \fi
}
%    \end{macrocode}
% \end{macro}
%
% \changes{v3.3c}{2017/08/10}{New command \cs{FBthousandsep} to
%    customise numprint.}
%
% \changes{v3.4a}{2017/12/29}{Shrink/stretch removed in
%    \cs{FBthousandsep}.}
%
%    \begin{macrocode}
\newcommand*{\FBthousandsep}{\kern \fontdimen2\font \relax}
%    \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}
%  \label{ssec-captions-name}
%
%    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.}
%
% \changes{v3.1b}{2014/09/15}{Change \cs{scshape} to customisable
%    \cs{FBfigtabshape} for \cs{figurename} and \cs{tablename}.}
%
% \changes{v3.1g}{2015/05/10}{\cs{partname}’s definition depends now on
%    flag PartNameFull.  No need to redefine it in \cs{frenchbsetup}.}
%
% \changes{v3.3a}{2017/04/30}{Commands \cs{frenchpartfirst},
%    \cs{frenchpartsecond} and \cs{frenchpartnameord} added.}
%
% \changes{v3.5k}{2020/09/09}{Small caps removed in \cs{figurename} and
%    \cs{tablename}, use \cs{fnum@figure} and \cs{fnum@table} instead.}
%
% \changes{v3.5l}{2020/10/08}{Redefine \cs{fnum@figure} and
%    \cs{fnum@table} separately.}
%
%    |\figurename| and |\tablename| are printed in small caps in French,
%    unless either \fbo{SmallCapsFigTabCaptions} is set to \fbo{false}
%    or a class or package loaded before \frenchb{} defines
%    |\FBfigtabshape| as |\relax|.
%    \begin{macrocode}
\providecommand*{\FBfigtabshape}{\scshape}
%    \end{macrocode}
%
%    New implementation for caption names( requires \babel’s~3.10 or
%    newer).
%    \begin{macrocode}
\StartBabelCommands*{\BabelLanguages}{captions}
      [unicode, fontenc=TU 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}
   \SetString{\partfirst}{Première}
   \SetString{\partsecond}{Deuxième}
   \SetStringLoop{ordinal#1}{%
     \frenchpartfirst,\frenchpartsecond,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}{Figure}
   \SetString{\tablename}{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}
%   When \fbo{PartNameFull=true} (default), |\part{}| is printed in
%   French as ``Première partie’’ instead of ``Partie I’’.
%   As logic is prohibited inside |\SetString|, let’s hide the test
%   about \fbo{PartNameFull} in |\FB@partname|.
%    \begin{macrocode}
   \SetString{\partfirst}{Premi\`ere}
   \SetString{\partsecond}{Deuxi\`eme}
   \SetString{\partnameord}{partie}
   \SetStringLoop{ordinal#1}{%
     \partfirst,\partsecond,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{\unskip}}%
     \DeclareRobustCommand*{\FB@partname}{%
        \ifFBPartNameFull
          \csname ordinal\romannumeral\value{part}\endcsname\space
          \partnameord\FB@emptypart
        \else
          Partie%
        \fi}%
    }
   \SetString{\partname}{\FB@partname}
\EndBabelCommands
%    \end{macrocode}
%    |\figurename| and |\tablename| no longer include font commmands;
%    to print them in small caps in French (the default), we now
%    customise |\fnum@figure| and |\fnum@table| when available (not in
%    beamer.cls f.i.).
%    \begin{macrocode}
\AtBeginDocument{%
  \ifx\FBfigtabshape\relax
  \else
    \ifdefined\fnum@figure
      \let\fnum@figureORI\fnum@figure
      \renewcommand{\fnum@figure}{{\ifFBfrench\FBfigtabshape\fi
                                   \fnum@figureORI}}%
    \fi
    \ifdefined\fnum@table
      \let\fnum@tableORI\fnum@table
      \renewcommand{\fnum@table}{{\ifFBfrench\FBfigtabshape\fi
                                  \fnum@tableORI}}%
    \fi
  \fi
}
%    \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.}
%
%  \subsection{Figure and table captions}
%  \label{ssec-captions-fig}
%
% \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).}
%
% \begin{macro}{\FBWarning}
%    |\FBWarning| is an alias of |\PackageWarning{french.ldf}| which
%    can be made silent by option \fbo{SuppressWarning}.
%    \begin{macrocode}
\newcommand{\FBWarning}[1]{\PackageWarning{french.ldf}{#1}}
%    \end{macrocode}
% \end{macro}
%
% \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 LaTeX2e classes
%    (a space should preceed the colon in French).  This flaw may occur
%    with pdfLaTeX as  `:’ is made active too late.
%    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 LaTeX2e
%    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… change it).
%    If they are identical, \frenchb{} just adds a hook called
%    |\FBCaption@Separator| to |\@makecaption|; |\FBCaption@Separator|
%    defaults to `:~’ as in the standard definition of |\@makecaption|
%    and will be changed to `~:~’ in French `AtBeginDocument’;
%    it can be also set to |\CaptionSeparator| (` -- ’) using
%    \fbo{CustomiseFigTabCaptions}.
%
% \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{FBCaption@SeparatorORI}, 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}
%
%    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.
%
%    Enable the standard warning only if high punctuation is active.
%    \begin{macrocode}
\newif\if@FBwarning@capsep
\ifFB@active@punct\@FBwarning@capseptrue\fi
\newcommand*{\CaptionSeparator}{\space\textendash\space}
\def\FBCaption@Separator{: }
\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.}
%
%    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}
%
% \changes{v3.5l}{2020/10/01}{No warning about \cs{@makecaption} for
%    more classes.}
%
%    Disable the standard warning for some classes that do not use
%    `:’ as caption separator.
%    \begin{macrocode}
\@ifclassloaded{IEEEconf}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{IEEEtran}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{revtex4-2}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{svjour3}{\@FBwarning@capsepfalse}{}
%    \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|)
%    \begin{macrocode}
\@ifclassloaded{memoir}{\@FBwarning@capsepfalse}{}
\ifFB@koma \@FBwarning@capsepfalse \fi
%    \end{macrocode}
%    No warning with the \cls{beamer} class which defines
%    |\beamer@makecaption| (customised below) instead of
%    |\@makecaption|.  No warning either if |\@makecaption| is
%    undefined (i.e.\ \cls{letter}).
%    \begin{macrocode}
\@ifclassloaded{beamer}{\@FBwarning@capsepfalse}{}
\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/french.}
%
% \changes{v3.2b}{2016/03/30}{Warning added when the subcaption
%    package is loaded before babel/french.}
%
% \changes{v3.3c}{2017/08/16}{Reorganise warnings when the caption,
%    subcaption or floatrow packages are loaded before babel/french.}
%
% \changes{v3.5k}{2020/09/06}{Reorganise warnings about `:’ in captions,
%    according to enhancements in caption.sty v3.5a.}
%
% \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’).
%
% \changes{v3.1f}{2015/05/31}{\cs{FBCaption@Separator} changed when
%    option CustomiseFigTabCaptions is set to false.}
%
%    \begin{macrocode}
\AtBeginDocument{%
  \ifx\@makecaption\STD@makecaption
    \global\let\@makecaption\FB@makecaption
%    \end{macrocode}
%    If \fbo{OldFigTabCaptions=true}, do not overwrite
%    |\FBCaption@Separator| (already saved as `: ’  for other languages
%    and set to |\CaptionSeparator| by |\extrasfrench| when French is
%    the main language); otherwise locally force |\autospace@beforeFDP|
%    in case \fbo{AutoSpacePunctuation=false}.
%    \begin{macrocode}
    \ifFBOldFigTabCaptions
    \else
      \def\FBCaption@Separator{{\autospace@beforeFDP : }}%
      \ifFBCustomiseFigTabCaptions
        \ifFB@mainlanguage@FR
          \def\FBCaption@Separator{\CaptionSeparator}%
        \fi
      \fi
    \fi
    \@FBwarning@capsepfalse
  \fi
%    \end{macrocode}
%    No Warning if \file{caption.sty} or \file{caption-light.sty}
%    has been loaded.
%    \begin{macrocode}
    \@ifpackageloaded{caption}{\@FBwarning@capsepfalse}{}%
    \@ifpackageloaded{caption-light}{\@FBwarning@capsepfalse}{}%
%    \end{macrocode}
%    Final warning if relevant:
%    \begin{macrocode}
  \if@FBwarning@capsep
     \FBWarning
       {Figures' and tables' captions might look like\MessageBreak
        `Figure 1:' in French instead of `Figure 1 :'.\MessageBreak
        If this happens, to fix this issue\MessageBreak
        switch to LuaLaTeX or XeLaTeX or\MessageBreak
        try to add \protect\usepackage{caption} or\MessageBreak
        ... leave it as it is; reported}%
  \fi
  \let\FB@makecaption\relax
  \let\STD@makecaption\relax
}
%    \end{macrocode}
%
% \subsection{Dots…}
% \label{ssec-dots}
%
% \begin{macro}{\FBtextellipsis}
%    Unless a ready-made character is available in the current font,
%    LaTeX’s default definition of |\textellipsis| 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 LaTeX only) the
%    same way but without the last |\kern|.
%
%    LY1 has a ready made character for |\textellipsis|, it should be
%    used in French.  The same is true for Unicode fonts in use
%    with XeTeX and LuaTeX.
%
% \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).}
%
% \changes{v3.5m}{2021/07/19}{No longer redefine \cs{dots}, only
%    \cs{textellipsis}’s default definition is changed in French.}
%
%    \begin{macrocode}
\ifFBunicode
\else
  \DeclareTextSymbol{\FBtextellipsis}{LY1}{133}
  \DeclareTextCommand{\FBtextellipsis}{PU}{\9040\046}
  \DeclareTextCommand{\FBtextellipsis}{PD1}{\203}
  \DeclareTextCommandDefault{\FBtextellipsis}{%
      .\kern\fontdimen3\font.\kern\fontdimen3\font.\xspace}%
  \def\bbl@frenchdots{\babel@save\textellipsis
                      \let\textellipsis\FBtextellipsis}
  \addto\extrasfrench{\bbl@frenchdots}
\fi
%    \end{macrocode}
% \end{macro}
%
%  \subsection{More checks about packages’ loading order}
%  \label{ssec-loading-order}
%
% \changes{v3.1d}{2015/04/06}{New section: issue warnings if packages
%    listings, numprint and natbib are loaded too early or too late
%    vs babel.}
%
% \changes{v3.1i}{2015/10/03}{Remove restriction about loading
%    numprint.sty after babel.}
%
%    Like packages \file{captions} and \file{floatrow} (see
%    section~\ref{ssec-captions-fig}), package \file{listings} should
%    be loaded after \frenchb{} due to active characters issues
%    (pdfLaTeX only).
%
%    \begin{macrocode}
\ifFB@active@punct
   \@ifpackageloaded{listings}
      {\AtBeginDocument{%
         \FBWarning{Please load the "listings" package\MessageBreak
                    AFTER babel/french; reported}}%
      }{}
\fi
%    \end{macrocode}
%
%    Package \file{natbib} should be loaded before \frenchb{}
%    due to active characters issues (pdfLaTeX only).
%
%    \begin{macrocode}
\newif\if@FBwarning@natbib
\ifFB@active@punct
  \@ifpackageloaded{natbib}{}{\@FBwarning@natbibtrue}
\fi
\AtBeginDocument{%
   \if@FBwarning@natbib
     \@ifpackageloaded{natbib}{}{\@FBwarning@natbibfalse}%
   \fi
   \if@FBwarning@natbib
     \FBWarning{Please load the "natbib" package\MessageBreak
                BEFORE babel/french; reported}%
   \fi
}
%    \end{macrocode}
%
% \changes{v3.2g}{2017/01/30}{Issue a warning if beamerarticle.sty
%    is loaded after babel.}
%
%    Package \pkg{beamerarticle} should be loaded before \frenchb{}
%    to avoid list’s conflicts, see p.~\pageref{beamerarticle}.
%
%    \begin{macrocode}
\newif\if@FBwarning@beamerarticle
\@ifpackageloaded{beamerarticle}{}{\@FBwarning@beamerarticletrue}
\AtBeginDocument{%
   \if@FBwarning@beamerarticle
     \@ifpackageloaded{beamerarticle}{}%
                                     {\@FBwarning@beamerarticlefalse}%
   \fi
   \if@FBwarning@beamerarticle
     \FBWarning{Please load the "beamerarticle" package\MessageBreak
                BEFORE babel/french; reported}%
   \fi
}
%    \end{macrocode}
%
%  \subsection{Setup options: key/value stuff (l3keys)}
%  \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, now \cs{babel@save} and\cs{babel@savevariable} are
%    usable for French.}
%
% \changes{v3.6a}{2024/05/16}{Internal `l3keys’ replaces package
%    `keyval’ for options’ management.}
%
%    Check LaTeX2e version (support for \pkg{l3keys} required).
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
%    \end{macrocode}
%    All setup options are handled by command \fbsetup{} based on
%    the \file{l3keys}’ |\SetKeys{}| command.  A list of flags is
%    defined beforehand and set to default values which will possibly
%    be changed `AtEndOfPackage’ in case French is the main language.
%    After this, \fbsetup{} eventually modifies the preset values of
%    these flags.
%
%    {\sloppypar Some options processing occurs in \fbsetup{},
%    \emph{only for options explicitly set} by \fbsetup{}, the rest
%    `AtBeginDocument’; any option affecting |\extrasfrench{}|
%    \emph{must} be immediatelt 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 not an option because of its side-effects
%    (f.i.\ |\babel@save| and |\babel@savevariable| did not work for
%    French).\par}
%
%    We first define a collection of conditionals and set  their
%    defaults (true or false).
%
%    \begin{macrocode}
\newif\ifFBShowOptions
\newif\ifFBStandardLayout           \FBStandardLayouttrue
\newif\ifFBGlobalLayoutFrench       \FBGlobalLayoutFrenchtrue
\newif\ifFBStandardListSpacing      \FBStandardListSpacingtrue
\newif\ifFBListOldLayout
\newif\ifFBListItemsAsPar
\newif\ifFBCompactItemize
\newif\ifFBStandardItemizeEnv       \FBStandardItemizeEnvtrue
\newif\ifFBStandardEnumerateEnv     \FBStandardEnumerateEnvtrue
\newif\ifFBStandardItemLabels       \FBStandardItemLabelstrue
\newif\ifFBStandardLists            \FBStandardListstrue
\newif\ifFBIndentFirst
\newif\ifFBFrenchFootnotes
\newif\ifFBAutoSpaceFootnotes
\newif\ifFBOriginalTypewriter
\newif\ifFBThinColonSpace
\newif\ifFBThinSpaceInFrenchNumbers
\newif\ifFBFrenchSuperscripts       \FBFrenchSuperscriptstrue
\newif\ifFBLowercaseSuperscripts    \FBLowercaseSuperscriptstrue
\newif\ifFBPartNameFull             \FBPartNameFulltrue
\newif\ifFBCustomiseFigTabCaptions
\newif\ifFBOldFigTabCaptions
\newif\ifFBSmallCapsFigTabCaptions  \FBSmallCapsFigTabCaptionstrue
\newif\ifFBSuppressWarning
\newif\ifFBINGuillSpace
%    \end{macrocode}
%
% \changes{v3.1g}{2015/05/10}{Bug fix for koma-scripts classes:
%    a spurious dot was added by the \cs{partformat} command.}
%
% \changes{v3.4a}{2018/01/07}{Patch for koma-script classes moved here,
%    after \cs{ifFBPartNameFull} is defined, so that it applies to
%    \cs{extrasacadian} too: \cs{AtEndOfPackage} is too late.}
%
%    The following patch is for koma-script classes: the |\partformat|
%    command, defined as |\partname~\thepart\autodot|, is incompatible
%    with our redefinition of |\partname|.
%    \begin{macrocode}
\ifFB@koma
  \ifdefined\partformat
    \def\FB@partformat@fix{%
           \ifFBPartNameFull
             \babel@save\partformat
             \renewcommand*{\partformat}{\partname}%
           \fi}
    \addto\extrasfrench{\FB@partformat@fix}%
  \fi
\fi
%    \end{macrocode}
%
% \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}{No list customisation when beamer
%    class is loaded.}
%
% \changes{v3.2g}{2017/01/30}{Minimal list customisation when
%    beamerarticle.sty is loaded.}
%
% \changes{v3.2h}{2017/04/11}{Option GlobalLayoutFrench skipped
%    when French is not the main language.}
%
% \changes{v3.5e}{2019/03/14}{StandardLayout and GlobalLayoutFrench
%    options can no longer be toggled when French is not the main
%    language.}
%
%    The defaults values of these flags are choosen so that
%    \frenchb{} does not change anything regarding the global layout.
%    Some of them must be toogled when French (or a French dialect) is
%    the main language. The latter (last option of \babel, stored in
%    |\bbl@main@language|) will be known `AtEndOfPackage’.
%    So we postpone the |\bbl@main@language| checking until then.
%
%    Our list customisation conflicts with the \cls{beamer} class and
%    with the \pkg{beamerarticle} package.  The patch provided in
%    \pkg{beamerbasecompatibility} solves the conflict except in case
%    of language changes, so we provide our own patch.
%    When the \cls{beamer} is loaded, lists are not customised at all
%    to ensure compatibility.\hlabel{beamerarticle}
%    The \pkg{beamerarticle} package needs to be loaded \emph{before}
%    \babel, a warning is issued otherwise, see
%    section~\ref{ssec-loading-order}; a light customisation is
%    compatible with the \pkg{beamerarticle} package.
%
% \changes{v3.5n}{2022/04/18}{\cs{FBGlobalLayoutFrench} no longer set to
%    false when French is not the main language.}
%
%    \begin{macrocode}
\def\FB@french{french}
\def\FB@acadian{acadian}
\newif\ifFB@mainlanguage@FR
\AtEndOfPackage{%
  \ifx\bbl@main@language\FB@french \FB@mainlanguage@FRtrue
  \else \ifx\bbl@main@language\FB@acadian \FB@mainlanguage@FRtrue \fi
  \fi
  \ifFB@mainlanguage@FR
    \FBGlobalLayoutFrenchtrue
    \@ifclassloaded{beamer}%
      {\PackageInfo{french.ldf}{%
          No list customisation for the beamer class,%
          \MessageBreak reported}}%
      {\@ifpackageloaded{beamerarticle}%
         {\FBStandardItemLabelsfalse
          \FBStandardListSpacingfalse
          \PackageInfo{french.ldf}{%
             Minimal list customisation for the beamerarticle%
             \MessageBreak package; reported}}%
%    \end{macrocode}
%    Otherwise customise lists ``à la française’’:
%    \begin{macrocode}
         {\FBStandardListSpacingfalse
          \FBStandardItemizeEnvfalse
          \FBStandardEnumerateEnvfalse
          \FBStandardItemLabelsfalse}%
      }
    \FBIndentFirsttrue
    \FBFrenchFootnotestrue
    \FBAutoSpaceFootnotestrue
    \FBCustomiseFigTabCaptionstrue
  \fi
}
%    \end{macrocode}
%
% \begin{macro}{\frenchsetup}
%    Let’s define the keys to be used in \fbsetup{}.
%    \begin{macrocode}
\DeclareKeys[FBsetup]
  {
    ShowOptions.if               = FBShowOptions                        ,
    StandardLayout.default:n     = {true}                               ,
    StandardLayout.code          = \FBStandardLayout@setup{#1}          ,
    GlobalLayoutFrench.default:n = {true}                               ,
    GlobalLayoutFrench.code      = \FBGlobalLayout@setup{#1}            ,
    StandardListSpacing.if       = FBStandardListSpacing                ,
    ReduceListSpacing.ifnot      = FBStandardListSpacing                ,
    ListOldLayout.default:n      = {true}                               ,
    ListOldLayout.code           = \FBListOldLayout@setup{#1}           ,
    CompactItemize.default:n     = {true}                               ,
    CompactItemize.code          = \FBCompactItemize@setup{#1}          ,
    StandardItemizeEnv.if        = FBStandardItemizeEnv                 ,
    StandardEnumerateEnv.if      = FBStandardEnumerateEnv               ,
    StandardItemLabels.if        = FBStandardItemLabels                 ,
    ItemLabels.store             = \FrenchLabelItem                     ,
    ItemLabeli.store             = \Frlabelitemi                        ,
    ItemLabelii.store            = \Frlabelitemii                       ,
    ItemLabeliii.store           = \Frlabelitemiii                      ,
    ItemLabeliv.store            = \Frlabelitemiv                       ,
    StandardLists.default:n      = {true}                               ,
    StandardLists.code           = \FBStandardLists@setup{#1}           ,
    ListItemsAsPar.if            = FBListItemsAsPar                     ,
    IndentFirst.if               = FBIndentFirst                        ,
    FrenchFootnotes.if           = FBFrenchFootnotes                    ,
    AutoSpaceFootnotes.if        = FBAutoSpaceFootnotes                 ,
    AutoSpacePunctuation.if      = FBAutoSpacePunctuation               ,
    OriginalTypewriter.if        = FBOriginalTypewriter                 ,
    ThinColonSpace.default:n     = {true}                               ,
    ThinColonSpace.code          = \FBThinColonSpace@setup{#1}          ,
    ThinSpaceInFrenchNumbers.if  = FBThinSpaceInFrenchNumbers           ,
    FrenchSuperscripts.if        = FBFrenchSuperscripts                 ,
    LowercaseSuperscripts.if     = FBLowercaseSuperscripts              ,
    PartNameFull.if              = FBPartNameFull                       ,
    CustomiseFigTabCaptions.if   = FBCustomiseFigTabCaptions            ,
    OldFigTabCaptions.default:n  = {true}                               ,
    OldFigTabCaptions.code       = \FBOldFigTabCaptions@setup{#1}       ,
    SmallCapsFigTabCaptions.default:n = {true}                          ,
    SmallCapsFigTabCaptions.code = \FBSmallCapsFigTabCaptions@setup{#1} ,
    SuppressWarning.default:n    = {true}                               ,
    SuppressWarning.code         = \FBSuppressWarning@setup{#1}         ,
    INGuillSpace.default:n       = {true}                               ,
    INGuillSpace.code            = \FBINGuillSpace@setup{#1}            ,
    InnerGuillSingle.if          = FBInnerGuillSingle                   ,
    EveryParGuill.default:n      = {open}                               ,
    EveryParGuill.code           = \FBEveryParGuill@setup{#1}           ,
    EveryLineGuill.default:n     = {open}                               ,
    EveryLineGuill.code          = \FBEveryLineGuill@setup{#1}          ,
    UnicodeNoBreakSpaces.default:n = {true}                             ,
    UnicodeNoBreakSpaces.code    = \FBUnicodeNoBreakSpaces@setup{#1}    ,
    og.code                      = \FBog@setup{#1}                      ,
    fg.code                      = \FBfg@setup{#1}                      ,
}
%    \end{macrocode}
%
%    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.}
%
% \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.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}.}
%
% \changes{v3.1b}{2014/09/15}{New option SmallCapsFigTabCaptions.}
%
% \changes{v3.1e}{2015/04/10}{Corrected typo: SmallCapsFigTabcaptions
%    instead of SmallCapsFigTabCaptions.  Pointed out by Céline
%    Chevalier.}
%
% \changes{v3.1g}{2015/05/10}{PartNameFull now just sets the flag,
%    nothing to add to \cs{captionsfrench} when false.}
%
% \changes{v3.3a}{2017/04/30}{\cs{frenchbsetup} is now an alias for
%    \cs{frenchsetup}.}
%
% \changes{v3.3a}{2017/04/30}{Options INGuillSpace, ThinColonSpace no
%    longer delayed AtBeginDocument.}
%
% \changes{v3.5a}{2018/07/04}{New option ListItemsAsPar for displaying
%    lists’ items ``as paragraphs’’.}
%
% \changes{v3.5d}{2019/01/24}{ReduceListSpacing option depreciated: see
%    StandardListSpacing.}
%
%    \begin{macrocode}
\newcommand*{\frenchsetup}[1]{%
  \SetKeys[FBsetup]{#1}%
}%
\@onlypreamble\frenchsetup
%    \end{macrocode}
%    Keep the former name |\frenchbsetup| working for compatibility.
%    \begin{macrocode}
\let\frenchbsetup\frenchsetup
\@onlypreamble\frenchbsetup
%    \end{macrocode}
%
% \changes{v3.6c}{2024/07/25}{Removed spurious @ in
%   \cs{FBCompactItemize@setup} and \cs{FBListOldLayout@setup}
%   commands’ names.}
%
%    The following commands, defined with property |.code| in
%    |DeclareKeys{}|, execute some post-treatment required to
%    immediately take the flags value into account.
%    \begin{macrocode}
\newcommand*{\FBStandardLayout@setup}[1]%
  {\ifFB@mainlanguage@FR
     \csname FBStandardLayout#1\endcsname
   \else
     \PackageWarning{french.ldf}%
         {Option `StandardLayout' skipped:\MessageBreak
          French is *not* babel's last option.\MessageBreak
          Reported}%
   \fi
   \ifFBStandardLayout
     \FBStandardListSpacingtrue
     \FBStandardItemizeEnvtrue
     \FBStandardItemLabelstrue
     \FBStandardEnumerateEnvtrue
     \FBIndentFirstfalse
     \FBFrenchFootnotesfalse
     \FBAutoSpaceFootnotesfalse
   \else
     \FBStandardListSpacingfalse
     \FBStandardItemizeEnvfalse
     \FBStandardItemLabelsfalse
     \FBStandardEnumerateEnvfalse
     \FBIndentFirsttrue
     \FBFrenchFootnotestrue
     \FBAutoSpaceFootnotestrue
   \fi
  }
\newcommand*{\FBGlobalLayout@setup}[1]%
  {\ifFB@mainlanguage@FR
     \csname FBGlobalLayoutFrench#1\endcsname
   \else
     \PackageWarning{french.ldf}%
       {Option `GlobalLayoutFrench' skipped:\MessageBreak
        French is *not* babel's last option.\MessageBreak
        Reported}%
   \fi
  }
\newcommand*{\FBListOldLayout@setup}[1]%
  {\csname FBListOldLayout#1\endcsname
   \ifFBListOldLayout
     \FBStandardEnumerateEnvtrue
     \renewcommand*{\FrenchLabelItem}{\textendash}%
   \fi
  }
\newcommand*{\FBCompactItemize@setup}[1]%
  {\csname FBCompactItemize#1\endcsname
   \ifFBCompactItemize
     \FBStandardItemizeEnvfalse
     \FBStandardEnumerateEnvfalse
   \else
     \FBStandardItemizeEnvtrue
     \FBStandardEnumerateEnvtrue
   \fi
  }
\newcommand*{\FBStandardLists@setup}[1]%
  {\csname FBStandardLists#1\endcsname
   \ifFBStandardLists
     \FBStandardListSpacingtrue
     \FBStandardItemizeEnvtrue
     \FBStandardEnumerateEnvtrue
     \FBStandardItemLabelstrue
   \else
     \FBStandardListSpacingfalse
     \FBStandardItemizeEnvfalse
     \FBStandardEnumerateEnvfalse
     \FBStandardItemLabelsfalse
   \fi
  }
\newcommand*{\FBThinColonSpace@setup}[1]%
  {\csname FBThinColonSpace#1\endcsname
   \ifFBThinColonSpace
     \renewcommand*{\FBcolonspace}{\FBthinspace}%
   \fi
  }
\newcommand*{\FBOldFigTabCaptions@setup}[1]%
  {\csname FBOldFigTabCaptions#1\endcsname
   \ifFBOldFigTabCaptions
     \def\FB@capsep@fix{\babel@save\FBCaption@Separator
             \def\FBCaption@Separator{\CaptionSeparator}}%
             \addto\extrasfrench{\FB@capsep@fix}%
             \ifdefined\extrasacadian
               \addto\extrasacadian{\FB@capsep@fix}%
             \fi
   \fi
  }
\newcommand*{\FBSmallCapsFigTabCaptions@setup}[1]%
  {\csname FBSmallCapsFigTabCaptions#1\endcsname
   \ifFBSmallCapsFigTabCaptions
   \else
     \let\FBfigtabshape\relax
   \fi
  }
\newcommand*{\FBSuppressWarning@setup}[1]%
  {\csname FBSuppressWarning#1\endcsname
   \ifFBSuppressWarning
     \renewcommand{\FBWarning}[1]{}%
   \fi
  }
\newcommand*{\FBINGuillSpace@setup}[1]%
  {\csname FBINGuillSpace#1\endcsname
   \ifFBINGuillSpace
     \renewcommand*{\FBguillspace}{\space}%
   \fi
  }
\newcommand*{\FBEveryParGuill@setup}[1]%
  {\expandafter\let\expandafter
      \FBeveryparguill\csname FBguill#1\endcsname
   \ifx\FBeveryparguill\FBguillopen
   \else\ifx\FBeveryparguill\FBguillclose
        \else\ifx\FBeveryparguill\FBguillnone
             \else
               \let\FBeveryparguill\FBguillopen
               \FBWarning{Wrong value for `EveryParGuill':
                          try `open',\MessageBreak
                          `close' or `none'. Reported}%
              \fi
        \fi
   \fi
  }
\newcommand*{\FBEveryLineGuill@setup}[1]%
  {\ifFB@luatex@punct
     \expandafter\let\expandafter
        \FBeverylineguill\csname FBguill#1\endcsname
     \ifx\FBeverylineguill\FBguillopen
     \else\ifx\FBeverylineguill\FBguillclose
          \else\ifx\FBeverylineguill\FBguillnone
               \else
                 \let\FBeverylineguill\FBguillnone
                 \FBWarning{Wrong value for `EveryLineGuill':
                            try `open',\MessageBreak
                            `close' or `none'. Reported}%
               \fi
          \fi
     \fi
   \else
     \FBWarning{Option `EveryLineGuill' skipped:%
                \MessageBreak this option is for
                LuaTeX *only*.\MessageBreak Reported}%
   \fi
  }
%    \end{macrocode}
%
% \changes{v3.3c}{2017/07/23}{New option `UnicodeNoBreakSpaces’ for
%    html translators (LuaLaTeX only).}
%
%    Option \fbo{UnicodeNoBreakSpaces} (LuaLaTeX  only) is meant for
%    HTML translators: when true, all non-breaking spaces added by
%    \frenchb{} are coded in the PDF file as Unicode characters,
%    namely U+A0 or U+202F, instead of penalties and glues.
%    \begin{macrocode}
\newcommand*{\FBUnicodeNoBreakSpaces@setup}[1]%
  {\ifFB@luatex@punct
     \csname FBucsNBSP#1\endcsname
     \ifFBucsNBSP \FB@ucsNBSP=\@ne \fi
   \else
     \FBWarning{Option `UnicodeNoBreakSpaces' 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|.
%
%    Life is simple 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.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 0x13 and 0x14 added for French
%    quotes in T1-encoding.  Support for older versions of LuaTeX and
%    XeTeX dropped.}
%
% \changes{v3.2c}{2016/05/03}{Add a warning about options og/fg for old
%    XeTeX or LuaTeX engines requiring active characters.}
%
% \changes{v3.4d}{2018/04/11}{New test for deciding about utf8 encoding
%    for keys og and fg (the former one fails with LaTeX 2018 release).}
%
%    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
%    non-breaking 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,…) or
%    multi-bytes (utf-8, utf8x); the next command is meant for checking
%    whether a character is single-byte (|\FB@second| is empty) or not.
%
%    \begin{macrocode}
\def\FB@parse#1#2\endparse{\def\FB@second{#2}}%
\newcommand*{\FB@@og}%
  {\ifFBfrench
     \ifFB@spacing \FB@og\ignorespaces
     \else \guillemotleft
     \fi
   \else \guillemotleft
   \fi
  }
\newcommand*{\FB@@fg}%
  {\ifFBfrench
     \ifFB@spacing \FB@fg
     \else \guillemotright
     \fi
   \else \guillemotright
   \fi
  }
\newcommand*{\FBog@setup}[1]%
  {\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
%    \end{macrocode}
%    Issue a warning with older Unicode engines requiring active
%    characters.
%    \begin{macrocode}
     \ifFB@active@punct
       \FBWarning{Option og=« not supported with this version of
                  \MessageBreak LuaTeX/XeTeX; reported}% »
     \fi
   \else
%    \end{macrocode}
%    This is for conventional TeX engines:
%    \begin{macrocode}
     \AtBeginDocument{%
        \ifdefined\uc@dclc
%    \end{macrocode}
%    Package \pkg{inputenc} with utf8x (ucs) encoding loaded,
%    use |\uc@dclc|:
%    \begin{macrocode}
          \uc@dclc{171}{default}{\FB@@og}%
        \else
%    \end{macrocode}
%    if encoding is not utf8x, check if the argument of |og|
%    is a single-byte character:
%    \begin{macrocode}
          \FB@parse#1\endparse
          \ifx\FB@second\@empty
%    \end{macrocode}
%    This means 8-bit character encoding.
%    Package \pkg{MULEenc} (from CJK) defines |\mule@def|
%    to map characters to control sequences.
%    \begin{macrocode}
            \ifdefined\mule@def
              \mule@def{11}{\FB@@og}%
            \else
              \ifdefined\DeclareInputText
                \@tempcnta`#1\relax
                \DeclareInputText{\the\@tempcnta}{\FB@@og}%
              \else
%    \end{macrocode}
%    Package \pkg{inputenc} not loaded, no way…
%    \begin{macrocode}
                \FBWarning{Option `og' requires package
                           inputenc;\MessageBreak reported}%
              \fi
            \fi
          \else
%    \end{macrocode}
%    This means multi-byte character encoding, we assume UTF-8
%    \begin{macrocode}
            \DeclareUnicodeCharacter{00AB}{\FB@@og}%
          \fi
        \fi}%
   \fi
  }
%    \end{macrocode}
%
%    Same code for the closing quote.
%    \begin{macrocode}
\newcommand*{\FBfg@setup}[1]%
  {\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
     \ifFB@active@punct
       \FBWarning{Option fg=» not supported with this version of
                  \MessageBreak LuaTeX/XeTeX; reported}%
     \fi
   \else
     \AtBeginDocument{%
        \ifdefined\uc@dclc
          \uc@dclc{187}{default}{\FB@@fg}%
        \else
          \FB@parse#1\endparse
          \ifx\FB@second\@empty
             \ifdefined\mule@def
               \mule@def{27}{{\FB@@fg}}%
             \else
               \ifdefined\DeclareInputText
                 \@tempcnta`#1\relax
                 \DeclareInputText{\the\@tempcnta}{\FB@@fg}%
               \else
                 \FBWarning{Option `fg' requires package
                            inputenc;\MessageBreak reported}%
                 \fi
               \fi
          \else
            \DeclareUnicodeCharacter{00BB}{\FB@@fg}%
          \fi
        \fi}%
   \fi
  }
% \end{macro}
%
% \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{french.ldf}%
          {Setting StandardItemizeEnv=true for\MessageBreak
           compatibility with enumitem package,\MessageBreak
           reported}%
     \fi
     \ifFBStandardEnumerateEnv
     \else
       \FBStandardEnumerateEnvtrue
       \PackageInfo{french.ldf}%
          {Setting StandardEnumerateEnv=true for\MessageBreak
           compatibility with enumitem package,\MessageBreak
           reported}%
     \fi}{}%
  \@ifpackageloaded{paralist}{%
     \ifFBStandardItemizeEnv
     \else
       \FBStandardItemizeEnvtrue
       \PackageInfo{french.ldf}%
          {Setting StandardItemizeEnv=true for\MessageBreak
           compatibility with paralist package,\MessageBreak
           reported}%
     \fi
     \ifFBStandardEnumerateEnv
     \else
       \FBStandardEnumerateEnvtrue
       \PackageInfo{french.ldf}%
          {Setting StandardEnumerateEnv=true for\MessageBreak
           compatibility with paralist package,\MessageBreak
           reported}%
     \fi}{}%
  \@ifpackageloaded{enumerate}{%
     \ifFBStandardEnumerateEnv
     \else
       \FBStandardEnumerateEnvtrue
       \PackageInfo{french.ldf}%
          {Setting StandardEnumerateEnv=true for\MessageBreak
           compatibility with enumerate package,\MessageBreak
           reported}%
     \fi}{}%
%    \end{macrocode}
%    Reset |\FB@ufl|’s normal meaning and update lists’ settings
%    now in case French is the main language: \hlabel{FB@ufl}
%    \begin{macrocode}
  \def\FB@ufl{\update@frenchlists}
  \ifFB@mainlanguage@FR
    \update@frenchlists
  \else
    \ifFBStandardItemizeEnv
    \else
      \PackageWarning{french.ldf}%
        {babel-french will not customise lists' layout\MessageBreak
         when French is not the main language,\MessageBreak
         reported}%
    \fi
  \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 a non-breaking 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}
%
%    When package \pkg{numprint} is loaded with option
%    \opt{autolanguage}, \pkg{numprint}’s command |\npstylefrench| has
%    to be redefined differently according to the value of
%    flag\linebreak \fbo{ThinSpaceInFrenchNumbers}.
%    As |\npstylefrench| was undefined in old versions of
%    \pkg{numprint}, we provide this command.
%    \begin{macrocode}
  \@ifpackageloaded{numprint}%
    {\ifnprt@autolanguage
       \providecommand*{\npstylefrench}{}%
       \ifFBThinSpaceInFrenchNumbers
         \renewcommand*{\FBthousandsep}{\FBthinspace}%
       \fi
       \g@addto@macro\npstylefrench{\npthousandsep{\FBthousandsep}}%
     \fi
    }{}%
%    \end{macrocode}
%    \fbo{FrenchSuperscripts}: if \fbo{true} |\up=\fup|, else
%    |\up=\textsuperscript|.  The star-form |\up*=\FB@up@fake| 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}{%
      \texorpdfstring{\@ifstar{\FB@up@fake}{\fup}}{}%
      }
  \else
    \DeclareRobustCommand*{\up}{%
      \texorpdfstring{\@ifstar{\FB@up@fake}{\textsuperscript}}{}%
      }
  \fi
%    \end{macrocode}
%    \fbo{LowercaseSuperscripts}: if \fbo{false} |\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}.}
%
% \changes{v3.1f}{2015/05/31}{Definition of \cs{captionformat} and
%    \cs{captiondelim} changed when option CustomiseFigTabCaptions
%    is set to false.}
%
% \changes{v3.1f}{2015/05/31}{Bug fix for the beamer class:
%    figure and table captions are now consistent with babel-french’s
%    documentation.  Pointed out by Denis Bitouzé.}
%
% \changes{v3.5i}{2020/06/29}{For memoir, koma-script and beamer
%    classes, leave caption delimiter unchanged if it has been user
%    customised.}
%
%    This is for koma-script, \cls{memoir} and \cls{beamer} classes.
%    If the caption delimiter has been user customised, leave it
%    unchanged.  Otherwise, force the colon to behave properly in French
%    (add locally |\autospace@beforeFDP| in case of
%    \fbo{AutoSpacePunctuation=false}) and change the caption delimiter
%    to |\CaptionSeparator| if \fbo{CustomiseFigTabCaptions} has been
%    set to \fbo{true}.
%    \begin{macrocode}
  \ifFB@koma
     \ifx\captionformat\FB@std@capsep
       \ifFBCustomiseFigTabCaptions
          \renewcommand*{\captionformat}{\CaptionSeparator}%
       \else
          \renewcommand*{\captionformat}{{\autospace@beforeFDP :\ }}%
       \fi
     \fi
  \fi
  \@ifclassloaded{memoir}%
     {\ifx\@contdelim\FB@std@capsep
        \ifFBCustomiseFigTabCaptions
          \captiondelim{\CaptionSeparator}%
        \else
          \captiondelim{{\autospace@beforeFDP : }}%
        \fi
      \fi}{}%
  \@ifclassloaded{beamer}%
     {\protected@edef\FB@capsep{%
         \csname beamer@@tmpl@caption label separator\endcsname}%
      \ifx\FB@capsep\FB@std@capsep
        \ifFBCustomiseFigTabCaptions
           \defbeamertemplate{caption label separator}{FBcustom}{%
               \CaptionSeparator}%
           \setbeamertemplate{caption label separator}[FBcustom]%
        \else
           \defbeamertemplate{caption label separator}{FBcolon}{%
               {\autospace@beforeFDP : }}%
           \setbeamertemplate{caption label separator}[FBcolon]%
        \fi
      \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 babel-french ***\MessageBreak
     [Default values between brackets when french is loaded *LAST*]%
     \MessageBreak
     ShowOptions [false]\MessageBreak
     StandardLayout [false]\MessageBreak
     GlobalLayoutFrench [true]\MessageBreak
     PartNameFull [true]\MessageBreak
     IndentFirst [true]\MessageBreak
     ListItemsAsPar [false]\MessageBreak
     StandardListSpacing [false]\MessageBreak
     StandardItemizeEnv [false]\MessageBreak
     StandardEnumerateEnv [false]\MessageBreak
     StandardItemLabels [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
     StandardLists [false]\MessageBreak
     ListOldLayout [false]\MessageBreak
     FrenchFootnotes [true]\MessageBreak
     AutoSpaceFootnotes [true]\MessageBreak
     AutoSpacePunctuation [true]\MessageBreak
     ThinColonSpace [false]\MessageBreak
     OriginalTypewriter [false]\MessageBreak
     UnicodeNoBreakSpaces [false]\MessageBreak
     og= <left quote character>, fg= <right quote character>%
     INGuillSpace [false]\MessageBreak
     EveryParGuill=open, close, none [open]\MessageBreak
     EveryLineGuill=open, close, none
                   [open in LuaTeX, none otherwise]\MessageBreak
     InnerGuillSingle [false]\MessageBreak
     ThinSpaceInFrenchNumbers [false]\MessageBreak
     SmallCapsFigTabCaptions [true]\MessageBreak
     CustomiseFigTabCaptions [true]\MessageBreak
     OldFigTabCaptions [false]\MessageBreak
     FrenchSuperscripts [true]\MessageBreak
     LowercaseSuperscripts [true]\MessageBreak
     SuppressWarning [false]\MessageBreak
     \MessageBreak
     *********************************************%
     \MessageBreak\protect\frenchsetup{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 and execute
%    |\FBprocess@options|.
%    \begin{macrocode}
\AtBeginDocument{%
   \providecommand*{\xspace}{\relax}%
%    \end{macrocode}
%
% \changes{v3.5k}{2020/07/30}{\cs{pdfstringdefDisableCommands}
%    dropped.}
%
%    Let’s now process the remaining options, either not explicitly
%    set by \fbsetup{} or possibly modified by packages loaded after
%    \frenchb.
%    \begin{macrocode}
   \FBprocess@options
%    \end{macrocode}
%    When option \fbo{UnicodeNoBreakSpaces} is \fbo{true}
%    (LuaLaTeX only) we need to redefine |\FBmedkern|, |\FBthickkern|
%    and |\FBthousandsep| as Unicode characters.
%    \begin{macrocode}
   \ifFBucsNBSP
     \renewcommand*{\FBmedkern}{\char"202F\relax}%
     \renewcommand*{\FBthickkern}{\char"A0\relax}%
     \ifFBThinSpaceInFrenchNumbers
       \renewcommand*{\FBthousandsep}{\char"202F\relax}%
     \else
       \renewcommand*{\FBthousandsep}{\char"A0\relax}%
     \fi
   \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 with the luainputenc.sty package.}
%
% \changes{v3.2g}{2017/01/24}{fontspec defines TU encoding now and
%    no longer loads xunicode.sty. Test changed.}
%
% \changes{v3.3c}{2017/09/06}{LaTeX 2017-04-15 defines TU encoding
%    for Unicode engines, fontspec is no longer required.}
%
%    Finally,  with pdfLaTeX, when OT1 encoding is in use at the
%    |\begin{document}| a warning is issued; |\encodingdefault|
%    being defined as `long’, the test would fail if |\FBOTone| was
%    defined with |\newcommand*|!
%    \begin{macrocode}
   \begingroup
     \newcommand{\FBOTone}{OT1}%
     \ifx\encodingdefault\FBOTone
       \FBWarning{OT1 encoding should not be used for French.%
                  \MessageBreak
                  Add \protect\usepackage[T1]{fontenc} to the
                  preamble\MessageBreak of your document; reported}%
     \fi
   \endgroup
}
%    \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}
% \changes{v3.5q}{2023/02/15}{Bug correction: \cs{parsep} should be
%    related to \cs{parskip} and \cs{listparindent} to \cs{parindent}.}
% \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|…
%
%    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
\newdimen\FB@parskip
\def\FB@listVsettings{%
      \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
%    |\FB@parskip|.
%    \begin{macrocode}
      \FB@parskip=\parskip
      \addtolength{\topsep}{-\FB@parskip}%
      \addtolength{\partopsep}{\FB@parskip}%
      \setlength{\itemsep}{0.4ex plus 0.2ex minus 0.2ex}%
      \setlength{\parsep}{0.4ex plus 0.2ex minus 0.2ex}%
%    \end{macrocode}
%    (v3.5q) If |\parskip| is not null, |\parsep| is set to |\parskip|,
%    so paragraphs inside items will be preceeded by the same vertical
%    space as paragraphs located outside lists; the vertical skip before
%    items (|\itemsep| + |\parsep|) doesn’t need to be enlarged.
%    \begin{macrocode}
      \ifdim\FB@parskip>0pt
        \setlength{\parsep}{\FB@parskip}%
        \addtolength{\itemsep}{-\FB@parskip}%
      \fi
}
\def\listFB#1#2{\listORI{#1}{\FB@listVsettings #2}}
\let\endlistFB\endlistORI
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%    Let’s now consider French itemize-lists.  They differ from those
%    provided by the standard LaTeX 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, stored in
%          |\FrenchLabelItem}|, 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 shown p.~\pageref{ListAsPar}.
%    \end{itemize}
%
% \begin{macro}{\FrenchLabelItem}
% \changes{v2.6a}{2013/01/30}{default changed from \cs{textendash} to
%    \cs{textemdash}.}
% \begin{macro}{\Frlabelitemi}
% \begin{macro}{\Frlabelitemii}
% \begin{macro}{\Frlabelitemiii}
% \begin{macro}{\Frlabelitemiv}
%    Default labels for French itemize-lists ---same label for all
%    levels---, (already defined as empty by |\DeclareKey{}|):
%    \begin{macrocode}
\renewcommand*{\FrenchLabelItem}{\textemdash}
\renewcommand*{\Frlabelitemi}{\FrenchLabelItem}
\renewcommand*{\Frlabelitemii}{\FrenchLabelItem}
\renewcommand*{\Frlabelitemiii}{\FrenchLabelItem}
\renewcommand*{\Frlabelitemiv}{\FrenchLabelItem}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\listindentFB}
% \begin{macro}{\descindentFB}
% \begin{macro}{\labelindentFB}
% \begin{macro}{\labelwidthFB}
%    {\sloppy Let’s define four dimens |\listindentFB|, |\descindentFB|,
%    |\labelindentFB| and |\labelwidthFB| to customise lists’ horizontal
%    indentations.
%    They are given silly negative values here in order to eventually
%    enable their customisation in the preamble.  They will get
%    reasonnable defaults later when entering French (see
%    |\setlabelitemsFB| and |\setlistindentFB|) unless they have been
%    customised.\par}
%    \begin{macrocode}
\newdimen\listindentFB
\setlength{\listindentFB}{-1pt}
\newdimen\descindentFB
\setlength{\descindentFB}{-1pt}
\newdimen\labelindentFB
\setlength{\labelindentFB}{-1pt}
\newdimen\labelwidthFB
\setlength{\labelwidthFB}{-1pt}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \changes{v3.2e}{2016/10/28}{Add missing redefinitions for
%    \cs{leftmarginv}, \cs{leftmarginvi}. Suggested by J.F. Burnol.}
%
% \changes{v3.5a}{2018/07/04}{New optional layout for lists:
%    lists’ items can be typeset as paragraphs with indented labels
%    while the default leaves the labels hanging into the left margin.}
%
% \begin{macro}{\leftmarginFB}
% \begin{macro}{\FB@listHsettings}
%    |\FB@listHsettings| holds the new horizontal settings chosen for
%    French lists \env{itemize}, \env{enumerate} and \env{description}
%    (two possible layouts).
%    \begin{macrocode}
\newdimen\leftmarginFB
\def\FB@listHsettings{%
  \ifFBListItemsAsPar
%    \end{macrocode}
%    Optional layout: lists’ items are typeset as paragraphs with
%    indented labels.
%    \begin{macrocode}
    \itemindent=\labelindentFB
    \advance\itemindent by \labelwidthFB
    \advance\itemindent by \labelsep
    \leftmargini\z@
    \bbl@for\FB@dp {2, 3, 4, 5, 6}%
      {\csname leftmargin\romannumeral\FB@dp\endcsname =
         \labelindentFB}%
  \else
%    \end{macrocode}
%    Default layout: labels hanging into the list left margin.
%    \begin{macrocode}
    \leftmarginFB=\labelwidthFB
    \advance\leftmarginFB by \labelsep
    \bbl@for\FB@dp {1, 2, 3, 4, 5, 6}%
      {\csname leftmargin\romannumeral\FB@dp\endcsname =
         \leftmarginFB}%
    \advance\leftmargini by \listindentFB
%    \end{macrocode}
%    (v3.5q) Same `parindent’ for paragraphs in lists’ items (was null
%    as in standard lists).
%    \begin{macrocode}
    \listparindent=\parindent
  \fi
  \leftmargin=\csname leftmargin%
     \ifnum\@listdepth=\@ne i\else ii\fi\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
%    unless option \fbo{StandardListSpacing} is set, then set horizontal
%    indentations according to |\FB@listHsettings| unless option
%    \fbo{ListOldLayout} is \fbo{true} (compatibility with lists
%    up to v2.5k).
%    \begin{macrocode}
\def\FB@itemizesettings{%
    \ifFBStandardListSpacing
    \else
      \setlength{\topsep}{\z@}%
      \setlength{\partopsep}{\z@}%
      \FB@parskip=\parskip
      \addtolength{\topsep}{-\FB@parskip}%
      \addtolength{\partopsep}{\FB@parskip}%
      \setlength{\itemsep}{\z@}%
      \setlength{\parsep}{\z@}%
      \ifdim\FB@parskip>0pt
        \setlength{\parsep}{\FB@parskip}%
        \addtolength{\itemsep}{-\FB@parskip}%
      \fi
    \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 LaTeX classes (see \file{ltlists.dtx}),
%    spaces are customised by |\FB@itemizesettings|.
%
%    \begin{macrocode}
\def\itemizeFB{%
    \ifnum \@itemdepth >\thr@@\@toodeep\else
      \advance\@itemdepth by \@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\setlabelitemsFB{%
  \let\labelitemi\Frlabelitemi
  \let\labelitemii\Frlabelitemii
  \let\labelitemiii\Frlabelitemiii
  \let\labelitemiv\Frlabelitemiv
  \ifdim\labelwidthFB<\z@
    \settowidth{\labelwidthFB}{\FrenchLabelItem}%
  \fi
}
\def\setlistindentFB{%
  \ifdim\labelindentFB<\z@
    \ifdim\parindent=\z@
      \setlength{\labelindentFB}{1.5em}%
    \else
      \setlength{\labelindentFB}{\parindent}%
    \fi
  \fi
  \ifdim\listindentFB<\z@
    \ifdim\parindent=\z@
      \setlength{\listindentFB}{1.5em}%
    \else
      \setlength{\listindentFB}{\parindent}%
    \fi
  \fi
  \ifdim\descindentFB<\z@
    \ifFBListItemsAsPar
      \setlength{\descindentFB}{\labelindentFB}%
    \else
      \setlength{\descindentFB}{\listindentFB}%
    \fi
  \fi
}
%    \end{macrocode}
%
% \begin{macro}{\enumerateFB}
%    The definition of |\enumerateFB|, new to version~2.6a, follows
%    the one of |\enumerate| in standard LaTeX 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 by \@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}{Added \cs{listindentFB} to
%    \cs{itemindent}.  Suggested by Denis Bitouzé.}
%
% \changes{v3.2d}{2014/07/01}{Changed \cs{listindentFB} to
%    \cs{descindentFB} which defaults to \cs{listindentFB}.
%    \cs{leftmargini} reduced when \cs{descindentFB} is null.}
%
% \changes{v3.5a}{2018/07/04}{ListItemsAsPar option taken into account
%    for description lists.}
%
%    Same tuning for the \env{description} environment (see
%    \file{classes.dtx} for the original definition).
%    Customisable dimen |\descindentFB|, which defaults to
%    |\listindentFB|, is added to |\itemindent| (first level only).
%    When |\descindentFB=0pt| (1rst level labels start at the left
%    margin), |\leftmargini| is reduced to |\listindentFB| instead
%    of |\listindentFB| + |\leftmarginFB|.
%
%    When option \fbo{ListItemsAsPar} is turned to \fbo{true}, the
%    \env{description} items are also displayed as paragraphs;
%    |\descindentFB=0pt| can be used to push labels to the left margin.
%    \begin{macrocode}
\def\descriptionFB{%
      \list{}{\FB@listHsettings
              \labelwidth=\z@
              \ifFBListItemsAsPar
                \itemindent=\descindentFB
              \else
                \itemindent=-\leftmargin
                \ifnum\@listdepth=\@ne
                  \ifdim\descindentFB=\z@
                    \ifdim\listindentFB>\z@
                      \leftmargini=\listindentFB
                      \leftmargin=\leftmargini
                      \itemindent=-\leftmargin
                    \fi
                  \else
                    \advance\itemindent by \descindentFB
                  \fi
                \fi
              \fi
              \let\makelabel\descriptionlabel}%
}
\let\enddescriptionFB\endlistORI
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\update@frenchlists}
% \begin{macro}{\bbl@frenchlistlayout}
%    |\update@frenchlists| will set up lists according to the final
%    options (default or part of \fbsetup{} eventually overruled in
%    |\FBprocess@options|).
%    \begin{macrocode}
\def\update@frenchlists{%
  \setlistindentFB
  \ifFBStandardListSpacing
  \else \let\list\listFB \fi
  \ifFBStandardItemizeEnv
  \else \let\itemize\itemizeFB \fi
  \ifFBStandardItemLabels
  \else \setlabelitemsFB \fi
  \ifFBStandardEnumerateEnv
  \else \let\enumerate\enumerateFB \let\description\descriptionFB \fi
}
%    \end{macrocode}
%
% \changes{v3.2h}{2017/02/03}{Execute \cs{update@frenchlists} only
%    if GlobalLayoutFrench is false.
%    Delete stuff for lists in \cs{noextrasfrench}.}
%
%    If \fbo{GlobalLayoutFrench=true}, nothing has to be done at
%    language’s switches regarding lists.  Otherwise, |\extrasfrench|
%    saves the standard settings for lists and then executes
%    |\update@frenchlists|. In both cases, there is nothing to do for
%    lists in |\noextrasfrench|.
%
%    In order to ensure compatibility with packages customising lists,
%    the command |\update@frenchlists| should not be included in the
%    first call to |\extrasfrench| which occurs \emph{before} the
%    relevant flags are finally set, so we define |\FB@ufl| as
%    |\relax|, it will be redefined later `AtBeginDocument’ by
%    |\FBprocess@options| as |\update@frenchlists|,
%    see p.~\pageref{FB@ufl}.
%
%    Lists’ layout changes at language switches only if
%    |GlobalLayoutFrench=false|.
%    \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
    \FB@ufl
  \fi
}
\addto\extrasfrench{\bbl@frenchlistlayout}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%  \subsection{French indentation of sections}
%  \label{ssec-indent}
%
% \begin{macro}{\bbl@frenchindent}
%    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.}
%
% \changes{v3.5n}{2022/04/18}{\cs{bbl@frenchindent} changed.
%    \cs{bbl@nonfrenchindent} removed.}
%
%    Indentation changes at language switches in only two cases:\\
%    a) |GlobalLayoutFrench=false|,\\
%    b) |IndentFirst=true| and French isn’t the main language.
%
%    \begin{macrocode}
\def\bbl@frenchindent{%
  \ifFBGlobalLayoutFrench\else\babel@save\@afterindentfalse\fi
  \ifFBIndentFirst
    \ifFB@mainlanguage@FR\else\babel@save\@afterindentfalse\fi
    \let\@afterindentfalse\@afterindenttrue
    \@afterindenttrue
  \fi}
\addto\extrasfrench{\bbl@frenchindent}
%    \end{macrocode}
% \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.}
%
%    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!).
%
% \changes{v2.4a}{2009/11/23}{\cs{PackageWarning} changed to
%    \cs{PackageInfo} (when bigfoot package in use).}
%
% \begin{macro}{\@makefntextFB}
%    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), right aligned on
%    |\parindentFFN| and followed by a dot and an half quad kern.
%    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).}
%
% \changes{v3.2a}{2016/03/14}{beamer.cls requires a specific
%    definition of \cs{@makefntextFB} (pointed out by DB).
%    The same is true for memoir and koma-script classes (done).}
%
%    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}
\newdimen\parindentFFN
\parindentFFN=10in
%    \end{macrocode}
%    |\FBfnindent| will be set `AtBeginDocument’ to the width of
%    the box holding the footnote mark, |\dotFFN| and |\kernFFN|
%    (flushed right).  It is used by \cls{memoir} and koma-script
%    classes.
%    \begin{macrocode}
\newcommand*{\dotFFN}{.}
\newcommand*{\kernFFN}{\kern .5em}
\newdimen\FBfnindent
%    \end{macrocode}
%    |\@makefntextFB|’s definition depends on the document’s class.
%
%    Koma-script classes: they provide |\deffootnote|, a handy command
%    to customise the footnotes’ layout (see English manual
%    \file{scrguien.pdf}); it redefines |\@makefntext| and
%    |\@@makefnmark|.  First, save the original definitions.
%    \begin{macrocode}
\ifFB@koma
  \let\@makefntextORI\@makefntext
  \let\@@makefnmarkORI\@@makefnmark
%    \end{macrocode}
%    |\@makefntextFB| and |\@@makefnmarkFB| are used when option
%    \fbo{FrenchFootnotes} is \fbo{true}.
%    \begin{macrocode}
  \deffootnote[\FBfnindent]{0pt}{\parindentFFN}%
              {\thefootnotemark\dotFFN\kernFFN}
  \let\@makefntextFB\@makefntext
  \let\@@makefnmarkFB\@@makefnmark
%    \end{macrocode}
%    |\@makefntextTH| and |\@@makefnmarkTH| are meant for the
%    |\thanks| command used by |\maketitle| when \fbo{FrenchFootnotes}
%    is \fbo{true}.
%    \begin{macrocode}
  \deffootnote[\parindentFFN]{0pt}{\parindentFFN}%
              {\textsuperscript{\thefootnotemark}}
  \let\@makefntextTH\@makefntext
  \let\@@makefnmarkTH\@@makefnmark
%    \end{macrocode}
%    Restore the original definitions.
%    \begin{macrocode}
  \let\@makefntext\@makefntextORI
  \let\@@makefnmark\@@makefnmarkORI
\fi
%    \end{macrocode}
%    Definitions for the \cls{memoir} class:
%    \begin{macrocode}
\@ifclassloaded{memoir}
%    \end{macrocode}
%    (see original definition in \file{memman.pdf})
%    \begin{macrocode}
   {\newcommand{\@makefntextFB}[1]{%
      \def\footscript##1{##1\dotFFN\kernFFN}%
      \setlength{\footmarkwidth}{\FBfnindent}%
      \setlength{\footmarksep}{-\footmarkwidth}%
      \setlength{\footparindent}{\parindentFFN}%
      \makefootmark #1}%
   }{}
%    \end{macrocode}
%    Definitions for the \cls{beamer} class:\par
%    the original definition is in
%    \file{beamerbaseframecomponents.sty}, note that for the
%    \cls{beamer} class footnotes are LR-boxes, not paragraphs,
%    so |\parindentFFN| is irrelevant.
%
% \changes{v3.2h}{2016/04/09}{With beamer.cls, add \cs{llap} to
%    \cs{@thefnmark} for notes numbered over 99.}
%
%    \begin{macrocode}
\@ifclassloaded{beamer}
   {\def\@makefntextFB#1{%
      \def\insertfootnotetext{#1}%
      \def\insertfootnotemark{\insertfootnotemarkFB}%
      \usebeamertemplate***{footnote}}%
    \def\insertfootnotemarkFB{%
      \usebeamercolor[fg]{footnote mark}%
      \usebeamerfont*{footnote mark}%
      \llap{\@thefnmark}\dotFFN\kernFFN}%
   }{}
%    \end{macrocode}
%
%    Now the default definition of |\@makefntextFB| for standard LaTeX
%    and AMS classes.
%    The next command prints the footnote mark according to the
%    specifications of the French `Imprimerie Nationale’.
%    Keep in mind that |\@thefnmark| might be empty (i.e.\ in
%    AMS classes’ titles)!
%    \begin{macrocode}
\providecommand*{\insertfootnotemarkFB}{%
  \parindent=\parindentFFN
  \rule\z@\footnotesep
  \setbox\@tempboxa\hbox{\@thefnmark}%
  \ifdim\wd\@tempboxa>\z@
    \llap{\@thefnmark}\dotFFN\kernFFN
  \fi}
\providecommand\@makefntextFB[1]{\insertfootnotemarkFB #1}
%    \end{macrocode}
% \end{macro}
%
%    The rest of |\@makefntext|’s customisation will be done at
%    the |\begin{document}|: saving the original definition of
%    |\@makefntext|, then redefining |\@makefntext| according
%    to the value of flag |\ifFBFrenchFootnotes| (true or false).
%
% \begin{macro}{\@footnotemark}
%
% \changes{v3.6a}{2024/05/13}{Allow customisation of the space added
%    in \cs{\@footnotemarkFB}.}
%
%    We will save the original definition of |\@footnotemark| at the
%    |\begin{document}| in order to include any customisation that
%    packages might have done; we define a variant |\@footnotemarkFB|
%    which just adds a (customisable) thin space before the number or
%    symbol calling a footnote (any space typed in is removed first).
%    The choice between the two definitions (valid for the whole
%    document) is controlled by flag |\ifFBAutoSpaceFootnotes|.
%
%    |\@footnotemark|’s customisation: let’s define a customisable
%    thin space which will be added before footnote’s call by
%    |\@footnotemarkFB|.
%    \begin{macrocode}
\newcommand*{\FBfnmarkspace}{\kern .5\fontdimen2\font}
\def\@footnotemarkFB{\leavevmode\unskip\unkern
                     \protect\FBfnmarkspace\@footnotemarkORI}%
%    \end{macrocode}
% \end{macro}
%
% \changes{v2.0b}{2007/04/18}{Footnotes: Just do nothing
%    (except warning) when the bigfoot package is loaded.}
%
% \changes{v3.3c}{2017/07/28}{Reset \cs{localleftbox} locally
%    inside \cs{@makefntext}.  Needed by \cs{frquote} with LuaTeX.}
%
% \changes{v3.5b}{2018/07/17}{Reset \cs{FBeverypar@quote} locally
%    inside \cs{@makefntext}.  Needed by \cs{frquote}.}
%
% \changes{v3.5c}{2018/09/13}{Remove grouping inside \cs{@makefntext},
%    \cs{localleftbox} and \cs{FBeverypar@quote} saved and restored
%    instead.}
%
% \changes{v3.5s}{2024/01/05}{Footnotes: no customising of
%    \cs{@footnotetext} when the footnotebackref package is loaded.
%    Just warn the user.}
%
%    Switching between French or Standard layout for footnotes is done
%    `AtBeginDocument’.
%    The LuaTeX command |\localleftbox| and |\FBeverypar@quote| used
%    by |\frquote{}| have to be reset inside footnotes; done for LaTeX
%    based formats only.
%    \begin{macrocode}
\providecommand\localleftbox[1]{}
\AtBeginDocument{%
%    \end{macrocode}
%    When the \pkg{footnotebackref} package is loaded, \frenchb{}
%    will not customise |\@footnotetext| in order to keep back
%    referencing working.
%    \begin{macrocode}
  \@ifpackageloaded{footnotebackref}%
      {\FBFrenchFootnotesfalse
       \PackageWarning{french.ldf}%
          {footnotebackref package loaded.\MessageBreak
           babel-french will NOT customise footnotes;%
           \MessageBreak reported}}%
      {}%
%    \end{macrocode}
%    The \pkg{bigfoot} package deeply changes the way footnotes are
%    handled.  When \file{bigfoot} is loaded, we just warn the user
%    that \frenchb{} will not customise footnotes at all.
%    \begin{macrocode}
   \@ifpackageloaded{bigfoot}%
      {\PackageWarning{french.ldf}%
          {bigfoot package in use.\MessageBreak
           babel-french will NOT customise footnotes;%
           \MessageBreak reported}}%
%    \end{macrocode}
%    Otherwise, footnotes may be customised according to the
%    \fbsetup{} options.
%    \begin{macrocode}
      {\let\@footnotemarkORI\@footnotemark
       \ifFBAutoSpaceFootnotes
         \let\@footnotemark\@footnotemarkFB
       \fi
       \ifdim\parindentFFN<10in
       \else
         \parindentFFN=\parindent
         \ifdim\parindentFFN<1.5em \parindentFFN=1.5em \fi
       \fi
       \settowidth{\FBfnindent}{\dotFFN\kernFFN}%
       \addtolength{\FBfnindent}{\parindentFFN}%
       \let\@makefntextORI\@makefntext
%    \end{macrocode}
%    Koma-script classes require a special treatment.\par
%    Definition of |\@makefntext| for koma-script classes: running
%    \@makefntextORI inside a group to reset |\localleftbox{}| and
%    |\FBeverypar@quote| would mess up the layout of footnotes whenever
%    the first manadatory argument of |\deffootnote{}| (used as
%    |\leftskip|) is non-nil (default is 1em, 0pt in French).
%    \begin{macrocode}
       \ifFB@koma
         \let\@@makefnmarkORI\@@makefnmark
         \long\def\@makefntext#1{%
           \localleftbox{}%
           \let\FBeverypar@save\FBeverypar@quote
           \let\FBeverypar@quote\relax
           \ifFBFrenchFootnotes
             \ifx\footnote\thanks
               \let\@@makefnmark\@@makefnmarkTH
               \@makefntextTH{#1}
             \else
               \let\@@makefnmark\@@makefnmarkFB
               \@makefntextFB{#1}
             \fi
           \else
             \let\@@makefnmark\@@makefnmarkORI
             \@makefntextORI{#1}%
           \fi
           \let\FBeverypar@quote\FBeverypar@save
           \localleftbox{\FBeveryline@quote}}%
       \else
%    \end{macrocode}
%    Special add-on for the \cls{memoir} class: |\@makefntext| is
%    redefined as |\makethanksmark| by |\maketitle|, hence these
%    settings to match the other notes’ vertical alignment.
%    \begin{macrocode}
         \@ifclassloaded{memoir}%
            {\ifFBFrenchFootnotes
               \setlength{\thanksmarkwidth}{\parindentFFN}%
               \setlength{\thanksmarksep}{-\thanksmarkwidth}%
             \fi
            }{}%
%    \end{macrocode}
%    Special add-on for the \cls{beamer} class: issue a warning
%    in case |\parindentFFN| has been changed.
%    \begin{macrocode}
         \@ifclassloaded{beamer}%
            {\ifFBFrenchFootnotes
               \ifdim\parindentFFN=1.5em\else
                 \FBWarning{%
                    \protect\parindentFFN\space is ineffective%
                    \MessageBreak within the beamer class.%
                    \MessageBreak Reported}%
               \fi
             \fi
            }{}%
%    \end{macrocode}
%    Definition of |\@makefntext| for all other classes:
%    \begin{macrocode}
         \long\def\@makefntext#1{%
           \localleftbox{}%
           \let\FBeverypar@save\FBeverypar@quote
           \let\FBeverypar@quote\relax
           \ifFBFrenchFootnotes
             \@makefntextFB{#1}%
           \else
             \@makefntextORI{#1}%
           \fi
           \let\FBeverypar@quote\FBeverypar@save
           \localleftbox{\FBeveryline@quote}}%
       \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.}
%
% \changes{v3.1h}{2015/08/19}{french.cfg from e-french conflicts with
%    babel-french. Do NOT load it (no need for .cfg files with
%    babel-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. |\loadlocalcfg|
%    is redefined locally in order not to load any \file{.cfg} file for
%    French.
%    \begin{macrocode}
\FBclean@on@exit
\ldf@finish\CurrentOption
\let\loadlocalcfg\FB@llc
%</french>
%    \end{macrocode}
%
% \subsection[Files \file{frenchb.ldf}, \file{francais.ldf},
%                  \file{canadien.ldf} and \file{acadian.ldf}]%
%            {Files \file{frenchb.ldf}, \file{francais.ldf},
%                    \file{canadien.ldf} and\\  \file{acadian.ldf}}
%
% \changes{v3.3b}{2017/06/28}{Generate portmanteau files
%    \file{acadian.ldf}, \file{canadien.ldf}, \file{frenchb.ldf},
%    and \file{francais.ldf} and warn about deprecated options.}
%
%    Babel now expects a \file{\meta{lang}.ldf} file for each
%    \meta{lang}.
%    So we create portmanteau \file{.ldf} files for options
%    \texttt{canadien}, \texttt{francais}, \texttt{frenchb} and
%    \texttt{acadian}.  These files themselves only load
%    \file{french.ldf} which does the real work.
%    Warn users about options \opt{canadien}, \opt{frenchb} and
%    \opt{francais} being deprecated and force recommended options
%    \opt{acadian} or \opt{french}.
%    \begin{macrocode}
%<*acadian>
\PackageInfo{acadian.ldf}%
  {`acadian' dialect is currently\MessageBreak
   *absolutely identical* to the\MessageBreak
   `french' language; reported}
%</acadian>
%<*canadien>
\PackageWarning{canadien.ldf}%
  {Option `canadien' for Babel is *deprecated*,\MessageBreak
   it might be removed sooner or later.  Please\MessageBreak
   use `acadian' instead; reported}%
\def\CurrentOption{acadian}
%    \end{macrocode}
% \changes{v3.5f}{2019/09/04}{\cs{selectlanguage}\{canadien\}
%    allowed again only for backward compatibility (deprecated).}
%    \begin{macrocode}
\def\datecanadien{\dateacadian}
\def\captionscanadien{\captionsacadian}
\def\extrascanadien{\extrasacadian}
\def\noextrascanadien{\noextrasacadian}
%</canadien>
%<*francais>
\PackageWarning{francais.ldf}%
  {Option `francais' for Babel is *deprecated*,\MessageBreak
   it might be removed sooner or later.  Please\MessageBreak
   use `french' instead; reported}%
\chardef\l@francais\l@french
\def\CurrentOption{french}
%</francais>
%    \end{macrocode}
%    Compatibility code for \babel{} pre-3.13: \file{frenchb.ldf}
%    could be loaded with options \opt{acadian}, \opt{canadien},
%    \opt{frenchb} or \opt{francais}.
%    \begin{macrocode}
%<*frenchb>
\def\bbl@tempa{frenchb}
\ifx\CurrentOption\bbl@tempa
  \chardef\l@frenchb\l@french
  \def\CurrentOption{french}
  \PackageWarning{babel-french}%
    {Option `frenchb' for Babel is *deprecated*,\MessageBreak
     it might be removed sooner or later.  Please\MessageBreak
     use `french' instead; reported}
\else
  \def\bbl@tempa{francais}
  \ifx\CurrentOption\bbl@tempa
    \chardef\l@francais\l@french
    \def\CurrentOption{french}
%    \end{macrocode}
%    Plain formats: no warning when \file{francais.sty} loads
%    \file{frenchb.ldf} (\babel{} pre-3.13).
%    \begin{macrocode}
    \ifx\magnification\@undefined
      \PackageWarning{babel-french}%
        {Option `francais' for Babel is *deprecated*,\MessageBreak
         it might be removed sooner or later.  Please\MessageBreak
         use `french' instead; reported}
    \fi
  \else
    \def\bbl@tempa{canadien}
    \ifx\CurrentOption\bbl@tempa
      \def\CurrentOption{acadian}
      \PackageWarning{babel-french}%
        {Option `canadien' for Babel is *deprecated*,\MessageBreak
         it might be removed sooner or later.  Please\MessageBreak
         use `acadian' instead; reported}
    \fi
  \fi
\fi
%</frenchb>
%<acadian|canadien|frenchb|francais>\input french.ldf\relax
%<acadian|canadien>\let\extrasacadian\extrasfrench
%<acadian|canadien>\let\noextrasacadian\noextrasfrench
%<acadian|canadien|frenchb|francais|french>\endinput
%    \end{macrocode}
%
% \Finale
%
\endinput

%%% Local Variables:
%%% fill-column: 72
%%% coding: utf-8
%%% mode: doctex
%%% TeX-engine: luatex
%%% End:
