% \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{french3.ldf}{\from{frenchb3.dtx}{french}}
          \file{acadian.ldf}{\from{frenchb3.dtx}{acadian}}
          \file{canadien.ldf}{\from{frenchb3.dtx}{canadien}}
          \file{frenchb.ldf}{\from{frenchb3.dtx}{frenchb}}
          \file{francais.ldf}{\from{frenchb3.dtx}{francais}}
         }
\def\MetaPrefix{-- }
\endbatchfile
%</batch>
%<*gobble>
\fi
\expandafter\ifx\csname @currname\endcsname\empty
\csname fi\endcsname
%</gobble>
%
%<french>\ProvidesLanguage{french}
%<acadian>\ProvidesLanguage{acadian}
%<canadien>\ProvidesLanguage{canadien}
%<francais>\ProvidesLanguage{francais}
%<frenchb>\ProvidesLanguage{frenchb}
%
%<*dtx>
\ProvidesFile{frenchb3.dtx}
%</dtx>
         [2025-06-28 v3.7a French support from the babel system]
%<*dtx|french>
%%
%%  Babel package for LaTeX version 2e
%%  Copyright © 1996-2025
%%            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=UA-2, pdfversion=2.0, lang=en}
\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{Xe-LaTeX}
\lefthyphenmin=2 \righthyphenmin=3
\setlength{\parindent}{0pt}
\RecordChanges
\AtEndDocument{%
   \clearpage
   \section{Change History}%
   \GlossaryPrologue{}%
   Changes listed in reverse order (latest first) since~v3.3 (2018).
   \PrintChanges
}
\begin{document}
\GetFileInfo{frenchb3.dtx}
\begin{center}
  \textbf{\Large A Babel language definition file for French}\\[2mm]^^A\]
  \textbf{\large frenchb3.dtx \fileversion, \filedate}\\[3mm]^^A\]
  Daniel Flipo\\
  \texttt{daniel.flipo@free.fr}
