summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/babel-french/frenchb.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-03-09 21:30:03 +0000
committerKarl Berry <karl@freefriends.org>2014-03-09 21:30:03 +0000
commit0bfe05edb117d45b0720bc4f31d89be020b9c521 (patch)
treefd9bf569935867c88e87fe5f04464d91309ed5b0 /Master/texmf-dist/source/generic/babel-french/frenchb.dtx
parent65fff2c077cb5a94b0e949b80902cf73adb4abfd (diff)
babel-french (9mar14)
git-svn-id: svn://tug.org/texlive/trunk@33133 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/generic/babel-french/frenchb.dtx')
-rw-r--r--Master/texmf-dist/source/generic/babel-french/frenchb.dtx4122
1 files changed, 2285 insertions, 1837 deletions
diff --git a/Master/texmf-dist/source/generic/babel-french/frenchb.dtx b/Master/texmf-dist/source/generic/babel-french/frenchb.dtx
index 144aa16623e..abad36efa2c 100644
--- a/Master/texmf-dist/source/generic/babel-french/frenchb.dtx
+++ b/Master/texmf-dist/source/generic/babel-french/frenchb.dtx
@@ -1,4 +1,4 @@
-%\CheckSum{2958}
+%\CheckSum{3052}
%
%\iffalse
% Tell the \LaTeX\ system who we are and write an entry on the
@@ -10,58 +10,87 @@
% from `french' to `frenchb', otherwise \cs{listfiles} prints
% no date/version information. The bug with \cs{listfiles}
% (introduced in v.~1.5!), was pointed out by Ulrike Fischer.}
-%<code>\ProvidesLanguage{frenchb}
-%\fi
+%<ldf>\ProvidesLanguage{frenchb}
%\ProvidesFile{frenchb.dtx}
- [2013/12/30 v2.6g French support from the babel system]
-%\iffalse
+%<*!lua>
+ [2014/02/28 v3.0a French support from the babel system]
+%</!lua>
+%<*internal>
+\iffalse
+%</internal>
+%<*lua>
+--
+-- File `frenchb.lua' generated from frenchb.dtx [2014/02/28 v3.0a]
+--
+-- Copyright (C) 2014 Daniel Flipo <daniel.flipo at free.fr>
+-- License LPPL: see frenchb.dtx.
+--
+%</lua>
+%<*internal>
+\fi
+%</internal>
%<*dtx>
%%
-%% File `frenchb.dtx'
+%% File `frenchb.dtx'
%</dtx>
-%<*code>
+%<*ldf>
%%
-%% File `frenchb.ldf'
-%</code>
-%<*dtx|code>
-%% Babel package for LaTeX version 2e
-%% Copyright (C) 1989 - 2013
-%% by Daniel Flipo <daniel.flipo at free.fr>
+%% File `frenchb.ldf'
+%</ldf>
+%<*dtx|ldf>
+%% Babel package for LaTeX version 2e
+%% Copyright (C) 1996 - 2014
+%% by Daniel Flipo <daniel.flipo at free.fr>
%%
-%</dtx|code>
+%</dtx|ldf>
%<*dtx>
-%% This file is part of the babel system, it provides the source
-%% code for the French language definition file.
+%% This file is part of the babel system, it provides the source
+%% code for the French language definition file.
%%
%</dtx>
%<*filedriver>
\documentclass[a4paper]{ltxdoc}
+\usepackage[left=42mm,right=42mm,top=40mm,bottom=40mm]{geometry}
\usepackage{url}
\usepackage[colorlinks,urlcolor=blue]{hyperref}
\usepackage{bookmark}
-\DeclareFontEncoding{T1}{}{}
-\DeclareFontSubstitution{T1}{lmr}{m}{n}
-\DeclareTextCommand{\guillemotleft}{OT1}{%
- {\fontencoding{T1}\fontfamily{lmr}\selectfont\char19}}
-\DeclareTextCommand{\guillemotright}{OT1}{%
- {\fontencoding{T1}\fontfamily{lmr}\selectfont\char20}}
-\newcommand*\TeXhax{\TeX hax}
+\usepackage[utf8]{inputenc}
+\usepackage{bera}
+\usepackage[pdftex,dvipsnames]{xcolor}
+\def\PrintMacroName#1{%
+ \strut\MacroFont\color{Sepia}\normalsize\string#1}
+\usepackage[expansion=true,protrusion=true]{microtype}
+\def\ColorArg{\color{PineGreen}}
\newcommand*\babel{\textsf{babel}}
-\newcommand*\langvar{$\langle \mathit lang \rangle$}
+\newcommand*\frenchb{\textsf{frenchb}}
\newcommand*\note[1]{}
\newcommand*\Lopt[1]{\textsf{#1}}
\newcommand*\file[1]{\texttt{#1}}
+\newcommand*\cls[1]{\texttt{#1}}
+\newcommand*\pkg[1]{\texttt{#1}}
+\newcommand*\fbo[1]{\texttt{\ColorArg #1}}
+\newcommand*\fbsetup[1]{\cs{frenchbsetup\{\fbo{#1}\}}}
+\renewcommand*\descriptionlabel[1]{%
+ \hspace\labelsep \normalfont \fbo{#1}}
+\providecommand*\eTeX{\leavevmode\hbox{$\varepsilon$}-\TeX}
+\hyphenation{Lua-TeX Lua-LaTeX Xe-LaTeX}
\lefthyphenmin=2 \righthyphenmin=3
\begin{document}
\setlength{\parindent}{0pt}
+\GetFileInfo{frenchb.dtx}
+\RecordChanges
\begin{center}
- \textbf{\Large A Babel language definition file for French}\\[3mm]^^A\]
- Daniel \textsc{Flipo}\\
+ \textbf{\Large A Babel language definition file for French}\\[2mm]^^A\]
+ \textbf{\large frenchb.dtx \fileversion, \filedate}\\[3mm]^^A\]
+ Daniel Flipo\\
\texttt{daniel.flipo@free.fr}
\end{center}
- \GetFileInfo{frenchb.dtx}
- \RecordChanges
- \DocInput{frenchb.dtx}
+\vspace{2\baselineskip}
+\thispagestyle{empty}
+\GlossaryPrologue{\section{{Change History}}}
+\tableofcontents
+\clearpage
+\DocInput{frenchb.dtx}
\end{document}
%</filedriver>
%\fi
@@ -74,20 +103,23 @@
% French language.
%
% Customisation for the French language is achieved following the
-% book ``Lexique des r\`egles typographiques en usage \`a
-% l'Imprimerie nationale'' troisi\`eme \'edition (1994),
+% 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 (1996/05/31) as part of
-% \babel-3.6beta.
+% First version released: 1.1 (May 1996) as part of
+% \babel-3.6beta. Version~2.0a was released in February 2007.
%
-% |frenchb| has been improved using helpful suggestions from many
-% people, mainly from Jacques Andr\'e, Michel Bovani, Thierry Bouche,
-% and Vincent Jalby. Thanks to all of them!
+% \frenchb{} has been improved using helpful suggestions from many
+% people, mainly from Jacques André, Michel Bovani, Thierry Bouche,
+% Vincent Jalby and Denis Bitouzé. Thanks to all of them!
%
-% This new version (2.x) has been designed to be used with \LaTeXe{}
-% and Plain\TeX{} formats only. \LaTeX-2.09 is no longer supported.
-% Changes between version 1.6 and \fileversion{} are listed in
+% \LaTeX-2.09 is no longer supported.
+% This new version (3.x) has been designed to be used only with
+% \LaTeXe{} and Plain formats based on TeX, pdfTeX, LuaTeX or XeTeX
+% engines.
+%
+% Changes between version 2.0 and \fileversion{} are listed in
% subsection~\ref{ssec-changes} p.~\pageref{ssec-changes}.
%
% An extensive documentation is available in French here:\\
@@ -96,63 +128,62 @@
% \subsection{Basic interface}
%
% In a multilingual document, some typographic rules are language
-% dependent, i.e.\ spaces before `double punctuation' (|:| |;| |!|
-% |?|) in French, others concern the general layout (i.e.\ layout of
+% 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.
%
-% Starting with version~2.2, |frenchb| behaves differently according
-% to \babel's \emph{main language} defined as the \emph{last}
-% option\footnote{Its name is kept in \texttt{\textbackslash
-% bbl@main@language}.} at \babel's loading. When French is
-% not \babel's main language, |frenchb| no longer alters the global
+% \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|.
+% paragraphs of sections are not customised by \frenchb.
%
-% When French is loaded as the last option of \babel, |frenchb|
+% When French is loaded as the last option of \babel, \frenchb{}
% makes the following changes to the global layout, \emph{both in
% French and in all other languages}\footnote{%
% For each item, hooks are provided to reset standard
% \LaTeX{} settings or to emulate the behavior of former versions
-% of \texttt{frenchb} (see command
-% \texttt{\textbackslash frenchbsetup\{\}},
-% section~\ref{ssec-custom}).}:
+% 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 |\frenchbsetup{}|;
+% (`--' 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 ``\`a la fran\c{c}aise''.
+% \item footnotes are displayed ``à la française''.
+% \item the separator following the table or figure number in
+% captions is printed as `~--~' instead of `:~'; for changing
+% this see~\ref{sssec-captions} p.~\pageref{sssec-captions}.
% \end{enumerate}
%
% Regarding local typography, the command |\selectlanguage{french}|
% switches to the French language\footnote{%
-% \texttt{\textbackslash selectlanguage\{francais\}}
-% and \texttt{\textbackslash selectlanguage\{frenchb\}} are kept
-% for backward compatibility but should no longer be used.},
+% \cs{selectlanguage\{francais\}} and
+% \cs{selectlanguage\{frenchb\}} are kept for backward
+% compatibility but should no longer be used.},
% with the following effects:
% \begin{enumerate}
% \item French hyphenation patterns are made active;
-% \item `double punctuation' (|:| |;| |!| |?|) is made
-% active%\footnote{Actually, they are active in the whole
-% document, only their expansions differ in French and
-% outside French.} for correct spacing in French;
+% \item `high punctuation' characters (|:| |;| |!| |?|)
+% automatically add correct spacing in French; this is
+% achieved using callbacks in Lua(La)TeX or `XeTeXinterchar'
+% mechanism in Xe(La)TeX; with TeX'82 and pdf(La)TeX these
+% four characters are made active in the whole document;
% \item |\today| prints the date in French;
% \item the caption names are translated into French
-% (\LaTeX{} only). The separator following the table or
-% figure number in captions is printed as ` -- ' in French
-% instead of `: ', this setting can be changed by redefining
-% |\CaptionSeparator| for French and |\CaptionSeparatorORI|
-% for other languages.
+% (\LaTeX{} only). For customisation of caption names see
+% section~\ref{sssec-captions} p.~\pageref{sssec-captions}.
% \item the space after |\dots| is removed in French.
% \end{enumerate}
%
-% Some commands are provided in |frenchb| to make typesetting
+% Some commands are provided in \frenchb{} to make typesetting
% easier:
% \begin{enumerate}
% \item French quotation marks can be entered using the commands
@@ -171,20 +202,20 @@
% |\iemes| (|3\iemes| prints 3\textsuperscript{es}).
% \item Family names should be typeset in small capitals and never
% be hyphenated, the macro |\bsc| (boxed small caps) does
-% this, e.g., |Leslie~\bsc{Lamport}| will produce
-% Leslie~\mbox{\textsc{Lamport}}. Note that composed names
+% this, e.g., |L.~\bsc{Lamport}| will print the same as
+% |L.~\mbox{\textsc{Lamport}}|. Note that composed names
% (such as Dupont-Durant) may now be hyphenated on explicit
-% hyphens, this differs from |frenchb|~v.~1.x.
+% hyphens, this differs from \frenchb~v.~1.x.
% \item Commands |\primo|, |\secundo|, |\tertio| and |\quarto|
% print 1\textsuperscript{o}, 2\textsuperscript{o},
% 3\textsuperscript{o}, 4\textsuperscript{o}.
% |\FrenchEnumerate{6}| prints 6\textsuperscript{o}.
-% \item Abbreviations for ``Num\'ero(s)'' and ``num\'ero(s)''
+% \item Abbreviations for ``Numéro(s)'' and ``numéro(s)''
% (N\textsuperscript{o} N\textsuperscript{os}
% n\textsuperscript{o} and n\textsuperscript{os}~)
% are obtained via the commands |\No|, |\Nos|, |\no|, |\nos|.
% \item Two commands are provided to typeset the symbol for
-% ``degr\'e'': |\degre| prints the raw character and
+% ``degré'': |\degre| prints the raw character and
% |\degres| should be used to typeset temperatures (e.g.,
% ``|20~\degres C|'' with an unbreakable space), or for
% alcohols'' strengths (e.g., ``|45\degres|'' with \emph{no}
@@ -203,8 +234,8 @@
% by a comma in English or with a space in French; |\nombre|
% is now mapped to |\numprint| from \file{numprint.sty}, see
% \file{numprint.pdf} for more information.
-% \item |frenchb| has been designed to take advantage of the
-% \file{xspace} package if present: adding
+% \item \frenchb{} has been designed to take advantage of the
+% \pkg{xspace} package if present: adding
% |\usepackage{xspace}| in the preamble will force macros like
% |\fg|, |\ier|, |\ieme|, |\dots|, \dots, to respect the
% spaces you type after them, for instance typing
@@ -215,168 +246,221 @@
% \subsection{Customisation}
% \label{ssec-custom}
%
-% Up to version 1.6, customisation of |frenchb| was achieved
-% by entering commands in \file{frenchb.cfg}.
-% Version 2.0 introduced a new command |\frenchbsetup{}| using
-% the \file{keyval} syntax which should make it easier to choose
-% among the many options available. The command |\frenchbsetup{}|
-% is to appear in the preamble only (after loading \babel).
-% Usage of a \file{frenchb.cfg} file for customisation \emph{should
-% definitely be avoided}.
+% Customisation of \frenchb{} relies on command \fbsetup{},
+% options are entered using the \file{keyval} syntax.
+% The command \fbsetup{} is to appear in the preamble only
+% (after loading \babel).
+%
+% \subsubsection[\textbackslash frenchbsetup{}]
+% {\fbsetup{\marg{options}}}
+% \label{sssec-frenchbsetup}
%
% \vspace{.5\baselineskip}
-% |\frenchbsetup{ShowOptions}| prints all available options to
+% \fbsetup{ShowOptions} prints all available options to
% the \file{.log} file, it is just meant as a remainder of the
% list of offered options. As usual with \file{keyval} syntax,
-% boolean options (as |ShowOptions|) can be entered as
-% |ShowOptions=true| or just |ShowOptions|, the `|=true|' part
-% can be omitted.
+% 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 brackets, sometimes followed be a `\texttt{*}'.
+% 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{itemize}
-% \item |StandardLayout=true [false*]| forces |frenchb| not to
+% \frenchb{} is loaded as the \emph{last} option of \babel{}
+% ---\babel's \emph{main language}---, and is toggled otherwise.
+% \begin{description}
+% \item [StandardLayout=true (false*)] forces \frenchb{} not to
% interfere with the layout: no action on any kind of lists,
% first paragraphs of sections are not indented (as in English),
-% no action on footnotes. This option replaces the former
-% command |\StandardLayout|. It might be used to avoid conflicts
-% with classes or packages which customise lists or footnotes.
-% \item |GlobalLayoutFrench=false [true*]| can be used, when French
-% is the main language, to emulate what prior versions of
-% |frenchb| (pre-2.2) did: lists, and first paragraphs
-% of sections will be displayed the standard way in other
-% languages than French, and ``\`a la fran\c{c}aise'' in French.
-% Note that the layout of footnotes is language independent
-% anyway (see below |FrenchFootnotes| and |AutoSpaceFootnotes|).
-% This option replaces the former command |\FrenchLayout|.
-% \item |ReduceListSpacing=false [true*]|; |frenchb| reduces the
+% no action on footnotes. This option can be used to avoid
+% conflicts with classes or packages which customise lists or
+% footnotes.
+% \item [GlobalLayoutFrench=false (true*)] should no longer be
+% used; it was intended to emulate, when French is the main
+% language, what prior versions of \frenchb{} (pre-2.2) did:
+% lists, and first paragraphs of sections would be displayed
+% the standard way in other languages than French, and ``à la
+% française'' in French. Note that the layout of footnotes is
+% language independent anyway (see below \fbo{FrenchFootnotes}
+% and \fbo{AutoSpaceFootnotes}).
+% \item [ReduceListSpacing=false (true*)]; \frenchb{} reduces the
% values of the vertical spaces used in the \emph{all} list
% environments in French (this includes itemize, enumerate,
% description, but also abstract, quote, quotation and verse and
-% possibly others). Setting this option to |false|
-% reverts to the standard settings of |list|. This option
-% replaces the former command |\FrenchListSpacingfalse|.
-% \item |ListOldLayout=true [false]|; starting with version~2.6a,
+% possibly others). Setting this option to \fbo{false}
+% reverts to the standard settings of the |list| environment.
+% \item [ListOldLayout=true (false)]; starting with version~2.6a,
% the layout of lists has changed regarding leftmargins' sizes
% and default itemize label (`---' instead of `--' up to~2.5k).
% This option, provided for backward compatibility, displays
% lists as they were up to version~2.5k.
-% \item |CompactItemize=false [true*]|; should no longer be used
-% (kept only for backward compatibility).
-% \item |StandardItemizeEnv=true [false*]|; |frenchb| redefines
+% \item [CompactItemize=false (true*)]; should no longer be used
+% (kept only for backward compatibility), it is replaced by the
+% next two options.
+% \item [StandardItemizeEnv=true (false*)]; \frenchb{} redefines
% the |itemize| environment to suppress any vertical space
-% between items of |itemize| lists in French and customise
-% leftmargins. Setting this option to |false| reverts to the
-% standard definition of |itemize|.
-% \item |StandardEnumerateEnv=true [false*]|; starting with
-% version~2.6 |frenchb| redefines the |enumerate| and
-% |description| environments to make leftmargins match those of
+% between items of |itemize| lists in French and customises
+% left margins. Setting this option to \fbo{false} reverts to
+% the standard definition of |itemize|.
+% \item [StandardEnumerateEnv=true (false*)]; starting with
+% version~2.6 \frenchb{} redefines the |enumerate| and
+% |description| environments to make left margins match those of
% the French version of |itemize| lists. Setting this option to
-% |false| reverts to the standard definition of |enumerate| and
-% |description|.
-% \item |StandardItemLabels=true [false*]| when set to |true| this
-% option stops |frenchb| from changing the labels in |itemize|
-% lists in French.
-% \item |ItemLabels=\textendash|, |\textbullet|, |\ding{43}|,
-% \dots, |[\textemdash*]|; when |StandardItemLabels=false| (the
-% default), this option enables to choose the label used in
-% |itemize| lists for all levels. The next three options do
-% the same but each one for one level only. Note that the
-% example |\ding{43}| requires |\usepackage{pifont}|.
-% \item |ItemLabeli=\textendash|, |\textbullet|, |\ding{43}|,
-% \dots,|[\textemdash*]|
-% \item |ItemLabelii=\textendash|, |\textbullet|, |\ding{43}|,
-% \dots, |[\textemdash*]|
-% \item |ItemLabeliii=\textendash|, |\textbullet|, |\ding{43}|,
-% \dots, |[\textemdash*]|
-% \item |ItemLabeliv=\textendash|, |\textbullet|, |\ding{43}|,
-% \dots, |[\textemdash*]|
-% \item |StandardLists=true [false*]| forbids |frenchb| to
-% customise any kind of list. Try the option |StandardLists|
+% \fbo{false} reverts to the standard definition of |enumerate|
+% and |description|.
+% \item [StandardItemLabels=true (false*)] when set to \fbo{true}
+% this option prevents \frenchb{} from changing the labels in
+% |itemize| lists in French.
+% \item [ItemLabels=\cs{textbullet}, \cs{textendash},
+% \cs{ding\{43\}},...(\cs{textemdash}*)];\\
+% when \fbo{StandardItemLabels=false} (the default), this option
+% enables to choose the label used in French |itemize| lists for
+% all levels. The next four options do the same but each one for
+% a specific level only. Note that the example |\ding{43}|
+% requires |\usepackage{pifont}|.
+% \item [ItemLabeli=\cs{textbullet}, \cs{textendash},
+% \cs{ding\{43\}},...(\cs{textemdash}*)]
+% \item [ItemLabelii=\cs{textbullet}, \cs{textendash},
+% \cs{ding\{43\}},...(\cs{textemdash}*)]
+% \item [ItemLabeliii=\cs{textbullet}, \cs{textendash},
+% \cs{ding\{43\}},..(\cs{textemdash}*)]
+% \item [ItemLabeliv=\cs{textbullet}, \cs{textendash},
+% \cs{ding\{43\}},...(\cs{textemdash}*)]
+% \item [StandardLists=true (false*)] forbids \frenchb{} to
+% customise any kind of list. Try the option \fbo{StandardLists}
% in case of conflicts with classes or packages that customise
-% lists too. This option is just a shorthand for all four options
-% |ReduceListSpacing=false|, |StandardItemizeEnv=true|,
-% |StandardEnumerateEnv=true| and |StandardItemLabels=true|.
-% \item |IndentFirst=false [true*]|; |frenchb| normally forces
-% indentation of the first paragraph of sections.
-% When this option is set to |false|, the first paragraph of
-% will look the same in French and in English (not indented).
-% \item |FrenchFootnotes=false [true*]| reverts to the standard
-% layout of footnotes. By default |frenchb| typesets leading
+% lists too. This option is just a shorthand setting all four
+% options \fbo{ReduceListSpacing=false},
+% \fbo{StandardItemizeEnv=true}, \fbo{StandardEnumerateEnv=true}
+% and \fbo{StandardItemLabels=true}.
+% \item [IndentFirst=false (true*)]; set this option to \fbo{false}
+% if you do not want \frenchb{} to force indentation of the
+% first paragraph of sections. When French is the main language,
+% this options applies to all languages.
+% \item [FrenchFootnotes=false (true*)] reverts to the standard
+% layout of footnotes. By default \frenchb{} typesets leading
% numbers as `1.\hspace{.5em}' instead of `$\hbox{}^1$', but
% has no effect on footnotes numbered with symbols (as in the
-% |\thanks| command). The former commands |\StandardFootnotes|
-% and |\FrenchFootnotes| are still there, |\StandardFootnotes|
-% can be useful when some footnotes are numbered with letters
-% (inside minipages for instance).
-% \item |AutoSpaceFootnotes=false [true*]|; by default |frenchb|
+% |\thanks| command). Two commands |\StandardFootnotes|
+% and |\FrenchFootnotes| are available to change the layout of
+% footnotes locally; |\StandardFootnotes| can help when some
+% footnotes are numbered with letters (inside minipages for
+% instance).
+% \item [AutoSpaceFootnotes=false (true*)]; by default \frenchb{}
% adds a thin space in the running text before the number or
-% symbol calling the footnote. Making this option |false|
+% symbol calling the footnote. Making this option \fbo{false}
% reverts to the standard setting (no space added).
-% \item |FrenchSuperscripts=false [true]|; then
+% \item [FrenchSuperscripts=false (true)]; then
% |\up=\textsuperscript| (option added in version 2.1).
-% Should only be made |false| to recompile older documents.
+% Should only be made \fbo{false} to recompile older documents.
% By default |\up| now relies on |\fup| designed to produce
% better looking superscripts.
-% \item |AutoSpacePunctuation=false [true]|; in French, the user
+% \item [AutoSpacePunctuation=false (true)]; in French, the user
% \emph{should} input a space before the four characters `|:;!?|'
% but as many people forget about it (even among native French
-% writers!), the default behaviour of |frenchb| is to
+% writers!), the default behaviour of \frenchb{} is to
% automatically add a |\thinspace| before `|;|' `|!|' `|?|' and a
-% normal (unbreakable) space before~`|:|' (this is recommended by
-% the French Imprimerie nationale). This is convenient in most
-% cases but can lead to addition of spurious spaces in URLs or in
-% MS-DOS paths but only if they are no typed using |\texttt| or
-% verbatim mode. When the current font is a monospaced
-% (typewriter) font, |AutoSpacePunctuation| is locally switched
-% to |false|, no spurious space is added in that case, so the
-% default behaviour of of |frenchb| in that area should be fine
-% in most circumstances.
-%
-% Choosing |AutoSpacePunctuation=false| will ensure that
+% normal (unbreakable) space before~`|:|' as recommended by
+% the French Imprimerie nationale. This is convenient in most
+% cases but can lead to addition of spurious spaces in URLs, in
+% MS-DOS paths or in timetables (10:55), except if they are
+% typed in |\texttt| or verbatim mode. When the current font
+% is a monospaced (typewriter) font, \fbo{AutoSpacePunctuation}
+% is locally switched to \fbo{false}, no spurious space is added
+% in that case, so the default behaviour of of \frenchb{} in that
+% area should be fine in most circumstances.
+%
+% Choosing \fbo{AutoSpacePunctuation=false} will ensure that
% a proper space will be added before `|:;!?|' \emph{if and only
% if} a (normal) space has been typed in. Those who are unsure
% about their typing in this area should stick to the default
-% option and type |\string;| |\string:| |\string!| |\string?|
-% instead of |;| |:| |!| |?| in case an unwanted space is
-% added by |frenchb|.
-% \item |ThinColonSpace=true [false]| changes the normal
-% (unbreakable) space added before the colon `:' to a thin space,
+% option and use the provided |\NoAutoSpacing| command
+% inside a group in case an unwanted space is added by \frenchb{}
+% (i.e.\ |{\NoAutoSpacing 10:55}|).
+% \item [ThinColonSpace=true (false)] changes the inter-word
+% unbreakable space added before the colon `:' to a thin space,
% so that the same amount of space is added before any of the
-% four double punctuation characters. The default setting is
+% four `high punctuation' characters. The default setting is
% supported by the French Imprimerie nationale.
-% \item |LowercaseSuperscripts=false [true]|; by default |frenchb|
-% inhibits the uppercasing of superscripts (for instance when they
-% are moved to page headers). Making this option |false|
-% will disable this behaviour (not recommended).
-% \item |PartNameFull=false [true]|; when true, |frenchb| numbers
-% the title of |\part{}| commands as ``Premi\`ere partie'',
-% ``Deuxi\`eme partie'' and so on. With some classes which change
-% the|\part{}| command (AMS and SMF classes do so), you will get
-% ``Premi\`ere partie~I'', ``Deuxi\`eme partie~II'' instead;
-% when this occurs, this option should be set to |false|,
-% part titles will then be printed as ``Partie I'', ``Partie II''.
-% \item |SuppressWarning=true [false]|; when true |frenchb| issues
-% no warnings if |\@makecaption| has been redefined or if the
-% \file{bigfoot} package is in use.
-% \item |og=|\texttt{\guillemotleft}, |fg=|\texttt{\guillemotright};
+% \item [LowercaseSuperscripts=false (true)]; by default \frenchb{}
+% inhibits the uppercasing of superscripts (for instance when
+% they are moved to page headers). Making this option
+% \fbo{false} will disable this behaviour (not recommended).
+% \item [PartNameFull=false (true)]; when true, \frenchb{} numbers
+% the title of |\part{}| commands as ``Première partie'',
+% ``Deuxième partie'' and so on. With some classes which
+% change the |\part{}| command (AMS classes do so), you could
+% get ``Première partie~1'', ``Deuxième partie~2'' in the toc;
+% when this occurs, this option should be set to
+% \fbo{false}, part titles will then be printed as ``Partie I'',
+% ``Partie II''.
+% \item [CustomiseFigTabcaptions=false (true*)]; when \fbo{false}
+% the default separator (colon) is used instead of
+% |\CaptionSeparator|. Anyway, \frenchb{} makes sure that the
+% colon will be typeset with proper preceeding space in French.
+% \item [OldFigTabcaptions=true (false)] is to be used when
+% figures' and tables' captions must be typeset as with pre~3.0
+% versions of \frenchb{} (with |\CaptionSeparator| in French and
+% colon otherwise). Intended for standard \LaTeX{} classes only.
+% \item [SuppressWarning=true (false)]; can be turned to \fbo{true}
+% if you are bored with \frenchb's warnings.
+% \item [\texttt{og=\guillemotleft}, \texttt{fg=\guillemotright}];
% when guillemets characters are available on the keyboard
% (through a compose key for instance), it is nice to use them
-% instead of typing |\og| and |\fg|. This option tells |frenchb|
-% which characters are opening and closing French guillemets
-% (they depend on the input encoding), then you can type either
-% \texttt{\guillemotleft{} guillemets \guillemotright}, or
+% instead of typing |\og| and |\fg|. This option tells
+% \frenchb{} which characters are opening and closing French
+% guillemets (they depend on the input encoding), then you can
+% type either
+% \texttt{\guillemotleft{} guillemets \guillemotright} or
% \texttt{\guillemotleft{}guillemets\guillemotright} (with or
-% without spaces), to get properly typeset French quotes.
-% This option requires \file{inputenc} to be loaded with the
-% proper encoding, it works with 8-bits encodings (latin1,
-% latin9, ansinew, applemac,\dots) and multi-byte encodings
-% (utf8 and utf8x).
-% \end{itemize}
+% without spaces) to get properly typeset French quotes.
+% This option works with LuaLaTeX and XeLaTeX; with pdfLaTeX it
+% requires \file{inputenc} to be loaded with a proper encoding:
+% 8-bits encoding (latin1, latin9, ansinew, applemac,\dots) or
+% multi-byte encoding (utf8, utf8x).
+% \end{description}
+%
+% \textbf{Options' order} -- Please remember that options are read
+% in the order they appear in the \fbsetup{} command.
+% Someone wishing that \frenchb{} leaves the layout of lists
+% and footnotes untouched but caring for indentation of first
+% paragraph of sections should choose\\
+% \fbsetup{StandardLayout,IndentFirst} to get the expected
+% layout. The reverse order
+% \fbsetup{IndentFirst,StandardLayout} would lead to option
+% \fbo{IndentFirst} being overwritten by \fbo{StandardLayout}.
+%
+% \subsubsection{Captions}
+% \label{sssec-captions}
+%
+% Caption names can be customised in French using the simplified
+% syntax introduced by \babel~3.9, for instance:
+% |\def\frenchproofname{Preuve}|.
+% The older syntax |\addto\captionsfrench{\def\proofname{Preuve}}|
+% still works. Keep in mind that \emph{only} |french| can be used to
+% redefine captions, even if \babel{}'s option was entered as
+% |francais| or |frenchb|.
+%
+% For \emph{all} languages, when French is the main language,
+% \frenchb{} changes the separator (colon) used in figures'
+% and tables' captions to |\CaptionSeparator| which defaults to
+% `~--~' and can be redefined in the preamble with\\
+% |\renewcommand*{\CaptionSeparator}{...}|.
+%
+% When French is not the main language, the colon is preserved for
+% all languages but \frenchb{} makes sure that a proper space is
+% typeset before it.
+%
+% Two new options are provided: if \fbo{CustomiseFigTabCaptions} is
+% set to \fbo{false} the colon will be used as separator in all
+% languages, with a proper space before the colon in French.
+% The second option \fbo{OldFigTabCaptions} can be set to \fbo{true}
+% to print figures' and tables' captions as they were with versions
+% pre~3.0 of \frenchb{} (using |\CaptionSeparator| in French and
+% colon in other languages); this option only makes sense with the
+% standard \LaTeX{} classes \cls{article}, \cls{report} and
+% \cls{book}.
%
% \subsection{Hyphenation checks}
% \label{ssec-hyphen}
@@ -385,9 +469,9 @@
% perform some basic tests about hyphenation in French.
% For \LaTeXe{} I suggest this:
% \begin{itemize}
-% \item run the following file, with the encoding suitable for
-% your machine (\textit{my-encoding} will be |latin1| for
-% \textsc{unix} machines, |ansinew| for PCs running~Windows,
+% \item run |pdfLaTeX| on the following file, with the encoding
+% suitable for your machine (\textit{my-encoding} will be |latin1|
+% for Unix machines, |ansinew| for PCs running~Windows,
% |applemac| or |latin1| for Macintoshs, or |utf8|\dots\\[3mm]^^A\]
% |%%% Test file for French hyphenation.|\\
% |\documentclass{article}|\\
@@ -397,12 +481,11 @@
% |\usepackage[frenchb]{babel}|\\
% |\begin{document}|\\
% |\showhyphens{signal container \'ev\'enement alg\`ebre}|\\
-% |\showhyphens{|\texttt{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 \'ev\'e-ne-ment al-g\`ebre}.\\
+% \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}.
@@ -416,26 +499,147 @@
% \item you get |sig-nal con-tainer|, this probably means that the
% hyphenation patterns you are using are for US-English, not for
% French;
-% \item you get no hyphen at all in \texttt{\'ev\'e-ne-ment}, this
+% \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}
%
-% \textbf{Options' order} -- Please remember that options are read
-% in the order they appear inside the |\frenchbsetup| command.
-% Someone wishing that |frenchb| leaves the layout of lists
-% and footnotes untouched but caring for indentation of first
-% paragraph of sections could choose
-% |\frenchbsetup{StandardLayout,IndentFirst}| and get the expected
-% layout. Choosing |\frenchbsetup{IndentFirst,StandardLayout}|
-% would not lead to the expected result: option |IndentFirst| would
-% be overwritten by |StandardLayout|.
-%
% \subsection{Changes}
% \label{ssec-changes}
%
+% \subsubsection*{What's new in version 3.0?}
+%
+% Many deep changes lead me to step \frenchb's version number
+% to~3.0a:
+% \begin{itemize}
+% \item \babel{}~3.9 is required now to process
+% \file{frenchb.ldf}, this change allows for cleaner definitions
+% of dates and captions for the Unicode engines LuaTeX and
+% XeTeX and also provides a simpler syntax for end-users, see
+% section~\ref{sssec-captions} p.\pageref{sssec-captions}.
+% \item \fbsetup{} options management has been completely
+% reworked; two new options added.
+% \item Canadian French didn't work as a normal \babel's dialect,
+% it should now; btw. the French language should now be loaded
+% as \Lopt{french}, \emph{not as} \Lopt{frenchb} or
+% \Lopt{francais} and preferably as a \emph{global} option of
+% |\documentclass|. Some tolerance still exists in v3.0, but
+% do not rely on it.
+% \item \frenchb{} no longer loads \file{frenchb.cfg}:
+% customisation should definitely be done using \fbsetup{}
+% options.
+% \item Description lists labels are now indented; set
+% |\listendentFB=0pt| to get the former layout.
+% \item The last but not least change affects the (recent)
+% LuaTeX-based engines, (this means version 0.76 as included in
+% TL2013 and up): active characters are no longer used in French
+% for `high punctuation'. Functionalities and user interface
+% are unchanged.
+%
+% Many thanks to Paul Isambert who provided the basis for the
+% lua code (see his presentation at GUT'2010) and kindly
+% reviewed my first drafts suggesting significant improvements.
+%
+% Please note that this code, still experimental, is likely to
+% change until LuaTeX itself has reached version~1.0.
+% \end{itemize}
+%
+% \subsubsection*{What's new in version 2.6?}
+%
+% The way \frenchb{} handles list environments has been completely
+% redesigned in version~2.6 due to a long standing bug affecting
+% enumerate lists inside itemize lists. Horizontal indentation of
+% itemize, enumerate and description lists differs now from
+% previous versions, an option for backward compatibility is
+% provided: \fbsetup{ListOldLayout}.
+%
+% \frenchb{} is now compatible with the \pkg{paralist} package.
+%
+% Regarding the layout of figures' and tables' captions, version
+% 2.6c is now fully compatible with AMS and koma-script classes
+% and with \file{caption} and \pkg{floatrow} packages.
+% Starting with version 2.6c, the \file{frenchb.cfg} file is no
+% longer generated from \file{frenchb.dtx}, but it is still loaded
+% (if found) for backward compatibility.
+%
+% \subsubsection*{What's new in version 2.5?}
+%
+% The main change is that active characters are no longer used
+% in French with (recent) XeTeX-based engines (they still are
+% with TeX-based engines). All the functionalities (automatic
+% insertion of missing spaces before |:;!?| or bare replacement
+% of typed spaces with suitable unbreabable ones, tuning of the
+% spaces width) remain available and the user interface is
+% unchanged. The use of active characters is replaced by the
+% |\XeTeXinterchartoks| mechanism (adapted from the
+% \pkg{polyglossia} package).
+%
+% A new command |\NoAutoSpacing| has been added. It should be used
+% \emph{inside a group} instead of |\shorthandoff{;:!?}| whenever
+% active characters or automatic spacing of French punctuation or
+% quote characters conflict with other packages; it is designed to
+% work with TeX-, LuaTeX- and XeTeX-based engines.
+%
+% Bug corrections: |\frenchspacing| and |\nonfrenchspacing| are no
+% longer messed up by \file{frenchb.ldf}.
+%
+% \subsubsection*{What's new in version 2.4?}
+%
+% A new option \fbo{SuppressWarning} has been added (desactivated
+% by default) to suppress warnings if |\@makecaption| has been
+% redefined or if the \pkg{bigfoot} package is in use.
+%
+% French hyphenation patterns are now coded in Unicode, see file
+% \file{hyph-fr.tex}. Extra code has been added to deal with
+% hyphenation of the French ``apostrophe'' with XeTeX and LuaTeX
+% engines.
+%
+% Better compatibility with the \pkg{enumitem} package.
+%
+% When typewriter fonts are in use (hence in verbatim mode) no
+% space is added after `\guillemotleft' and before
+% `\guillemotright' when they are entered as characters
+% (see \fbsetup{}).
+%
+% \subsubsection*{What's new in version 2.3?}
+%
+% Starting with version~2.3a, \frenchb{} no longer inserts spaces
+% automatically before `|:;!?|' when a typewriter font is in use;
+% this was suggested by Yannis Haralambous to prevent
+% spurious spaces in computer source code or expressions like
+% \texttt{C\string:/foo}, \texttt{http\string://foo.bar},
+% etc. An option (\fbo{OriginalTypewriter}) is provided to get
+% back to the former behaviour of \frenchb{}.
+%
+% Another probably invisible change: lowercase conversion in
+% |\up{}| is now achieved by the \LaTeX{} command |\MakeLowercase|
+% instead of \TeX's |\lowercase| command. This prevents error
+% messages when diacritics are used inside |\up{}| (diacritics
+% should \emph{never} be used in superscripts though!).
+%
+% \subsubsection*{What's new in version 2.2?}
+%
+% Starting with version~2.2a, \frenchb{} alters the layout of
+% lists, footnotes, and the indentation of first paragraphs of
+% sections) \emph{only if} French is the ``main language''
+% (i.e. \babel's last language option). The layout is global for
+% the whole document: lists, etc.\ look the same in French and in
+% other languages, everything is typeset ``à la française''
+% if French is the ``main language'', otherwise \frenchb{} doesn't
+% change anything regarding lists, footnotes, and indentation of
+% paragraphs.
+%
+% \subsubsection*{What's new in version 2.1?}
+%
+% A new command |\fup| is provided to typeset better looking
+% superscripts; it was designed using ideas from Jacques André,
+% Thierry Bouche and René Fritz, thanks to all of them!
+% Former command |\up| is now defined as |\fup|, an option
+% \fbo{FrenchSuperscripts=false} is provided for
+% backward compatibility.
+%
% \subsubsection*{What's new in version 2.0?}
%
% Here is the list of all changes:
@@ -448,17 +652,17 @@
% be preferred for typesetting in French). A warning is issued
% when OT1 encoding is in use at the |\begin{document}|.
% \item Customisation should now be handled only by command
-% |\frenchbsetup{}|, \file{frenchb.cfg} (kept for compatibility)
+% \fbsetup{}, \file{frenchb.cfg} (kept for compatibility)
% should no longer be used. See section~\ref{ssec-custom} for
% the list of available options.
-% \item Captions in figures and table have changed in French: former
+% \item Captions in figures and tables have changed in French: former
% abbreviations ``Fig.'' and ``Tab.'' have been replaced by full
% names ``Figure'' and ``Table''. If this leads to formatting
% problems in captions, you can add the following two commands to
% your preamble (after loading \babel) to get the former captions\\
% |\addto\captionsfrench{\def\figurename{{\scshape Fig.}}}|\\
% |\addto\captionsfrench{\def\tablename{{\scshape Tab.}}}|.
-% \item The |\nombre| command is now provided by the \file{numprint}
+% \item The |\nombre| command is now provided by the \pkg{numprint}
% package which has to be loaded \emph{after} \babel{} with the
% option |autolanguage| if number formatting should depend on the
% current language.
@@ -470,113 +674,23 @@
% You can get back to the former behaviour of |\bsc| by adding\\
% |\renewcommand*{\bsc}[1]{\leavevmode\hbox{\scshape #1}}|\\
% to the preamble of your document.
-% \item Footnotes are now displayed ``\`a la fran\c caise'' for the
+% \item Footnotes are now displayed ``à la française'' for the
% whole document, except with an explicit\\
-% |\frenchbsetup{AutoSpaceFootnotes=false,FrenchFootnotes=false}|.\\
+% \fbsetup{AutoSpaceFootnotes=false,FrenchFootnotes=false}.\\
% Add this command if you want standard footnotes. It is still
% possible to revert locally to the standard layout of footnotes
% by adding |\StandardFootnotes| (inside a |minipage| environment
% for instance).
% \end{itemize}
%
-% \subsubsection*{What's new in version 2.1?}
-%
-% New command |\fup| to typeset better looking superscripts.
-% Former command |\up| is now defined as |\fup|, an option
-% |\frenchbsetup{FrenchSuperscripts=false}| is provided for
-% backward compatibility. |\fup| was designed using ideas from
-% Jacques Andr\'e, Thierry Bouche and Ren\'e Fritz, thanks to them!
-%
-% \subsubsection*{What's new in version 2.2?}
-%
-% Starting with version~2.2a, |frenchb| alters the layout of
-% lists, footnotes, and the indentation of first paragraphs of
-% sections) \emph{only if} French is the ``main language''
-% (i.e. babel's last language option). The layout is global for
-% the whole document: lists, etc.\ look the same in French and in
-% other languages, everything is typeset ``\`a la fran\c caise''
-% if French is the ``main language'', otherwise |frenchb| doesn't
-% change anything regarding lists, footnotes, and indentation of
-% paragraphs.
-%
-% \subsubsection*{What's new in version 2.3?}
-%
-% Starting with version~2.3a, |frenchb| no longer inserts spaces
-% automatically before `|:;!?|' when a typewriter font is in use;
-% this was suggested by Yannis Haralambous to prevent
-% spurious spaces in computer source code or expressions like
-% \texttt{C\string:/foo}, \texttt{http\string://foo.bar},
-% etc. An option (|OriginalTypewriter|) is provided to get back
-% to the former behaviour of |frenchb|.
-%
-% Another probably invisible change: lowercase conversion in
-% |\up{}| is now achieved by the \LaTeX{} command |\MakeLowercase|
-% instead of \TeX's |\lowercase| command. This prevents error
-% messages when diacritics are used inside |\up{}| (diacritics
-% should \emph{never} be used in superscripts though!).
-%
-% \subsubsection*{What's new in version 2.4?}
-%
-% A new option |SuppressWarning| has been added (desactivated by
-% default) to suppress warnings if |\@makecaption| has been
-% redefined or if the \file{bigfoot} package is in use.
-%
-% French hyphenation patterns are now coded in Unicode, see file
-% \file{hyph-fr.tex}. Extra code has been added to deal with
-% hyphenation of the French ``apostrophe'' with XeTeX and LuaTeX
-% engines.
-%
-% Better compatibility with the \file{enumitem} package.
-%
-% When typewriter fonts are in use (hence in verbatim mode) no
-% space is added after `\guillemotleft' and before
-% `\guillemotright' when they are entered as characters
-% (see |\frenchbsetup|).
-%
-% \subsubsection*{What's new in version 2.5?}
-%
-% The main change is that active characters are no longer used
-% in French with (recent) Xe\TeX-based engines (they still are
-% with \TeX-based engines). All the functionalities (automatic
-% insertion of missing spaces before |:;!?| or bare replacement
-% of typed spaces with suitable unbreabable ones, tuning of the
-% spaces width) remain available and the user interface is
-% unchanged. The use of active characters is replaced by the
-% |\XeTeXinterchartoks| mechanism (adapted from the
-% \file{polyglossia} package).
-%
-% A new command |\NoAutoSpacing| has been added. It should be used
-% \emph{inside a group} instead of |\shorthandoff{;:!?}| whenever
-% active characters or automatic spacing of French punctuation or
-% quote characters conflict with other packages; it is designed to
-% work with \TeX- and Xe\TeX-based engines.
-%
-% Bug corrections: |\frenchspacing| and |\nonfrenchspacing| are no
-% longer messed up by \file{frenchb.ldf}.
-%
-% \subsubsection*{What's new in version 2.6?}
-%
-% The way |frenchb| handles list environments has been completely
-% redesigned in version~2.6 due to a long standing bug affecting
-% enumerate lists inside itemize lists. Horizontal indentation of
-% itemize, enumerate and description lists differs now from
-% previous versions, an option for backward compatibility is
-% provided: |\frenchbsetup{ListOldLayout}|.
-%
-% |frenchb| is now compatible with the \file{paralist} package.
-%
-% Regarding the layout of figures' and tables' captions, version
-% 2.6c is now fully compatible with AMS and koma-script classes
-% and with \file{caption} and \file{floatrow} packages.
-% Starting with version 2.6c, the \file{frenchb.cfg} file is no
-% longer generated from \file{frenchb.dtx}, but it is still loaded
-% (if found) for backward compatibility.
-%
% \StopEventually{}
%
% \changes{v2.6c}{2013/05/20}{Dummy file frenchb.cfg is no longer
% generated from frenchb.dtx.}
%
+% \clearpage
+% \newgeometry{left=53mm,right=25mm}
+%
% \section{The code}
%
% \subsection{Initial setup}
@@ -587,21 +701,90 @@
% (french) as to be corrected before calling \cs{LdfInit}.}
%
% \iffalse
-%<*code>
+%<*ldf>
% \fi
%
-% While this file was read through the option \Lopt{frenchb} we make
-% it behave as if \Lopt{french} was specified.
+% \changes{v3.0a}{2014/02/28}{Support for options frenchb, francais,
+% canadien, acadian changed.}
+%
+% First make sure that |\l@french| is defined (possibly as 0).
+% In Plain formats, \texttt{@} catcode is not `letter';
+% LuaTeX and XeTeX formats set |\lang@<languagename>| instead of
+% |\l@<languagename>|.
% \begin{macrocode}
-\def\CurrentOption{french}
+\chardef\atcatcode=\catcode`\@
+\catcode`\@=11\relax
+\def\FB@nopatterns{%
+ \ifx\l@nohyphenation\@undefined
+ \edef\bbl@nulllanguage{\string\language=0}%
+ \adddialect\l@french0
+ \else
+ \adddialect\l@french\l@nohyphenation
+ \edef\bbl@nulllanguage{\string\language=nohyphenation}%
+ \fi
+ \@nopatterns{French}}
+\ifx\l@french\@undefined
+ \ifx\lang@french\@undefined
+ \FB@nopatterns
+ \else
+ \ifnum\lang@french>0
+ \let\l@french\lang@french
+ \else
+ \FB@nopatterns{French}
+ \fi
+ \fi
+\fi
% \end{macrocode}
+% If \file{frenchb.ldf} was loaded with \babel{}'s options
+% \Lopt{francais} or \Lopt{frenchb}, we make it behave as if
+% \Lopt{french} was specified.
+% \begin{macrocode}
+\def\bbl@tempa{francais}
+\ifx\CurrentOption\bbl@tempa
+ \let\l@francais\l@french
+ \def\captionsfrancais{\captionsfrench}
+ \def\datefrancais{\datefrench}
+ \def\extrasfrancais{\extrasfrench}
+ \def\noextrasfrancais{\extrasfrench}
+ \def\CurrentOption{french}
+\fi
+\def\bbl@tempa{frenchb}
+\ifx\CurrentOption\bbl@tempa
+ \let\l@frenchb\l@french
+ \def\captionsfrenchb{\captionsfrench}
+ \def\datefrenchb{\datefrench}
+ \def\extrasfrenchb{\extrasfrench}
+ \def\noextrasfrenchb{\extrasfrench}
+ \def\CurrentOption{french}
+\fi
+\catcode`\@=\atcatcode \let\atcatcode\relax
+% \end{macrocode}
+%
+% \changes{v3.0a}{2014/02/19}{\cs{LdfInit} checks \cs{datefrench}
+% instead of \cs{captionsfrench} to avoid a conflict with
+% papertex.cls which loads datetime.sty.}
%
% The macro |\LdfInit| takes care of preventing that this file is
% loaded more than once, checking the category code of the
% \texttt{@} sign, etc.
%
% \begin{macrocode}
-\LdfInit\CurrentOption\datefrench
+\LdfInit\CurrentOption\captionsfrench
+% \end{macrocode}
+%
+% \changes{v3.0a}{2014/02/18}{frenchb requires babel-3.9.}
+%
+% Quit if \babel's version is less than 3.9.
+% \begin{macrocode}
+\let\bbl@tempa\relax
+\ifx\StartBabelCommands\@undefined
+ \let\bbl@tempa\endinput
+ \PackageError{frenchb.ldf}
+ {frenchb requires babel v.3.9.\MessageBreak
+ Aborting here}
+ {Please upgrade Babel!}
+\fi
+\bbl@tempa
% \end{macrocode}
%
% \changes{v2.1d}{2008/05/04}{Avoid warning ``\cs{end} occurred
@@ -628,86 +811,64 @@
% \end{macrocode}
% \end{macro}
%
-% Check if hyphenation patterns for the French language have been
-% loaded in language.dat; we allow for the names `french',
-% `francais', `canadien' or `acadian'. The latter two are both
-% names used in Canada for variants of French that are in use in
-% that country.
+% \file{frenchb.ldf} can be loaded with options \Lopt{canadien} or
+% \Lopt{acadian}, which both stand for Canadian French. Internally,
+% \Lopt{acadian} will be the name of the corresponding \babel's
+% dialect, so we set |\CurrentOption| to \Lopt{acadian} in both
+% cases.
+% If no specific hyphenation patterns are available, Canadian French
+% will use the French ones.
%
+% TODO: Canadien French hyphenation doesn't work with LuaTeX.
% \begin{macrocode}
-\ifx\l@french\@undefined
- \ifx\l@francais\@undefined
- \ifx\l@canadien\@undefined
- \ifx\l@acadian\@undefined
- \@nopatterns{French}
- \adddialect\l@french0
- \else
- \let\l@french\l@acadian
- \fi
- \else
- \let\l@french\l@canadien
- \fi
- \else
- \let\l@french\l@francais
- \fi
+\ifx\l@acadian\@undefined
+ \ifx\l@canadien\@undefined
+ \adddialect\l@acadian\l@french
+ \adddialect\l@canadien\l@french
+ \else
+ \adddialect\l@acadian\l@canadien
+ \fi
+\else
+ \adddialect\l@canadien\l@acadian
+\fi
+\def\bbl@tempa{canadien}
+\ifx\CurrentOption\bbl@tempa
+ \def\captionscanadien{\captionsacadian}
+ \def\datecanadien{\dateacadian}
+ \def\extrascanadien{\extrasacadian}
+ \def\noextrascanadien{\extrasacadian}
+ \def\CurrentOption{acadian}
\fi
% \end{macrocode}
-% Now |\l@french| is always defined.
%
-% The internal name for the French language is |french|;
-% |francais| and |frenchb| are synonymous for |french|:
-% first let both names use the same hyphenation patterns.
-% Later we will have to set aliases for |\captionsfrench|,
-% |\datefrench|, |\extrasfrench| and |\noextrasfrench|.
-% As French uses the standard values of |\lefthyphenmin| (2)
-% and |\righthyphenmin| (3), no special setting is required here.
+% \changes{v3.0a}{2014/02/15}{In Plain, provide a substitute for
+% \cs{PackageWarning} and \cs{PackageInfo}.}
%
+% Let's provide a substitute for |\PackageWarning| and |\PackageInfo|
+% not defined in Plain:
% \begin{macrocode}
-\ifx\l@francais\@undefined
- \let\l@francais\l@french
-\fi
-\ifx\l@frenchb\@undefined
- \let\l@frenchb\l@french
-\fi
-% \end{macrocode}
-% When this language definition file was loaded for one of the
-% Canadian versions of French we need to make sure that a suitable
-% hyphenation pattern register will be found by \TeX.
-% \begin{macrocode}
-\ifx\l@canadien\@undefined
- \let\l@canadien\l@french
-\fi
-\ifx\l@acadian\@undefined
- \let\l@acadian\l@french
-\fi
+\def\fb@warning#1{%
+ \begingroup
+ \newlinechar=`\^^J
+ \def\\{^^J(frenchb.ldf) }%
+ \message{\\#1}%
+ \endgroup}
+\def\fb@info#1{%
+ \begingroup
+ \newlinechar=`\^^J
+ \def\\{^^J}%
+ \wlog{#1}%
+ \endgroup}
% \end{macrocode}
%
-% This language definition can be loaded for different variants of
-% the French language. The `key' \babel\ macros are only defined
-% once, using `french' as the language name, but |frenchb| and
-% |francais| are synonymous.
+% French uses the standard values of |\lefthyphenmin| (2)
+% and |\righthyphenmin| (3); let's provide their values though,
+% as required by \babel.
+%
% \begin{macrocode}
-\def\datefrancais{\datefrench}
-\def\datefrenchb{\datefrench}
-\def\extrasfrancais{\extrasfrench}
-\def\extrasfrenchb{\extrasfrench}
-\def\noextrasfrancais{\noextrasfrench}
-\def\noextrasfrenchb{\noextrasfrench}
+\expandafter\providehyphenmins\expandafter{\CurrentOption}{\tw@\thr@@}
% \end{macrocode}
%
-% \begin{macro}{\extrasfrench}
-% \begin{macro}{\noextrasfrench}
-% The macro |\extrasfrench| will perform all the extra
-% definitions needed for the French language.
-% The macro |\noextrasfrench| is used to cancel the actions of
-% |\extrasfrench|.\\
-% In French, character ``apostrophe'' is a letter in expressions
-% like |l'ambulance| (French hyphenation patterns provide entries
-% for this kind of words). This means that the |\lccode| of
-% ``apostrophe'' has to be non null in French for proper hyphenation
-% of those expressions, and has to be reset to null when exiting
-% French.
-%
% \begin{macro}{\ifFBunicode}
% \begin{macro}{\ifFBLuaTeX}
% \begin{macro}{\ifFBXeTeX}
@@ -729,6 +890,8 @@
% \changes{v2.6g}{2013/12/15}{lccode values for the French
% ``apostrophe'' are now the same for XeTeX and LuaTeX.}
%
+% We cannot rely on \eTeX's |\ifdefined| at this stage, as it is not
+% defined in Plain \TeX{} format.
% \begin{macrocode}
\newif\ifFBunicode
\newif\ifFBLuaTeX
@@ -744,86 +907,111 @@
\FBunicodetrue \FBXeTeXtrue
\fi
% \end{macrocode}
-% These |\lccode| changes will ensure correct hyphenation of
-% words like |d'aventure|, |l'utopie|, with all TeX engines
-% (XeTeX, LuaTeX, pdfTeX) using \file{hyph-fr.tex} patterns.
-% \begin{macrocode}
-\@namedef{extras\CurrentOption}{%
- \ifFBunicode \lccode`\'="2019 \lccode"2019="2019
- \else \lccode`\'=`\'
- \fi}
-\@namedef{noextras\CurrentOption}{%
- \ifFBunicode \lccode"2019=\z@\fi
- \lccode`\'=\z@}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\extrasfrench}
+% \changes{v3.0a}{2014/02/18}{Take advantage of babel's
+% \cs{babel@savevariable} to handle apostrophe's \cs{lccode}.}
+%
+% \begin{macro}{\noextrasfrench}
+% The macro |\extrasfrench| will perform all the extra
+% definitions needed for the French language.
+% The macro |\noextrasfrench| is used to cancel the actions of
+% |\extrasfrench|.
+%
+% In French, character ``apostrophe'' is a letter in expressions
+% like |l'ambulance| (French hyphenation patterns provide entries
+% for this kind of words). This means that the |\lccode| of
+% ``apostrophe'' has to be non null in French for proper hyphenation
+% of those expressions, and has to be reset to null when exiting
+% French.
+%
+% The following code ensures correct hyphenation of words like
+% |d'aventure|, |l'utopie|, with all TeX engines (XeTeX, LuaTeX,
+% pdfTeX) using \file{hyph-fr.tex} patterns.
+%
+% \begin{macrocode}
+\@namedef{extras\CurrentOption}{%
+ \babel@savevariable{\lccode`\'}%
+ \ifFBunicode
+ \babel@savevariable{\lccode"2019}%
+ \lccode`\'="2019\lccode"2019="2019
+ \else
+ \lccode`\'=`\'
+ \fi
+}
+\@namedef{noextras\CurrentOption}{}
+% \end{macrocode}
+%
+% Let's define a handy command for adding stuff to
+% |\extras\CurrentOption|,\linebreak[0] |\noextras\CurrentOption| or
+% |\captions\CurrentOption| but first let's save the value of
+% |\CurrentOption| for later use in \fbsetup{} (`AfterEndOfPackage',
+% |\CurrentOption| will be lost).
+% \begin{macrocode}
+\let\FB@CurOpt\CurrentOption
+\newcommand*{\FB@addto}[2]{%
+ \expandafter\addto\csname #1\FB@CurOpt\endcsname{#2}}
+% \end{macrocode}
+%
% One more thing |\extrasfrench| needs to do is to make sure that
% ``Frenchspacing'' is in effect. |\noextrasfrench| will switch
% ``Frenchspacing'' off again if necessary.
% \begin{macrocode}
-\addto\extrasfrench{\bbl@frenchspacing}
-\addto\noextrasfrench{\bbl@nonfrenchspacing}
+\FB@addto{extras}{\bbl@frenchspacing}
+\FB@addto{noextras}{\bbl@nonfrenchspacing}
% \end{macrocode}
+% \end{macro}
+% \end{macro}
%
% \subsection{Punctuation}
-% \label{sec-punct}
+% \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 `double
+% 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
-% insert before them. Xe\TeX{} provides an alternative to active
-% characters and Lua\TeX{} will hopefully do so as well in the
-% (near?) future.
-%
-% Before doing so, we have to save the standard definition of
-% |\@makecaption| (which includes two ':') to compare it later to
-% its definition at the |\begin{document}|.
+% |\active| for an automatic control of the amount of space to be
+% inserted before them. Both XeTeX and LuaTeX provide an
+% alternative to active characters (`XeTeXinterchar' mechanism and
+% LuaTeX's callbacks).
+%
+% With LuaTeX and XeTeX engines, \frenchb{} handles French quotes
+% together with `high punctuation', a new conditional will be
+% needed:
% \begin{macrocode}
-\long\def\STD@makecaption#1#2{%
- \vskip\abovecaptionskip
- \sbox\@tempboxa{#1: #2}%
- \ifdim \wd\@tempboxa >\hsize
- #1: #2\par
- \else
- \global \@minipagefalse
- \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
- \fi
- \vskip\belowcaptionskip}
+\newif\ifFBAutoSpaceGuill \FBAutoSpaceGuilltrue
% \end{macrocode}
%
-% \changes{v2.5a}{2010/08/10}{Define \cs{Fthinspace} for those who want
-% to customise the width of the space before ; ! and ?.}
+% \changes{v3.0a}{2014/01/10}{New flag \cs{ifFB@luatex@punct} for
+% `high punctuation' management with LuaTeX engines.}
%
-% \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.}
+% \begin{macro}{\ifFB@active@punct}
+% \begin{macro}{\ifFB@xetex@punct}
+% \begin{macro}{\ifFB@luatex@punct}
+% Three internal flags are needed for the three different techniques
+% used for `high punctuation' management.
%
-% According to the I.N.\ specifications, the `:' requires a normal
-% space before it, but some people prefer a |\thinspace| (just
-% like the other three). We define |\FBcolonspace| to hold the
-% required amount of space (user customisable). In case some users
-% are not satisfied with |\thinspace|'s width, it is also
-% customisable.
+% With LuaTeX, starting with version 0.76, callbacks are used to
+% get rid of active punctuation. With previous versions, `high
+% punctuation' characters remain active (see below).
% \begin{macrocode}
-\newcommand*{\FBcolonspace}{\space}
-\newcommand*{\FBthinspace}{\thinspace}
+\newif\ifFB@active@punct \FB@active@puncttrue
+\newif\ifFB@luatex@punct
+\ifFBLuaTeX
+ \ifnum\luatexversion>75
+ \FB@luatex@puncttrue\FB@active@punctfalse
+ \fi
+\fi
% \end{macrocode}
%
-% \begin{macro}{\ifF@active@punct}
-% \begin{macro}{\ifF@xetex@punct}
-% Check the availability of |\XeTeXinterchartokenstate| and decide
-% whether the `double punctuation' characters (|;| |!| |?| and |:|)
-% have to be made |\active| or not.
+% For XeTeX, the availability of |\XeTeXinterchartokenstate|
+% decides whether the `high punctuation' characters (|;| |!| |?|
+% and |:|) have to be made |\active| or not.
% \begin{macrocode}
-\newif\ifFB@active@punct \FB@active@puncttrue
\newif\ifFB@xetex@punct
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname XeTeXinterchartokenstate\endcsname\relax
@@ -833,21 +1021,387 @@
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\FBcolonspace}
+% \begin{macro}{\FBthinspace}
+% \changes{v2.5a}{2010/08/10}{Define \cs{FBthinspace} for those who want
+% to customise the width of the space before ; and co.}
+%
+% \changes{v2.6d}{2013/06/19}{Rename \cs{Fthinspace} to
+% \cs{FBthinspace} and \cs{Fcolonspace} to \cs{FBcolonspace} to avoid
+% a conflict with fournier.sty.}
+%
+% \changes{v3.0a}{2014/01/13}{\cs{FBthinspace} is no longer a kern but
+% a skip (frenchb adds a nobreak penalty before it).}
+%
+% \begin{macro}{\FBcolonskip}
+% \begin{macro}{\FBthinskip}
+% \changes{v3.0a}{2014/01/10}{LuaTeX requires dimensions: two new skips
+% \cs{FBcolonskip} and \cs{FBthinskip}.}
+%
+% According to the I.N.\ specifications, the `:' requires an
+% inter-word space before it, the other three require just
+% a |\thinspace|. We define |\FBcolonspace| as |\space|
+% (inter-word space) and |\FBthinspace| as |\thinspace| (both
+% are user customisable).
+% LuaTeX requires skips instead of commands, so we define
+% |\FBcolonskip| and |\FBthinskip| to hold the specifications
+% (width/stretch/shrink) of |\space| and |\thinspace| for the
+% |lmr10| font; these parameters will be scaled for the current font
+% by the \file{frenchb.lua} script (see how p.~\pageref{lua-scaling}).
+% |\FBcolonskip| and |\FBthinskip| are also user customisable.
+% \begin{macrocode}
+\newcommand*{\FBcolonspace}{\space}
+\newcommand*{\FBthinspace}{\thinspace}
+\newskip\FBcolonskip
+\FBcolonskip=3.33pt plus 1.665pt minus 1.11pt \relax
+\newskip\FBthinskip
+\FBthinskip=1.66672pt \relax
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{Punctuation with LuaTeX}
+% \label{sssec-punct-luatex}
+%
+% \changes{v3.0a}{2014/01/10}{New handling of `high punctuation'
+% through callbacks with LuaTeX engines.}
+%
+% The following part holds specific code for punctuation with modern
+% LuaTeX engines (version $\ge 0.76$).
+%
+% We define two LuaTeX attributes to control spacing in French
+% for `high punctuation' and quotes, making sure that
+% |\newluatexattribute| is defined.
+% \begin{macrocode}
+\ifFB@luatex@punct
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname newluatexattribute\endcsname\relax
+ \input luaotfload.sty
+ \fi
+ \newluatexattribute\FB@addDPspace \FB@addDPspace=1 \relax
+ \newluatexattribute\FB@addGUILspace \FB@addGUILspace=0 \relax
+ \ifLaTeXe
+ \PackageInfo{frenchb.ldf}{No need for active punctuation characters%
+ \MessageBreak with this version of LuaTeX!%
+ \MessageBreak reported}
+ \else
+ \fb@info{No need for active punctuation characters\\
+ with this version of LuaTeX!}
+ \fi
+% \end{macrocode}
+%
+% \iffalse
+%</ldf>
+%<*lua>
+% \fi
+% \file{frenchb.lua} holds Lua code to deal with `high punctuation'
+% and quotes. This code is based on suggestions from Paul Isambert.
+%
+% First we define two flags to control spacing before French `high
+% punctuation' (thin space or inter-word space).
+% \begin{macrocode}
+local FB_punct_thin =
+ {[string.byte("!")] = true,
+ [string.byte("?")] = true,
+ [string.byte(";")] = true}
+local FB_punct_thick =
+ {[string.byte(":")] = true}
+% \end{macrocode}
+% Managing spacing after `\guillemotleft' (U+00AB) and before
+% `\guillemotright' (U+00BB) can be done by the way; we define two
+% flags, |FB_punct_left| for characters requiring some space before
+% them and |FB_punct_right| for `\guillemotleft' which must be
+% followed by some space.
+% \begin{macrocode}
+local FB_punct_left =
+ {[string.byte("!")] = true,
+ [string.byte("?")] = true,
+ [string.byte(";")] = true,
+ [string.byte(":")] = true,
+ [0xBB] = true}
+local FB_punct_right =
+ {[0xAB] = true}
+% \end{macrocode}
+% Two more flags will be needed to avoid spurious spaces in
+% strings like !! ?? or (?)
+% \begin{macrocode}
+local FB_punct_null =
+ {[string.byte("!")] = true,
+ [string.byte("?")] = true,
+ [string.byte("[")] = true,
+ [string.byte("(")] = true,
+% \end{macrocode}
+% or if the user has typed a nobreak space U+00A0 or a nobreak thin
+% space U+202F before a `high punctuation' character: no space
+% should be added by \frenchb. Same is true inside French quotes.
+% \begin{macrocode}
+ [0xA0] = true,
+ [0x202F] = true}
+local FB_guil_null =
+ {[0xA0] = true,
+ [0x202F] = true}
+% \end{macrocode}
+% Local definitions for nodes:
+% \begin{macrocode}
+local new_node = node.new
+local copy_node = node.copy
+local node_id = node.id
+local GLUE = node_id("glue")
+local GSPEC = node_id("glue_spec")
+local GLYPH = node_id("glyph")
+local PENALTY = node_id("penalty")
+local nobreak = new_node(PENALTY)
+nobreak.penalty = 10000
+local insert_node_before = node.insert_before
+local insert_node_after = node.insert_after
+local remove_node = nodes.remove
+% \end{macrocode}
+% Some variables to store |\FBthinskip|, |\FBcolonskip| and
+% |\FBguillskip| (given for |lmr10|); width/stretch/shrink are
+% stored as fractions of |\fontdimen2|, |\fontdimen3| and
+% |\fontdimen4| of |lmr10| font respectively\dots
+% \label{lua-scaling}
+% \begin{macrocode}
+local thin10 = tex.skip['FBthinskip']
+local thinwd = thin10.width/65536/3.33
+local thinst = thin10.stretch/65536/1.665
+local thinsh = thin10.shrink/655.36/1.11
+local coln10 = tex.skip['FBcolonskip']
+local colnwd = coln10.width/65536/3.33
+local colnst = coln10.stretch/65536/1.665
+local colnsh = coln10.shrink/65536/1.11
+local guil10 = tex.skip['FBguillskip']
+local guilwd = guil10.width/65536/3.33
+local guilst = guil10.stretch/65536/1.665
+local guilsh = guil10.shrink/65536/1.11
+% \end{macrocode}
+% and a function to scale them for the current font:
+% \begin{macrocode}
+local font_table = {}
+local function new_glue_scaled (fid,width,stretch,shrink)
+ local fp = font_table[fid]
+ if not fp then
+ font_table[fid] = font.getfont(fid).parameters
+ fp = font_table[fid]
+ end
+ local gl = new_node(GLUE,0)
+ local gl_spec = new_node(GSPEC)
+ gl_spec.width = width * fp.space
+ gl_spec.stretch = stretch * fp.space_stretch
+ gl_spec.shrink = shrink * fp.space_shrink
+ gl.spec = gl_spec
+ return gl
+end
+% \end{macrocode}
+% Let's catch LuaTeX attributes |\FB@addDPspace| and
+% |\FB@addGUILspace|. Constant |FR=lang.id(french)| will be
+% defined by command |\activate@luatexpunct|.
+% \begin{macrocode}
+local addDPspace = luatexbase.attributes['FB@addDPspace']
+local addGUILspace = luatexbase.attributes['FB@addGUILspace']
+local has_attribute = node.has_attribute
+% \end{macrocode}
+% The following function will be added to |pre_linebreak_filter| and
+% |hpack_filter| callbacks. It catches all nodes of type |GLYPH|
+% in the list starting at |head| and checks the language attributes
+% of the current glyph: nothing is done if the current language is
+% not French and only specific punctuation characters (those for
+% which |FB_punct_left| or |FB_punct_rigt| is true) need a special
+% treatment.
+% In French, local variables are defined to hold the properties of
+% the current glyph (|item|) and of the previous one (|prev|) or the
+% next one (|next|).
+% \begin{macrocode}
+local function french_punctuation (head)
+ for item in node.traverse_id(GLYPH, head) do
+ local lang = item.lang
+ local char = item.char
+ local SIG = has_attribute(item, addGUILspace)
+ if lang == FR and FB_punct_left[char] then
+ local fid = item.font
+ local prev = item.prev
+ local prev_id, prev_subtype, prev_char
+ if prev then
+ prev_id = prev.id
+ prev_subtype = prev.subtype
+ if prev_id == GLYPH then
+ prev_char = prev.char
+ end
+ end
+ local glue = prev_id == GLUE and prev_subtype == 0
+% \end{macrocode}
+% For characters for which |FB_punct_thin| or |FB_punct_thick| is
+% \emph{true}, the amount of spacing to be typeset before them
+% is controlled by |\FBthinskip| (|thinwd|, |thinst|, |thinsh|) or
+% |\FBcolonskip| (|colnwd|, |colnst|, |colnsh|) respectively.
+% Two options: if a space has been typed in before (turned to
+% \emph{glue} in the node list), we remove the \emph{glue} and add a
+% nobreak penalty and the required \emph{glue}.
+% Otherwise (|auto| option), the penalty and the required
+% \emph{glue} are inserted \emph{only if} all three conditions are
+% satisfied: a) attribute |\FB@addDPspace| is set,
+% b) the previous character is not part of type
+% |FB_punct_null| (this avoids spurious spaces in strings
+% like |(!)| or |??|),
+% c) the punctuation mark does not start a paragraph.
+% \begin{macrocode}
+ if FB_punct_thin[char] or FB_punct_thick[char] then
+ local SBDP = has_attribute(item, addDPspace)
+ local fbglue
+ if FB_punct_thick[char] then
+ fbglue = new_glue_scaled(fid,colnwd,colnst,colnsh)
+ else
+ fbglue = new_glue_scaled(fid,thinwd,thinst,thinsh)
+ end
+ local auto =
+ SBDP and SBDP > 0 and
+ (prev_char and not FB_punct_null[prev_char]) or
+ (not prev_char and (prev_id ~= 0 or prev_subtype ~= 3))
+ if glue or auto then
+ if glue then
+ head = remove_node(head,prev,true)
+ end
+ insert_node_before(head, item, copy_node(nobreak))
+ insert_node_before(head, item, copy_node(fbglue))
+ end
+% \end{macrocode}
+% Let's consider `\guillemotright' now (the only remaining glyph of
+% |FB_punct_left| class): we just have to remove any \emph{glue}
+% possibly preceeding `\guillemotright', then insert the nobreak
+% penalty and the proper \emph{glue} (controlled by |\FBguillskip|).
+% This is done only if French quotes have been `activated' by
+% options \fbo{og=\guillemotleft, fg=\guillemotright} in
+% \fbsetup{} and can be denied locally with |\NoAutoSpacing|
+% (this is controlled by the |SIG| flag).
+% \begin{macrocode}
+ elseif SIG and SIG > 0 then
+ if glue or (prev_char and not FB_guil_null[prev_char]) then
+ if glue then
+ head = remove_node(head,prev,true)
+ end
+ local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh)
+ insert_node_before(head, item, copy_node(nobreak))
+ insert_node_before(head, item, copy_node(fbglue))
+ end
+ end
+ end
+% \end{macrocode}
+% Similarly, for `\guillemotleft' (unique member of the
+% |FB_punct_right| class), we check the following node looking for
+% \emph{glue} or |FB_guil_null| character, in order to remove any
+% \emph{glue} possibly following it and to insert the proper
+% \emph{glue} and nobreak penalty in this order if necessary.
+% \begin{macrocode}
+ if lang == FR and FB_punct_right[char] and SIG and SIG > 0 then
+ local next = item.next
+ local next_id, next_subtype, next_char
+ if next then
+ next_id = next.id
+ next_subtype = next.subtype
+ if next_id == GLYPH then
+ next_char = next.char
+ end
+ end
+ local glue = next_id == GLUE and next_subtype == 0
+ if glue or (next_char and not FB_guil_null[next_char]) then
+ if glue then
+ head = remove_node(head,next,true)
+ end
+ local fid = item.font
+ local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh)
+ insert_node_after(head, item, copy_node(fbglue))
+ insert_node_after(head, item, copy_node(nobreak))
+ end
+ end
+ end
+ return head
+end
+return french_punctuation
+% \end{macrocode}
+% \iffalse
+%</lua>
+%<*ldf>
+% \fi
+%
+% As a language tag is part of glyph nodes in LuaTeX, nothing needs
+% to be added to |\extrasfrench| and |\noextrasfrench|; we will just
+% redefine |\shorthandoff| and |\shorthandon| in French to issue a
+% warning reminding the user that active characters are no longer
+% used in French with recent LuaTeX engines.
+% \begin{macrocode}
+ \newcommand*{\FB@luatex@punct@french}{%
+ \ifx\shorthandoffORI\@undefined
+ \let\shorthandonORI\shorthandon
+ \let\shorthandoffORI\shorthandoff
+ \fi
+ \def\shorthandoff##1{%
+ \ifx\PackageWarning\@undefined
+ \fb@warning{\noexpand\shorthandoff{;:!?} is helpless with
+ LuaTeX,\\ use \noexpand\NoAutoSpacing
+ *inside a group* instead.}%
+ \else
+ \PackageWarning{frenchb.ldf}{\protect\shorthandoff{;:!?} is
+ helpless with LuaTeX,\MessageBreak use \protect\NoAutoSpacing
+ \space *inside a group* instead;\MessageBreak reported}%
+ \fi}%
+ \def\shorthandon##1{}%
+ }
+ \newcommand*{\FB@luatex@punct@nonfrench}{%
+ \ifx\shorthandoffORI\@undefined
+ \else
+ \let\shorthandon\shorthandonORI
+ \let\shorthandoff\shorthandoffORI
+ \fi
+ }
+ \FB@addto{extras}{\FB@luatex@punct@french}
+ \FB@addto{noextras}{\FB@luatex@punct@nonfrench}
+% \end{macrocode}
+% In \LaTeXe, file \file{frenchb.lua} will be loaded
+% `AtBeginDocument' \emph{after} processing options
+% (\fbo{ThinColonSpace} needs to be taken into account). The next
+% definition will be used to activate Lua punctuation: it sets the
+% language number for French, loads \file{frenchb.lua} and adds
+% function |french_punctuation| to both callbacks
+% |pre_linebreak_filter| (paragraph building) and |hpack_filter|
+% (|\hbox| building).
+% \begin{macrocode}
+ \def\activate@luatexpunct{%
+ \directlua{%
+ FR = \the\l@french
+ local f = dofile("frenchb.lua")
+ luatexbase.add_to_callback("pre_linebreak_filter",
+ f, "frenchb.french_punctuation",1)
+ luatexbase.add_to_callback("hpack_filter",
+ f, "frenchb.french_punctuation",1)
+ }%
+ }
+% \end{macrocode}
+% End of specific code for punctuation with LuaTeX engines.
+% \begin{macrocode}
+\fi
+% \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 polyglossia package, see
-% \file{gloss-french.ldf}. We use the same mechanism for French
+% following code was borrowed from the \pkg{polyglossia} package,
+% see \file{gloss-french.ldf}. We use the same mechanism for French
% quotes (\texttt{\guillemotleft} and \texttt{\guillemotright}),
% when automatic spacing for quotes is required by options
-% \texttt{og=} and \texttt{fg=} in |\frenchbsetup{}| (see
-% section~\ref{sec-keyval}).
+% \fbo{og=} and \fbo{fg=} in \fbsetup{} (see
+% section~\ref{ssec-keyval}).
%
% For every character used in French text-mode (except spaces),
% |\XeTeXcharclass| value must be 0.
% |\XeTeXcharclass| value for spaces is assumed to be 255.
-% Otherwise, the spacing before the `double punctuation' characters
+% Otherwise, the spacing before the `high punctuation' characters
% and inside quotes might not be correct.
%
% We switch |\XeTeXinterchartokenstate| to 1 and change the
@@ -862,26 +1416,24 @@
% \changes{v2.5g}{2012/01/02}{Add four \cs{newif} to control
% spacing of quotes (characters and control sequences).}
%
-% \changes{v2.5g}{2012/01/01}{Skip the message in Plain,
-% \cs{PackageInfo} undefined for Plain formats.}
-%
+% The following part holds specific code for punctuation with XeTeX
+% engines.
% \begin{macrocode}
-\newif\ifFBAutoSpaceGuill \FBAutoSpaceGuilltrue
-\newif\ifFBguillo@addspace
-\newif\ifFBguillf@addspace
-\newif\ifFBog@addspace \FBog@addspacetrue
-\newif\ifFBfg@addspace \FBfg@addspacetrue
\newcount\FB@interchartokenstateORI
\ifFB@xetex@punct
\ifLaTeXe
- \PackageInfo{frenchb.ldf}{No need for active punctuation characters
- \MessageBreak with this version of XeTeX! reported}
+ \PackageInfo{frenchb.ldf}{No need for active punctuation characters%
+ \MessageBreak with this version of XeTeX!%
+ \MessageBreak reported}
+ \else
+ \fb@info{No need for active punctuation characters\\
+ with this version of XeTeX!}
\fi
% \end{macrocode}
-% We will need the following code (borrowed from
-% \file{zhsusefulmacros.sty}) for loops:
+% The following code is borrowed from \file{ltcntrl.dtx}
+% (LaTeX base) for loops (|\@for| undefined in Plain):
% \begin{macrocode}
- \@ifundefined{@for}{%
+ \ifx\@for\@undefined
\def\@nnil{\@nil}%
\def\@empty{}%
\def\@fornoop#1\@@#2#3{}%
@@ -900,7 +1452,7 @@
\long\def\@tforloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
\expandafter\@fornoop \else
#4\relax\expandafter\@tforloop\fi#2\@@#3{#4}}%
- }{}%
+ \fi
% \end{macrocode}
% \changes{v2.5i}{2012/04/20}{Temporary fix: as long as
% \file{xeCJK.sty} will not use \cs{newXeTeXintercharclass} to
@@ -911,16 +1463,22 @@
%
% \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 `double
+% to prevent frenchb from adding it's own space before `high
% punctuation' characters.}
%
-% Five new character classes are defined for |frenchb|.
+% \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@punctguilo
- \newXeTeXintercharclass\FB@punctguilf
+ \newXeTeXintercharclass\FB@guilo
+ \newXeTeXintercharclass\FB@guilf
+ \newXeTeXintercharclass\FB@guilnul
% \end{macrocode}
% We define a command to store the |\XeTeXcharclass| values which
% will be modified for French (as a comma separated list) and a
@@ -939,7 +1497,7 @@
% (locally) to avoid error messages with XeTeX-based engines.
%
% \changes{v2.5g}{2011/12/31}{XeTeXcharclass(es) for French quotes will
-% be set to \cs{FB@punctguilo} and \cs{FB@punctguilf} by options
+% 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.}
%
@@ -972,7 +1530,7 @@
\XeTeXcharclass `\: = \FB@punctthick
\XeTeXinterchartoks \z@ \FB@punctthick = {%
\ifhmode\FDP@colonspace\fi}%
- \XeTeXinterchartoks \FB@punctguilf \FB@punctthick = {%
+ \XeTeXinterchartoks \FB@guilf \FB@punctthick = {%
\FDP@colonspace}%
\XeTeXinterchartoks 255 \FB@punctthick = {%
\ifhmode\unskip\penalty\@M\FBcolonspace\fi}%
@@ -980,23 +1538,23 @@
{\XeTeXcharclass\FB@char=\FB@punctthin}%
\XeTeXinterchartoks \z@ \FB@punctthin = {%
\ifhmode\FDP@thinspace\fi}%
- \XeTeXinterchartoks \FB@punctguilf \FB@punctthin = {%
+ \XeTeXinterchartoks \FB@guilf \FB@punctthin = {%
\FDP@thinspace}%
\XeTeXinterchartoks 255 \FB@punctthin = {%
\ifhmode\unskip\penalty\@M\FBthinspace\fi}%
- \XeTeXinterchartoks \FB@punctguilo \z@ = {%
+ \XeTeXinterchartoks \FB@guilo \z@ = {%
\ifFBAutoSpaceGuill\FBguill@spacing\fi}%
- \XeTeXinterchartoks \FB@punctguilo 255 = {%
+ \XeTeXinterchartoks \FB@guilo 255 = {%
\ifFBAutoSpaceGuill\FBguill@spacing\ignorespaces\fi}%
- \XeTeXinterchartoks \z@ \FB@punctguilf = {%
+ \XeTeXinterchartoks \z@ \FB@guilf = {%
\ifFBAutoSpaceGuill\FBguill@spacing\fi}%
- \XeTeXinterchartoks \FB@punctthin \FB@punctguilf = {%
+ \XeTeXinterchartoks \FB@punctthin \FB@guilf = {%
\ifFBAutoSpaceGuill\FBguill@spacing\fi}%
- \XeTeXinterchartoks 255 \FB@punctguilf = {%
+ \XeTeXinterchartoks 255 \FB@guilf = {%
\ifFBAutoSpaceGuill\unskip\FBguill@spacing\fi}%
% \end{macrocode}
-% This avoids spurious spaces in (!), [?] and with Unicode
-% nobreakspaces (U+00A0, U+202F).
+% This will avoid spurious spaces in (!), [?] and with Unicode
+% nobreakspaces (U+00A0, U+202F):
% \begin{macrocode}
\@for\FB@char:={`\[,`\(,"A0,"202F}\do
{\XeTeXcharclass\FB@char=\FB@punctnul}%
@@ -1011,13 +1569,15 @@
% With Xe(La)TeX, French defines no active shorthands.
% \begin{macrocode}
\def\shorthandoff##1{%
- \@ifundefined{PackageWarning}%
- {\let\PackageWarning\undefined}%
- {\PackageWarning{frenchb.ldf}{\protect\shorthandoff{;:!?} is
- helpless with XeTeX,\MessageBreak use \protect\NoAutoSpacing
- \space *inside a group* instead;\MessageBreak reported}%
- }%
- }%
+ \ifx\PackageWarning\@undefined
+ \fb@warning{\noexpand\shorthandoff{;:!?} is helpless with
+ XeTeX,\\ use \noexpand\NoAutoSpacing
+ *inside a group* instead.}%
+ \else
+ \PackageWarning{frenchb.ldf}{\protect\shorthandoff{;:!?} is
+ helpless with XeTeX,\MessageBreak use \protect\NoAutoSpacing
+ \space *inside a group* instead;\MessageBreak reported}%
+ \fi}%
\def\shorthandon##1{}%
}
% \end{macrocode}
@@ -1044,14 +1604,20 @@
\let\shorthandoff\shorthandoffORI
\fi
}
- \addto\extrasfrench{\FB@xetex@punct@french}
- \addto\noextrasfrench{\FB@xetex@punct@nonfrench}
-\fi
+ \FB@addto{extras}{\FB@xetex@punct@french}
+ \FB@addto{noextras}{\FB@xetex@punct@nonfrench}
% \end{macrocode}
% \end{macro}
+% End of specific code for punctuation with modern XeTeX engines.
+% \begin{macrocode}
+\fi
+% \end{macrocode}
%
-% Otherwise we need to make the four characters |;| |!| |?| and |:|
-% `active' and provide their definitions.
+% \subsubsection{Punctuation with standard (pdf)TeX}
+% \label{sssec-punct-tex}
+%
+% In standard (pdf)TeX we need to make the four characters |;| |!| |?|
+% and |:| `active' and provide their definitions.
% \begin{macrocode}
\ifFB@active@punct
\initiate@active@char{:}%
@@ -1064,10 +1630,10 @@
% in horizontal mode, hence the test |\ifhmode|.
%
% In horizontal mode, if a space has been typed before `;' we
-% remove it and put an unbreakable |\thinspace| instead. If no
+% remove it and put an unbreakable |\FBthinspace| instead. If no
% space has been typed, we add |\FDP@thinspace| which will be
-% defined, up to the user's wishes, as an automatic added
-% thin space, or as |\@empty|.
+% defined, up to the user's wishes, as |\FBthinspace|, or as
+% |\@empty|.
% \begin{macrocode}
\declare@shorthand{french}{;}{%
\ifhmode
@@ -1125,8 +1691,7 @@
% We specify that the French group of shorthands should be used when
% switching to French.
% \begin{macrocode}
- \addto\extrasfrench{%
- \languageshorthands{french}%
+ \FB@addto{extras}{\languageshorthands{french}%
% \end{macrocode}
% These characters are `turned on' once, later their definition may
% vary. Don't misunderstand the following code: they keep being
@@ -1135,13 +1700,20 @@
\bbl@activate{:}\bbl@activate{;}%
\bbl@activate{!}\bbl@activate{?}%
}
- \addto\noextrasfrench{%
+ \FB@addto{noextras}{%
\bbl@deactivate{:}\bbl@deactivate{;}%
- \bbl@deactivate{!}\bbl@deactivate{?}}
+ \bbl@deactivate{!}\bbl@deactivate{?}%
+ }
\fi
% \end{macrocode}
%
-% A new `if' |\FBAutoSpacePunctuation| needs to be defined now.
+% \subsubsection{Punctuation switches common to all engines}
+% \label{sssec-punct-switches}
+%
+% A new `if' |\ifFBAutoSpacePunctuation| needs to be defined now to
+% control the two possible ways of dealing with `high punctuation'.
+% it's default value is true, but it can be set to false by
+% \fbsetup{AutoSpacePunctuation=false} for finer control.
% \begin{macrocode}
\newif\ifFBAutoSpacePunctuation \FBAutoSpacePunctuationtrue
% \end{macrocode}
@@ -1156,18 +1728,24 @@
%
% \begin{macro}{\AutoSpaceBeforeFDP}
% \begin{macro}{\NoAutoSpaceBeforeFDP}
-% |\FDP@thinspace| and |\FDP@colonspace| are defined as unbreakable
-% spaces by |\autospace@beforeFDP| or as |\@empty| by
-% |\noautospace@beforeFDP| (internal commands), user commands
-% |\AutoSpaceBeforeFDP| and |\NoAutoSpaceBeforeFDP| do the same and
-% take care of the flag |\ifFBAutoSpacePunctuation| in \LaTeX{}.
+% |\autospace@beforeFDP| and |\noautospace@beforeFDP| are internal
+% commands. |\autospace@beforeFDP| defines |\FDP@thinspace| and
+% |\FDP@colonspace| as unbreakable spaces and sets LuaTeX attribute
+% |\FB@addDPspace| to 1 (true), while |\noautospace@beforeFDP|
+% lets these spaces empty and sets flag |\FB@addDPspace|
+% to 0 (false). User commands |\AutoSpaceBeforeFDP| and
+% |\NoAutoSpaceBeforeFDP| do the same and take care of the flag
+% |\ifFBAutoSpacePunctuation| in \LaTeX{}.
% Set the default now for Plain (done later for \LaTeX).
% \begin{macrocode}
\def\autospace@beforeFDP{%
- \def\FDP@thinspace{\penalty\@M\FBthinspace}%
- \def\FDP@colonspace{\penalty\@M\FBcolonspace}}
-\def\noautospace@beforeFDP{\let\FDP@thinspace\@empty
- \let\FDP@colonspace\@empty}
+ \ifFB@luatex@punct\FB@addDPspace=1 \fi
+ \def\FDP@thinspace{\penalty\@M\FBthinspace}%
+ \def\FDP@colonspace{\penalty\@M\FBcolonspace}}
+\def\noautospace@beforeFDP{%
+ \ifFB@luatex@punct\FB@addDPspace=0 \fi
+ \let\FDP@thinspace\@empty
+ \let\FDP@colonspace\@empty}
\ifLaTeXe
\def\AutoSpaceBeforeFDP{\autospace@beforeFDP
\FBAutoSpacePunctuationtrue}
@@ -1183,22 +1761,24 @@
% \end{macro}
%
% \changes{v2.3a}{2008/10/10}{In LaTeX, frenchb no longer adds spaces
-% before `double punctuation' characters in computer code.
+% before `high punctuation' characters in computer code.
% Suggested by Yannis Haralambous.}
%
% \changes{v2.3c}{2009/02/07}{Commands \cs{ttfamily}, \cs{rmfamily}
% and \cs{sffamily} have to be robust. Bug introduced in 2.3a,
-% pointed out by Manuel P\'egouri\'e-Gonnard.}
+% pointed out by Manuel Pégourié-Gonnard.}
%
% In \LaTeXe{} |\ttfamily| (and hence |\texttt|) will be redefined
% `AtBeginDocument' as |\ttfamilyFB| so that no space
% is added before the four |; : ! ?| characters, even if
-% |AutoSpacePunctuation| is true. |\rmfamily| and |\sffamily| need
-% to be redefined also (|\ttfamily| is not always used inside a
-% group, its effect can be cancelled by |\rmfamily| or |\sffamily|).
+% \fbo{AutoSpacePunctuation} is \fbo{true}. |\rmfamily| and
+% |\sffamily| need to be redefined also (|\ttfamily| is not always
+% used inside a group, its effect can be cancelled by |\rmfamily| or
+% |\sffamily|).
%
% These redefinitions can be canceled if necessary, for instance to
-% recompile older documents, see option |OriginalTypewriter| below.
+% 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
@@ -1207,28 +1787,22 @@
% 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 |\frenchbsetup{}|.
+% characters} with the `og'/`fg' options in \fbsetup{}.
% This is also a workaround for the weird behaviour of these
% characters in verbatim mode.
%
-% \changes{v2.5g}{2012/01/02}{Switch flags \cs{ifFBog@addspace} and
-% \cs{ifFBfg@addspace} to true, otherwise \cs{og} and \cs{fg}
-% provide no spacing in XeLaTeX with options `og' and `fg'
-% activated in \cs{frenchbsetup} (bug v.~2.5a-f).}
-%
% \begin{macrocode}
\ifLaTeXe
- \let\ttfamilyORI\ttfamily
- \let\rmfamilyORI\rmfamily
- \let\sffamilyORI\sffamily
+ %\let\ttfamilyORI\ttfamily
+ %\let\rmfamilyORI\rmfamily
+ %\let\sffamilyORI\sffamily
\DeclareRobustCommand\ttfamilyFB{%
\FBAutoSpaceGuillfalse
- \FBog@addspacetrue \FBfg@addspacetrue
+ \ifFB@luatex@punct\FB@addGUILspace=0 \fi
\noautospace@beforeFDP\ttfamilyORI}%
\DeclareRobustCommand\rmfamilyFB{%
\FBAutoSpaceGuilltrue
- \ifFBguillo@addspace\FBog@addspacefalse\fi
- \ifFBguillf@addspace\FBfg@addspacefalse\fi
+ \ifFB@luatex@punct\FB@addGUILspace=1 \fi
\ifFBAutoSpacePunctuation
\autospace@beforeFDP
\else
@@ -1237,8 +1811,7 @@
\rmfamilyORI}%
\DeclareRobustCommand\sffamilyFB{%
\FBAutoSpaceGuilltrue
- \ifFBguillo@addspace\FBog@addspacefalse\fi
- \ifFBguillf@addspace\FBfg@addspacefalse\fi
+ \ifFB@luatex@punct\FB@addGUILspace=1 \fi
\ifFBAutoSpacePunctuation
\autospace@beforeFDP
\else
@@ -1254,25 +1827,20 @@
% \begin{macro}{\NoAutoSpacing}
% The following command will switch off active punctuation
% characters (if any) and disable automatic spacing for French quote
-% characters. It is engine independent (works for \TeX{} and
-% Xe\TeX{} based engines) and is meant to be used inside a group.
-%
-% \changes{v2.5g}{2012/01/02}{Switch flags \cs{ifFBog@addspace} and
-% \cs{ifFBfg@addspace} to true, otherwise \cs{og} and \cs{fg}
-% provide no spacing in XeLaTeX with options `og' and `fg'
-% activated in \cs{frenchbsetup} (bug v.~2.5a-f).}
+% characters. It is engine independent (works for TeX, LuaTeX and
+% XeTeX based engines) and is meant to be used inside a group.
%
% \begin{macrocode}
\newcommand*{\NoAutoSpacing}{\FBAutoSpaceGuillfalse
- \FBog@addspacetrue \FBfg@addspacetrue
\ifFB@active@punct\shorthandoff{;:!?}\fi
- \ifFB@xetex@punct\XeTeXinterchartokenstate=0\fi
+ \ifFB@xetex@punct\XeTeXinterchartokenstate=0 \fi
+ \ifFB@luatex@punct\FB@addDPspace=0 \FB@addGUILspace=0 \fi
}
% \end{macrocode}
% \end{macro}
%
% \subsection{Commands for French quotation marks}
-% \label{sec-quotes}
+% \label{ssec-quotes}
%
% \begin{macro}{\og}
% \begin{macro}{\fg}
@@ -1280,9 +1848,12 @@
% (``\underline{o}uvrez \underline{g}uillemets'') and |\fg|
% (``\underline{f}ermez \underline{g}uillemets'').
% Another option for typesetting quotes in multilingual texts
-% is to use the package \file{csquotes.sty} and its command
+% is to use the package \pkg{csquotes} and its command
% |\enquote|.
-%
+% Dummy definition of |\og| and |\fg| just to ensure that this
+% commands are not yet defined. The default definition of |\og|
+% and |\fg| will be set later (for English) by
+% |\bbl@nonfrenchguillemets|.
% \begin{macrocode}
\newcommand*{\og}{\@empty}
\newcommand*{\fg}{\@empty}
@@ -1296,13 +1867,11 @@
% \begin{macro}{\textquoteddblright}
% \LaTeX{} users are supposed to use 8-bit output encodings (T1,
% LY1,\dots) to typeset French, those who still stick to OT1 should
-% call \file{aeguill.sty} or a similar package. In both cases the
+% call \pkg{aeguill} or a similar package. In both cases the
% commands |\guillemotleft| and |\guillemotright| will print the
% French opening and closing quote characters from the output font.
-% For XeLaTeX, |\guillemotleft| and |\guillemotright| are defined
-% by package \file{xunicode.sty}.
-% We will check `AtBeginDocument' that the proper output encodings
-% are in use (see end of section~\ref{sec-keyval}).
+% For XeLaTeX and LuaLaTeX, |\guillemotleft| and |\guillemotright|
+% are defined by package \pkg{xunicode} loaded by \pkg{fontspec}.
%
% \changes{v2.5a}{2010/08/20}{Change \cs{guillemotleft} and
% \cs{guillemotright} definitions for Unicode anf provide
@@ -1310,7 +1879,7 @@
% \cs{textquotedbright}. Insures correct printing of quotes
% by \cs{og} and \cs{fg} in French and outside.}
%
-% We give the following definitions for non-LaTeX users only as a
+% 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
@@ -1341,27 +1910,61 @@
% quotation marks but no line break is allowed neither \emph{after}
% the opening one, nor \emph{before} the closing one.
% |\FBguill@spacing| which does the spacing, has been fine tuned by
-% Thierry Bouche. French quotes (including spacing) are printed by
+% Thierry Bouche to 80\% of an inter-word space but with reduced
+% stretchability. French quotes (including spacing) are printed by
% |\FB@og| and |\FB@fg|, the expansion of the top level commands
% |\og| and |\og| is different in and outside French.
-% We'll try to be smart to users of David~Carlisle's \file{xspace}
+% 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.5g}{2012/01/01}{\cs{FBguill@spacing} needs to be skipped
-% in commands \cs{FB@og} and \cs{FB@fg} only when XeTeX's ``inter
-% char'' mechanism is triggered for quotes, see \cs{frenchbsetup}.}
+% \changes{v3.0a}{2014/01/10}{Definitions of \cs{FB@og} and \cs{FB@fg}
+% now depend on punctuation handling (LuaTeX / XeTeX / active).}
%
+% \changes{v3.0a}{2014/01/10}{Added explicit \cs{FBguillskip}
+% for LuaTeX.}
+%
+% LuaTeX which requires skips; |\FBguillskip| is computed from
+% |\FBguill@spacing| for the |lmr10| font, its dimensions will
+% be scaled by \file{frenchb.lua} for the current font.
% \begin{macrocode}
+\newskip\FBguillskip
+\FBguillskip=2.664pt plus 0.500pt minus 0.888pt \relax
\newcommand*{\FBguill@spacing}{\penalty\@M\hskip.8\fontdimen2\font
plus.3\fontdimen3\font
minus.8\fontdimen4\font}
-\DeclareRobustCommand*{\FB@og}{\leavevmode\guillemotleft
- \ifFBog@addspace\FBguill@spacing\fi}
-\DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
- \ifFBfg@addspace\FBguill@spacing\fi
- \guillemotright\xspace}
+% \end{macrocode}
+% |\FBguill@spacing| is not used with LuaTeX.
+% \begin{macrocode}
+\ifFB@luatex@punct
+ \DeclareRobustCommand*{\FB@og}{\leavevmode
+ \bgroup\FB@addGUILspace=1 \guillemotleft\egroup}
+ \DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
+ \bgroup\FB@addGUILspace=1 \guillemotright\egroup\xspace}
+\fi
+% \end{macrocode}
+% With XeTeX, |\FBAutoSpaceGuill| is set to |false| locally to
+% prevent the quotes characters from adding space when option
+% \fbo{og=«, fg=»} is set.
+% characters.
+% \begin{macrocode}
+\ifFB@xetex@punct
+ \DeclareRobustCommand*{\FB@og}{\leavevmode
+ \bgroup\FBAutoSpaceGuillfalse\guillemotleft\egroup
+ \FBguill@spacing}
+ \DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
+ \FBguill@spacing
+ \bgroup\FBAutoSpaceGuillfalse\guillemotright\egroup\xspace}
+\fi
+\ifFB@active@punct
+ \DeclareRobustCommand*{\FB@og}{\leavevmode
+ \guillemotleft
+ \FBguill@spacing}
+ \DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
+ \FBguill@spacing
+ \guillemotright\xspace}
+\fi
% \end{macrocode}
%
% The top level definitions for French quotation marks are switched
@@ -1373,28 +1976,31 @@
% correctly in English when using XeTeX or LuaTeX, fixed by using
% \cs{textquotedblleft} and \cs{textquotedblright} defined above.}
%
+% \changes{v3.0a}{2010/08/20}{\cs{bbl@nonfrenchguillemets} deleted,
+% use \cs{babel@save} instead.}
+%
% \begin{macrocode}
\ifLaTeXe
\def\bbl@frenchguillemets{\renewcommand*{\og}{\FB@og}%
\renewcommand*{\fg}{\FB@fg}}
- \def\bbl@nonfrenchguillemets{\renewcommand*{\og}{\textquotedblleft}%
- \renewcommand*{\fg}{\ifdim\lastskip>\z@\unskip\fi
- \textquotedblright}}
+ \renewcommand*{\og}{\textquotedblleft}
+ \renewcommand*{\fg}{\ifdim\lastskip>\z@\unskip\fi \textquotedblright}
\else
\def\bbl@frenchguillemets{\let\og\FB@og
\let\fg\FB@fg}
- \def\bbl@nonfrenchguillemets{\def\og{\textquotedblleft}%
- \def\fg{\ifdim\lastskip>\z@\unskip\fi\textquotedblright}}
+ \def\og{\textquotedblleft}
+ \def\fg{\ifdim\lastskip>\z@\unskip\fi\textquotedblright}
\fi
-\addto\extrasfrench{\bbl@frenchguillemets}
-\addto\noextrasfrench{\bbl@nonfrenchguillemets}
+\FB@addto{extras}{\babel@save\og \babel@save\fg \bbl@frenchguillemets}
% \end{macrocode}
%
% \subsection{Date in French}
+% \label{sssec-date}
%
% \begin{macro}{\datefrench}
% The macro |\datefrench| redefines the command |\today| to
-% produce French dates.
+% produce French dates. This new implementation requires \babel~3.9
+% or newer.
%
% \changes{v2.0}{2006/11/06}{2 '\cs{relax}' added in
% \cs{today}'s definition.}
@@ -1402,17 +2008,45 @@
% \changes{v2.1a}{2008/03/25}{\cs{today} changed (correction in 2.0
% was wrong: \cs{today} was printed without spaces in toc).}
%
-% \changes{v2.5a}{2010/08/20}{Replaced \cs{'}e and \cs{\char94}u
-% by c.s. to work with XeTeX and LuaTeX.}
+% \changes{v3.0a}{2014/02/18}{Take advantage of babel's \cs{SetString}
+% commands for \cs{datefrench}. Doesn't work with Plain (yet?).}
%
% \begin{macrocode}
-\@namedef{date\CurrentOption}{%
- \def\today{{\number\day}\ifnum1=\day {\ier}\fi \space
- \ifcase\month
- \or janvier\or f{\FBeacute}vrier\or mars\or avril\or mai\or
- juin\or juillet\or ao{\FBucirconflexe}t\or septembre\or
- octobre\or novembre\or d{\FBeacute}cembre\fi
- \space \number\year}}
+\ifLaTeXe
+ \def\BabelLanguages{french,acadian}
+ \StartBabelCommands*{\BabelLanguages}{date}
+ [unicode, fontenc=EU1 EU2, charset=utf8]
+ \SetString\monthiiname{février}
+ \SetString\monthviiiname{août}
+ \SetString\monthxiiname{décembre}
+ \StartBabelCommands*{\BabelLanguages}{date}
+ \SetStringLoop{month#1name}{%
+ janvier,f\'evrier,mars,avril,mai,juin,juillet,%
+ ao\^ut,septembre,octobre,novembre,d\'ecembre}
+ \SetString\today{{\number\day}\ifnum1=\day {\ier}\fi\space
+ \csname month\romannumeral\month name\endcsname \space
+ \number\year
+ }
+ \EndBabelCommands
+\else
+ \ifFBunicode
+ \@namedef{date\CurrentOption}{%
+ \def\today{{\number\day}\ifnum1=\day {\ier}\fi \space
+ \ifcase\month
+ \or janvier\or février\or mars\or avril\or mai\or
+ juin\or juillet\or août\or septembre\or
+ octobre\or novembre\or décembre\fi
+ \space \number\year}}
+ \else
+ \@namedef{date\CurrentOption}{%
+ \def\today{{\number\day}\ifnum1=\day {\ier}\fi \space
+ \ifcase\month
+ \or janvier\or f\'evrier\or mars\or avril\or mai\or
+ juin\or juillet\or ao\^ut\or septembre\or
+ octobre\or novembre\or d\'ecembre\fi
+ \space \number\year}}
+ \fi
+\fi
% \end{macrocode}
% \end{macro}
%
@@ -1432,12 +2066,7 @@
% \changes{v2.4d}{2010/07/28}{Command \cs{up} defined with
% \cs{providecommand} instead of \cs{newcommand} as \cs{up} may be
% defined elsewhere (catalan.ldf).
-% Bug pointed out by Felip Many\'e i Ballester.}
-%
-% \changes{v2.5a}{2010/08/21}{Test \cs{@ifundefined} leaves the
-% tested control sequence defined as \cs{relax} when TRUE.
-% Changed \cs{relax} to \cs{undefined} when testing
-% \cs{realsuperscript}.}
+% Bug pointed out by Felip Manyé i Ballester.}
%
% \begin{macro}{\fup}
%
@@ -1452,19 +2081,19 @@
% characters in encodings like applemac, utf-8,\dots}
%
% |\up| eases the typesetting of superscripts like
-% `1\textsuperscript{er}'. Up to version 2.0 of |frenchb| |\up| was
-% just a shortcut for |\textsuperscript| in \LaTeXe, but several
+% `1\textsuperscript{er}'. Up to version 2.0 of \frenchb{} |\up|
+% was just a shortcut for |\textsuperscript| in \LaTeXe, but several
% users complained that |\textsuperscript| typesets superscripts
% too high and too big, so we now define |\fup| as an attempt to
% produce better looking superscripts. |\up| is defined as |\fup|
-% but |\frenchbsetup{FrenchSuperscripts=false}| redefines |\up|
+% 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 \file{scalefnt} which will be loaded at the end of
-% \babel's loading (|frenchb| being an option of babel, it cannot
+% 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}
@@ -1483,7 +2112,7 @@
% |\FB@lc| is defined as |\MakeLowercase| to inhibit the uppercasing
% of superscripts (this may happen in page headers with the standard
% classes but is wrong); |\FB@lc| can be redefined to do nothing
-% by option |LowercaseSuperscripts=false| of |\frenchbsetup{}|.
+% by option \fbo{LowercaseSuperscripts=false} of \fbsetup{}.
% \begin{macrocode}
\newcommand*{\FBsupR}{-0.12}
\newcommand*{\FBsupS}{0.65}
@@ -1496,10 +2125,9 @@
}
% \end{macrocode}
% The only packages I currently know to take advantage of real
-% superscripts are a) \file{xltxtra} used in conjunction with
-% XeLaTeX and OpenType fonts having the font feature
-% 'VerticalPosition=Superior' (\file{xltxtra} defines
-% |\realsuperscript| and |\fakesuperscript|) and b) \file{fourier}
+% superscripts are a) \pkg{realscripts} used in conjunction with
+% XeLaTeX or LuaLaTeX and OpenType fonts having the font feature
+% 'VerticalPosition=Superior' and b) \pkg{fourier}
% (from version 1.6) when Expert Utopia fonts are available.
%
% |\FB@up| checks whether the current font is a Type1 `Expert'
@@ -1547,18 +2175,20 @@
\newcommand*{\FB@up@real}[1]{\bgroup
\fontfamily{\FB@firstthree -sup}\selectfont \FB@lc{#1}\egroup}
% \end{macrocode}
-% |\fup| is now defined as |\FB@up| unless |\realsuperscript| is
-% defined (occurs with XeLaTeX calling \file{xltxtra.sty}).
+% |\fup| is defined as |\FB@up| unless |\realsuperscript| is
+% defined by \file{realscripts.sty}.
% \begin{macrocode}
\DeclareRobustCommand*{\fup}[1]{%
- \@ifundefined{realsuperscript}%
- {\FB@up{#1}\let\realsuperscript\undefined}%
- {\bgroup\let\fakesuperscript\FB@up@fake
- \realsuperscript{\FB@lc{#1}}\egroup}}
+ \ifx\realsuperscript\@undefined
+ \FB@up{#1}%
+ \else
+ \bgroup\let\fakesuperscript\FB@up@fake
+ \realsuperscript{\FB@lc{#1}}\egroup
+ \fi}
% \end{macrocode}
% Let's provide a temporary definition for |\up| (redefined
% `AtBeginDocument' as |\fup| or |\textsuperscript| according to
-% |\frenchbsetup{}| options).
+% \fbsetup{} options).
% \begin{macrocode}
\providecommand*{\up}{\relax}
% \end{macrocode}
@@ -1626,7 +2256,7 @@
% \end{macrocode}
%
% Let's provide four macros for the common abbreviations
-% of ``Num\'ero''.
+% of ``Numéro''.
% \begin{macrocode}
\DeclareRobustCommand*{\No}{N\up{\lowercase{o}}\kern+.2em}
\DeclareRobustCommand*{\no}{n\up{\lowercase{o}}\kern+.2em}
@@ -1644,7 +2274,7 @@
% As family names should be written in small capitals and never be
% hyphenated, we provide a command (its name comes from Boxed Small
% Caps) to input them easily. Note that this command has changed
-% with version~2 of |frenchb|: a |\kern0pt| is used instead of |\hbox|
+% with version~2 of \frenchb: a |\kern0pt| is used instead of |\hbox|
% because |\hbox| would break microtype's font expansion; as a
% (positive?) side effect, composed names (such as Dupont-Durand)
% can now be hyphenated on explicit hyphens.
@@ -1703,31 +2333,6 @@
\fi
% \end{macrocode}
%
-% \changes{v2.5a}{2010/08/20}{New definitions needed for XeTeX/LuaTeX
-% to properly print some dates and captions: using c.s. like \cs{'e}
-% do not work with XeTeX (OK with XeLaTeX).}
-%
-% French dates and captions make use of four non-ascii characters
-% (\texttt{\`a}, \texttt{\`e}, \texttt{\'e} and \texttt{\^u}).
-% This is fine except for (plain) XeTeX (|\accent| commands are not
-% implemented), so we define four new commands to deal with this
-% issue.
-% \begin{macrocode}
-\newcommand*{\FBagrave}{\`a}
-\newcommand*{\FBegrave}{\`e}
-\newcommand*{\FBeacute}{\'e}
-\newcommand*{\FBucirconflexe}{\^u}
-\ifFBunicode
- \ifLaTeXe
- \else
- \def\FBagrave{{\char"00E0}}
- \def\FBegrave{{\char"00E8}}
- \def\FBeacute{{\char"00E9}}
- \def\FBucirconflexe{{\char"00FB}}
- \fi
-\fi
-% \end{macrocode}
-%
% \begin{macro}{\degres}
% We now define a macro |\degres| for typesetting the abbreviation
% for `degrees' (as in `degrees Celsius'). As the bounding box of
@@ -1761,17 +2366,19 @@
\else
\def\Warning@degree@TSone{%
\PackageWarning{frenchb.ldf}{%
- Degrees would look better in TS1-encoding:
+ Degrees would look better in TS1-encoding:%
\MessageBreak add \protect
- \usepackage{textcomp} to the preamble.
+ \usepackage{textcomp} to the preamble.%
\MessageBreak Degrees used}}
- \AtBeginDocument{\@ifundefined{DeclareEncodingSubset}%
- {\DeclareRobustCommand*{\degres}{%
- \leavevmode\hbox to 0.3em{\hss\degre\hss}%
- \Warning@degree@TSone
- \global\let\Warning@degree@TSone\relax}}%
- {\DeclareRobustCommand*{\degres}{%
- \hbox{\UseTextSymbol{TS1}{\textdegree}}}}%
+ \AtBeginDocument{\ifx\DeclareEncodingSubset\@undefined
+ \DeclareRobustCommand*{\degres}{%
+ \leavevmode\hbox to 0.3em{\hss\degre\hss}%
+ \Warning@degree@TSone
+ \global\let\Warning@degree@TSone\relax}%
+ \else
+ \DeclareRobustCommand*{\degres}{%
+ \hbox{\UseTextSymbol{TS1}{\textdegree}}}%
+ \fi
}
\fi
\else
@@ -1782,7 +2389,7 @@
% \end{macro}
%
% \subsection{Formatting numbers}
-% \label{sec-numbers}
+% \label{ssec-numbers}
%
% \begin{macro}{\DecimalMathComma}
% \begin{macro}{\StandardMathComma}
@@ -1806,17 +2413,19 @@
\advance\dec@mcc by -\@tempcnta
\newcommand*{\DecimalMathComma}{\iflanguage{french}%
{\mathcode`\,=\dec@mcc}{}%
- \addto\extrasfrench{\mathcode`\,=\dec@mcc}}
+ \FB@addto{extras}{\mathcode`\,=\dec@mcc}%
+}
\newcommand*{\StandardMathComma}{\mathcode`\,=\std@mcc
- \addto\extrasfrench{\mathcode`\,=\std@mcc}}
-\addto\noextrasfrench{\mathcode`\,=\std@mcc}
+ \FB@addto{extras}{\mathcode`\,=\std@mcc}%
+}
+\FB@addto{noextras}{\mathcode`\,=\std@mcc}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\nombre}
%
-% \changes{v2.0}{2006/11/06}{\cs{nombre} requires now numprint.sty.}
+% \changes{v2.0}{2006/11/06}{\cs{nombre} now requires numprint.sty.}
%
% The command |\nombre| is now borrowed from \file{numprint.sty} for
% \LaTeXe. There is no point to maintain the former tricky code
@@ -1825,15 +2434,17 @@
% it prints them as is and issues a warning about the change.
%
% Fake command |\nombre| for Plain based formats, warning users of
-% |frenchb| v.~1.x.\ of the change.
+% \frenchb{} v.~1.x.\ of the change.
% \begin{macrocode}
-\newcommand*{\nombre}[1]{{#1}\message{%
- *** \noexpand\nombre no longer formats numbers\string! ***}}%
+\newcommand*{\nombre}[1]{{#1}\fb@warning{*** \noexpand\nombre
+ no longer formats numbers\string! ***}}
% \end{macrocode}
% \end{macro}
%
-% The next definitions only make sense for \LaTeXe. Let's cleanup
-% and exit if the format in Plain based.
+% The next definitions only make sense for \LaTeXe.
+% For Plain based formats, let's activate LuaTeX punctuation if
+% necessary, then cleanup and exit. Temporary fix: |\l@french| is
+% not properly set by \babel~3.9h with Plain LuaTeX format.
%
% \begin{macrocode}
\let\FBstop@here\relax
@@ -1842,39 +2453,37 @@
\let\LaTeXefalse\undefined}
\ifx\magnification\@undefined
\else
- \def\FBstop@here{\let\STD@makecaption\relax
+ \def\FBstop@here{\ifFB@luatex@punct
+ \activate@luatexpunct
+ \fi
\FBclean@on@exit
\ldf@quit\CurrentOption\endinput}
\fi
\FBstop@here
% \end{macrocode}
%
-% What follows now is for \LaTeXe{} \emph{only}.
+% What follows is for \LaTeXe{} \emph{only}; as all \LaTeXe{}
+% based formats include \eTeX, we can use |\ifdefined| now.
% We redefine |\nombre| for \LaTeXe. A warning is issued
% at the first call of |\nombre| if |\numprint| is not
-% defined, suggesting what to do. The package \file{numprint}
-% is \emph{not} loaded automatically by |frenchb| because of
+% defined, suggesting what to do. The package \pkg{numprint}
+% is \emph{not} loaded automatically by \frenchb{} because of
% possible options conflict.
%
-% \changes{v2.5a}{2010/08/21}{Test \cs{@ifundefined} leaves the
-% tested control sequence defined as \cs{relax} when TRUE.
-% Changed \cs{relax} to \cs{undefined} when testing
-% \cs{numprint}.}
-%
% \begin{macrocode}
\renewcommand*{\nombre}[1]{\Warning@nombre\numprint{#1}}
\newcommand*{\Warning@nombre}{%
- \@ifundefined{numprint}%
- {\PackageWarning{frenchb.ldf}{%
- \protect\nombre\space now relies on package numprint.sty,
+ \ifdefined\numprint
+ \else
+ \PackageWarning{frenchb.ldf}{%
+ \protect\nombre\space now relies on package numprint.sty,%
\MessageBreak add \protect
\usepackage[autolanguage]{numprint}\MessageBreak
- to your preamble *after* loading babel, \MessageBreak
+ to your preamble *after* loading babel,\MessageBreak
see file numprint.pdf for more options.\MessageBreak
\protect\nombre\space called}%
- \global\let\Warning@nombre\relax
- \global\let\numprint\undefined
- }{}%
+ \global\let\Warning@nombre\relax
+ \fi
}
% \end{macrocode}
%
@@ -1882,20 +2491,9 @@
% numprint's command \cs{npstylefrench}, it will be redefined
% `AtBeginDocument' by \cs{FBprocess@options}.}
%
-% \changes{v2.0c}{2007/06/25}{\cs{ThinSpaceInFrenchNumbers} added
-% for compatibility with frenchb-1.x.}
-%
-% \begin{macrocode}
-\newcommand*{\ThinSpaceInFrenchNumbers}{%
- \PackageWarning{frenchb.ldf}{%
- Type \protect\frenchbsetup{ThinSpaceInFrenchNumbers}
- \MessageBreak Command \protect\ThinSpaceInFrenchNumbers\space
- is no longer\MessageBreak defined in frenchb v.~2,}}
-% \end{macrocode}
-%
% \subsection{Caption names}
%
-% The next step consists of defining the French equivalents for
+% The next step consists in defining the French equivalents for
% the \LaTeX{} caption names.
%
% \begin{macro}{\captionsfrench}
@@ -1905,95 +2503,98 @@
% \changes{v2.0}{2006/11/06}{`Fig.' changed to `Figure' and
% `Tab.' to `Table'.}
%
-% \changes{v2.0}{2006/12/15}{Set \cs{CaptionSeparator} in
-% \cs{extrasfrench} now instead of \cs{captionsfrench}
-% because it has to be reset when leaving French.}
-%
% \changes{v2.5a}{2010/08/16}{\cs{emph} deleted in \cs{seename}
% and \cs{alsoname} to match what is done for the other languages.
% Suggested by Marc Baudoin.}
%
-% \changes{v2.5a}{2010/08/20}{Replaced \cs{'e}, \cs{`e} and \cs{`a}
-% by c.s. to work with XeTeX.}
-%
-% \begin{macrocode}
-\@namedef{captions\CurrentOption}{%
- \def\refname{R{\FBeacute}f{\FBeacute}rences}%
- \def\abstractname{R{\FBeacute}sum{\FBeacute}}%
- \def\bibname{Bibliographie}%
- \def\prefacename{Pr{\FBeacute}face}%
- \def\chaptername{Chapitre}%
- \def\appendixname{Annexe}%
- \def\contentsname{Table des mati{\FBegrave}res}%
- \def\listfigurename{Table des figures}%
- \def\listtablename{Liste des tableaux}%
- \def\indexname{Index}%
- \def\figurename{{\scshape Figure}}%
- \def\tablename{{\scshape Table}}%
-% \end{macrocode}
-% ``Premi\`ere partie'' instead of ``Part I''.
-% \begin{macrocode}
- \def\partname{\protect\@Fpt partie}%
- \def\@Fpt{{\ifcase\value{part}\or Premi{\FBegrave}re\or
- Deuxi{\FBegrave}me\or Troisi{\FBegrave}me\or
- Quatri{\FBegrave}me\or Cinqui{\FBegrave}me\or
- Sixi{\FBegrave}me\or Septi{\FBegrave}me\or Huiti{\FBegrave}me\or
- Neuvi{\FBegrave}me\or Dixi{\FBegrave}me\or Onzi{\FBegrave}me\or
- Douzi{\FBegrave}me\or Treizi{\FBegrave}me\or
- Quatorzi{\FBegrave}me\or Quinzi{\FBegrave}me\or
- Seizi{\FBegrave}me\or Dix-septi{\FBegrave}me\or
- Dix-huiti{\FBegrave}me\or Dix-neuvi{\FBegrave}me\or
- Vingti{\FBegrave}me\fi}\space\def\thepart{}}%
- \def\pagename{page}%
- \def\seename{voir}%
- \def\alsoname{voir aussi}%
- \def\enclname{P.~J. }%
- \def\ccname{Copie {\FBagrave} }%
- \def\headtoname{}%
- \def\proofname{D{\FBeacute}monstration}%
- \def\glossaryname{Glossaire}%
- }
+% \changes{v3.0a}{2014/02/18}{Take advantage of babel's \cs{SetString}
+% commands for captionnames.}
+%
+% New implementation for caption names (requires \babel's~3.9 or up).
+% \begin{macrocode}
+\StartBabelCommands*{\BabelLanguages}{captions}
+ [unicode, fontenc=EU1 EU2, charset=utf8]
+ \SetString{\refname}{Références}
+ \SetString{\abstractname}{Résumé}
+ \SetString{\prefacename}{Préface}
+ \SetString{\contentsname}{Table des matières}
+ \SetString{\ccname}{Copie à }
+ \SetString{\proofname}{Démonstration}
+ \SetStringLoop{ordinal#1}{%
+ Première,Deuxième,Troisième,Quatrième,Cinquième,%
+ Sixième,Septième,Huitième,Neuvième,Dixième,Onzième,%
+ Douzième,Treizième,Quatorzième,Quinzième,Seizième,%
+ Dix-septième,Dix-huitième,Dix-neuvième,Vingtième}
+\StartBabelCommands*{\BabelLanguages}{captions}
+ \SetString{\refname}{R\'ef\'erences}
+ \SetString{\abstractname}{R\'esum\'e}
+ \SetString{\bibname}{Bibliographie}
+ \SetString{\prefacename}{Pr\'eface}
+ \SetString{\chaptername}{Chapitre}
+ \SetString{\appendixname}{Annexe}
+ \SetString{\contentsname}{Table des mati\`eres}
+ \SetString{\listfigurename}{Table des figures}
+ \SetString{\listtablename}{Liste des tableaux}
+ \SetString{\indexname}{Index}
+ \SetString{\figurename}{{\scshape Figure}}
+ \SetString{\tablename}{{\scshape Table}}
+ \SetString{\pagename}{page}
+ \SetString{\seename}{voir}
+ \SetString{\alsoname}{voir aussi}
+ \SetString{\enclname}{P.~J. }
+ \SetString{\ccname}{Copie \`a }
+ \SetString{\headtoname}{}
+ \SetString{\proofname}{D\'emonstration}
+ \SetString{\glossaryname}{Glossaire}
+% \end{macrocode}
+% ``Première partie'' instead of ``Part I''.
+% \begin{macrocode}
+ \SetStringLoop{ordinal#1}{%
+ Premi\`ere,Deuxi\`eme,Troisi\`eme,Quatri\`eme,Cinqui\`eme,%
+ Sixi\`eme,Septi\`eme,Huiti\`eme,Neuvi\`eme,Dixi\`eme,Onzi\`eme,%
+ Douzi\`eme,Treizi\`eme,Quatorzi\`eme,Quinzi\`eme,Seizi\`eme,%
+ Dix-septi\`eme,Dix-huiti\`eme,Dix-neuvi\`eme,Vingti\`eme}
+ \AfterBabelCommands{%
+ \DeclareRobustCommand*{\FB@emptypart}{\def\thepart{}}%
+ \DeclareRobustCommand*{\FB@Rpart}{\def\thepart{\Roman{part}}}%
+ }
+ \SetString{\partname}{%
+ \csname ordinal\romannumeral\value{part}\endcsname\space
+ partie\FB@emptypart}
+\EndBabelCommands
% \end{macrocode}
% \end{macro}
%
-% As some users who choose |frenchb| or |francais| as option of
-% \babel, might customise |\captionsfrenchb| or |\captionsfrancais|
-% in the preamble, we merge their changes at the |\begin{document}|
-% when they do so.
-% The other variants of French (canadien, acadian) are defined by
-% checking if the relevant option was used and then adding one extra
-% level of expansion.
-%
-% \changes{v2.5b}{2010/10/30}{\cs{captionsfrench} will be executed
-% `AtBeginDocument' after \cs{FBprocess@options}, no need to
-% add it here.}
-%
-% \begin{macrocode}
-\AtBeginDocument{\let\captions@French\captionsfrench
- \@ifundefined{captionsfrenchb}%
- {\let\captions@Frenchb\relax}%
- {\let\captions@Frenchb\captionsfrenchb}%
- \@ifundefined{captionsfrancais}%
- {\let\captions@Francais\relax}%
- {\let\captions@Francais\captionsfrancais}%
- \def\captionsfrench{\captions@French
- \captions@Francais\captions@Frenchb}%
- \def\captionsfrancais{\captionsfrench}%
- \def\captionsfrenchb{\captionsfrench}%
- }
-\@ifpackagewith{babel}{canadien}{%
- \def\captionscanadien{\captionsfrench}%
- \def\datecanadien{\datefrench}%
- \def\extrascanadien{\extrasfrench}%
- \def\noextrascanadien{\noextrasfrench}%
- }{}
-\@ifpackagewith{babel}{acadian}{%
- \def\captionsacadian{\captionsfrench}%
- \def\dateacadian{\datefrench}%
- \def\extrasacadian{\extrasfrench}%
- \def\noextrasacadian{\noextrasfrench}%
- }{}
-% \end{macrocode}
+% \changes{v3.0a}{2014/02/28}{Merging of \cs{captionsfrenchb},
+% \cs{captionsfrancais} with \cs{captionsfrench} deleted in favor
+% of new babel 3.9 syntax.}
+%
+% Up to v2.6h \frenchb{} used to merge |\captionsfrenchb| and
+% |\captionsfrancais| into |\captionsfrench| at |\begin{document}|.
+% This is deprecated in favor of the new (much simpler!) syntax
+% introduced in \babel~3.9. No need to define |\captionscanadien|
+% and |\captionsacadian| either.
+%
+% \begin{macro}{\CaptionSeparator}
+% Let's consider now captions in figures and tables.
+% In French, captions in figures and tables should never be printed
+% as `Figure 1:' which is the default in standard \LaTeXe{} classes;
+% the `:' is made active too late, no space is added before it.
+% With LuaLaTeX and XeLaTeX, this glitch doesn't occur, you get
+% `Figure 1~:' which is correct in French. With pdfLaTeX \frenchb{}
+% provides the following workaround.
+%
+% The standard definition of |\@makecaption| (e.g., the one provided
+% in article.cls, report.cls, book.cls which is frozen for \LaTeXe{}
+% according to Frank Mittelbach), is saved in |\STD@makecaption|.
+% `AtBeginDocument' we compare it to its current definition (some
+% classes like \cls{memoir}, koma-script classes, AMS classes,
+% ua-thesis.cls\dots change it).
+% If they are identical, \frenchb{} just adds a hook called
+% |\FBCaption@Separator| to |\@makecaption|; |\FBCaption@Separator|
+% defaults to `: ' as in the standard |\@makecaption| and will be
+% changed to ` : ' in French `AtBeginDocument'; it can be also set to
+% |\CaptionSeparator| (` -- ') using \fbo{CustomiseFigTabCaptions}.
%
% \changes{v2.4a}{2009/11/23}{\cs{PackageWarning} changed to
% \cs{FBWarning} (in case \cs{@makecaption} has been customised).
@@ -2002,38 +2603,45 @@
%
% \changes{v2.6c}{2013/05/18}{Former \cs{CaptionSeparator}
% has been renamed as \cs{FBCaption@Separator};
-% \cs{CaptionSeparator} and \cs{CaptionSeparatorORI} are available
-% for customisation. Newif \cs{if@FBwarning@capsep} added.}
+% Newif \cs{if@FBwarning@capsep} added.}
%
-% \begin{macro}{\CaptionSeparator}
-% \begin{macro}{\CaptionSeparatorORI}
-% Let's consider now captions in figures and tables.
-% In French, captions in figures and tables should be printed with
-% the number followed by endash (` -- '), never as `Figure 1:' which
-% is the default in standard \LaTeXe{} classes.
+% \changes{v2.6h}{2014/01/03}{No active catcodes in
+% \cs{STD@makecaption}'s definition.}
%
-% The standard definition of |\@makecaption| (e.g., the one provided
-% in article.cls, report.cls, book.cls which is frozen for \LaTeXe{}
-% according to Frank Mittelbach), has been saved in
-% |\STD@makecaption| before making `:' active
-% (see section~\ref{sec-punct}). `AtBeginDocument' we compare it to
-% its current definition (some classes like koma-script classes,
-% AMS classes, ua-thesis.cls\dots change it).
-% If they are identical, |frenchb| just adds a hook called
-% |\FBCaption@Separator| to |\@makecaption|; |\FBCaption@Separator|
-% defaults to |\CaptionSeparatorORI| (`: ') as in the standard
-% |\@makecaption|, and will be changed to |\CaptionSeparator|
-% (` -- ') in French.
+% \changes{v3.0a}{2014/02/28}{Remove \cs{CaptionSeparatorORI}, use
+% \cs{babel@save} instead.}
%
-% The \file{caption} and \file{floatrow} packages are compatible
-% with |frenchb| if they are loaded after babel (a warning is
+% While saving the standard definition of |\@makecaption| we have to
+% make sure that characters `:' and `|>|' have |\catcode| 12
+% (\frenchb{} makes `:' active and \file{spanish.ldf} makes `|>|'
+% active).
+% \begin{macrocode}
+\bgroup
+ \catcode`:=12 \catcode`>=12 \relax
+ \long\gdef\STD@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ #1: #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}
+\egroup
+% \end{macrocode}
+%
+% The \pkg{caption} and \pkg{floatrow} packages are compatible
+% with \frenchb{} if they are loaded after \babel{} (a warning is
% printed in the .log file when they are loaded too early).
%
-% No warning is issued for AMS classes as their layout of captions
-% is compatible with French typographic standards.
+% No warning is issued for SMF and AMS classes as their layout of
+% captions is compatible with French typographic standards.
%
-% With koma-script classes, frenchb customises |\captionformat| in
-% French and issues no warning.
+% 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.
@@ -2042,9 +2650,8 @@
\newif\if@FBwarning@capsep
\@FBwarning@capseptrue
\newcommand{\FBWarning}[2]{\PackageWarning{#1}{#2}}
-\newcommand*{\CaptionSeparatorORI}{\string:\space}
\newcommand*{\CaptionSeparator}{\space\textendash\space}
-\def\FBCaption@Separator{\CaptionSeparatorORI}
+\def\FBCaption@Separator{:\space}
\long\def\FB@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#1\FBCaption@Separator #2}%
@@ -2057,40 +2664,54 @@
\vskip\belowcaptionskip}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \changes{v2.6c}{2013/05/18}{No warning about \cs{@makecaption} for
% AMS classes.}
%
-% Disable the standard warning with AMS classes.
+% \changes{v3.0a}{2014/02/20}{No warning about \cs{@makecaption} for
+% SMF classes. No warning either with LuaTeX or XeTeX engines.}
+%
+% Disable the standard warning with AMS and SMF classes.
% \begin{macrocode}
\@ifclassloaded{amsart}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{amsbook}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{amsdtx}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{amsldoc}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{amproc}{\@FBwarning@capsepfalse}{}
+\@ifclassloaded{smfart}{\@FBwarning@capsepfalse}{}
+\@ifclassloaded{smfbook}{\@FBwarning@capsepfalse}{}
+% \end{macrocode}
+%
+% Disable the standard warning unless high punctuation is active.
+% \begin{macrocode}
+\ifFB@active@punct\else\@FBwarning@capsepfalse\fi
% \end{macrocode}
%
% \changes{v2.6c}{2013/05/18}{No warning about \cs{@makecaption} for
% koma-script classes. \cs{captionformat} customised in French.}
%
-% No warning with koma-script classes: they change |\makecaption|
-% but we will manage to customise |\captionformat| in French later
-% on (see below after executing |\FBprocess@options|).
+% \changes{v2.6h}{2014/01/05}{If \cs{@makecaption} is undefined, no
+% warning.}
+%
+% No warning with \cls{memoir} or koma-script classes: they change
+% |\@makecaption| but we will manage to customise them in French
+% later on (see below after executing |\FBprocess@options|).
+% No warning either if |\@makecaption| is undefined.
% \begin{macrocode}
-\AtBeginDocument{%
- \@ifundefined{captionformat}%
- {\let\captionformat\undefined}%
- {\@FBwarning@capsepfalse}%
-}
+\newif\ifFB@koma
+\@ifclassloaded{memoir}{\@FBwarning@capsepfalse}{}
+\@ifclassloaded{scrartcl}{\@FBwarning@capsepfalse\FB@komatrue}{}
+\@ifclassloaded{scrbook}{\@FBwarning@capsepfalse\FB@komatrue}{}
+\@ifclassloaded{scrreprt}{\@FBwarning@capsepfalse\FB@komatrue}{}
+\ifdefined\@makecaption\else\@FBwarning@capsepfalse\fi
% \end{macrocode}
%
% \changes{v2.6c}{2013/05/18}{Warning added when the caption
% or floatrow package is loaded before babel/frenchb.}
%
-% Check if package \file{caption} is loaded now (before
-% babel/frenchb), then issue a warning advising to load it
-% after babel/frenchb and disable the standard warning.
+% Check if package \pkg{caption} is loaded now (before
+% \babel/\frenchb), then issue a warning advising to load it
+% after \babel/\frenchb{} and disable the standard warning.
% \begin{macrocode}
\@ifpackageloaded{caption}
{\FBWarning{frenchb.ldf}%
@@ -2110,529 +2731,49 @@
{}
% \end{macrocode}
%
-% Check the definition of |\@makecaption|, change it or issue a
-% warning in case it has been changed by a class or package not
-% (yet) compatible with |frenchb|.
+% \changes{v3.0a}{2014/02/20}{More informative, less TeXnical warning
+% about \cs{@makecaption}.}
+%
+% First check the definition of |\@makecaption|, change it or issue
+% a warning in case it has been changed by a class or package not
+% (yet) compatible with \frenchb; then change the definition of
+% |\FBCaption@Separator|, taking care that the colon is typeset
+% correctly in French (\emph{not} `Figure~1: légende').
+%
% \begin{macrocode}
\AtBeginDocument{%
\ifx\@makecaption\STD@makecaption
\global\let\@makecaption\FB@makecaption
+% \end{macrocode}
+% Do not overwrite |\FBCaption@Separator| if already saved
+% as ': ' for other languages and set to |\CaptionSeparator| by
+% |\extrasfrench| when French is the main language.
+% \begin{macrocode}
+ \ifFBOldFigTabCaptions
+ \else
+ \def\FBCaption@Separator{\iflanguage{french}{ : }{: }}%
+ \fi
+ \ifFBCustomiseFigTabCaptions
+ \ifx\bbl@main@language\FB@french
+ \def\FBCaption@Separator{\CaptionSeparator}%
+ \fi
+ \fi
\@FBwarning@capsepfalse
\fi
\if@FBwarning@capsep
\FBWarning{frenchb.ldf}%
- {The definition of \protect\@makecaption\space
- has been changed,\MessageBreak
- frenchb will NOT customise it;\MessageBreak reported}%
+ {Figures' and tables' captions might look like\MessageBreak
+ `Figure 1:' which is wrong in French.\MessageBreak
+ Check your class or packages to change this;\MessageBreak
+ reported}%
\fi
\let\FB@makecaption\relax
\let\STD@makecaption\relax
}
% \end{macrocode}
-% In French, |\FB@makecaption| uses |\CaptionSeparator| which
-% defaults to ` -- ' and |\CaptionSeparatorORI| (default `: ') for
-% other languages.
-% \begin{macrocode}
-\addto\extrasfrench{%
- \def\FBCaption@Separator{\CaptionSeparator}}
-\addto\noextrasfrench{%
- \def\FBCaption@Separator{\CaptionSeparatorORI}}
-% \end{macrocode}
-%
-% \subsection{French lists}
-% \label{sec-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\'e.
-% Lists have been completely redesigned in frenchb v.~2.6a.
-% An option for backward compatibility is provided.}
-%
-% \begin{macro}{\listFB}
-% \begin{macro}{\listORI}
-% \begin{macro}{\FB@listVsettings}
-% Vertical spacing in lists should be shorter in French texts than
-% the defaults provided by \LaTeX.
-% Note that the easy way, just changing values of vertical spacing
-% parameters when entering French and restoring them to their
-% defaults on exit would not work; so we define the command
-% |\FB@listVsettings| to hold the settings to be used by
-% the French variant |\listFB| of |\list|. Note that switching
-% to |\listFB| reduces vertical spacing in \emph{all} environments
-% built on |\list|: |itemize|, |enumerate|, |description|, but also
-% |abstract|, |quotation|, |quote| and |verse|\dots{}
-%
-% The amount of vertical space before and after a list is given by
-% |\topsep| + |\parskip| (+ |\partopsep| if the list starts a new
-% paragraph). IMHO, |\parskip| should be added \emph{only} when
-% the list starts a new paragraph, so I subtract |\parskip| from
-% |\topsep| and add it back to |\partopsep|; this will normally
-% make no difference because |\parskip|'s default value is 0pt, but
-% will be noticeable when |\parskip| is \emph{not} null.
-%
-% |\endlist| is not redefined, but |\endlistORI| and |\endlistFB|
-% will be defined as |\endlist| `AtBeginDocument' for users
-% who define their own lists using |\listORI| or |\listFB|.
-% \begin{macrocode}
-\let\listORI\list
-\def\FB@listVsettings{%
- \setlength{\itemsep}{0.4ex plus 0.2ex minus 0.2ex}%
- \setlength{\parsep}{0.4ex plus 0.2ex minus 0.2ex}%
- \setlength{\topsep}{0.8ex plus 0.4ex minus 0.4ex}%
- \setlength{\partopsep}{0.4ex plus 0.2ex minus 0.2ex}%
-% \end{macrocode}
-% |\parskip| is of type `skip', its mean value only (\emph{not
-% the glue}) should be subtracted from |\topsep| and added to
-% |\partopsep|, so convert |\parskip| to a `dimen' using
-% |\@tempdima|.
-% \begin{macrocode}
- \@tempdima=\parskip
- \addtolength{\topsep}{-\@tempdima}%
- \addtolength{\partopsep}{\@tempdima}%
-}
-\def\listFB#1#2{\listORI{#1}{\FB@listVsettings #2}}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% Let's now consider French itemize-lists. They differ from those
-% provided by the standard \LaTeXe{} classes:
-% \begin{itemize}
-% \item The `\textbullet' is never used in French itemize-lists,
-% an emdash `---' or an endash `--' is preferred for all
-% levels. The item label to be used in French is stored in
-% |\FrenchLabelItem}|, it defaults to `---' and can be changed
-% using |\frenchbsetup{}| (see section~\ref{sec-keyval}).
-% \item Vertical spacing between items, before and after
-% the list, should be \emph{null} with \emph{no glue} added;
-% \item In French the labels of itemize-lists are vertically
-% aligned as follows:\\
-% \fbox{\parbox[t]{.5\textwidth}{%
-% \parindent=1.5em
-% Text starting at `parindent' \\
-% \noindent$\Leftarrow$ Leftmargin\\
-% \hspace*{\parindent}\textendash{} first item\dots{}\\
-% \hspace*{\parindent}\hspace*{\labelsep}%
-% \textendash{} first second level item\\
-% \hspace*{\parindent}\hspace*{\labelsep}%
-% \textendash{} next one\dots{}\\
-% \hspace*{\parindent}\textendash{} second item\dots{}
-% }}\\
-% \end{itemize}
-%
-% \begin{macro}{\FrenchLabelItem}
-% \changes{v2.6a}{2013/01/30}{defaults to \cs{textemdash} instead of
-% \cs{textendash} up to v.~2.5k.}
-% \begin{macro}{\Frlabelitemi}
-% \begin{macro}{\Frlabelitemii}
-% \begin{macro}{\Frlabelitemiii}
-% \begin{macro}{\Frlabelitemiv}
-% Default labels for French itemize-lists (same label for all levels):
-% \begin{macrocode}
-\newcommand*{\FrenchLabelItem}{\textemdash}
-\newcommand*{\Frlabelitemi}{\FrenchLabelItem}
-\newcommand*{\Frlabelitemii}{\FrenchLabelItem}
-\newcommand*{\Frlabelitemiii}{\FrenchLabelItem}
-\newcommand*{\Frlabelitemiv}{\FrenchLabelItem}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\bbl@frenchlabelitems}
-% \changes{v2.6a}{2013/01/30}{It now sets default values for
-% \cs{labelwidthFB} and \cs{listindentFB} and resets
-% \cs{FrenchLabelItem} to \cs{textendash} when compatibility
-% with former versions is requested.}
-% \begin{macro}{\bbl@nonfrenchlabelitems}
-% |\bbl@frenchlabelitems| saves current itemize labels and changes
-% them to their value in French. This code should never be executed
-% twice in a row, so we need a new flag that will be set and reset
-% by |\bbl@nonfrenchlabelitems| and |\bbl@frenchlabelitems|.
-% |\bbl@frenchlabelitems| also sets reasonable default values for
-% lengths |\labelwidthFB| and |\listindentFB| to be defined below,
-% but these lengths can still be customised in the preamble.
-% \begin{macrocode}
-\newif\ifFB@enterFrench \FB@enterFrenchtrue
-\def\bbl@frenchlabelitems{%
- \ifFB@enterFrench
- \let\@ltiORI\labelitemi
- \let\@ltiiORI\labelitemii
- \let\@ltiiiORI\labelitemiii
- \let\@ltivORI\labelitemiv
- \let\labelitemi\Frlabelitemi
- \let\labelitemii\Frlabelitemii
- \let\labelitemiii\Frlabelitemiii
- \let\labelitemiv\Frlabelitemiv
- \ifdim\labelwidthFB<\z@
- \settowidth{\labelwidthFB}{\FrenchLabelItem}%
- \fi
- \ifdim\listindentFB<\z@
- \ifdim\parindent=\z@
- \setlength{\listindentFB}{1.5em}%
- \else
- \setlength{\listindentFB}{\parindent}%
- \fi
- \fi
- \FB@enterFrenchfalse
- \fi
-}
-\def\bbl@nonfrenchlabelitems{%
- \ifFB@enterFrench
- \else
- \let\Frlabelitemi\labelitemi
- \let\Frlabelitemii\labelitemii
- \let\Frlabelitemiii\labelitemiii
- \let\Frlabelitemiv\labelitemiv
- \let\labelitemi\@ltiORI
- \let\labelitemii\@ltiiORI
- \let\labelitemiii\@ltiiiORI
- \let\labelitemiv\@ltivORI
- \FB@enterFrenchtrue
- \fi
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\listindentFB}
-% \begin{macro}{\labelwidthFB}
-% Let's define two lengths |\listindentFB| and |\labelwidthFB| to
-% customise lists' horizontal indentations. They are given
-% silly values here ($-1$\,pt) in order to eventually
-% enable their customisation in the preamble. They will get
-% reasonnable defaults later when entering French (see
-% |\bbl@frenchlabelitems|) unless they have been customised.
-% \begin{macrocode}
-\newlength\listindentFB
-\setlength{\listindentFB}{-1pt}
-\newlength\labelwidthFB
-\setlength{\labelwidthFB}{-1pt}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\FB@listHsettings}
-% \begin{macro}{\leftmarginFB}
-% |\FB@listHsettings| holds the new horizontal settings chosen for
-% French lists itemize and enumerate starting with version~2.6a.
-% They are based on the look resquested in French for
-% itemize-lists.
-% \begin{macrocode}
-\newlength\leftmarginFB
-\def\FB@listHsettings{%
- \leftmarginFB\labelwidthFB
- \advance\leftmarginFB \labelsep
- \leftmargini\leftmarginFB
- \advance\leftmargini \listindentFB
- \leftmarginii\leftmarginFB
- \leftmarginiii\leftmarginFB
- \leftmarginiv\leftmarginFB
- \leftmargin\csname leftmargin\romannumeral\the\@listdepth\endcsname
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\itemizeFB}
-% \begin{macro}{\FB@itemizesettings}
-%
-% \changes{v2.6f}{2013/11/25}{\cs{labelwidth} must be reset, f.i. when
-% an itemize list occurs inside environments based on trivlist which
-% set \cs{labelwidth} to 0 (see proof environment in amsthm.sty).
-% Bug pointed out by Julien Hauseux.}
-%
-% \changes{v2.6g}{2013/12/30}{Suppress all vertical spaces only if
-% ReduceListSpacing is true. Pointed out by Pierre Willaime.}
-%
-% New environment for French itemize-lists.\\ |\FB@itemizesettings|
-% does two things: first suppress all vertical spaces including
-% glue when option ReduceListSpacing is set, then set horizontal
-% indentations according to |\FB@listHsettings| unless option
-% |ListOldLayout| is true (compatibility with lists up to v.~2.5k).
-% \begin{macrocode}
-\def\FB@itemizesettings{%
- \ifFBReduceListSpacing
- \setlength{\itemsep}{\z@}%
- \setlength{\parsep}{\z@}%
- \setlength{\topsep}{\z@}%
- \setlength{\partopsep}{\z@}%
- \@tempdima=\parskip
- \addtolength{\topsep}{-\@tempdima}%
- \addtolength{\partopsep}{\@tempdima}%
- \fi
- \settowidth{\labelwidth}{\csname\@itemitem\endcsname}%
- \ifFBListOldLayout
- \setlength{\leftmargin}{\labelwidth}%
- \addtolength{\leftmargin}{\labelsep}%
- \addtolength{\leftmargin}{\parindent}%
- \else
- \FB@listHsettings
- \fi
-}
-% \end{macrocode}
-% The definition of |\itemizeFB| follows the one of |\itemize|
-% in standard \LaTeXe{} classes (see \file{ltlists.dtx}),
-% spaces are customised by |\FB@itemizesettings|.
-%
-% |\enditemizeFB| will be defined as |\endlist|=|\endlistORI|
-% `AtBeginDocument'.
-% \begin{macrocode}
-\def\itemizeFB{%
- \ifnum \@itemdepth >\thr@@\@toodeep\else
- \advance\@itemdepth\@ne
- \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
- \expandafter
- \listORI
- \csname\@itemitem\endcsname
- \FB@itemizesettings
- \fi}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\enumerateFB}
-% The definition of |\enumerateFB|, new to version~2.6a, follows
-% the one of |\enumerate| in standard \LaTeXe{} classes (see
-% \file{ltlists.dtx}), vertical spaces are customised (or not)
-% via |\list| (=|\listFB| or |\listORI|) and horizontal spaces
-% (leftmargins) are borrowed from |itemize| lists via
-% |\FB@listHsettings|.
-%
-% |\endenumerateFB| will be defined as |\endlist|=|\endlistORI|
-% `AtBeginDocument'.
-% \begin{macrocode}
-\def\enumerateFB{%
- \ifnum \@enumdepth >\thr@@\@toodeep\else
- \advance\@enumdepth\@ne
- \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
- \expandafter
- \list
- \csname label\@enumctr\endcsname
- {\FB@listHsettings
- \usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
- \fi}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\descriptionFB}
-% \changes{v2.6b}{2013/02/10}{Settings of \cs{FB@listHsettings} should
-% apply to description lists too.}
-%
-% Same tuning for the |description| environment (see the original
-% definition in \file{classes.dtx}).
-%
-% \begin{macrocode}
-\def\descriptionFB{%
- \list{}{\FB@listHsettings
- \labelwidth\z@ \itemindent-\leftmargin
- \let\makelabel\descriptionlabel}}
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{French indentation of sections}
-% \label{sec-indent}
-%
-% \begin{macro}{\bbl@frenchindent}
-% \begin{macro}{\bbl@nonfrenchindent}
-% In French the first paragraph of each section should be indented,
-% this is another difference with US-English. This is controlled
-% by the flag |\if@afterindent|.
-%
-% \changes{v2.3d}{2009/03/16}{Bug correction: previous versions of
-% frenchb set the flag \cs{if@afterindent} to false outside
-% French which is correct for English but wrong for some languages
-% like Spanish. Pointed out by Juan Jos\'e Torrens.}
-%
-% We will need to save the value of the flag |\if@afterindent|
-% `AtBeginDocument' before eventually changing its value.
-%
-% \begin{macrocode}
-\def\bbl@frenchindent{\let\@afterindentfalse\@afterindenttrue
- \@afterindenttrue}
-\def\bbl@nonfrenchindent{\let\@afterindentfalse\@aifORI
- \@afterindentfalse}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Formatting footnotes}
-% \label{sec-footnotes}
-%
-% \changes{v2.0}{2006/11/06}{Footnotes are now printed
-% by default `\`a la fran\c caise' for the whole document.}
-%
-% \changes{v2.0b}{2007/04/18}{Footnotes: Just do nothing
-% (except warning) when the bigfoot package is loaded.}
-%
-% The \file{bigfoot} package deeply changes the way footnotes are
-% handled. When \file{bigfoot} is loaded, we just warn the user
-% that |frenchb| will drop the customisation of footnotes.
-%
-% The layout of footnotes is controlled by two flags
-% |\ifFBAutoSpaceFootnotes| and |\ifFBFrenchFootnotes| which are
-% set by options of |\frenchbsetup{}| (see section~\ref{sec-keyval}).
-% Notice that the layout of footnotes \emph{does not depend} on the
-% current language (just think of two footnotes on the same page
-% looking different because one was called in a French part, the
-% other one in English!).
-%
-% When |\ifFBAutoSpaceFootnotes| is true, |\@footnotemark| (whose
-% definition is saved at the |\begin{document}| in order to include
-% any customisation that packages might have done) is redefined to
-% add a thin space before the number or symbol calling a footnote
-% (any space typed in is removed first). This has no effect on
-% the layout of the footnote itself.
-%
-% \changes{v2.4a}{2009/11/23}{\cs{PackageWarning} changed to
-% \cs{FBWarning} (when bigfoot package in use).}
-%
-% \begin{macrocode}
-\AtBeginDocument{\@ifpackageloaded{bigfoot}%
- {\FBWarning{frenchb.ldf}%
- {bigfoot package in use.\MessageBreak
- frenchb will NOT customise footnotes;\MessageBreak
- reported}}%
- {\let\@footnotemarkORI\@footnotemark
- \def\@footnotemarkFB{\leavevmode\unskip\unkern
- \,\@footnotemarkORI}%
- \ifFBAutoSpaceFootnotes
- \let\@footnotemark\@footnotemarkFB
- \fi}%
- }
-% \end{macrocode}
-%
-% We then define |\@makefntextFB|, a variant of |\@makefntext|
-% which is responsible for the layout of footnotes, to match the
-% specifications of the French `Imprimerie Nationale': footnotes
-% will be indented by |\parindentFFN|, numbers (if any) typeset on
-% the baseline (instead of superscripts) and followed by a dot
-% and an half quad space. Whenever symbols are used to number
-% footnotes (as in |\thanks| for instance), we switch back to the
-% standard layout (the French layout of footnotes is meant for
-% footnotes numbered by Arabic or Roman digits).
-%
-% \changes{v2.0}{2006/11/06}{\cs{parindentFFN} not changed if
-% already defined (required by JA for cah-gut.cls).}
-%
-% \changes{v2.3b}{2008/12/06}{New commands \cs{dotFFN} and
-% \cs{kernFFN} for more flexibility (suggested by JA).}
-%
-% The value of |\parindentFFN| will be redefined at the
-% |\begin{document}|, as the maximum of |\parindent| and 1.5em
-% \emph{unless} it has been set in the preamble (the weird value
-% 10in is just for testing whether |\parindentFFN| has been set
-% or not).
-%
-% \begin{macrocode}
-\newcommand*{\dotFFN}{.}
-\newcommand*{\kernFFN}{\kern .5em}
-\newdimen\parindentFFN
-\parindentFFN=10in
-\def\ftnISsymbol{\@fnsymbol\c@footnote}
-\long\def\@makefntextFB#1{\ifx\thefootnote\ftnISsymbol
- \@makefntextORI{#1}%
- \else
- \parindent=\parindentFFN
- \rule\z@\footnotesep
- \setbox\@tempboxa\hbox{\@thefnmark}%
- \ifdim\wd\@tempboxa>\z@
- \llap{\@thefnmark}\dotFFN\kernFFN
- \fi #1
- \fi}%
-% \end{macrocode}
-%
-% We save the standard definition of |\@makefntext| at the
-% |\begin{document}|, and then redefine |\@makefntext| according to
-% the value of flag |\ifFBFrenchFootnotes| (true or false).
-%
-% \begin{macrocode}
-\AtBeginDocument{\@ifpackageloaded{bigfoot}{}%
- {\ifdim\parindentFFN<10in
- \else
- \parindentFFN=\parindent
- \ifdim\parindentFFN<1.5em\parindentFFN=1.5em\fi
- \fi
- \let\@makefntextORI\@makefntext
- \long\def\@makefntext#1{%
- \ifFBFrenchFootnotes
- \@makefntextFB{#1}%
- \else
- \@makefntextORI{#1}%
- \fi}%
- }%
- }
-% \end{macrocode}
-%
-% For compatibility reasons, we provide definitions for the commands
-% dealing with the layout of footnotes in |frenchb| version~1.6.
-% |\frenchbsetup{}| (see in section \ref{sec-keyval}) should be
-% preferred for setting these options. |\StandardFootnotes| may
-% still be used locally (in minipages for instance), that's why the
-% test |\ifFBFrenchFootnotes| is done inside |\@makefntext|.
-% \begin{macrocode}
-\newcommand*{\AddThinSpaceBeforeFootnotes}{\FBAutoSpaceFootnotestrue}
-\newcommand*{\FrenchFootnotes}{\FBFrenchFootnotestrue}
-\newcommand*{\StandardFootnotes}{\FBFrenchFootnotesfalse}
-% \end{macrocode}
-%
-% \subsection{Global layout}
-% \label{sec-global}
-%
-% In multilingual documents, some typographic rules must depend
-% on the current language (e.g., hyphenation, typesetting of
-% numbers, spacing before double punctuation\dots), others should,
-% IMHO, be kept global to the document: especially the layout of
-% lists (see~\ref{sec-lists}) and footnotes
-% (see~\ref{sec-footnotes}), and the indentation of the first
-% paragraph of sections (see~\ref{sec-indent}).
-%
-% From version 2.2 on, if |frenchb| is \babel's ``main language''
-% (i.e.\ last language option at \babel's loading), |frenchb|
-% customises the layout (i.e.\ lists, indentation of the first
-% paragraphs of sections and footnotes) in the whole document
-% regardless the current language. On the other hand, if |frenchb|
-% is \emph{not} \babel's ``main language'', it leaves the layout
-% unchanged both in French and in other languages.
-%
-% \begin{macro}{\FrenchLayout}
-% \begin{macro}{\StandardLayout}
-% The former commands |\FrenchLayout| and |\StandardLayout| are kept
-% for compatibility reasons but should no longer be used.
-%
-% \changes{v2.0g}{2008/03/23}{Flag \cs{ifFBStandardLayout} not checked
-% by \cs{FBprocess@options}, low-level flags have to be set
-% one by one.}
-%
-% \begin{macrocode}
-\newcommand*{\FrenchLayout}{%
- \FBGlobalLayoutFrenchtrue
- \PackageWarning{frenchb.ldf}%
- {\protect\FrenchLayout\space is obsolete. Please use\MessageBreak
- \protect\frenchbsetup{GlobalLayoutFrench} instead.}%
-}
-\newcommand*{\StandardLayout}{%
- \FBReduceListSpacingfalse
- \FBCompactItemizefalse
- \FBStandardItemLabelstrue
- \FBIndentFirstfalse
- \FBFrenchFootnotesfalse
- \FBAutoSpaceFootnotesfalse
- \PackageWarning{frenchb.ldf}%
- {\protect\StandardLayout\space is obsolete. Please use\MessageBreak
- \protect\frenchbsetup{StandardLayout} instead.}%
-}
-\@onlypreamble\FrenchLayout
-\@onlypreamble\StandardLayout
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
%
% \subsection{Dots\dots}
-% \label{sec-dots}
+% \label{ssec-dots}
%
% \begin{macro}{\FBtextellipsis}
% \LaTeXe's standard definition of |\dots| in text-mode is
@@ -2667,35 +2808,57 @@
.\kern\fontdimen3\font.\kern\fontdimen3\font.\xspace}
\fi
% \end{macrocode}
-% |\Mdots@| and |\Tdots@ORI| hold the definitions of |\dots| in
+% |\Mdots@| and |\Tdots@| hold the definitions of |\dots| in
% Math and Text mode. They default to those of amsmath-2.0, and
% will revert to standard \LaTeX{} definitions `AtBeginDocument',
% if amsmath has not been loaded. |\Mdots@| doesn't change when
% switching from/to French, while |\Tdots@| is |\FBtextellipsis|
% in French and |\Tdots@ORI| otherwise.
% \begin{macrocode}
-\newcommand*{\Tdots@ORI}{\@xp\textellipsis}
-\newcommand*{\Tdots@}{\Tdots@ORI}
+\newcommand*{\Tdots@}{\@xp\textellipsis}
\newcommand*{\Mdots@}{\@xp\mdots@}
\AtBeginDocument{\DeclareRobustCommand*{\dots}{\relax
\csname\ifmmode M\else T\fi dots@\endcsname}%
- \@ifundefined{@xp}{\let\@xp\relax}{}%
- \@ifundefined{mdots@}{\let\Tdots@ORI\textellipsis
- \let\Mdots@\mathellipsis
- \let\mdots@\undefined}{}}
-\def\bbl@frenchdots{\let\Tdots@\FBtextellipsis}
-\def\bbl@nonfrenchdots{\let\Tdots@\Tdots@ORI}
-\addto\extrasfrench{\bbl@frenchdots}
-\addto\noextrasfrench{\bbl@nonfrenchdots}
+ \ifdefined\@xp\else\let\@xp\relax\fi
+ \ifdefined\mdots@\else\let\Mdots@\mathellipsis\fi
+ }
+\def\bbl@frenchdots{\babel@save\Tdots@ \let\Tdots@\FBtextellipsis}
+\FB@addto{extras}{\bbl@frenchdots}
% \end{macrocode}
% \end{macro}
%
% \subsection{Setup options: keyval stuff}
-% \label{sec-keyval}
+% \label{ssec-keyval}
%
% \changes{v2.0}{2006/11/06}{New command \cs{frenchbsetup} added
% for global customisation.}
%
+% \changes{v3.0a}{2014/02/24}{Options processing completely
+% reorganised.}
+%
+% All setup options are handled by command \fbsetup{} using the
+% keyval syntax. A list of flags is defined and set to a default
+% value which will possibly be changed `AtEndOfPackage' if French is
+% the main language. After this, \fbsetup{} eventually modifies the
+% preset values of these flags.
+%
+% Option processing can occur either in \fbsetup{}, but \emph{only
+% for options explicitly set} by \fbsetup{}, or `AtBeginDocument';
+% any option affecting |\extrasfrench{}| \emph{must} be processed by
+% \fbsetup{}: when French is the main language, |\extrasfrench{}| is
+% executed by \babel{} when it switches the main language and this
+% occurs \emph{before} reading the stuff postponed by \frenchb{}
+% `AtBeginDocument'. Reexecuting |\extrasfrench{}| is a possibility
+% which was used up to v2.6h, it has been dropped in v3.0a because
+% of its side-effects (f.i. |\babel@save| and |\babel@savevariable|
+% no longer work).
+%
+% \begin{macro}{\frenchbsetup}
+% Let's now define this command which reads and sets the options
+% to be processed either immediately (i.e. just after setting the
+% key) or later (at |\begin{document}|) by |\FBprocess@options|.
+% \fbsetup{} can only be called in the preamble.
+%
% \changes{v2.0c}{2007/06/25}{Option ThinSpaceInFrenchNumbers added.}
%
% \changes{v2.0d}{2007/07/15}{Options og and fg changed: limit
@@ -2728,11 +2891,8 @@
% no longer changed when frenchb is not the last option of babel
% (\cs{bbl@main@language}). Suggested by Ulrike Fischer.}
%
-% \changes{v2.2a}{2008/05/08}{Values of flags
-% \cs{ifFBReduceListSpacing}, \cs{ifFBCompactItemize},
-% \cs{ifFBStandardItemLabels}, \cs{ifFBIndentFirst},
-% \cs{ifFBFrenchFootnotes}, \cs{ifFBAutoSpaceFootnotes} changed:
-% default now means `StandardLayout', it will be changed to
+% \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}.}
%
@@ -2751,14 +2911,25 @@
% StandardItemizeEnv and StandardEnumerateEnv (CompactItemize is
% deprecated).}
%
-% We first define a collection of conditionals with their defaults
+% \changes{v3.0a}{2014/02/28}{New options OldFigTabCaptions and
+% CustomiseFigTabCaptions.}
+%
+% \begin{macrocode}
+\newcommand*{\frenchbsetup}[1]{%
+ \setkeys{FB}{#1}%
+}%
+\@onlypreamble\frenchbsetup
+% \end{macrocode}
+% \end{macro}
+%
+% We define a collection of conditionals with their defaults
% (true or false).
%
% \begin{macrocode}
\newif\ifFBStandardLayout \FBStandardLayouttrue
-\newif\ifFBGlobalLayoutFrench \FBGlobalLayoutFrenchfalse
+\newif\ifFBGlobalLayoutFrench \FBGlobalLayoutFrenchtrue
\newif\ifFBReduceListSpacing \FBReduceListSpacingfalse
-\newif\ifFBListOldLayout \FBListOldLayouttrue
+\newif\ifFBListOldLayout \FBListOldLayoutfalse
\newif\ifFBCompactItemize \FBCompactItemizefalse
\newif\ifFBStandardItemizeEnv \FBStandardItemizeEnvtrue
\newif\ifFBStandardEnumerateEnv \FBStandardEnumerateEnvtrue
@@ -2773,19 +2944,21 @@
\newif\ifFBFrenchSuperscripts \FBFrenchSuperscriptstrue
\newif\ifFBLowercaseSuperscripts \FBLowercaseSuperscriptstrue
\newif\ifFBPartNameFull \FBPartNameFulltrue
+\newif\ifFBCustomiseFigTabCaptions \FBCustomiseFigTabCaptionsfalse
+\newif\ifFBOldFigTabCaptions \FBOldFigTabCaptionsfalse
\newif\ifFBSuppressWarning \FBSuppressWarningfalse
\newif\ifFBShowOptions \FBShowOptionsfalse
% \end{macrocode}
%
-% The defaults values of these flags have been set so that |frenchb|
-% does not change anything regarding the global layout.
-% |\bbl@main@language|, set by the last option of babel, controls
+% The defaults values of these flags have been choosen so that
+% \frenchb{} does not change anything regarding the global layout.
+% |\bbl@main@language|, set by the last option of \babel, controls
% the global layout of the document. `AtEndOfPackage' we check the
% main language in |\bbl@main@language|; if it is French,
% the values of some flags have to be changed to ensure a French
% looking layout for the whole document (even in parts written in
% languages other than French); the end-user will then be able to
-% customise the values of all these flags with |\frenchbsetup{}|.
+% customise the values of all these flags with \fbsetup{}.
%
% \changes{v2.5b}{2010/10/30}{Do not use the
% test \cs{iflanguage}\{french\} to check whether French is the
@@ -2793,75 +2966,38 @@
% 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\"unter Milde.}
+% Pointed out by Günter Milde.}
%
% \begin{macrocode}
-\def\FB@french{french}
+\edef\FB@french{\CurrentOption}
\AtEndOfPackage{%
\ifx\bbl@main@language\FB@french
+ \FBGlobalLayoutFrenchtrue
\FBReduceListSpacingtrue
- \FBListOldLayoutfalse
- \FBCompactItemizetrue
\FBStandardItemizeEnvfalse
\FBStandardEnumerateEnvfalse
\FBStandardItemLabelsfalse
\FBIndentFirsttrue
\FBFrenchFootnotestrue
\FBAutoSpaceFootnotestrue
- \FBGlobalLayoutFrenchtrue
+ \FBCustomiseFigTabCaptionstrue
+ \else
+ \FBGlobalLayoutFrenchfalse
\fi
-}
-% \end{macrocode}
-%
-% \begin{macro}{\frenchbsetup}
-% From version 2.0 on, all setup options are handled by \emph{one}
-% command |\frenchbsetup| using the keyval syntax.
-% Let's now define this command which reads and sets the options
-% to be processed later (at |\begin{document}|) by
-% |\FBprocess@options|. It can only be called in the preamble.
-% \begin{macrocode}
-\newcommand*{\frenchbsetup}[1]{%
- \setkeys{FB}{#1}%
-}%
-\@onlypreamble\frenchbsetup
% \end{macrocode}
-% |frenchb| being an option of babel, it cannot load a package
-% (\file{keyval}) while \file{frenchb.ldf} is read, so we defer the
+% \frenchb{} being an option of \babel, it cannot load a package
+% (\pkg{keyval}) while \file{frenchb.ldf} is read, so we defer the
% loading of \file{keyval} and the options setup at the end of
% \babel's loading.
-%
-% |StandardLayout| resets the layout in French to the standard layout
-% defined par the \LaTeX{} class and packages loaded. It deals with
-% lists, indentation of first paragraphs of sections and footnotes.
-% Other keys, entered \emph{after} |StandardLayout| in
-% |\frenchbsetup|, can overrule some of the |StandardLayout|
-% settings.
-%
-% When French is the main language, |GlobalLayoutFrench| forces the
-% layout in French and (as far as possible) outside French to meet
-% the French typographic standards.
-%
-% \changes{v2.3d}{2009/03/16}{Warning added to \cs{GlobalLayoutFrench}
-% when French is not the main language.}
-%
-% \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\"unter Milde.}
-%
% \begin{macrocode}
-\AtEndOfPackage{%
- \RequirePackage{keyval}%
- \define@key{FB}{StandardLayout}[true]%
+ \RequirePackage{keyval}%
+ \define@key{FB}{StandardLayout}[true]%
{\csname FBStandardLayout#1\endcsname
\ifFBStandardLayout
\FBReduceListSpacingfalse
\FBStandardItemizeEnvtrue
- \FBStandardEnumerateEnvtrue
\FBStandardItemLabelstrue
+ \FBStandardEnumerateEnvtrue
\FBIndentFirstfalse
\FBFrenchFootnotesfalse
\FBAutoSpaceFootnotesfalse
@@ -2869,38 +3005,38 @@
\else
\FBReduceListSpacingtrue
\FBStandardItemizeEnvfalse
- \FBStandardEnumerateEnvfalse
\FBStandardItemLabelsfalse
+ \FBStandardEnumerateEnvfalse
\FBIndentFirsttrue
\FBFrenchFootnotestrue
\FBAutoSpaceFootnotestrue
\fi}%
- \define@key{FB}{GlobalLayoutFrench}[true]%
+ \define@key{FB}{GlobalLayoutFrench}[true]%
{\csname FBGlobalLayoutFrench#1\endcsname
- \ifFBGlobalLayoutFrench
+% \end{macrocode}
+% If this key is set to \fbo{true} when French is the main language,
+% nothing to do: all flags keep their default value.
+% If this key is set to \fbo{false}, nothing to do either:
+% |\babel@save| will do the job.
+% \begin{macrocode}
+ \ifFBGlobalLayoutFrench
\ifx\bbl@main@language\FB@french
- \FBReduceListSpacingtrue
- \FBStandardItemizeEnvfalse
- \FBStandardEnumerateEnvfalse
- \FBStandardItemLabelsfalse
- \FBIndentFirsttrue
- \FBFrenchFootnotestrue
- \FBAutoSpaceFootnotestrue
\else
\PackageWarning{frenchb.ldf}%
- {Option `GlobalLayoutFrench' skipped:
+ {Option `GlobalLayoutFrench' skipped:%
\MessageBreak French is *not*
babel's last option.\MessageBreak}%
\fi
\fi}%
- \define@key{FB}{ReduceListSpacing}[true]%
+ \define@key{FB}{ReduceListSpacing}[true]%
{\csname FBReduceListSpacing#1\endcsname}%
- \define@key{FB}{ListOldLayout}[true]%
+ \define@key{FB}{ListOldLayout}[true]%
{\csname FBListOldLayout#1\endcsname
\ifFBListOldLayout
+ \FBStandardEnumerateEnvtrue
\renewcommand*{\FrenchLabelItem}{\textendash}%
\fi}%
- \define@key{FB}{CompactItemize}[true]%
+ \define@key{FB}{CompactItemize}[true]%
{\csname FBCompactItemize#1\endcsname
\ifFBCompactItemize
\FBStandardItemizeEnvfalse
@@ -2909,23 +3045,23 @@
\FBStandardItemizeEnvtrue
\FBStandardEnumerateEnvtrue
\fi}%
- \define@key{FB}{StandardItemizeEnv}[true]%
- {\csname FBStandardItemizeEnv#1\endcsname}%
- \define@key{FB}{StandardEnumerateEnv}[true]%
- {\csname FBStandardEnumerateEnv#1\endcsname}%
- \define@key{FB}{StandardItemLabels}[true]%
+ \define@key{FB}{StandardItemizeEnv}[true]%
+ {\csname FBStandardItemizeEnv#1\endcsname}%
+ \define@key{FB}{StandardEnumerateEnv}[true]%
+ {\csname FBStandardEnumerateEnv#1\endcsname}%
+ \define@key{FB}{StandardItemLabels}[true]%
{\csname FBStandardItemLabels#1\endcsname}%
- \define@key{FB}{ItemLabels}{%
+ \define@key{FB}{ItemLabels}{%
\renewcommand*{\FrenchLabelItem}{#1}}%
- \define@key{FB}{ItemLabeli}{%
+ \define@key{FB}{ItemLabeli}{%
\renewcommand*{\Frlabelitemi}{#1}}%
- \define@key{FB}{ItemLabelii}{%
- \renewcommand*{\Frlabelitemii}{#1}}%
- \define@key{FB}{ItemLabeliii}{%
+ \define@key{FB}{ItemLabelii}{%
+ \renewcommand*{\Frlabelitemii}{#1}}%
+ \define@key{FB}{ItemLabeliii}{%
\renewcommand*{\Frlabelitemiii}{#1}}%
- \define@key{FB}{ItemLabeliv}{%
- \renewcommand*{\Frlabelitemiv}{#1}}%
- \define@key{FB}{StandardLists}[true]%
+ \define@key{FB}{ItemLabeliv}{%
+ \renewcommand*{\Frlabelitemiv}{#1}}%
+ \define@key{FB}{StandardLists}[true]%
{\csname FBStandardLists#1\endcsname
\ifFBStandardLists
\FBReduceListSpacingfalse
@@ -2940,411 +3076,313 @@
\FBStandardEnumerateEnvfalse
\FBStandardItemLabelsfalse
\fi}%
- \define@key{FB}{IndentFirst}[true]%
+ \define@key{FB}{IndentFirst}[true]%
{\csname FBIndentFirst#1\endcsname}%
- \define@key{FB}{FrenchFootnotes}[true]%
+ \define@key{FB}{FrenchFootnotes}[true]%
{\csname FBFrenchFootnotes#1\endcsname}%
- \define@key{FB}{AutoSpaceFootnotes}[true]%
+ \define@key{FB}{AutoSpaceFootnotes}[true]%
{\csname FBAutoSpaceFootnotes#1\endcsname}%
- \define@key{FB}{AutoSpacePunctuation}[true]%
+ \define@key{FB}{AutoSpacePunctuation}[true]%
{\csname FBAutoSpacePunctuation#1\endcsname}%
- \define@key{FB}{OriginalTypewriter}[true]%
+ \define@key{FB}{OriginalTypewriter}[true]%
{\csname FBOriginalTypewriter#1\endcsname}%
- \define@key{FB}{ThinColonSpace}[true]%
+ \define@key{FB}{ThinColonSpace}[true]%
{\csname FBThinColonSpace#1\endcsname}%
- \define@key{FB}{ThinSpaceInFrenchNumbers}[true]%
+ \define@key{FB}{ThinSpaceInFrenchNumbers}[true]%
{\csname FBThinSpaceInFrenchNumbers#1\endcsname}%
- \define@key{FB}{FrenchSuperscripts}[true]%
+ \define@key{FB}{FrenchSuperscripts}[true]%
{\csname FBFrenchSuperscripts#1\endcsname}
- \define@key{FB}{LowercaseSuperscripts}[true]%
+ \define@key{FB}{LowercaseSuperscripts}[true]%
{\csname FBLowercaseSuperscripts#1\endcsname}
- \define@key{FB}{PartNameFull}[true]%
- {\csname FBPartNameFull#1\endcsname}%
- \define@key{FB}{SuppressWarning}[true]%
+ \define@key{FB}{PartNameFull}[true]%
+ {\csname FBPartNameFull#1\endcsname
+ \ifFBPartNameFull
+ \else
+ \FB@addto{captions}{%
+ \def\partname{Partie\protect\FB@Rpart}}%
+ \fi}%
+ \define@key{FB}{CustomiseFigTabCaptions}[true]%
+ {\csname FBCustomiseFigTabCaptions#1\endcsname}%
+ \define@key{FB}{OldFigTabCaptions}[true]%
+ {\csname FBOldFigTabCaptions#1\endcsname
+% \end{macrocode}
+% |\CurrentOption| no longer defined. It's value has been saved
+% in |\FB@CurOpt| while reading \file{frenchb.ldf}.
+% \begin{macrocode}
+ \ifFBOldFigTabCaptions
+ \FB@addto{extras}{\babel@save\FBCaption@Separator
+ \def\FBCaption@Separator{\CaptionSeparator}}%
+ \fi}%
+ \define@key{FB}{SuppressWarning}[true]%
{\csname FBSuppressWarning#1\endcsname
\ifFBSuppressWarning
\renewcommand{\FBWarning}[2]{\relax}%
- \else
- \renewcommand{\FBWarning}[2]{%
- \PackageWarning{##1}{##2}}%
- \fi}
- \define@key{FB}{ShowOptions}[true]%
+ \fi}%
+ \define@key{FB}{ShowOptions}[true]%
{\csname FBShowOptions#1\endcsname}%
% \end{macrocode}
% Inputing French quotes as \emph{single characters} when they are
% available on the keyboard (through a compose key for instance)
% is more comfortable than typing |\og| and |\fg|.
-% The purpose of the following code is to map the French quote
-% characters to |\og\ignorespaces| and |{\fg}| respectively when
-% the current language is French, and to |\guillemotleft| and
-% |\guillemotright| otherwise (think of German quotes); thus correct
+%
+% With pdfTeX (or old LuaTeX and XeTeX engines), quote characters
+% are made active and expand to |\og\ignorespaces| and |{\fg}|
+% respectively if the current language is French, and to
+% |\guillemotleft| and |\guillemotright| otherwise (think of German
+% quotes), this is done by |\FB@@og| and |\FB@@fg|; thus correct
% unbreakable spaces will be added automatically to French quotes.
% The quote characters typed in depend on the input encoding,
% it can be single-byte (latin1, latin9, applemac,\dots) or
-% multi-bytes (utf-8, utf8x). We first check whether XeTeX or
-% LuaTeX engines are used, if not the \file{inputenc} package has to
+% multi-bytes (utf-8, utf8x); the \pkg{inputenc} package has to
% be loaded before the |\begin{document}| with the proper coding
% option, so we check if |\DeclareInputText| is defined.
%
+% Life is much simpler here with modern LuaTeX or XeTeX engines: we
+% just have to activate the |\FB@addGUILspace| attribute for LuaTeX
+% or set |\XeTeXcharclass| of quotes to the proper value for XeTeX.
+%
% \changes{v2.4c}{2010/05/23}{In \cs{ttfamilyFB}, also cancel
% automatic spaces inside French guillemets coded as characters
% (see \cs{frenchbsetup}).}
%
-% \changes{v2.5a}{2010/08/21}{Test \cs{@ifundefined} leaves the
-% tested control sequence defined as \cs{relax} when TRUE.
-% Changed \cs{relax} to \cs{undefined} when testing
-% \cs{XeTeXrevision}, \cs{DeclareInputText}, \cs{uc@dclc},
-% \cs{DeclareUnicodeCharacter}, \cs{mule@def} in \cs{og} and
-% \cs{fg}.}
-%
% \changes{v2.5c}{2011/01/16}{The code meant for XeTeX also works for
% LuaTeX, we just need to change the test.}
%
% \changes{v2.5g}{2011/12/31}{When \cs{ifFB@xetex@punct} is true,
% `og' and `fg' options now set XeTeXcharclasses of these characters
-% to \cs{FB@punctguilo} and \cs{FB@punctguilf}. Otherwise French
+% 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.}
+%
% \begin{macrocode}
- \define@key{FB}{og}{%
- \newcommand*{\FB@@og}{%
- \iflanguage{french}%
- {\ifFBAutoSpaceGuill\FB@og\ignorespaces
- \else\guillemotleft
- \fi}%
- {\guillemotleft}}%
+ \define@key{FB}{og}{%
+ \ifFB@active@punct
+ \newcommand*{\FB@@og}{%
+ \iflanguage{french}%
+ {\ifFBAutoSpaceGuill\FB@og\ignorespaces
+ \else\guillemotleft
+ \fi}%
+ {\guillemotleft}}%
+ \fi
\ifFBunicode
% \end{macrocode}
-% LuaTeX or XeTeX in use,
+% LuaTeX or XeTeX in use, first try modern LuaTeX: we just need
+% to set LuaTeX's attribute |\FB@addGUILspace| to 1,
% \begin{macrocode}
- \ifFB@xetex@punct
+ \ifFB@luatex@punct
+ \FB@addGUILspace=1 \relax
+ \else
+% \end{macrocode}
+% then modern XeTeX, this more tricky:
+% \begin{macrocode}
+ \ifFB@xetex@punct
% \end{macrocode}
% |\XeTeXinterchartokenstate| is defined, we just need to set
-% |\XeTeXcharclass| to |\FB@punctguilo| for the French opening
-% quote (see subsection~\ref{sec-punct}) and to switch
-% |\ifFBog@addspace| to false, otherwise commands |\og| and
-% |\fg| would produce a double space; the |\ifFBguillo@addspace|
-% flag is needed when switching from |\ttfamily| back to |\sf| or
-% |\rm|.
-% \begin{macrocode}
- \XeTeXcharclass"00AB = \FB@punctguilo
- \FBguillo@addspacetrue \FBog@addspacefalse
- \else
+% |\XeTeXcharclass| to |\FB@guilo| for the French opening
+% quote (see subsection~\ref{ssec-punct}).
+% \begin{macrocode}
+ \XeTeXcharclass"AB = \FB@guilo
+ \XeTeXcharclass"A0 = \FB@guilnul
+ \XeTeXcharclass"202F = \FB@guilnul
+ \else
% \end{macrocode}
-% then LuaTeX or an old XeTeX in use, the following trick
+% then an old LuaTeX or XeTeX in use, the following trick
% for defining the active quote character is borrowed from
% \file{inputenc.dtx}.
% \begin{macrocode}
- \catcode`#1=\active
- \bgroup
- \uccode`\~`#1%
- \uppercase{%
- \egroup
- \def~%
- }{\FB@@og}%
+ \catcode`#1=\active
+ \bgroup
+ \uccode`\~`#1%
+ \uppercase{%
+ \egroup
+ \def~%
+ }{\FB@@og}%
+ \fi
\fi
\else
% \end{macrocode}
% This is for conventional TeX engines:
% \begin{macrocode}
- \AtBeginDocument
- {\@ifundefined{DeclareInputText}%
- {\PackageWarning{frenchb.ldf}%
- {Option `og' requires package inputenc.\MessageBreak}%
- \let\DeclareInputText\undefined
- }%
- {\@ifundefined{uc@dclc}%
-% \end{macrocode}
-% if |\uc@dclc| is undefined, utf8x is not loaded\dots
-% \begin{macrocode}
- {\@ifundefined{DeclareUnicodeCharacter}%
-% \end{macrocode}
-% if |\DeclareUnicodeCharacter| is undefined, utf8 is not loaded
-% either, we assume 8-bit character input encoding.
-% Package \file{MULEenc.sty} (from CJK) defines |\mule@def| to map
-% characters to control sequences.
-% \begin{macrocode}
- {\@tempcnta`#1\relax
- \@ifundefined{mule@def}%
- {\DeclareInputText{\the\@tempcnta}{\FB@@og}%
- \let\mule@def\undefined}%
- {\mule@def{11}{{\FB@@og}}}%
- \let\DeclareUnicodeCharacter\undefined
- }%
+ \AtBeginDocument{%
+ \ifdefined\DeclareInputText
+ \ifdefined\uc@dclc
+% \end{macrocode}
+% Package \pkg{inputenc} with utf8x encoding loaded, use |\uc@dclc|,
+% \begin{macrocode}
+ \uc@dclc{171}{default}{\FB@@og}%
+ \else
+% \end{macrocode}
+% if encoding is not utf8x, try utf8\dots
+% \begin{macrocode}
+ \ifdefined\DeclareUnicodeCharacter
% \end{macrocode}
% utf8 loaded, use |\DeclareUnicodeCharacter|,
% \begin{macrocode}
- {\DeclareUnicodeCharacter{00AB}{\FB@@og}}%
- \let\uc@dclc\undefined
- }%
+ \DeclareUnicodeCharacter{00AB}{\FB@@og}%
+ \else
% \end{macrocode}
-% utf8x loaded, use |\uc@dclc|,
+% if utf8 is not loaded either, we assume 8-bit character input
+% encoding. Package \pkg{MULEenc} (from CJK) defines |\mule@def|
+% to map characters to control sequences.
% \begin{macrocode}
- {\uc@dclc{171}{default}{\FB@@og}}%
- }%
- }%
+ \@tempcnta`#1\relax
+ \ifdefined\mule@def
+ \mule@def{11}{\FB@@og}%
+ \else
+ \DeclareInputText{\the\@tempcnta}{\FB@@og}%
+ \fi
+ \fi
+ \fi
+ \else
+% \end{macrocode}
+% Package \pkg{inputenc} not loaded, no way\dots{}
+% \begin{macrocode}
+ \PackageWarning{frenchb.ldf}%
+ {Option `og' requires package inputenc.\MessageBreak}%
+ \fi
+ }%
\fi
- }%
+ }%
% \end{macrocode}
+%
% Same code for the closing quote.
% \begin{macrocode}
- \define@key{FB}{fg}{%
- \newcommand*{\FB@@fg}{%
- \iflanguage{french}%
- {\ifFBAutoSpaceGuill\FB@fg
- \else\guillemotright
- \fi}%
- {\guillemotright}}%
+ \define@key{FB}{fg}{%
+ \ifFB@active@punct
+ \newcommand*{\FB@@fg}{%
+ \iflanguage{french}%
+ {\ifFBAutoSpaceGuill\FB@fg
+ \else\guillemotright
+ \fi}%
+ {\guillemotright}}%
+ \fi
\ifFBunicode
- \ifFB@xetex@punct
- \XeTeXcharclass"00BB = \FB@punctguilf
- \FBguillf@addspacetrue \FBfg@addspacefalse
+ \ifFB@luatex@punct
+ \FB@addGUILspace=1 \relax
\else
- \catcode`#1=\active
- \bgroup
- \uccode`\~`#1%
- \uppercase{%
- \egroup
- \def~%
- }{{\FB@@fg}}%
+ \ifFB@xetex@punct
+ \XeTeXcharclass"BB = \FB@guilf
+ \XeTeXcharclass"A0 = \FB@guilnul
+ \XeTeXcharclass"202F = \FB@guilnul
+ \else
+ \catcode`#1=\active
+ \bgroup
+ \uccode`\~`#1%
+ \uppercase{%
+ \egroup
+ \def~%
+ }{{\FB@@fg}}%
+ \fi
\fi
\else
- \AtBeginDocument
- {\@ifundefined{DeclareInputText}%
- {\PackageWarning{frenchb.ldf}%
+ \AtBeginDocument{%
+ \ifdefined\DeclareInputText
+ \ifdefined\uc@dclc
+ \uc@dclc{187}{default}{\FB@@fg}%
+ \else
+ \ifdefined\DeclareUnicodeCharacter
+ \DeclareUnicodeCharacter{00BB}{\FB@@fg}%
+ \else
+ \@tempcnta`#1\relax
+ \ifdefined\mule@def
+ \mule@def{27}{{\FB@@fg}}%
+ \else
+ \DeclareInputText{\the\@tempcnta}{\FB@@fg}%
+ \fi
+ \fi
+ \fi
+ \else
+ \PackageWarning{frenchb.ldf}%
{Option `fg' requires package inputenc.\MessageBreak}%
- \let\DeclareInputText\undefined
- }%
- {\@ifundefined{uc@dclc}%
- {\@ifundefined{DeclareUnicodeCharacter}%
- {\@tempcnta`#1\relax
- \@ifundefined{mule@def}%
- {\DeclareInputText{\the\@tempcnta}{{\FB@@fg}}%
- \let\mule@def\undefined
- }%
- {\mule@def{27}{{\FB@@fg}}}%
- \let\DeclareUnicodeCharacter\undefined
- }%
- {\DeclareUnicodeCharacter{00BB}{{\FB@@fg}}%
- }%
- \let\uc@dclc\undefined
- }%
- {\uc@dclc{187}{default}{{\FB@@fg}}}%
- }%
- }%
+ \fi
+ }%
\fi
- }%
+ }%
}
% \end{macrocode}
-% \end{macro}
%
% \begin{macro}{\FBprocess@options}
-% |\FBprocess@options| processes the options, it is called \emph{once}
-% at |\begin{document}|.
+% |\FBprocess@options| will be executed at |\begin{document}|:
+% it first checks about packages loaded in the preamble (possibly
+% after \babel) which customise lists: currently \pkg{enumitem},
+% \pkg{paralist} and \pkg{enumerate}; then it processes the options
+% as set by \fbsetup{} or forced for compatibility with packages
+% loaded in the preamble.
+%
+% When French is the main language, |\extrasfrench| and
+% |\captionsfrench| \emph{have already been processed} by \babel{}
+% at |\begin{document}| \emph{before} |\FBprocess@options|.
% \begin{macrocode}
\newcommand*{\FBprocess@options}{%
% \end{macrocode}
-% Nothing has to be done here for |StandardLayout| and
-% |StandardLists| (the involved flags have already been set in
-% |\frenchbsetup{}| or before (at babel's EndOfPackage).
-%
-% The next three options deal with the layout of lists in French.
-%
-% |ReduceListSpacing| reduces the vertical spaces in lists
-% in French (done by changing |\list| to |\listFB|).
-% When |GlobalLayoutFrench| is true (the default), the same is
-% done outside French except for languages that force a different
-% setting.
-% \begin{macrocode}
- \ifFBReduceListSpacing
- \addto\extrasfrench{\let\list\listFB
- \let\endlist\endlistFB}%
- \addto\noextrasfrench{\ifFBGlobalLayoutFrench
- \let\list\listFB
- \let\endlist\endlistFB
- \else
- \let\list\listORI
- \let\endlist\endlistORI
- \fi}%
- \else
- \addto\extrasfrench{\let\list\listORI
- \let\endlist\endlistORI
- }%
- \addto\noextrasfrench{\let\list\listORI
- \let\endlist\endlistORI
- }%
- \fi
-% \end{macrocode}
-%
-% When |ListOldLayout=true|, set |StandardEnumerateEnv=true|
-% (before v.~2.6a |enumerate| was not redefined).
-% \begin{macrocode}
- \ifFBListOldLayout
- \FBStandardEnumerateEnvtrue
- \fi
-% \end{macrocode}
-%
-% \changes{v2.4b}{2010/04/30}{Warning and set flag CompactItemize false
-% when the enumitem package is loaded (ensures compatibility).}
-%
-% \changes{v2.5k}{2012/12/27}{No warning if flag CompactItemize already
-% set to false by user.}
-%
-% \changes{v2.6a}{2013/01/30}{Flag CompactItemize deprecated.
-% Set flags StandardItemizeEnv and StandardEnumerateEnv to true
-% when the enumitem package is loaded.}
-%
-% \changes{v2.6a}{2013/01/30}{Ensure compatibility with paralist and
-% enumerate packages.}
-%
-% To ensure compatibility with the \file{enumitem} package, when
-% |enumitem| is loaded, force flags |StandardItemizeEnv| and
-% |StandardEnumerateEnv| to true.
+% Update flags if a package customising lists has been loaded,
+% currently: \pkg{enumitem}, \pkg{paralist}, \pkg{enumerate}.
% \begin{macrocode}
\@ifpackageloaded{enumitem}{%
\ifFBStandardItemizeEnv
\else
- \FBWarning{frenchb.ldf}%
+ \FBStandardItemizeEnvtrue
+ \PackageInfo{frenchb.ldf}%
{Setting StandardItemizeEnv=true for\MessageBreak
compatibility with enumitem package,\MessageBreak}%
- \FBStandardItemizeEnvtrue
\fi
\ifFBStandardEnumerateEnv
\else
- \FBWarning{frenchb.ldf}%
+ \FBStandardEnumerateEnvtrue
+ \PackageInfo{frenchb.ldf}%
{Setting StandardEnumerateEnv=true for\MessageBreak
compatibility with enumitem package,\MessageBreak}%
- \FBStandardEnumerateEnvtrue
- \fi}%
- {}%
-% \end{macrocode}
-%
-% To ensure compatibility with the \file{paralist} package, when
-% \file{paralist} is loaded; force flags |StandardItemizeEnv| and
-% |StandardEnumerateEnv| to true.
-% \begin{macrocode}
+ \fi}{}%
\@ifpackageloaded{paralist}{%
\ifFBStandardItemizeEnv
\else
- \FBWarning{frenchb.ldf}%
+ \FBStandardItemizeEnvtrue
+ \PackageInfo{frenchb.ldf}%
{Setting StandardItemizeEnv=true for\MessageBreak
compatibility with paralist package,\MessageBreak}%
- \FBStandardItemizeEnvtrue
\fi
\ifFBStandardEnumerateEnv
\else
- \FBWarning{frenchb.ldf}%
+ \FBStandardEnumerateEnvtrue
+ \PackageInfo{frenchb.ldf}%
{Setting StandardEnumerateEnv=true for\MessageBreak
compatibility with paralist package,\MessageBreak}%
- \FBStandardEnumerateEnvtrue
- \fi}%
- {}%
-% \end{macrocode}
-%
-% To ensure compatibility with the \file{enumerate} package, when
-% |enumerate| is loaded, force flag |StandardEnumerateEnv| to true.
-% \begin{macrocode}
+ \fi}{}%
\@ifpackageloaded{enumerate}{%
\ifFBStandardEnumerateEnv
\else
- \FBWarning{frenchb.ldf}%
+ \FBStandardEnumerateEnvtrue
+ \PackageInfo{frenchb.ldf}%
{Setting StandardEnumerateEnv=true for\MessageBreak
compatibility with enumerate package,\MessageBreak}%
- \FBStandardEnumerateEnvtrue
- \fi}%
- {}%
+ \fi}{}%
% \end{macrocode}
-%
-% Let's now process flags |StandardItemizeEnv| and
-% |StandardEnumerateEnv|. Mind that
-% |StandardEnumerateEnv|'s value decides for both environments
-% |enumerate| and |description|).
+% Reset |\FB@ufl|'s normal meaning and update lists' settings
+% in case French is the main language: \label{FB@ufl}
% \begin{macrocode}
- \ifFBStandardItemizeEnv
- \addto\extrasfrench{\let\itemize\itemizeORI}%
- \addto\noextrasfrench{\let\itemize\itemizeORI}%
- \else
- \addto\extrasfrench{\let\itemize\itemizeFB}%
- \addto\noextrasfrench{\ifFBGlobalLayoutFrench
- \let\itemize\itemizeFB
- \else
- \let\itemize\itemizeORI
- \fi}%
- \fi
- \ifFBStandardEnumerateEnv
- \addto\extrasfrench{\let\enumerate\enumerateORI
- \let\description\descriptionORI}%
- \addto\noextrasfrench{\let\enumerate\enumerateORI
- \let\description\descriptionORI}%
- \else
- \addto\extrasfrench{\let\enumerate\enumerateFB
- \let\description\descriptionFB}%
- \addto\noextrasfrench{\ifFBGlobalLayoutFrench
- \let\enumerate\enumerateFB
- \let\description\descriptionFB
- \else
- \let\enumerate\enumerateORI
- \let\description\descriptionORI
- \fi}%
- \fi
-% \end{macrocode}
-%
-% |StandardItemLabels| resets labelitems in French to their
-% standard values set by the \LaTeX{} class and packages loaded.
-% When |GlobalLayoutFrench| is true, labelitems are identical
-% whether the current language is French or not.
-% \begin{macrocode}
- \ifFBStandardItemLabels
- \addto\extrasfrench{\bbl@nonfrenchlabelitems}%
- \addto\noextrasfrench{\bbl@nonfrenchlabelitems}%
- \else
- \addto\extrasfrench{\bbl@frenchlabelitems}%
- \addto\noextrasfrench{\ifFBGlobalLayoutFrench
- \bbl@frenchlabelitems
- \else
- \bbl@nonfrenchlabelitems
- \fi}%
- \fi
-% \end{macrocode}
-%
-% |IndentFirst| forces the first paragraphs of sections to be
-% indented just like the other ones in French.
-% When |GlobalLayoutFrench| is true, the same is done outside French
-% except for languages that force a different setting.
-% |\bbl@nonfrenchindent| has been designed to be smart with other
-% languages (like Spanish) who also indent every first paragraphs of
-% sections (see section~\ref{sec-indent}).
-% \begin{macrocode}
- \ifFBIndentFirst
- \addto\extrasfrench{\bbl@frenchindent}%
- \addto\noextrasfrench{\ifFBGlobalLayoutFrench
- \bbl@frenchindent
- \else
- \bbl@nonfrenchindent
- \fi}%
- \else
- \addto\extrasfrench{\bbl@nonfrenchindent}%
- \addto\noextrasfrench{\bbl@nonfrenchindent}%
+ \def\FB@ufl{\update@frenchlists}
+ \ifx\bbl@main@language\FB@french
+ \update@frenchlists
\fi
% \end{macrocode}
-%
% The layout of footnotes is handled at the |\begin{document}|
-% depending on the values of flags |FrenchFootnotes|
-% and |AutoSpaceFootnotes| (see section~\ref{sec-footnotes}),
+% depending on the values of flags \fbo{FrenchFootnotes}
+% and \fbo{AutoSpaceFootnotes} (see section~\ref{ssec-footnotes}),
% nothing has to be done here for footnotes.
%
-% |AutoSpacePunctuation| adds an unbreakable space (in French only)
-% before the four active characters (:;!?) even if none has been
-% typed before them.
+% \fbo{AutoSpacePunctuation} adds an unbreakable space (in French
+% only) before the four active characters (:;!?) even if none has
+% been typed before them.
% \begin{macrocode}
\ifFBAutoSpacePunctuation
- \autospace@beforeFDP
+ \autospace@beforeFDP
\else
- \noautospace@beforeFDP
+ \noautospace@beforeFDP
\fi
% \end{macrocode}
-%
-% When |OriginalTypewriter| is set to |false| (the default),
+% 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
@@ -3352,24 +3390,35 @@
% \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}
%
-% |ThinColonSpace| changes the normal unbreakable space typeset in
-% French before `:' to a thin space.
+% \changes{v3.0a}{2014/01/10}{Changed option ThinColonSpace to make it
+% work also with LuaTeX.}
+%
+% \fbo{ThinColonSpace} changes the normal unbreakable space typeset
+% in French before `:' to a thin space.
% \begin{macrocode}
- \ifFBThinColonSpace\renewcommand*{\FBcolonspace}{\FBthinspace}\fi
+ \ifFBThinColonSpace
+ \ifFB@luatex@punct
+ \FBcolonskip=\FBthinskip\relax
+ \else
+ \renewcommand*{\FBcolonspace}{\FBthinspace}%
+ \fi
+ \fi
% \end{macrocode}
-%
-% When |true|, |ThinSpaceInFrenchNumbers| redefines |numprint.sty|'s
-% command |\npstylefrench| to set |\npthousandsep| to |\,|
-% (thinspace) instead of |~| (default) . This option has no effect
-% if package \file{numprint.sty} is not loaded with `|autolanguage|'.
-% As old versions of \file{numprint.sty} did not define
-% |\npstylefrench|, we have to provide this command.
+% When \fbo{true}, \fbo{ThinSpaceInFrenchNumbers} redefines
+% |numprint.sty|'s command |\npstylefrench| to set |\npthousandsep|
+% to |\,| (thinspace) instead of |~| (default) . This option has no
+% effect if package \pkg{numprint} is not loaded with
+% `|autolanguage|'. As old versions of \pkg{numprint} did not
+% define |\npstylefrench|, we have to provide this command.
% \begin{macrocode}
\@ifpackageloaded{numprint}%
{\ifnprt@autolanguage
@@ -3396,8 +3445,7 @@
\npaddtolanguage{french}{french}%
\fi}{}%
% \end{macrocode}
-%
-% |FrenchSuperscripts|: if |true| |\up=\fup|, else
+% \fbo{FrenchSuperscripts}: if \fbo{true} |\up=\fup|, else
% |\up=\textsuperscript|. Anyway |\up*=\FB@up@fake|. The star-form
% |\up*{}| is provided for fonts that lack some superior letters:
% Adobe Jenson Pro and Utopia Expert have no ``g superior'' for
@@ -3410,9 +3458,8 @@
{\textsuperscript}}%
\fi
% \end{macrocode}
-%
-% |LowercaseSuperscripts|: if |true| let |\FB@lc| be |\lowercase|,
-% else |\FB@lc| is redefined to do nothing.
+% \fbo{LowercaseSuperscripts}: if \fbo{true} let |\FB@lc| be
+% |\lowercase|, else |\FB@lc| is redefined to do nothing.
% \begin{macrocode}
\ifFBLowercaseSuperscripts
\else
@@ -3420,14 +3467,33 @@
\fi
% \end{macrocode}
%
-% |PartNameFull|: if |false|, redefine |\partname|.
+% \changes{v3.0a}{2014/02/20}{With koma-script and memoir class,
+% customise \cs{captionformat} and \cs{captiondelim}.}
+%
+% Use French |\CaptionSeparator| for koma-script and \cls{memoir}
+% classes unless \fbo{CustomiseFigTabCaptions} has been set to
+% \fbo{false} (the default).
+% \begin{macrocode}
+ \ifFBCustomiseFigTabCaptions
+ \ifFB@koma
+ \let\captionformat\CaptionSeparator
+ \fi
+ \@ifclassloaded{memoir}%
+ {\captiondelim{\CaptionSeparator}}{}%
+ \else
+% \end{macrocode}
+% When \fbo{CustomiseFigTabCaptions} is \fbo{false}, have the colon
+% behave properly in French.
% \begin{macrocode}
- \ifFBPartNameFull
- \else\addto\captionsfrench{\def\partname{Partie}}\fi
+ \ifFB@koma
+ \def\captionformat{\iflanguage{french}{ : }{: }}%
+ \fi
+ \@ifclassloaded{memoir}%
+ {\captiondelim{\iflanguage{french}{ : }{: }}}{}%
+ \fi
% \end{macrocode}
-%
-% |ShowOptions|: if |true|, print the list of all options to the
-% \file{.log} file.
+% \fbo{ShowOptions}: if \fbo{true}, print the list of all options
+% to the \file{.log} file.
% \begin{macrocode}
\ifFBShowOptions
\GenericWarning{* }{%
@@ -3464,68 +3530,31 @@
LowercaseSuperscripts=false [true]\MessageBreak
PartNameFull=false [true]\MessageBreak
SuppressWarning=true [false]\MessageBreak
- og= <left quote character>, fg= <right quote character>
+ CustomiseFigTabCaptions=false [true]\MessageBreak
+ og= <left quote character>, fg= <right quote character>%
\MessageBreak
- *********************************************
+ *********************************************%
\MessageBreak\protect\frenchbsetup{ShowOptions}}
\fi
}
% \end{macrocode}
% \end{macro}
%
-% \changes{v2.0}{2006/12/15}{AtBeginDocument, save again the
-% definitions of the `list' and `itemize' environments and the
-% values of labelitems. As of frenchb v.~1.6, `ORI' values were
-% set when reading frenchb.ldf, later changes were ignored.}
-%
% \changes{v2.0}{2006/12/06}{Added warning for OT1 encoding.}
%
% \changes{v2.1b}{2008/04/07}{Disable some commands in bookmarks.}
%
-% \changes{v2.5a}{2010/08/21}{Test \cs{@ifundefined} leaves the
-% tested control sequence defined as \cs{relax} when TRUE.
-% Changed \cs{relax} to \cs{undefined} when testing
-% \cs{pdfstringdefDisableCommands} AtBeginDocument.}
-%
-% \changes{v2.5e}{2011/04/03}{The redefinition of
-% \cs{pdfstringdefDisableCommands} from \cs{relax} to \cs{undefined}
-% was misplaced. Reported by S\'ebastien Gouezel.}
-%
% \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\'ebastien Gouezel.}
-%
-% At |\begin{document}| we save again the value of
-% |\if@afterindent|, definitions of the list environments and the
-% values of labelitems so that all changes made in the preamble are
-% taken into account in languages other than French and in French
-% with the StandardLayout option.
-% We also have to provide an |\xspace| command in case the
-% \file{xspace.sty} package is not loaded.
+% Reported by Sébastien Gouezel.}
%
+% At |\begin{document}|, we have to provide an |\xspace| command
+% in case the \pkg{xspace} package is not loaded, do some setup for
+% \file{hyperref}'s bookmarks, execute |\FBprocess@options|, switch
+% LuaTeX punctuation on and issue some warnings if necessary.
% \begin{macrocode}
\AtBeginDocument{%
- \ifx\@afterindentfalse\@afterindenttrue
- \let\@aifORI\@afterindenttrue
- \else \let\@aifORI\@afterindentfalse
- \fi
- \let\listORI\list
- \let\endlistORI\endlist
- \let\endlistFB\endlist
- \let\itemizeORI\itemize
- \let\enditemizeORI\endlist
- \let\enditemizeFB\endlist
- \let\enumerateORI\enumerate
- \let\endenumerateORI\endlist
- \let\endenumerateFB\endlist
- \let\descriptionORI\description
- \let\enddescriptionORI\endlist
- \let\enddescriptionFB\endlist
- \let\@ltiORI\labelitemi
- \let\@ltiiORI\labelitemii
- \let\@ltiiiORI\labelitemiii
- \let\@ltivORI\labelitemiv
\providecommand*{\xspace}{\relax}%
% \end{macrocode}
%
@@ -3534,9 +3563,8 @@
%
% Let's redefine some commands in \file{hyperref}'s bookmarks.
% \begin{macrocode}
- \@ifundefined{pdfstringdefDisableCommands}%
- {\let\pdfstringdefDisableCommands\undefined}%
- {\pdfstringdefDisableCommands{%
+ \ifdefined\pdfstringdefDisableCommands
+ \pdfstringdefDisableCommands{%
\let\up\relax
\let\fup\relax
\let\degre\textdegree
@@ -3559,87 +3587,43 @@
\def\circonflexe{\string^}%
\def\tild{\string~}%
\let\bsc\textsc
- }%
- }%
-% \end{macrocode}
-%
-% It is time to process the options set with |\frenchboptions{}|.
-% Then we need to execute either |\extrasfrench| and
-% |\captionsfrench| or |\noextrasfrench| according to the current
-% language at the |\begin{document}| (these three commands have been
-% updated by |\FBprocess@options|). \emph{But}, when French is the
-% main language, |\extrasfrench| is executed \emph{again} now
-% (French has been switched on `AtBeginDocument' some time before).
-% This is harmless, except for |\bbl@frenchspacing| which will
-% redefine |\bbl@nonfrenchspacing| to |\relax|, this will be
-% wrong if the user switches to English.
-% When French is \emph{not} the main language, |\noextrasfrench|
-% executes |\bbl@nonfrenchspacing| (=|\nonfrenchspacing|), thus
-% eventually overwriting a |\frenchspacing| command issued by the
-% main language (German, Spanish, etc.).
-% So we have to define |\bbl@nonfrenchspacing| as |\relax| here
-% and restore it's meaning afterwards.
-%
-% It is also the right time, when a koma-script class is in use, to
-% save the value of |\captionformat| in |\CaptionSeparatorORI}| and
-% to add the redefinitions of |\captionformat| to
-% |\(no)extrasfrench|.
-%
-% \changes{v2.5a}{2010/08/15}{Define \cs{bbl@nonfrenchspacing} locally
-% as \cs{relax}, otherwise the \cs{bbl@frenchspacing} command
-% included in germanb.ldf is overwritten here by
-% \cs{noextrasfrench}. Bug pointed out by Ulrike Fischer.}
-%
-% \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\"unter Milde.}
-%
-% \changes{v2.6c}{2013/05/18}{With koma-script classes, save the value
-% of \cs{captionformat} in \cs{CaptionSeparatorORI} NOW, then add
-% the redefinitions of \cs{captionformat} to \cs{(no)extrasfrench}.}
-%
+ }%
+ \fi
+% \end{macrocode}
+% It is time to process the options set with \fbsetup{} or later.
% \begin{macrocode}
\FBprocess@options
- \let\bbl@nonfrenchspacingORI\bbl@nonfrenchspacing
- \let\bbl@nonfrenchspacing\relax
- \@ifundefined{captionformat}%
- {\let\captionformat\undefined}%
- {\let\CaptionSeparatorORI\captionformat
- \addto\extrasfrench{%
- \renewcommand*{\captionformat}{\CaptionSeparator}}%
- \addto\noextrasfrench{%
- \renewcommand*{\captionformat}{\CaptionSeparatorORI}}%
- }%
- \ifx\bbl@main@language\FB@french
- \extrasfrench\captionsfrench
- \else
- \noextrasfrench
- \fi
- \let\bbl@nonfrenchspacing\bbl@nonfrenchspacingORI
% \end{macrocode}
+% With LuaTeX engines it is time to load file \file{frenchb.lua}
+% (|\FBthinskip| and |\FBcolonskip| values are set now).
+% \begin{macrocode}
+ \ifFB@luatex@punct
+ \activate@luatexpunct
+ \fi
+% \end{macrocode}
+%
+% \changes{v3.0a}{2014/01/28}{Test \cs{ifXeTeX} changed to
+% \cs{ifFBunicode} and `xltxtra' changed to `fontspec'.}
+%
% Some warnings are issued when output font encodings are not
-% properly set. With XeLaTeX, \file{fontspec.sty} and
+% properly set. With XeLaTeX or LuaLaTeX, \file{fontspec.sty} and
% \file{xunicode.sty} should be loaded; with (pdf)\LaTeX, a warning
% is issued when OT1 encoding is in use at the |\begin{document}|.
% Mind that |\encodingdefault| is defined as `long', defining
% |\FBOTone| with |\newcommand*| would fail!
% \begin{macrocode}
- \ifFBXeTeX
- \@ifundefined{DeclareUTFcharacter}%
- {\PackageWarning{frenchb.ldf}%
- {Add \protect\usepackage{xltxtra} to the\MessageBreak
+ \ifFBunicode
+ \ifdefined\DeclareUTFcharacter
+ \else
+ \PackageWarning{frenchb.ldf}%
+ {Add \protect\usepackage{fontspec} to the\MessageBreak
preamble of your document,}%
- \let\DeclareUTFcharacter\undefined}%
- {}%
- \else
+ \fi
+ \else
\begingroup \newcommand{\FBOTone}{OT1}%
\ifx\encodingdefault\FBOTone
\PackageWarning{frenchb.ldf}%
- {OT1 encoding should not be used for French.
+ {OT1 encoding should not be used for French.%
\MessageBreak
Add \protect\usepackage[T1]{fontenc} to the
preamble\MessageBreak of your document,}%
@@ -3649,26 +3633,490 @@
}
% \end{macrocode}
%
-% \subsection{Clean up and exit}
+% \subsection{French lists}
+% \label{ssec-lists}
+%
+% \changes{v2.6a}{2013/01/30}{Bug correction: changing \cs{leftmargin}
+% cannot be done only for itemize-lists: it messes up
+% embedded enumerate lists. Pointed out by Denis Bitouzé.
+% Lists have been completely redesigned in frenchb v.~2.6a.
+% An option for backward compatibility is provided.}
+%
+% \begin{macro}{\listFB}
+% \begin{macro}{\listORI}
+% \begin{macro}{\FB@listVsettings}
+% Vertical spacing in lists should be shorter in French texts than
+% the defaults provided by \LaTeX.
+% Note that the easy way, just changing values of vertical spacing
+% parameters when entering French and restoring them to their
+% defaults on exit would not work; so we define the command
+% |\FB@listVsettings| to hold the settings to be used by
+% the French variant |\listFB| of |\list|. Note that switching
+% to |\listFB| reduces vertical spacing in \emph{all} environments
+% built on |\list|: |itemize|, |enumerate|, |description|, but also
+% |abstract|, |quotation|, |quote| and |verse|\dots{}
+%
+% The amount of vertical space before and after a list is given by
+% |\topsep| + |\parskip| (+ |\partopsep| if the list starts a new
+% paragraph). IMHO, |\parskip| should be added \emph{only} when
+% the list starts a new paragraph, so I subtract |\parskip| from
+% |\topsep| and add it back to |\partopsep|; this will normally
+% make no difference because |\parskip|'s default value is 0pt, but
+% will be noticeable when |\parskip| is \emph{not} null.
%
-% Load |frenchb.cfg| (kept just for backward compatibility).
% \begin{macrocode}
-\loadlocalcfg{frenchb}
+\let\listORI\list
+\let\endlistORI\endlist
+\def\FB@listVsettings{%
+ \setlength{\itemsep}{0.4ex plus 0.2ex minus 0.2ex}%
+ \setlength{\parsep}{0.4ex plus 0.2ex minus 0.2ex}%
+ \setlength{\topsep}{0.8ex plus 0.4ex minus 0.4ex}%
+ \setlength{\partopsep}{0.4ex plus 0.2ex minus 0.2ex}%
% \end{macrocode}
+% |\parskip| is of type `skip', its mean value only (\emph{not
+% the glue}) should be subtracted from |\topsep| and added to
+% |\partopsep|, so convert |\parskip| to a `dimen' using
+% |\@tempdima|.
+% \begin{macrocode}
+ \@tempdima=\parskip
+ \addtolength{\topsep}{-\@tempdima}%
+ \addtolength{\partopsep}{\@tempdima}%
+}
+\def\listFB#1#2{\listORI{#1}{\FB@listVsettings #2}}
+\let\endlistFB\endlist
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% Let's now consider French itemize-lists. They differ from those
+% provided by the standard \LaTeXe{} classes:
+% \begin{itemize}
+% \item The `\textbullet' is never used in French itemize-lists,
+% an emdash `---' or an endash `--' is preferred for all
+% levels. The item label to be used in French is stored in
+% |\FrenchLabelItem}|, it defaults to `---' and can be changed
+% using \fbsetup{} (see section~\ref{ssec-keyval}).
+% \item Vertical spacing between items, before and after
+% the list, should be \emph{null} with \emph{no glue} added;
+% \item In French the labels of itemize-lists are vertically
+% aligned as follows:\\
+% \fbox{\parbox[t]{.5\textwidth}{%
+% \parindent=1.5em
+% Text starting at `parindent' \\
+% \noindent$\Leftarrow$ Leftmargin\\
+% \hspace*{\parindent}\textendash{} first item\dots{}\\
+% \hspace*{\parindent}\hspace*{\labelsep}%
+% \textendash{} first second level item\\
+% \hspace*{\parindent}\hspace*{\labelsep}%
+% \textendash{} next one\dots{}\\
+% \hspace*{\parindent}\textendash{} second item\dots{}
+% }}
+% \end{itemize}
+%
+% \begin{macro}{\FrenchLabelItem}
+% \changes{v2.6a}{2013/01/30}{defaults to \cs{textemdash} instead of
+% \cs{textendash} up to v.~2.5k.}
+% \begin{macro}{\Frlabelitemi}
+% \begin{macro}{\Frlabelitemii}
+% \begin{macro}{\Frlabelitemiii}
+% \begin{macro}{\Frlabelitemiv}
+% Default labels for French itemize-lists (same label for all levels):
+% \begin{macrocode}
+\newcommand*{\FrenchLabelItem}{\textemdash}
+\newcommand*{\Frlabelitemi}{\FrenchLabelItem}
+\newcommand*{\Frlabelitemii}{\FrenchLabelItem}
+\newcommand*{\Frlabelitemiii}{\FrenchLabelItem}
+\newcommand*{\Frlabelitemiv}{\FrenchLabelItem}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\listindentFB}
+% \begin{macro}{\labelwidthFB}
+% Let's define two lengths |\listindentFB| and |\labelwidthFB| to
+% customise lists' horizontal indentations. They are given
+% silly values here ($-1$\,pt) in order to eventually
+% enable their customisation in the preamble. They will get
+% reasonnable defaults later when entering French (see
+% |\bbl@frenchlabelitems|) unless they have been customised.
+% \begin{macrocode}
+\newlength\listindentFB
+\setlength{\listindentFB}{-1pt}
+\newlength\labelwidthFB
+\setlength{\labelwidthFB}{-1pt}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\FB@listHsettings}
+% \begin{macro}{\leftmarginFB}
+% |\FB@listHsettings| holds the new horizontal settings chosen for
+% French lists itemize and enumerate starting with version~2.6a.
+% They are based on the look resquested in French for
+% itemize-lists.
+% \begin{macrocode}
+\newlength\leftmarginFB
+\def\FB@listHsettings{%
+ \leftmarginFB\labelwidthFB
+ \advance\leftmarginFB \labelsep
+ \leftmargini\leftmarginFB
+ \advance\leftmargini \listindentFB
+ \leftmarginii\leftmarginFB
+ \leftmarginiii\leftmarginFB
+ \leftmarginiv\leftmarginFB
+ \leftmargin\csname leftmargin\romannumeral\the\@listdepth\endcsname
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\itemizeFB}
+% \begin{macro}{\FB@itemizesettings}
+%
+% \changes{v2.6f}{2013/11/25}{\cs{labelwidth} must be reset, f.i. when
+% an itemize list occurs inside environments based on trivlist which
+% set \cs{labelwidth} to 0 (see proof environment in amsthm.sty).
+% Bug pointed out by Julien Hauseux.}
+%
+% \changes{v2.6g}{2013/12/30}{Suppress all vertical spaces only if
+% ReduceListSpacing is true. Pointed out by Pierre Willaime.}
+%
+% New environment for French itemize-lists.\\ |\FB@itemizesettings|
+% does two things: first suppress all vertical spaces including glue
+% when option \fbo{ReduceListSpacing} is set, then set horizontal
+% indentations according to |\FB@listHsettings| unless option
+% \fbo{ListOldLayout} is \fbo{true} (compatibility with lists up to
+% v.~2.5k).
+% \begin{macrocode}
+\def\FB@itemizesettings{%
+ \ifFBReduceListSpacing
+ \setlength{\itemsep}{\z@}%
+ \setlength{\parsep}{\z@}%
+ \setlength{\topsep}{\z@}%
+ \setlength{\partopsep}{\z@}%
+ \@tempdima=\parskip
+ \addtolength{\topsep}{-\@tempdima}%
+ \addtolength{\partopsep}{\@tempdima}%
+ \fi
+ \settowidth{\labelwidth}{\csname\@itemitem\endcsname}%
+ \ifFBListOldLayout
+ \setlength{\leftmargin}{\labelwidth}%
+ \addtolength{\leftmargin}{\labelsep}%
+ \addtolength{\leftmargin}{\parindent}%
+ \else
+ \FB@listHsettings
+ \fi
+}
+% \end{macrocode}
+% The definition of |\itemizeFB| follows the one of |\itemize|
+% in standard \LaTeXe{} classes (see \file{ltlists.dtx}),
+% spaces are customised by |\FB@itemizesettings|.
+%
+% \begin{macrocode}
+\def\itemizeFB{%
+ \ifnum \@itemdepth >\thr@@\@toodeep\else
+ \advance\@itemdepth\@ne
+ \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
+ \expandafter
+ \listORI
+ \csname\@itemitem\endcsname
+ \FB@itemizesettings
+ \fi
+}
+\let\enditemizeFB\endlistORI
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+\def\labelitemsFB{%
+ \let\labelitemi\Frlabelitemi
+ \let\labelitemii\Frlabelitemii
+ \let\labelitemiii\Frlabelitemiii
+ \let\labelitemiv\Frlabelitemiv
+ \ifdim\labelwidthFB<\z@
+ \settowidth{\labelwidthFB}{\FrenchLabelItem}%
+ \fi
+ \ifdim\listindentFB<\z@
+ \ifdim\parindent=\z@
+ \setlength{\listindentFB}{1.5em}%
+ \else
+ \setlength{\listindentFB}{\parindent}%
+ \fi
+ \fi
+}
+% \end{macrocode}
+%
+% \begin{macro}{\enumerateFB}
+% The definition of |\enumerateFB|, new to version~2.6a, follows
+% the one of |\enumerate| in standard \LaTeXe{} classes (see
+% \file{ltlists.dtx}), vertical spaces are customised (or not)
+% via |\list| (=|\listFB| or |\listORI|) and horizontal spaces
+% (leftmargins) are borrowed from |itemize| lists via
+% |\FB@listHsettings|.
+%
+% \begin{macrocode}
+\def\enumerateFB{%
+ \ifnum \@enumdepth >\thr@@\@toodeep\else
+ \advance\@enumdepth\@ne
+ \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
+ \expandafter
+ \list
+ \csname label\@enumctr\endcsname
+ {\FB@listHsettings
+ \usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
+ \fi
+}
+\let\endenumerateFB\endlistORI
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\descriptionFB}
+% \changes{v2.6b}{2013/02/10}{Settings of \cs{FB@listHsettings} should
+% apply to description lists too.}
+%
+% \changes{v3.0a}{2014/02/28}{Add \cs{listindentFB} to
+% \cs{itemindent}. Suggested by Denis Bitouzé.}
+%
+% Same tuning for the |description| environment (see the original
+% definition in \file{classes.dtx}). Customisable |\listindentFB|
+% added to |\itemindent| (first level only).
+%
+% \begin{macrocode}
+\def\descriptionFB{%
+ \list{}{\FB@listHsettings
+ \labelwidth\z@
+ \itemindent-\leftmargin
+ \ifnum\@listdepth=1
+ \advance\itemindent by \listindentFB
+ \fi
+ \let\makelabel\descriptionlabel}%
+}
+\let\enddescriptionFB\endlistORI
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\update@frenchlists}
+% \begin{macro}{\bbl@frenchlistlayout}
+% \begin{macro}{\bbl@nonfrenchlistlayout}
+% |\update@frenchlists| will setup lists according to the options
+% of \fbsetup{}.
+% \begin{macrocode}
+\def\update@frenchlists{%
+ \ifFBReduceListSpacing \let\list\listFB \fi
+ \ifFBStandardItemizeEnv
+ \else \let\itemize\itemizeFB \fi
+ \ifFBStandardItemLabels
+ \else \labelitemsFB \fi
+ \ifFBStandardEnumerateEnv
+ \else \let\enumerate\enumerateFB \let\description\descriptionFB \fi
+}
+% \end{macrocode}
+% In order to ensure compatibility with packages customising lists,
+% the command |\update@frenchlists| should not be included in
+% |\extrasfrench| yet, so we also define |\FB@ufl| as |\relax|,
+% it will be redefined as |\update@frenchlists| in due time
+% `AtBeginDocument' by |\FBprocess@options|,
+% see p.~\pageref{FB@ufl}.
+% \begin{macrocode}
+\def\FB@ufl{\relax}
+\def\bbl@frenchlistlayout{%
+ \ifFBGlobalLayoutFrench
+ \else
+ \babel@save\list \babel@save\itemize
+ \babel@save\enumerate \babel@save\description
+ \babel@save\labelitemi \babel@save\labelitemii
+ \babel@save\labelitemiii \babel@save\labelitemiv
+ \fi
+ \FB@ufl
+}
+\def\bbl@nonfrenchlistlayout{%
+ \ifFBGlobalLayoutFrench
+ \update@frenchlists
+ \fi
+}
+\FB@addto{extras}{\bbl@frenchlistlayout}
+\FB@addto{noextras}{\bbl@nonfrenchlistlayout}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{French indentation of sections}
+% \label{ssec-indent}
+%
+% \begin{macro}{\bbl@frenchindent}
+% \begin{macro}{\bbl@nonfrenchindent}
+% In French the first paragraph of each section should be indented,
+% this is another difference with US-English. This is controlled
+% by the flag |\if@afterindent|.
+%
+% \changes{v2.3d}{2009/03/16}{Bug correction: previous versions of
+% frenchb set the flag \cs{if@afterindent} to false outside
+% French which is correct for English but wrong for some languages
+% like Spanish. Pointed out by Juan José Torrens.}
+%
+% We will need to save the value of the flag |\if@afterindent|
+% `AtBeginDocument' before eventually changing its value.
+%
+% \begin{macrocode}
+\def\bbl@frenchindent{%
+ \ifFBGlobalLayoutFrench\else\babel@save\@afterindentfalse\fi
+ \ifFBIndentFirst
+ \let\@afterindentfalse\@afterindenttrue
+ \@afterindenttrue
+ \fi}
+\def\bbl@nonfrenchindent{%
+ \ifFBGlobalLayoutFrench
+ \ifFBIndentFirst
+ \@afterindenttrue
+ \fi
+ \fi}
+\FB@addto{extras}{\bbl@frenchindent}
+\FB@addto{noextras}{\bbl@nonfrenchindent}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Formatting footnotes}
+% \label{ssec-footnotes}
+%
+% \changes{v2.0}{2006/11/06}{Footnotes are now printed
+% by default `à la française' for the whole document.}
+%
+% \changes{v2.0b}{2007/04/18}{Footnotes: Just do nothing
+% (except warning) when the bigfoot package is loaded.}
+%
+% The \pkg{bigfoot} package deeply changes the way footnotes are
+% handled. When \file{bigfoot} is loaded, we just warn the user
+% that \frenchb{} will drop the customisation of footnotes.
+%
+% The layout of footnotes is controlled by two flags
+% |\ifFBAutoSpaceFootnotes| and |\ifFBFrenchFootnotes| which are
+% set by options of \fbsetup{} (see section~\ref{ssec-keyval}).
+% The layout of footnotes \emph{does not depend} on the current
+% language (just think of two footnotes on the same page looking
+% different because one was called in a French part, the other one
+% in English!).
+%
+% When |\ifFBAutoSpaceFootnotes| is true, |\@footnotemark| (the
+% definition of which is saved at the |\begin{document}| in order to
+% include any customisation that packages might have done) is
+% redefined to add a thin space before the number or symbol calling
+% a footnote (any space typed in is removed first).
+% This has no effect on the layout of the footnote itself.
+%
+% \changes{v2.4a}{2009/11/23}{\cs{PackageWarning} changed to
+% \cs{FBWarning} (when bigfoot package in use).}
+%
+% \begin{macrocode}
+\AtBeginDocument{\@ifpackageloaded{bigfoot}%
+ {\PackageInfo{frenchb.ldf}%
+ {bigfoot package in use.\MessageBreak
+ frenchb will NOT customise footnotes;\MessageBreak
+ reported}}%
+ {\let\@footnotemarkORI\@footnotemark
+ \def\@footnotemarkFB{\leavevmode\unskip\unkern
+ \,\@footnotemarkORI}%
+ \ifFBAutoSpaceFootnotes
+ \let\@footnotemark\@footnotemarkFB
+ \fi}%
+ }
+% \end{macrocode}
+%
+% We then define |\@makefntextFB|, a variant of |\@makefntext|
+% which is responsible for the layout of footnotes, to match the
+% specifications of the French `Imprimerie Nationale': footnotes
+% will be indented by |\parindentFFN|, numbers (if any) typeset on
+% the baseline (instead of superscripts) and followed by a dot
+% and an half quad space. Whenever symbols are used to number
+% footnotes (as in |\thanks| for instance), we switch back to the
+% standard layout (the French layout of footnotes is meant for
+% footnotes numbered by Arabic or Roman digits).
+%
+% \changes{v2.0}{2006/11/06}{\cs{parindentFFN} not changed if
+% already defined (required by JA for cah-gut.cls).}
+%
+% \changes{v2.3b}{2008/12/06}{New commands \cs{dotFFN} and
+% \cs{kernFFN} for more flexibility (suggested by JA).}
+%
+% The value of |\parindentFFN| will be redefined at the
+% |\begin{document}|, as the maximum of |\parindent| and 1.5em
+% \emph{unless} it has been set in the preamble (the weird value
+% 10in is just for testing whether |\parindentFFN| has been set
+% or not).
+%
+% \begin{macrocode}
+\newcommand*{\dotFFN}{.}
+\newcommand*{\kernFFN}{\kern .5em}
+\newdimen\parindentFFN
+\parindentFFN=10in
+\def\ftnISsymbol{\@fnsymbol\c@footnote}
+\long\def\@makefntextFB#1{\ifx\thefootnote\ftnISsymbol
+ \@makefntextORI{#1}%
+ \else
+ \parindent=\parindentFFN
+ \rule\z@\footnotesep
+ \setbox\@tempboxa\hbox{\@thefnmark}%
+ \ifdim\wd\@tempboxa>\z@
+ \llap{\@thefnmark}\dotFFN\kernFFN
+ \fi #1
+ \fi}%
+% \end{macrocode}
+%
+% We save the standard definition of |\@makefntext| at the
+% |\begin{document}|, and then redefine |\@makefntext| according to
+% the value of flag |\ifFBFrenchFootnotes| (true or false).
+%
+% \begin{macrocode}
+\AtBeginDocument{\@ifpackageloaded{bigfoot}{}%
+ {\ifdim\parindentFFN<10in
+ \else
+ \parindentFFN=\parindent
+ \ifdim\parindentFFN<1.5em \parindentFFN=1.5em \fi
+ \fi
+ \let\@makefntextORI\@makefntext
+ \long\def\@makefntext#1{%
+ \ifFBFrenchFootnotes
+ \@makefntextFB{#1}%
+ \else
+ \@makefntextORI{#1}%
+ \fi}%
+ }%
+ }
+% \end{macrocode}
+%
+% For compatibility reasons, we provide definitions for the commands
+% dealing with the layout of footnotes in \frenchb{} version~1.6.
+% \fbsetup{} (see in section \ref{ssec-keyval}) should be
+% preferred for setting these options. |\StandardFootnotes| may
+% still be used locally (in minipages for instance), that's why the
+% test |\ifFBFrenchFootnotes| is done inside |\@makefntext|.
+% \begin{macrocode}
+\newcommand*{\AddThinSpaceBeforeFootnotes}{\FBAutoSpaceFootnotestrue}
+\newcommand*{\FrenchFootnotes}{\FBFrenchFootnotestrue}
+\newcommand*{\StandardFootnotes}{\FBFrenchFootnotesfalse}
+% \end{macrocode}
+%
+% \subsection{Clean up and exit}
+%
+% \changes{v3.0a}{2014/02/20}{french.cfg will be loaded (if found)
+% instead of frenchb.cfg. NO NEED for .cfg files in French anyway.}
+%
% Final cleaning.
-% The macro |\ldf@quit| takes care for setting the main language
+% 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.
-% The config file searched for has to be |frenchb.cfg|, and
-% |\CurrentOption| has been set to `french', so
-% |\ldf@finish\CurrentOption| cannot be used: we first load
-% |frenchb.cfg|, then call |\ldf@quit\CurrentOption|.
% \begin{macrocode}
\FBclean@on@exit
-\ldf@quit\CurrentOption
+\ldf@finish\CurrentOption
% \end{macrocode}
% \iffalse
-%</code>
+%</ldf>
%<*dtx>
% \fi
%%