\end{center}
\vspace{2\baselineskip}
\thispagestyle{empty}
\tableofcontents
\clearpage
\DocInput{frenchb3.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 3.7a\ and was last revised on
%    2025/05/25.}, 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.
%
%    Starting with version 4.0a, the development of \frenchb{} is split
%    into to parts: the (legacy) part ``frenchb3’’ meant for TeX pdfTeX
%    and XeTeX which is frozen except for bug corrections and the
%    (active) part ``frenchb’’ meant for LuaTeX.
%
%    \begin{center}
%      \fbox{\parbox{.75\textwidth}{\centering\Large\bfseries
%            This file \file{frenchb3.dtx} is for eTeX,\\
%            pdfTeX and XeTeX only.\\
%            See file \file{frenchb.dtx} for LuaTeX.}%
%           }
%    \end{center}
%
%    \frenchb{} has been improved using helpful suggestions from many
%    people, mainly from Jacques André, Michel Bovani, Thierry Bouche,
%    Vincent Jalby, Denis Bitouzé, Thomas Savary, Ulrike Fisher and
%    Marcel Krüger.  Thanks to all of them!
%
%    LaTeX-2.09 is no longer supported.
%    \frenchb{} is designed to be used only with LaTeX2e and
%    Plain formats based on LuaTeX or XeTeX engines.
%
%    Changes between version 3.3 (2018) and 3.7 are listed in
%    subsection~\ref{ssec-changes} p.~\pageref{ssec-changes}.
%
%    An extensive documentation in French (file \file{frenchb3-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!}
%
%    \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 `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.
%      The inner quotation is surrounded by double quotes
%      (``\textit{texte}’’) unless option \fbo{InnerGuillSingle=true}
%      is selected 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}.
%
%      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 [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),
%      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}|
%      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 [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{\emph{Do not} code
%         \texttt{«\textasciitilde{}guillemets\textasciitilde{}»}.}
%      (with or without spaces) to get properly typeset French quotes.
%      This option works with 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
%      when \fbo{InnerGuillSingle=true} (see below). \hlabel{everyparguill}
%
%    \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}|.
%    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.7?}
%
%    The \opt{acadian} dialect is no longer supported:
%    coding |\usepackage[acadian]{babel}| prints a warning
%    and uses \opt{french} instead. Reason: I have never got feedback
%    from anybody using them; anyway \frenchb{} is customisable enough to
%    fit any French dialect, see |\fbsetup{}| p.\pageref{ssec-keyval}.
%
%    \frenchb{} has been split into two files \file{frenchb3.dtx} (this
%    file) the legacy part which is frozen, meant for TeX, pdfTeX and XeTeX
%    engines \emph{only}, and \file{frenchb.dtx} meant for LuaTeX.
%
%    Option \opt{GlobalLayoutFrench} has been deleted: it doesn't make sense
%    to change the lists' layout at language switches.
%
%    \textbf{Note on PDF tagging:} this project requires a complete
%    redesign of lists based on templates. The new lists templates,
%    still experimental, are incompatible with \frenchb{} lists’
%    customisation, which is consequently disabled when tagging is
%    enabled.  A warning is issued in the \file{.log}.
%    See \url{https://github.com/latex3/tagging-project/issues/694}
%    for more information.
%    I plan to get \frenchb{} lists’ customisation working again asap
%    (hopefully with the next LaTeX release 2025/10/01).
%
%  \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.
%
%    A new command |\FBsetspaces| has been added for easy customising of
%    spacing before high punctuation and inside quotes, 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.
%
%    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.  The only recommended
%    option is \opt{french} all other are deprecated.
%
%    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|.
%
%    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, 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(french3.ldf) }%
      \errhelp{#2}\errmessage{\\#1^^J}%
    \endgroup}
\def\fb@warning#1{%
   \begingroup
      \newlinechar=`\^^J
      \def\\{^^J(french3.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 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}
%
%    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@@}
%    \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{french3.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}{\ifFBXeTeX}
%\begin{macro}{\ifFBunicode}
%    French hyphenation patterns are now coded in Unicode, see file
%    \file{hyph-fr.tex}.  XeTeX and LuaTeX engines require some extra
%    code to deal with the French ``apostrophe’’.
%    Let’s define a new `if’: |\ifFBunicode| which will be true for
%    the XeTeX engine and false for 8-bits engines. |\ifFBXeTeX| is
%    kept for backward compatibility only.
%
% \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\ifFBXeTeX
\newif\ifFBunicode
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname XeTeXrevision\endcsname\relax
\else
  \FBunicodetrue \FBXeTeXtrue
\fi
%    \end{macrocode}
% \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}.}
%
% \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 XeTeX, and 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.  XeTeX provides `XeTeXinterchar’ as an
%    alternative to active characters.
%
% \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@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.
%    |\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.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\footnote{%
%    The former optional \opt{lang} argument no longer has any effect.}:
%    the first one is a \textit{string} either "guill", "colon", or
%    "thin", the last three are decimal numbers specifying
%    \textit{width}, \textit{stretch} and \textit{shrink} relative to
%    the relevant \textit{fontdimens}.\hlabel{FBsetspaces}
%    For instance |\FBsetspaces{colon}{0.5}{0}{0}| defines
%    |\FBcolonspace| as a thinspace as suggested by the
%    ``Guide du typographe Roman’’.
%    \begin{macrocode}
\ifLaTeXe
  \newcommand*{\FBsetspaces}[5][french]{%
    \@namedef{FB#2space}{\hskip #3\fontdimen2\font
                           plus #4\fontdimen3\font
                          minus #5\fontdimen4\font \relax}}%
  \@onlypreamble\FBsetspaces
\fi
%    \end{macrocode}
% \end{macro}
%
% \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.
%    \begin{macrocode}
\newif\ifFB@spacing \FB@spacingtrue
%    \end{macrocode}
%
%  \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}
\newif\ifFB@og@fg@xetex
\ifFB@xetex@punct
  \ifLaTeXe
    \PackageInfo{french3.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
     \AddToHook{env/document/before}{%
       \@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*}).}
%
% \changes{v3.7a}{2025/06/18}{\cs{XeTeXcharclass}(es) of French double
%    quotes are set in \cs{FB@xetex@punct@french} if options og=« and/or
%    fg=» have been selected.}
%
%    \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}
%    Assign classes related to French double quotes if options
%    \fbo{og=«, fg=»} have been selected.
%    \begin{macrocode}
    \ifFB@og@fg@xetex
      \XeTeXcharclass"13   = \FB@guilo
      \XeTeXcharclass"14   = \FB@guilf
      \XeTeXcharclass"AB   = \FB@guilo
      \XeTeXcharclass"BB   = \FB@guilf
      \XeTeXcharclass"A0   = \FB@guilnul
      \XeTeXcharclass"202F = \FB@guilnul
    \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}%
    \ifFB@og@fg@xetex
      \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}%
    \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 both 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,
%    while |\noautospace@beforeFDP| makes them no-op.
%    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{%
  \def\FDP@thinspace{\penalty\@M\FBthinspace}%
  \def\FDP@colonspace{\penalty\@M\FBcolonspace}}
\def\noautospace@beforeFDP{%
  \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 flag \cs{ifFB@spacing}.}
%
%    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@spacingfalse \ttfamilyORI}
  \DeclareRobustCommand\rmfamilyFB{\FB@spacingtrue  \rmfamilyORI}
  \DeclareRobustCommand\sffamilyFB{\FB@spacingtrue  \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, pdfTeX 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@spacingfalse
                  \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 |\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}
%
% \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.
%    With XeTeX, |\ifFB@spacing| is set to |false| locally
%    to prevent the quotes characters from adding space when
%    option \fbo{og=«, fg=»} is set.
%    \begin{macrocode}
\newcommand*{\FB@guillspace}{\penalty\@M\FBguillspace}
\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}
%
% \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…
%
% \changes{v3.7a}{2024/08/19}{Flag \cs{ifFBcloseguill} does not apply
%    to \cs{@fgii}.}
%
%    \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}{\ifFBInnerGuillSingle
                      \guilsinglleft\FB@guillspace
                    \else \textquotedblleft
                    \fi}
\newcommand*{\fgii}{\ifFBInnerGuillSingle
                      \ifdim\lastskip>\z@\unskip\fi
                      \FB@guillspace\guilsinglright
                    \else \textquotedblright
                    \fi}
\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.
%     We eventually need to redefine |\FBeverypar@quote|
%    for level 2 quotations:
%
%    \changes{v3.5c}{2018/09/14}{\cs{FBeverypar@quote}’s value now properly
%    reset across level changes.}
%
%    \begin{macrocode}
    \let\FBeverypar@quote\relax
    \ifFBInnerGuillSingle
      \ifx\FBeveryparguill\FBguillopen
        \def\FBeverypar@quote{\guilsinglleft\FB@guillspace}%
      \fi
    \fi
    \ifx\FBeveryparguill\FBguillclose
          \def\FBeverypar@quote{\guilsinglright\FB@guillspace}%
    \fi
    \@ogii #1\@fgii
  \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{french3.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
  \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).
%    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.}
%
%    \begin{macrocode}
\StartBabelCommands*{french}{date}
    [unicode, fontenc=TU EU1 EU2, charset=utf8]
  \SetString\monthiiname{février}
  \SetString\monthviiiname{août}
  \SetString\monthxiiname{décembre}
\StartBabelCommands*{french}{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}
%    \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  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}
%    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 \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.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
\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}
\let\dec@m@c\relax
%    \end{macrocode}
%    If |\DecimalMathComma| is issued in the document body
%    (when the current language is French) 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{french3.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{french3.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}
%
%    Cleanup and exit without loading any \file{.cfg} file
%    in case of Plain formats.
%
%    \begin{macrocode}
\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}
\AddToHook{env/document/before}{%
  \@FBpreamblefalse
  \@ifpackageloaded{icomma}%
     {\FB@icommatrue
      \if@preamble@DecimalMathComma
        \PackageWarning{french3.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}%
      \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}%
     }%
  }
%    \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{french3.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.
%
% \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.}
%
%    New implementation for caption names (requires \babel’s~3.10 or
%    newer).
%    \begin{macrocode}
\StartBabelCommands*{french}{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*{french}{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| 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}
%
% \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{french3.ldf}| which
%    can be made silent by option \fbo{SuppressWarning}.
%    \begin{macrocode}
\newcommand{\FBWarning}[1]{\PackageWarning{french3.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 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}.}
%
%    Check the definition of |\@makecaption| (|\AtBeginDocument|,
%    \pkg{caption3} compatibility), 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.
%
% \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}
      {\AddToHook{env/document/before}{%
         \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
\AddToHook{env/document/before}{%
   \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}
\AddToHook{env/document/before}{%
   \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\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}
\newif\ifFB@mainlanguage@FR
\AtEndOfPackage{%
  \ifx\bbl@main@language\FB@french \FB@mainlanguage@FRtrue \fi
  \ifFB@mainlanguage@FR
    \@ifclassloaded{beamer}%
      {\PackageInfo{french3.ldf}{%
          No list customisation for the beamer class,%
          \MessageBreak reported}}%
      {\@ifpackageloaded{beamerarticle}%
         {\FBStandardItemLabelsfalse
          \FBStandardListSpacingfalse
          \PackageInfo{french3.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}          ,
    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}           ,
    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.}
%
% \changes{v3.7a}{2025/06/28}{Option GlobalLayoutFrench deleted.}
%
%    \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{french3.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*{\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}%
   \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
  }
%    \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 XeTeX engines: we just have to
%    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 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}
%    With the XeTeX engine, French guillemets will have their
%    |\XeTeXcharclass|(es) set in |\extrasfrench| according to this flag.
%    \begin{macrocode}
     \FB@og@fg@xetextrue
   \else
%    \end{macrocode}
%    This is for conventional TeX engines:
%    \begin{macrocode}
     \AddToHook{env/document/before}{%
        \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
     \FB@og@fg@xetextrue
   \else
     \AddToHook{env/document/before}{%
        \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| are executed by \babel{} at |\begin{document}|,
%    i.e.\ after |\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{french3.ldf}%
          {Setting StandardItemizeEnv=true for\MessageBreak
           compatibility with enumitem package,\MessageBreak
           reported}%
     \fi
     \ifFBStandardEnumerateEnv
     \else
       \FBStandardEnumerateEnvtrue
       \PackageInfo{french3.ldf}%
          {Setting StandardEnumerateEnv=true for\MessageBreak
           compatibility with enumitem package,\MessageBreak
           reported}%
     \fi}{}%
  \@ifpackageloaded{paralist}{%
     \ifFBStandardItemizeEnv
     \else
       \FBStandardItemizeEnvtrue
       \PackageInfo{french3.ldf}%
          {Setting StandardItemizeEnv=true for\MessageBreak
           compatibility with paralist package,\MessageBreak
           reported}%
     \fi
     \ifFBStandardEnumerateEnv
     \else
       \FBStandardEnumerateEnvtrue
       \PackageInfo{french3.ldf}%
          {Setting StandardEnumerateEnv=true for\MessageBreak
           compatibility with paralist package,\MessageBreak
           reported}%
     \fi}{}%
  \@ifpackageloaded{enumerate}{%
     \ifFBStandardEnumerateEnv
     \else
       \FBStandardEnumerateEnvtrue
       \PackageInfo{french3.ldf}%
          {Setting StandardEnumerateEnv=true for\MessageBreak
           compatibility with enumerate package,\MessageBreak
           reported}%
     \fi}{}%
%    \end{macrocode}
%    Lists will be customised in |\extrafrench{}| called by
%    babel later,\\ (|\AtBeginDocument{}|).
%    \begin{macrocode}
  \ifFB@mainlanguage@FR
  \else
    \ifFBStandardItemizeEnv
    \else
      \PackageWarning{french3.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 controlled by the values of two flags
%    \fbo{FrenchFootnotes} and \fbo{AutoSpaceFootnotes};
%    see section~\ref{ssec-footnotes} for the definition of
%    |\FBfootnote@switch|.
%    \begin{macrocode}
  \FBfootnote@switch
%    \end{macrocode}
%    Option \fbo{SmallCapsFigTabCaptions}:
%    |\figurename| and |\tablename| are printed in small caps (in French
%    \emph{only}), unless either \fbo{SmallCapsFigTabCaptions} is set to
%    \fbo{false} or a class or package loaded defines |\FBfigtabshape|
%    as |\relax|.
%    As |\figurename| and |\tablename| should not include font commmands,
%    we use |\fnum@figure| and |\fnum@table| when available (not in
%    beamer.cls f.i.).
%    \begin{macrocode}
  \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}
%    \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
     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
     og= <left quote character>, fg= <right quote character>%
     INGuillSpace [false]\MessageBreak
     EveryParGuill=open, close, none [open]\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.}
%
% \changes{v3.5k}{2020/07/30}{\cs{pdfstringdefDisableCommands}
%    dropped.}
%
%    Just before |\begin{document}|, let’s now process the remaining
%    options, either not explicitly set by \fbsetup{} or possibly
%    modified by packages loaded after \frenchb.
%    We also have to provide an |\xspace| command in case the
%    \pkg{xspace} package is not loaded.
%    \begin{macrocode}
\AddToHook{env/document/before}{%
   \providecommand*{\xspace}{\relax}%
   \FBprocess@options
%    \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@pardim
\def\FB@listVsettings{%
      \setlength{\topsep}{0.8ex plus 0.4ex minus 0.4ex}%
      \setlength{\partopsep}{0.4ex plus 0.2ex minus 0.2ex}%
      \setlength{\itemsep}{0.4ex plus 0.2ex minus 0.2ex}%
      \setlength{\parsep}{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@pardim|.
%    \begin{macrocode}
      \FB@pardim=\parskip
%    \end{macrocode}
%    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@pardim>\z@
        \addtolength{\topsep}{-\FB@pardim}%
        \addtolength{\partopsep}{\FB@pardim}%
        \setlength{\parsep}{\FB@pardim}%
        \addtolength{\itemsep}{-\FB@pardim}%
      \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 below
%    |\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}
%
%    The next function will be included in |\update@frenchlists|
%    which is exectuted in |\extrasfrench{}| `AtBeginDocument’.
%    \begin{macrocode}
\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}
%
% \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
      \FB@pardim=\parskip
      \ifdim\FB@pardim>\z@
        \setlength{\topsep}{-\FB@pardim}%
        \setlength{\partopsep}{\FB@pardim}%
        \setlength{\parsep}{\FB@pardim}%
        \setlength{\itemsep}{-\FB@pardim}%
      \else
        \setlength{\topsep}{\z@}%
        \setlength{\partopsep}{\z@}%
        \setlength{\parsep}{\z@}%
        \setlength{\itemsep}{\z@}%
      \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}
%
%    The next function will be included in |\update@frenchlists|
%    which is exectuted in |\extrasfrench{}| `AtBeginDocument’.
%    \begin{macrocode}
\def\setlabelitemsFB{%
  \let\labelitemi\Frlabelitemi
  \let\labelitemii\Frlabelitemii
  \let\labelitemiii\Frlabelitemiii
  \let\labelitemiv\Frlabelitemiv
  \ifdim\labelwidthFB<\z@
    \settowidth{\labelwidthFB}{\FrenchLabelItem}%
  \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}{\bbl@frenchlistlayout}
% \begin{macro}{\update@frenchlists}
%    |\update@frenchlists| will set up lists according to the final
%    options (default or part of \fbsetup{} eventually overruled in
%    |\FBprocess@options|).
%    \begin{macrocode}
\@ifpackageloaded{latex-lab-testphase-block}%
  {\def\update@frenchlists{%
     \FBWarning{You requested LaTeX tagging support.\MessageBreak
         Babel-french’s list customization is currently\MessageBreak
         incompatible with the new lists’ implementation\MessageBreak
         (still experimental) required to support tagging.%
         \MessageBreak Babel-french’s list customization is *DISABLED*%
         \MessageBreak when tagging is enabled (see frenchb.pdf).%
         \MessageBreak Reported
         }%
     \setlistindentFB
    }%
  }
%    \end{macrocode}
%    This is for conventionnal lists.
%    \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}.}
%
%    Nothing has to be done at language’s switches regarding lists,
%    except at the first switch in case French is the main language,
%    then lists are updated once for all.
%    There is nothing to do for lists in |\noextrasfrench|.
%
%    Lists’ layout no longer changes at language switches.
%    \begin{macrocode}
\def\bbl@frenchlistlayout{%
  \ifFB@mainlanguage@FR
    \update@frenchlists
    \let\update@frenchlists\relax
  \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 only if
%    |IndentFirst=true| and French isn’t the main language.
%
%    \begin{macrocode}
\def\bbl@frenchindent{%
  \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.}
%
%    The following command |\FBfootnote@switch| gathers the code needed
%    to switch between French or Standard layout for footnotes; it will
%    be included in command |\FBprocess@options| processed just before
%    |\begin{document}|.
%    \begin{macrocode}
\newcommand*{\FBfootnote@switch}{%
%    \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{french3.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{french3.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{%
           \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
          }%
       \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{%
           \let\FBeverypar@save\FBeverypar@quote
           \let\FBeverypar@quote\relax
           \ifFBFrenchFootnotes
             \@makefntextFB{##1}%
           \else
             \@makefntextORI{##1}%
           \fi
           \let\FBeverypar@quote\FBeverypar@save
          }%
       \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}}
%
%    Babel expects a \file{\meta{lang}.ldf} file for each
%    \meta{lang}.
%
% \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.}
%
% \changes{v3.7a}{2025/05/19}{Support for acadian dropped. The files
%    \file{acadian.ldf}, \file{canadien.ldf}, \file{frenchb.ldf} and
%    \file{francais.ldf} load \file{french.ldf} and print a warning.}
%
%    So we create portmanteau \file{.ldf} files for options
%    \texttt{canadien}, \texttt{francais}, \texttt{frenchb} and
%    \texttt{acadian}.  These files themselves only load
%    \file{french3.ldf} which does the real work.
%    Warn users about options \opt{acadien}, \opt{canadien},
%    \opt{frenchb} and \opt{francais} being deprecated and force
%    the recommended option \opt{french}.
%    \begin{macrocode}
%<*acadian>
\PackageInfo{acadian.ldf}%
  {Option 'acadian' for Babel is *deprecated*,\MessageBreak
   it might be removed sooner or later.  Please\MessageBreak
   use 'french' instead; reported}%
\chardef\l@acadian\l@french
\def\CurrentOption{french}
%</acadian>
%<*canadien>
\PackageInfo{canadien.ldf}%
  {Option 'canadien' for Babel is *deprecated*,\MessageBreak
   it might be removed sooner or later.  Please\MessageBreak
   use 'french' instead; reported}%
\chardef\l@canadien\l@french
\def\CurrentOption{french}
%</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>
%<*frenchb>
\PackageWarning{frenchb}%
    {Option `frenchb' for Babel is *deprecated*,\MessageBreak
     it might be removed sooner or later.  Please\MessageBreak
     use `french' instead; reported}
\chardef\l@frenchb\l@french
\def\CurrentOption{french}
%</frenchb>
%    \end{macrocode}
%
% \Finale
%
\endinput

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