summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-01-30 21:04:29 +0000
committerKarl Berry <karl@freefriends.org>2018-01-30 21:04:29 +0000
commit26b507ff1e2b1d8acaaf4bb212f149f39c436821 (patch)
tree42a8b9f981c489b6a1055e1eb30438981114bf6b
parent27a29325fbe6a50247f1eb60f8a9d46509c11531 (diff)
babel-french (30jan18)
git-svn-id: svn://tug.org/texlive/trunk@46493 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/generic/babel-french/README2
-rw-r--r--Master/texmf-dist/doc/generic/babel-french/frenchb.pdfbin287379 -> 297020 bytes
-rw-r--r--Master/texmf-dist/source/generic/babel-french/frenchb.dtx996
-rw-r--r--Master/texmf-dist/source/generic/babel-french/frenchb.ins2
-rw-r--r--Master/texmf-dist/tex/generic/babel-french/acadian.ldf8
-rw-r--r--Master/texmf-dist/tex/generic/babel-french/canadien.ldf4
-rw-r--r--Master/texmf-dist/tex/generic/babel-french/francais.ldf2
-rw-r--r--Master/texmf-dist/tex/generic/babel-french/french.ldf408
-rw-r--r--Master/texmf-dist/tex/generic/babel-french/frenchb.ldf2
-rw-r--r--Master/texmf-dist/tex/generic/babel-french/frenchb.lua113
10 files changed, 955 insertions, 582 deletions
diff --git a/Master/texmf-dist/doc/generic/babel-french/README b/Master/texmf-dist/doc/generic/babel-french/README
index 90dc8d625ba..693f01b7bc7 100644
--- a/Master/texmf-dist/doc/generic/babel-french/README
+++ b/Master/texmf-dist/doc/generic/babel-french/README
@@ -3,7 +3,7 @@ The babel-french bundle (formerly known as `frenchb')
French language support for the babel multilingual package
-Copyright 1996--2017 Daniel Flipo
+Copyright 1996--2018 Daniel Flipo
E-mail: daniel (dot) flipo (at) free (dot) fr
Released under the LaTeX Project Public License v1.3 or later
diff --git a/Master/texmf-dist/doc/generic/babel-french/frenchb.pdf b/Master/texmf-dist/doc/generic/babel-french/frenchb.pdf
index 618961eb02d..36e9a512336 100644
--- a/Master/texmf-dist/doc/generic/babel-french/frenchb.pdf
+++ b/Master/texmf-dist/doc/generic/babel-french/frenchb.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/generic/babel-french/frenchb.dtx b/Master/texmf-dist/source/generic/babel-french/frenchb.dtx
index 03bbe841547..ee9b8d9d19d 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{3545}
+%\CheckSum{3593}
%
%\iffalse
% Tell the \LaTeX\ system who we are and write an entry on the
@@ -13,12 +13,12 @@
%<frenchb>\ProvidesLanguage{frenchb}
%<lua>--[[
%<lua> File `frenchb.lua’ generated from frenchb.dtx
- [2017/10/19 v3.3d French support from the babel system]
+ [2018/01/30 v3.4a French support from the babel system]
%<*internal>
\iffalse
%</internal>
%<*lua>
- Copyright © 2014-2017 Daniel Flipo
+ Copyright © 2014-2018 Daniel Flipo
<daniel (dot) flipo (at) free (dot) fr>
License LPPL: see french.ldf.
--]]
@@ -32,7 +32,7 @@
%<*dtx|french>
%%
%% Babel package for LaTeX version 2e
-%% Copyright © 1996 - 2017
+%% Copyright © 1996-2018
%% by Daniel Flipo <daniel (dot) flipo (at) free (dot) fr>
%%
%</dtx|french>
@@ -265,6 +265,11 @@
% character (the outer one) as recommended by the French
% `Imprimerie Nationale’.
%
+% \item |\frenchdate|\marg{year}\marg{month}\marg{day} helps
+% typesetting dates in French: |\frenchdate{2001}{01}{01}|
+% will print 1\up{er} janvier 2001 in a box without any
+% linebreak.
+%
% \item A command |\up| is provided to typeset superscripts like
% |M\up{me}| (abbreviation for ``Madame’’), |1\up{er}| (for
% ``premier’’). Other commands are also provided for
@@ -518,7 +523,7 @@
% after opening French quotes and before closing French quotes to
% the French `Imprimerie Nationale’ standards (inter-word space).
% \frenchb’s default setting produces slightly narrower spaces
-% with lesser stretchability.
+% with less stretchability.
% \item [EveryParGuill=open, close, none (open)]; sets whether
% an opening quote (\texttt{«}) or a closing one (\texttt{»}) or
% nothing should be printed by |\frquote{}| at the beginning of
@@ -582,8 +587,9 @@
% \label{sssec-captions-name}
%
% All caption names can easily be customised in French using the
-% simplified syntax introduced by \babel~3.9, for instance:
-% |\def\frenchproofname{Preuve}|.
+% simplified syntax introduced by \babel~3.9, for instance
+% |\def\frenchproofname{Preuve}| or
+% |\def\acadianproofname{Preuve}| for the \Lopt{acadian} dialect.
% The older syntax |\addto\captionsfrench{\def\proofname{Preuve}}|
% still works. Keep in mind that \emph{only} |french| can be used
% to redefine captions, even if \babel{}’s option was entered as
@@ -639,11 +645,11 @@
% 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}|\\
+% |\documentclass[french]{article}|\\
% |\usepackage[|\textit{my-encoding}|]{inputenc}|\\
% |\usepackage[T1]{fontenc} % Use LM fonts|\\
% |\usepackage{lmodern} % for French|\\
-% |\usepackage[frenchb]{babel}|\\
+% |\usepackage{babel}|\\
% |\begin{document}|\\
% |\showhyphens{signal container \'ev\'enement alg\`ebre}|\\
% |\showhyphens{signal container événement algèbre}|\\
@@ -674,6 +680,25 @@
% \subsection{Changes}
% \label{ssec-changes}
%
+% \subsubsection*{What’s new in version 3.4?}
+%
+% Version 3.4a adds a new command |\frenchdate| (see
+% p.~\pageref{sssec-date}) and slightly changes number formatting:
+% |\FBthousandsep| is now a \textit{kern} instead of a rubber
+% length. |\renewcommand*{\FBthousandsep}{~}| will switch back
+% to the former (wrong) behaviour.
+%
+% Both options \Lopt{french} and \Lopt{acadian} can now be used
+% simultaneously in a document; currently \Lopt{french} and
+% \Lopt{acadian} are identical, it is up to the user to customise
+% \Lopt{acadian} in terms of hyphenation patterns, captionnames,
+% date format or high punctuation and quotes spacing if he/she
+% needs a variant for French.
+%
+% A new command |\FBsetspaces| has been added for easy customising of
+% spacing before high punctuation and inside quotes independently for
+% \Lopt{french} and \Lopt{acadian}, see p.~\pageref{FBsetspaces}.
+%
% \subsubsection*{What’s new in version 3.3?}
%
% In version~3.3d the automatic insertion of non-breaking spaces
@@ -697,6 +722,8 @@
% files \file{frenchb.ldf},\file{francais.ldf}, \file{acadian.ldf}
% and \file{canadien.ldf} have been added. Recommended options are
% \Lopt{french} or \Lopt{acadian}, all other are deprecated.
+% BTW, options \Lopt{french} and \Lopt{acadian} are currently
+% strictly identical.
%
% Release 3.3a is compatible with LuaTeX v.~0.95 (TL2016) and up.
% Former skips |\FBcolonskip|, |\FBthinskip| and |\FBguillskip|
@@ -824,63 +851,23 @@
% \changes{v3.0a}{2014/02/28}{Support for options frenchb, francais,
% canadien, acadian changed.}
%
-% \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.}
+% \changes{v3.0a}{2014/02/19}{\cs{LdfInit} checks \cs{captionsfrench}
+% instead of \cs{datefrench} to avoid a conflict with papertex.cls
+% which loads datetime.sty.}
%
-% The macro |\LdfInit| takes care of preventing that this file is
-% loaded more than once, checking the category code of the
-% \texttt{@} sign, etc.
+% \changes{v3.4a}{2018/01/14}{\cs{LdfInit} checks \cs{FBclean@on@exit}
+% instead of \cs{captionsfrench} (undefined in PLain).
+% Prevents loading french.ldf again with acadian option.}
%
-% \begin{macrocode}
-\LdfInit\CurrentOption\captionsfrench
-% \end{macrocode}
-%
-% \changes{v3.0c}{2014/03/30}{No need to define \cs{l@french} as
-% \cs{lang@french}, babel.def (3.9j) takes care for this.}
+% The macro |\LdfInit| takes care of preventing that this file is
+% loaded more than once (even if both options \Lopt{french} and
+% \Lopt{acadian} are used in the same document), checking the
+% category code of the \texttt{@} sign, etc.
%
-% Make sure that |\l@french| is defined (possibly as 0).
-% \file{babel.def} now (3.9i) defines |\l@<languagename>| also for
-% eTeX, LuaTeX and XeTeX formats which set |\lang@<languagename>|.
% \begin{macrocode}
-\def\FB@nopatterns{%
- \ifx\l@nohyphenation\@undefined
- \edef\bbl@nulllanguage{\string\language=0}%
- \adddialect\l@french0
- \else
- \adddialect\l@french\l@nohyphenation
- \edef\bbl@nulllanguage{\string\language=nohyphenation}%
- \fi
- \@nopatterns{French}}
-\ifx\l@french\@undefined
- \FB@nopatterns
-\fi
+\LdfInit\CurrentOption{FBclean@on@exit}
% \end{macrocode}
%
-% \changes{v2.1d}{2008/05/04}{Avoid warning `\cs{end} occurred
-% when \cs{ifx} ... incomplete’ with LaTeX-2.09.}
-%
-% \begin{macro}{\ifLaTeXe}
-% No support is provided for late \LaTeX-2.09: issue a warning
-% and exit if \LaTeX-2.09 is in use. Plain is still supported.
-% \begin{macrocode}
-\newif\ifLaTeXe
-\let\bbl@tempa\relax
-\ifx\magnification\@undefined
- \ifx\@compatibilitytrue\@undefined
- \PackageError{french.ldf}
- {LaTeX-2.09 format is no longer supported.\MessageBreak
- Aborting here}
- {Please upgrade to LaTeX2e!}
- \let\bbl@tempa\endinput
- \else
- \LaTeXetrue
- \fi
-\fi
-\bbl@tempa
-% \end{macrocode}
-% \end{macro}
-%
% \changes{v3.0a}{2014/02/15}{In Plain, provide a substitute for
% \cs{PackageWarning} and \cs{PackageInfo}.}
%
@@ -907,20 +894,37 @@
\endgroup}
% \end{macrocode}
%
-% \changes{v3.0c}{2014/03/30}{frenchb requires babel-3.9i.}
+% \changes{v3.4a}{2018/01/04}{babel-french now requires eTeX.}
+%
+% Quit if eTeX is not available.
+% \begin{macrocode}
+\let\bbl@tempa\relax
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname eTeXversion\endcsname\relax
+ \let\bbl@tempa\endinput
+ \fb@error{babel-french requires eTeX.\\
+ Aborting here}
+ {Orignal PlainTeX is not supported,\\
+ please use LuaTeX or XeTeX engines.}
+\fi
+\bbl@tempa
+% \end{macrocode}
+%
+% \changes{v3.0c}{2014/03/30}{babel-french requires babel-3.9i.}
%
% Quit if \babel’s version is less than 3.9i.
% \begin{macrocode}
\let\bbl@tempa\relax
-\ifx\babeltags\@undefined
+\ifdefined\babeltags
+\else
\let\bbl@tempa\endinput
- \ifLaTeXe
+ \ifdefined\PackageError
\PackageError{french.ldf}
- {frenchb requires babel v.3.9i.\MessageBreak
+ {babel-french requires babel v.3.16.\MessageBreak
Aborting here}
{Please upgrade Babel!}
\else
- \fb@error{frenchb requires babel v.3.9i.\\
+ \fb@error{babel-french requires babel v.3.16.\\
Aborting here}
{Please upgrade Babel!}
\fi
@@ -928,17 +932,32 @@
\bbl@tempa
% \end{macrocode}
%
+% \changes{v3.0c}{2014/03/30}{No need to define \cs{l@french} as
+% \cs{lang@french}, babel.def (3.9j) takes care for this.}
+%
+% Make sure that |\l@french| is defined (fallbacks are
+% |\l@nohyphenation| if available or~0).
+% \file{babel.def} (3.9i and up) defines |\l@<languagename>| also for
+% eTeX, LuaTeX and XeTeX formats which set |\lang@<languagename>|.
+% \begin{macrocode}
+\def\FB@nopatterns{%
+ \ifdefined\l@nohyphenation
+ \adddialect\l@french\l@nohyphenation
+ \edef\bbl@nulllanguage{\string\language=nohyphenation}%
+ \else
+ \edef\bbl@nulllanguage{\string\language=0}%
+ \adddialect\l@french0
+ \fi
+ \@nopatterns{French}}
+\ifdefined\l@french \else \FB@nopatterns \fi
+% \end{macrocode}
+%
% Babel’s French language can be loaded with option \Lopt{acadian}
% which stands for Canadian French.
% If no specific hyphenation patterns are available, Canadian French
% will use the French ones.
% \begin{macrocode}
-\def\bbl@tempa{acadian}
-\ifx\CurrentOption\bbl@tempa
- \ifx\l@acadian\@undefined
- \adddialect\l@acadian\l@french
- \fi
-\fi
+\ifdefined\l@acadian \else \adddialect\l@acadian\l@french \fi
% \end{macrocode}
%
% French uses the standard values of |\lefthyphenmin| (2)
@@ -946,8 +965,34 @@
% as required by \babel.
%
% \begin{macrocode}
-\expandafter\providehyphenmins\expandafter{\CurrentOption}{\tw@\thr@@}
+\providehyphenmins{french}{\tw@\thr@@}
+\providehyphenmins{acadian}{\tw@\thr@@}
+% \end{macrocode}
+%
+%\changes{v2.1d}{2008/05/04}{Avoid warning `\cs{end} occurred
+% when \cs{ifx} ... incomplete’ with LaTeX-2.09.}
+%
+% \begin{macro}{\ifLaTeXe}
+% No support is provided for late \LaTeX-2.09: issue a warning
+% and exit if \LaTeX-2.09 is in use. Plain is still supported.
+% \begin{macrocode}
+\newif\ifLaTeXe
+\let\bbl@tempa\relax
+\ifdefined\magnification
+\else
+ \ifdefined\@compatibilitytrue
+ \LaTeXetrue
+ \else
+ \PackageError{french.ldf}
+ {LaTeX-2.09 format is no longer supported.\MessageBreak
+ Aborting here}
+ {Please upgrade to LaTeX2e!}
+ \let\bbl@tempa\endinput
+ \fi
+\fi
+\bbl@tempa
% \end{macrocode}
+% \end{macro}
%
%\begin{macro}{\ifFBunicode}
% \begin{macro}{\ifFBLuaTeX}
@@ -970,20 +1015,14 @@
% \changes{v2.6g}{2013/12/15}{lccode values for the French
% `apostrophe’ are now the same for XeTeX and LuaTeX.}
%
-% We cannot rely on \eTeX’s |\ifdefined| at this stage, as it is not
-% defined in Plain \TeX{} format.
% \begin{macrocode}
\newif\ifFBunicode
\newif\ifFBLuaTeX
\newif\ifFBXeTeX
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname luatexversion\endcsname\relax
-\else
+\ifdefined\luatexversion
\FBunicodetrue \FBLuaTeXtrue
\fi
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname XeTeXrevision\endcsname\relax
-\else
+\ifdefined\XeTeXrevision
\FBunicodetrue \FBXeTeXtrue
\fi
% \end{macrocode}
@@ -996,8 +1035,8 @@
%
% \begin{macro}{\ifFBfrench}
% True when the current language is French or any of its dialects;
-% will be set to true by |\extras\CurrentOption| and to false by
-% |\noextras\CurrentOption|. Used in |\DecimalMathComma| and
+% will be set to true by |\extrasfrench| and to false by
+% |\noextrasfrench|. Used in |\DecimalMathComma| and
% |frenchsetup{og=«, fg=»}|.
% \begin{macrocode}
\newif\ifFBfrench
@@ -1008,6 +1047,10 @@
% \changes{v3.0a}{2014/02/18}{Take advantage of babel’s
% \cs{babel@savevariable} to handle apostrophe’s \cs{lccode}.}
%
+% \changes{v3.4a}{2018/01/06}{Change \cs{(no)extras}\cs{CurrentOption}
+% to \cs{(no)extrasfrench}. \cs{(no)extrasacadian} will be defined
+% as \cs{(no)extrasfrench} in file acadian.ldf.}
+%
% \begin{macro}{\noextrasfrench}
% The macro |\extrasfrench| will perform all the extra
% definitions needed for the French language.
@@ -1026,7 +1069,7 @@
% pdfTeX) using \file{hyph-fr.tex} patterns.
%
% \begin{macrocode}
-\@namedef{extras\CurrentOption}{%
+\def\extrasfrench{%
\FBfrenchtrue
\babel@savevariable{\lccode`\'}%
\ifFBunicode
@@ -1036,26 +1079,15 @@
\lccode`\'=`\'
\fi
}
-\@namedef{noextras\CurrentOption}{\FBfrenchfalse}
-% \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}}
+\def\noextrasfrench{\FBfrenchfalse}
% \end{macrocode}
%
% One more thing |\extrasfrench| needs to do is to make sure that
% ``Frenchspacing’’ is in effect. |\noextrasfrench| will switch
% ``Frenchspacing’’ off again if necessary.
% \begin{macrocode}
-\FB@addto{extras}{\bbl@frenchspacing}
-\FB@addto{noextras}{\bbl@nonfrenchspacing}
+\addto\extrasfrench{\bbl@frenchspacing}
+\addto\noextrasfrench{\bbl@nonfrenchspacing}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1077,15 +1109,14 @@
% `high punctuation’ management with LuaTeX engines.}
%
% \begin{macro}{\ifFB@active@punct}
+% Three internal flags are needed for the three different techniques
+% used for `high punctuation’ management.
% \begin{macrocode}
\newif\ifFB@active@punct \FB@active@puncttrue
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifFB@luatex@punct}
-% Three internal flags are needed for the three different techniques
-% used for `high punctuation’ management.
-%
% With LuaTeX, starting with version 0.95, callbacks are used to
% get rid of active punctuation. With previous versions, `high
% punctuation’ characters remain active (see below).
@@ -1095,13 +1126,14 @@
\ifnum\luatexversion<95
\ifx\PackageWarning\@undefined
\fb@warning{Please upgrade LuaTeX to version 0.95 or above!\\%
- frenchb will make high punctuation characters (;:!?) active\\%
- with LuaTeX < 0.95.}%
+ babel-french will make high punctuation characters (;:!?)\\%
+ active with LuaTeX < 0.95.}%
\else
\PackageWarning{french.ldf}{Please upgrade LuaTeX
to version 0.95 or above!\MessageBreak
- frenchb will make high punctuation characters\MessageBreak
- (;:!?) active with LuaTeX < 0.95;\MessageBreak reported}%
+ babel-french will make high punctuation characters%
+ \MessageBreak (;:!?) active with LuaTeX < 0.95;%
+ \MessageBreak reported}%
\fi
\else
\FB@luatex@puncttrue\FB@active@punctfalse
@@ -1119,15 +1151,13 @@
% non characters: it’s value will be 4095 for new engines and 255
% for older ones.}
%
-% The number of available character classes has been increased
-% from 256 to 4096 in XeTeX v.~0.99994, the class for
-% non-characters is now 4095 instead of 255.
+% The number of available character classes has been increased from
+% 256 to 4096 in XeTeX v.~0.99994, the class for non-characters is
+% now 4095 instead of 255.
% \begin{macrocode}
\newcount\FB@nonchar
\newif\ifFB@xetex@punct
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname XeTeXinterchartokenstate\endcsname\relax
-\else
+\ifdefined\XeTeXinterchartokenstate
\FB@xetex@puncttrue\FB@active@punctfalse
\ifdim\the\XeTeXversion\XeTeXrevision pt<0.99994pt
\FB@nonchar=255 \relax
@@ -1138,6 +1168,7 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\FBguillspace}
% \begin{macro}{\FBcolonspace}
% \begin{macro}{\FBthinspace}
% \changes{v2.5a}{2010/08/10}{Define \cs{FBthinspace} for those who want
@@ -1148,7 +1179,7 @@
% a conflict with fournier.sty.}
%
% \changes{v3.1f}{2015/05/31}{\cs{FBthinspace} is no longer a kern but
-% a skip (frenchb adds a nobreak penalty before it).}
+% a skip (babel-french adds a nobreak penalty before it).}
%
% \changes{v3.2c}{2016/05/14}{Change .16667em to
% .5\cs{fontdimen2}\cs{font} to get in XeTeX and pdfTeX
@@ -1158,32 +1189,167 @@
% \cs{FBthinskip} replaced by toks \cs{FBcolonsp} and
% \cs{FBthinsp}.}
%
+% These three commands are meant for basic French. Other French
+% dialects can use different settings, see below.
% According to the I.N.\ specifications, the `:’ requires an
% inter-word space before it, the other three require just a thin
% space. We define |\FBcolonspace| as |\space| (inter-word space)
% and |\FBthinspace| as an half inter-word space with no shrink nor
-% stretch, both are user customisable in the preamble.
-% \begin{macrocode}
+% stretch.
+% |\FBguillspace| is defined btw. as spacing for French quotes is
+% handled together with high punctuation for LuaTeX and XeTeX.
+% |\FBguillspace| has been fine tuned by Thierry Bouche to 80\% of an
+% inter-word space with reduced stretchability.
+% All three are user customisable in the preamble, best using the
+% |\FBsetspaces| command described below.
+% A penalty will be added before these spaces to prevent line
+% breaking.
+% \begin{macrocode}
+\newcommand*{\FBguillspace}{\hskip .8\fontdimen2\font
+ plus .3\fontdimen3\font
+ minus .8\fontdimen4\font \relax}
\newcommand*{\FBcolonspace}{\space}
-\newcommand*{\FBthinspace}{\hskip.5\fontdimen2\font \relax}
+\newcommand*{\FBthinspace}{\hskip .5\fontdimen2\font \relax}
% \end{macrocode}
-% These commands will be converted into toks `AtBeginDocument’
-% for LuaTeX.
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \changes{v3.3a}{2016/04/30}{Skip \cs{FBguillskip} for LuaTeX
+% replaced by toks \cs{FBguillsp}.}
+%
+% \changes{v3.4a}{2018/01/15}{Toks \cs{FBcolonsp}, \cs{FBthinsp} and
+% \cs{FBguillsp} removed.}
+%
+% \changes{v3.4a}{2018/01/26}{New command \cs{FBsetspaces} to fine tune
+% spacing independently in French and in French dialects.}
+%
+% \begin{macro}{\FBsetspaces}
+% This command makes it easy to fine tune |\FBguillspace|,
+% |\FBcolonspace| and |\FBthinspace| in French (defaut) or
+% independently in a French dialect using the optional argument.
+% They are meant for \LaTeXe{} \emph{only} and can only be used
+% in the preamble.
+% Four mandatory arguments are expected besides the optional one:
+% the first one is a \textit{string} either "guill", "colon", or
+% "thin", the last four are decimal numbers specifying
+% \textit{width}, \textit{stretch} and \textit{shrink} relative to
+% \textit{fontdimens}.\hlabel{FBsetspaces}
+% For instance |\FBsetspaces[acadian]{colon}{0.5}{0}{0}| defines
+% |\acadianFBcolonspace| as a thinspace which will be used for
+% the Acadian dialect only. When used without optional argument or
+% with argument `french’, the same command would tune the basic
+% |\FBcolonspace| command.
% \begin{macrocode}
-\newtoks\FBcolonsp
-\newtoks\FBthinsp
+\ifLaTeXe
+ \newcommand*{\FBsetspaces}[5][french]{%
+ \def\bbl@tempa{french}\def\bbl@tempb{#1}%
+ \ifx\bbl@tempa\bbl@tempb \def\bbl@tempb{}\fi
+ \@namedef{\bbl@tempb FB#2space}{\hskip #3\fontdimen2\font
+ plus #4\fontdimen3\font
+ minus #5\fontdimen4\font \relax}%
+% \end{macrocode}
+% With option "acadian", fill the corresponding LuaTeX table.
+% All unset values in the "acadian" subtables will be filled
+% `AtBeginDocument’ by |\set@glue@table| with the value available
+% for "french".
+% \begin{macrocode}
+ \ifFB@luatex@punct
+ \ifx\bbl@tempb\FB@acadian
+ \directlua{
+ FBsp.#2.gl.ac[1] = #3
+ FBsp.#2.gl.ac[2] = #4
+ FBsp.#2.gl.ac[3] = #5
+ if #3 > 0.6 then
+ FBsp.#2.ch.ac = 0xA0
+ elseif #3 > 0.2 then
+ FBsp.#2.ch.ac = 0x202F
+ else
+ FBsp.#2.ch.ac = 0x200B
+ end
+ }%
+ \fi
+ \fi
+ }
+ \@onlypreamble\FBsetspaces
+\fi
% \end{macrocode}
% \end{macro}
-% \end{macro}
+%
+% Remember that the \emph{same} |\extrasfrench| command is executed
+% when switching to French or to a French dialect (Acadian).
+% Acadian and French may share the same patterns (or not), and may
+% use different spacing for high punctuation and/or quotes.
+% Basically, for pdfLaTeX and XeLaTeX, the spacing is set for French,
+% then potentially tuned differently for Acadian.
+% LuaTeX relies on an attribute |\FB@dialect| to decide what spacing
+% is needed for French or Acadian (see LuaTeX table |FBsp|).
+% \hlabel{extrapunct}
+% As a rough test on |\languagename| would be unreliable to set the
+% value of |\FB@dialect| (see \file{babel.pdf}), we use a trick
+% based on |\detokenize|; another option would be to use the
+% |\IfLanguageName| command from Oberdiek’s package \file{iflang}.
+% \begin{macrocode}
+\ifLaTeXe
+ \addto\extrasfrench{%
+ \ifFB@luatex@punct
+ \edef\bbl@tempa{\detokenize\expandafter{\languagename}}%
+ \edef\bbl@tempb{\detokenize{french}}%
+ \ifx\bbl@tempa\bbl@tempb \FB@dialect=0 \relax
+ \else \FB@dialect=1 \relax
+ \fi
+% \end{macrocode}
+% The first time whe enter French, we have to set the LuaTeX
+% tables for French (|\FB@dialet=0|) \emph{before} any dialect
+% redefines any |\FB...space| command. Doing this `AtBeginDocument’
+% would be too late: if French or a French dialect is the main
+% language, |\extrasfrench| has been executed before!
+% \begin{macrocode}
+ \ifdefined\FB@once\else
+ \set@glue@table{FBcolonspace}{colon}%
+ \set@glue@table{FBthinspace}{thin}%
+ \set@glue@table{FBguillspace}{guill}%
+ \def\FB@once{}%
+ \fi
+ \fi
+% \end{macrocode}
+% Any dialect dependent customisation done using
+% |\FBsetspaces[|\textit{dialect}|]| command or alike is now
+% taken into account: the value of |\FBthinspace| (meant for French,
+% i.e.|\FB@dialect=0|) is first saved then changed (for Acadian).
+% \begin{macrocode}
+ \ifcsname\languagename FBthinspace\endcsname
+ \babel@save\FBthinspace
+ \renewcommand*{\FBthinspace}{%
+ \csname\languagename FBthinspace\endcsname}%
+ \fi
+% \end{macrocode}
+% Same for |\FBcolonspace|:
+% \begin{macrocode}
+ \ifcsname\languagename FBcolonspace\endcsname
+ \babel@save\FBcolonspace
+ \renewcommand*{\FBcolonspace}{%
+ \csname\languagename FBcolonspace\endcsname}%
+ \fi
+% \end{macrocode}
+% And for |\FBguillspace|:
+% \begin{macrocode}
+ \ifcsname\languagename FBguillspace\endcsname
+ \babel@save\FBguillspace
+ \renewcommand*{\FBguillspace}{%
+ \csname\languagename FBguillspace\endcsname}%
+ \fi
+ }
+\fi
+% \end{macrocode}
%
% \changes{v3.2c}{2016/05/14}{Newif \cs{ifFB@spacing} and new commands
% \cs{FB@spacingon}, \cs{FB@spacingoff} to control space tuning in
% French.}
%
-% With LuaTeX and XeTeX engines, \frenchb{} handles French quotes
-% together with `high punctuation’; the conditional |\ifFB@spacing|
-% will be used by PdfTeX and XeTeX engines to switch on or off space
-% tuning before high punctuation and inside French quotes.
+% The conditional |\ifFB@spacing| will be used by pdfTeX and XeTeX
+% engines to switch on or off space tuning before high punctuation
+% and inside French quotes.
% A matching attribute will be defined later for LuaTeX.
% \begin{macrocode}
\newif\ifFB@spacing \FB@spacingtrue
@@ -1242,34 +1408,47 @@
% \changes{v3.3a}{2017/04/30}{Compatibility code for pre
% 2015/10/01 LaTeX release removed, see ltnews23.tex.}
%
-% We define three LuaTeX attributes to control spacing in French
-% for `high punctuation’ and quotes, making sure that
-% |\newattribute| is defined.
+% \changes{v3.4a}{2018/01/15}{New attribute \cs{FB@dialect} for the
+% French dialect acadian.}
+%
% \begin{macrocode}
\ifFB@luatex@punct
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname newluafunction\endcsname\relax
+ \ifdefined\newluafunction\else
% \end{macrocode}
-% This code is for Plain: load\file{ltluatex.tex} if it hasn’t been
+% This code is for Plain: load \file{ltluatex.tex} if it hasn’t been
% loaded before \babel.
% \begin{macrocode}
\input ltluatex.tex
\fi
% \end{macrocode}
+% We define five LuaTeX attributes to control spacing in French
+% and/or Acadian for `high punctuation’ and quotes, making sure
+% that |\newattribute| is defined.
+%
% |\FB@spacing=0| switches off any space tuning both before high
% punctuation characters and inside French quotes (i.e.\ function
% |french_punctuation| doesn’t alter the node list at all).
+%
% |\FB@addDPspace=0| switches off automatic insertion of spaces
% before high punctuation characters (but typed spaces are still
% turned into non-breaking thin- or word-spaces).
+%
% |\FB@addGUILspace| will be set to~1 by option \fbo{og=«, fg=»},
% thus enabling automatic insertion of proper spaces after `«’ and
% before `»’.
+%
+% |\FB@ucsNBSP| triggers the replacement of glues by characters, it
+% is controlled by option \fbo{UnicodeNoBreakSpaces}.
+%
+% |\FB@dialect| is 0 for French and 1 for Acadian; its value controls
+% which parts of the glue table (|.fr| or |.ac|) are taken into
+% account.
% \begin{macrocode}
\newattribute\FB@spacing \FB@spacing=1 \relax
\newattribute\FB@addDPspace \FB@addDPspace=1 \relax
\newattribute\FB@addGUILspace \FB@addGUILspace=0 \relax
\newattribute\FB@ucsNBSP \FB@ucsNBSP=0 \relax
+ \newattribute\FB@dialect \FB@dialect=0 \relax
\ifLaTeXe
\PackageInfo{french.ldf}{No need for active punctuation
characters\MessageBreak with this version
@@ -1278,6 +1457,53 @@
\fb@info{No need for active punctuation characters\\
with this version of LuaTeX!}
\fi
+% \end{macrocode}
+% The next command will be used in the first call of |\extrasfrench|
+% to convert |\FBcolonspace|, |\FBthinspace| and |\FBguillspace|
+% into a table usable by LuaTeX. This way, any customisation done
+% in the preamble (by \fbsetup{}, redefinitions or |\FBsetspaces|
+% commands) are taken into account. Values not explicitly set for
+% Acadian by |\FBsetspaces[|\textit{acadian}|]| commands are copied
+% from the French ones.
+% In case parsing by the Lua function |FBget_glue| (defined in file
+% \file{frenchb.lua}) fails due to unexpected syntax in |\FB...space|
+% the table remains unchanged and a warning is issued.
+% The matching space characters for option \fbo{UnicodeNoBreakSpaces}
+% are set as word space, thin space or null space according to the
+% \textit{width} parameter.
+% \begin{macrocode}
+ \newcommand*{\set@glue@table}[2]{%
+ \directlua {
+ local s = token.get_meaning("#1")
+ local t = FBget_glue(s)
+ if t then
+ FBsp.#2.gl.fr = t
+ if not FBsp.#2.gl.ac[1] then
+ FBsp.#2.gl.ac = t
+ end
+ if FBsp.#2.gl.fr[1] > 0.6 then
+ FBsp.#2.ch.fr = 0xA0
+ elseif FBsp.#2.gl.fr[1] > 0.2 then
+ FBsp.#2.ch.fr = 0x202F
+ else
+ FBsp.#2.ch.fr = 0x200B
+ end
+ if not FBsp.#2.ch.ac then
+ FBsp.#2.ch.ac = FBsp.#2.ch.fr
+ end
+ else
+ texio.write_nl('term and log', '')
+ texio.write_nl('term and log',
+ '*** french.ldf warning: Unexpected syntax in FB#2space,')
+ texio.write_nl('term and log',
+ '*** french.ldf warning: LuaTeX table FBsp unchanged.')
+ texio.write_nl('term and log',
+ '*** french.ldf warning: Consider using FBsetspaces to ')
+ texio.write('term and log', 'customise FB#2space.')
+ texio.write_nl('term and log', '')
+ end
+ }%
+ }
\fi
% \end{macrocode}
%
@@ -1366,47 +1592,69 @@ local insert_node_before = node.insert_before
local insert_node_after = node.insert_after
local remove_node = node.remove
% \end{macrocode}
+%
+%\changes{v3.4a}{2018/01/26}{Global `FBsp' table added; local function
+% `get\_glue' changed into global `FBget\_glue'.}
+%
% Commands |\FBthinspace|, |\FBcolonspace| and |\FBguillspace| are
-% converted `AtBeginDocument’ into toks |\FBthinsp|, |\FBcolonsp|
-% and |\FBguillsp|;
-% the latter are processed by the next function |get_glue| which
-% returns a table of three values which are fractions of
-% |\fontdimen2|, |\fontdimen3| and |\fontdimen4|.
-% \hlabel{lua-scaling}
-% \begin{macrocode}
-local function get_glue(toks)
+% converted `AtBeginDocument’ by the next function |FBget_glue| into
+% tables of three values which are fractions of |\fontdimen2|,
+% |\fontdimen3| and |\fontdimen4|. \hlabel{lua-scaling}
+% If parsing fails due to unexpected syntax, the function returns
+% \textit{nil} instead of a table.
+% \begin{macrocode}
+function FBget_glue(toks)
local t = nil
- local f = string.match(toks, "\\hskip%s*([%d%.]*)%s*\\fontdimen 2")
+ local f = string.match(toks,
+ "[^%w]hskip%s*([%d%.]*)%s*[^%w]fontdimen 2")
if f == "" then f = 1 end
if tonumber(f) then
t = {tonumber(f), 0, 0}
- f = string.match(toks, "plus%s*([%d%.]*)%s*\\fontdimen 3")
+ f = string.match(toks, "plus%s*([%d%.]*)%s*[^%w]fontdimen 3")
if f == "" then f = 1 end
if tonumber(f) then
t[2] = tonumber(f)
- f = string.match(toks, "minus%s*([%d%.]*)%s*\\fontdimen 4")
+ f = string.match(toks, "minus%s*([%d%.]*)%s*[^%w]fontdimen 4")
if f == "" then f = 1 end
if tonumber(f) then
t[3] = tonumber(f)
end
end
- elseif string.match(toks, "\\F?B?thinspace") then
+ elseif string.match(toks, "[^%w]F?B?thinspace") then
t = {0.5, 0, 0}
- elseif string.match(toks, "\\space") then
+ elseif string.match(toks, "[^%w]space") then
t = {1, 1, 1}
end
return t
end
-local colngl = get_glue(tex.toks['FBcolonsp']) or {1, 1, 1}
-local thingl = get_glue(tex.toks['FBthinsp']) or {.5, 0, 0}
-local guilgl = get_glue(tex.toks['FBguillsp']) or {.8, .3, .8}
% \end{macrocode}
-% The next function converts glue sizes returned in fontdimens
-% by function |get_glue| into sp for the current font;
-% beware of null values for fid, see |\nullfont| in TikZ, and of
-% special fonts like lcircle1.pfb for which |font.getfont(fid)|
-% does not return a proper font table, in such cases the function
-% returns |nil|.
+% Let’s initialize the global LuaTeX table |FBsp|: it holds the
+% characteristics of the glues used in French and Acadian for
+% high punctuation and quotes and the corresponding no-breaking
+% space characters for option \fbo{UnicodeNoBreakSpaces}.
+% \begin{macrocode}
+FBsp = {}
+FBsp.thin = {}
+FBsp.thin.gl = {}
+FBsp.thin.gl.fr = {.5, 0, 0} ; FBsp.thin.gl.ac = {}
+FBsp.thin.ch = {}
+FBsp.thin.ch.fr = 0x202F ; FBsp.thin.ch.ac = nil
+FBsp.colon = {}
+FBsp.colon.gl = {}
+FBsp.colon.gl.fr = { 1, 1, 1} ; FBsp.colon.gl.ac = {}
+FBsp.colon.ch = {}
+FBsp.colon.ch.fr = 0xA0 ; FBsp.colon.ch.ac = nil
+FBsp.guill = {}
+FBsp.guill.gl = {}
+FBsp.guill.gl.fr = {.8, .3, .8} ; FBsp.guill.gl.ac = {}
+FBsp.guill.ch = {}
+FBsp.guill.ch.fr = 0xA0 ; FBsp.guill.ch.ac = nil
+% \end{macrocode}
+% The next function converts the glue table returned by function
+% |FBget_glue| into sp for the current font; beware of null values
+% for fid, see |\nullfont| in TikZ, and of special fonts like
+% lcircle1.pfb for which |font.getfont(fid)| does not return a proper
+% font table, in such cases the function returns |nil|.
%
% \changes{v3.1l}{2016/02/13}{font.getfont(fid) possibly
% returns nil even for a positive fid (i.e. AMS lcircle1.pfb).
@@ -1414,7 +1662,7 @@ local guilgl = get_glue(tex.toks['FBguillsp']) or {.8, .3, .8}
%
% \changes{v3.1m}{2016/02/16}{new\_glue\_scaled returns
% nil in case of invalid font table (i.e. lcircle1.pfb). In such
-% cases frenchb leaves the node list unchanged.}
+% cases babel-french leaves the node list unchanged.}
%
% \changes{v3.2b}{2016/04/18}{glue\_spec removed;
% starting with LuaTeX 0.95, glue specifications fit in glue.}
@@ -1422,7 +1670,7 @@ local guilgl = get_glue(tex.toks['FBguillsp']) or {.8, .3, .8}
% \begin{macrocode}
local font_table = {}
local function new_glue_scaled (fid,table)
- if fid > 0 then
+ if fid > 0 and table[1] then
local fp = font_table[fid]
if not fp then
local ft = font.getfont(fid)
@@ -1452,6 +1700,7 @@ local FBspacing = luatexbase.attributes['FB@spacing']
local addDPspace = luatexbase.attributes['FB@addDPspace']
local addGUILspace = luatexbase.attributes['FB@addGUILspace']
local FBucsNBSP = luatexbase.attributes['FB@ucsNBSP']
+local FBdialect = luatexbase.attributes['FB@dialect']
local has_attribute = node.has_attribute
% \end{macrocode}
% The following function will be added to |kerning| callback.
@@ -1462,8 +1711,8 @@ local has_attribute = node.has_attribute
% or |FB_punct_right| is true) need a special treatment.
% In French, local variables are defined to hold the properties of
% the current glyph (|item|) and of the previous one (|prev|) or the
-% next one (|next|). Constant |FR=lang.id(french)| is defined by
-% command |\activate@luatexpunct|.
+% next one (|next|). Constants |FR_fr| (french) and |FR_ca|
+% (acadian) are defined by command |\activate@luatexpunct|.
%
% \changes{v3.1b}{2014/09/16}{Add a check for null fid
% in french\_punctuation (Tikz \cs{nullfont}).
@@ -1479,27 +1728,15 @@ local function french_punctuation (head)
FRspacing = FRspacing and FRspacing > 0
local FRucsNBSP = has_attribute(item, FBucsNBSP)
FRucsNBSP = FRucsNBSP and FRucsNBSP > 0
- local NBthinspace = new_node("glyph")
- NBthinspace.font = fid
- NBthinspace.char = 0x202F
- local NBcolnspace = new_node("glyph")
- NBcolnspace.font = fid
- if colngl[1] <= 0.5 then
- NBcolnspace.char = 0x202F
- else
- NBcolnspace.char = 0xA0
- end
- local NBguilspace = new_node("glyph")
- NBguilspace.font = fid
- if guilgl[1] <= 0.5 then
- NBguilspace.char = 0x202F
- else
- NBguilspace.char = 0xA0
- end
+ local FRdialect = has_attribute(item, FBdialect)
+ FRdialect = FRdialect and FRdialect > 0
local SIG = has_attribute(item, addGUILspace)
SIG = SIG and SIG >0
- if lang == FR and FRspacing and
- FB_punct_left[char] and fid > 0 then
+ if lang ~= FR_fr and lang ~= FR_ca then
+ FRspacing = nil
+ end
+ local nbspace = new_node("glyph")
+ if FRspacing and FB_punct_left[char] and fid > 0 then
local prev = item.prev
local prev_id, prev_subtype, prev_char
if prev then
@@ -1579,14 +1816,25 @@ local function french_punctuation (head)
end
end
local fbglue
- local nbspace
+ local t
if FB_punct_thick[char] then
- fbglue = new_glue_scaled(fid,colngl)
- nbspace = NBcolnspace
+ if FRdialect then
+ t = FBsp.colon.gl.ac
+ nbspace.char = FBsp.colon.ch.ac
+ else
+ t = FBsp.colon.gl.fr
+ nbspace.char = FBsp.colon.ch.fr
+ end
else
- fbglue = new_glue_scaled(fid,thingl)
- nbspace = NBthinspace
+ if FRdialect then
+ t = FBsp.thin.gl.ac
+ nbspace.char = FBsp.thin.ch.ac
+ else
+ t = FBsp.thin.gl.fr
+ nbspace.char = FBsp.thin.ch.fr
+ end
end
+ fbglue = new_glue_scaled(fid, t)
% \end{macrocode}
% In case |new_glue_scaled| fails (returns |nil|) the node list
% remains unchanged.
@@ -1596,6 +1844,7 @@ local function french_punctuation (head)
head = remove_node(head,prev,true)
end
if (FRucsNBSP) then
+ nbspace.font = fid
insert_node_before(head, item, copy_node(nbspace))
else
insert_node_before(head, item, copy_node(nobreak))
@@ -1636,13 +1885,20 @@ local function french_punctuation (head)
if is_glue and glue_wd <= 1 then
addgl = false
end
- local fbglue = new_glue_scaled(fid,guilgl)
+ local t = FBsp.guill.gl.fr
+ nbspace.char = FBsp.guill.ch.fr
+ if FRdialect then
+ t = FBsp.guill.gl.ac
+ nbspace.char = FBsp.guill.ch.ac
+ end
+ local fbglue = new_glue_scaled(fid, t)
if addgl and fbglue then
if is_glue then
head = remove_node(head,prev,true)
end
if (FRucsNBSP) then
- insert_node_before(head, item, copy_node(NBguilspace))
+ nbspace.font = fid
+ insert_node_before(head, item, copy_node(nbspace))
else
insert_node_before(head, item, copy_node(nobreak))
insert_node_before(head, item, copy_node(fbglue))
@@ -1667,8 +1923,8 @@ local function french_punctuation (head)
% a null glue (i.e. springs).}
%
% \begin{macrocode}
- if lang == FR and FRspacing and FB_punct_right[char]
- and fid > 0 and SIG then
+ if FRspacing and FB_punct_right[char]
+ and fid > 0 and SIG then
local next = item.next
local next_id, next_subtype, next_char, nextnext, kern_wd
if next then
@@ -1710,13 +1966,20 @@ local function french_punctuation (head)
addgl = false
end
local fid = item.font
- local fbglue = new_glue_scaled(fid,guilgl)
+ local t = FBsp.guill.gl.fr
+ nbspace.char = FBsp.guill.ch.fr
+ if FRdialect then
+ t = FBsp.guill.gl.ac
+ nbspace.char = FBsp.guill.ch.ac
+ end
+ local fbglue = new_glue_scaled(fid, t)
if addgl and fbglue then
if is_glue then
head = remove_node(head,next,true)
end
if (FRucsNBSP) then
- insert_node_after(head, item, copy_node(NBguilspace))
+ nbspace.font = fid
+ insert_node_after(head, item, copy_node(nbspace))
else
insert_node_after(head, item, copy_node(fbglue))
insert_node_after(head, item, copy_node(nobreak))
@@ -1735,11 +1998,12 @@ return french_punctuation
% \fi
%
% \begin{macro}{\FB@luatex@punct@french}
-% 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.
+% As a language tag is part of glyph nodes in LuaTeX, no more
+% switching has to be done in |\extrasfrench|, setting the dialect
+% attribute has already be done (see above, p.~\pageref{extrapunct}).
+% 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.
%
% \changes{v3.1l}{2016/02/07}{Use \cs{babel@save} to save and restore
% \cs{shorthandon} and \cs{shorthandoff}.}
@@ -1747,8 +2011,8 @@ return french_punctuation
% \begin{macrocode}
\ifFB@luatex@punct
\newcommand*{\FB@luatex@punct@french}{%
- \babel@save{\shorthandon}%
- \babel@save{\shorthandoff}%
+ \babel@save\shorthandon
+ \babel@save\shorthandoff
\def\shorthandoff##1{%
\ifx\PackageWarning\@undefined
\fb@warning{\noexpand\shorthandoff{;:!?} is helpless with
@@ -1761,7 +2025,7 @@ return french_punctuation
\fi}%
\def\shorthandon##1{}%
}
- \FB@addto{extras}{\FB@luatex@punct@french}
+ \addto\extrasfrench{\FB@luatex@punct@french}
% \end{macrocode}
% \end{macro}
%
@@ -1773,17 +2037,13 @@ return french_punctuation
% inserted at the end of the `kerning’ callback (no priority)
% instead of `hpack\_filter’ and `pre\_linebreak\_filter’.}
%
-% 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| at the end of the |kerning| callback
-% (no priority).
+% The next definition will be used to activate Lua punctuation: it
+% loads \file{frenchb.lua} and adds function |french_punctuation|
+% at the end of the |kerning| callback (no priority).
% \begin{macrocode}
\def\activate@luatexpunct{%
\directlua{%
- FR = \the\l@french
+ FR_fr = \the\l@french ; FR_ca = \the\l@acadian ;
local path = kpse.find_file("frenchb.lua", "lua")
if path then
local f = dofile(path)
@@ -2036,7 +2296,7 @@ return french_punctuation
{`\{,`\,,`\.,`\-,`\),`\],`\},`\%,"22,"27,"60,"2019}%
{\XeTeXcharclass\FB@char=\z@}%
}
- \FB@addto{extras}{\FB@xetex@punct@french}
+ \addto\extrasfrench{\FB@xetex@punct@french}
% \end{macrocode}
% \end{macro}
%
@@ -2139,7 +2399,7 @@ return french_punctuation
% We specify that the French group of shorthands should be used when
% switching to French.
% \begin{macrocode}
- \FB@addto{extras}{\languageshorthands{french}%
+ \addto\extrasfrench{\languageshorthands{french}%
% \end{macrocode}
% These characters are `turned on’ once, later their definition may
% vary. Don’t misunderstand the following code: they keep being
@@ -2148,7 +2408,7 @@ return french_punctuation
\bbl@activate{:}\bbl@activate{;}%
\bbl@activate{!}\bbl@activate{?}%
}
- \FB@addto{noextras}{%
+ \addto\noextrasfrench{%
\bbl@deactivate{:}\bbl@deactivate{;}%
\bbl@deactivate{!}\bbl@deactivate{?}%
}
@@ -2333,46 +2593,37 @@ return french_punctuation
% \end{macro}
% \end{macro}
%
+% \changes{v3.4a}{2018/01/18}{New \cs{FBgspchar} to customise the
+% space character to be used for \cs{og} and\cs{fg} with the
+% UnicodeNoBreakSpaces option.}
+%
+% \begin{macro}{\FBgspchar}
% \begin{macro}{\FB@og}
% \begin{macro}{\FB@fg}
-% \begin{macro}{\FBguillspace}
% The next step is to provide correct spacing after `«’ and before
% `»’; no line break is allowed neither \emph{after} the opening
% one, nor \emph{before} the closing one.
-% |\FBguillspace| which does the spacing, has been fine tuned by
-% Thierry Bouche to 80\% of an inter-word space 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.
+% 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.
%
% \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.3a}{2016/04/30}{Skip \cs{FBguillskip} for LuaTeX
-% replaced by toks \cs{FBguillsp}.}
-%
-% LuaTeX requires toks; |\FBguillsp| will be computed from
-% |\FBguillspace| `AtBeginDocument’, its dimensions will
-% be scaled by \file{frenchb.lua} for the current font and used
-% after `«’ and before `»’.
-% \begin{macrocode}
-\newcommand*{\FBguillspace}{\hskip.8\fontdimen2\font
- plus.3\fontdimen3\font
- minus.8\fontdimen4\font \relax}
-\newcommand*{\FB@guillspace}{\penalty\@M\FBguillspace}
-\newtoks\FBguillsp
-% \end{macrocode}
% The definitions of |\FB@og| and |\FB@fg| need some engine-dependent
% tuning: for LuaTeX, |\FB@spacing| is set to~0 locally to prevent
% the quotes characters from adding space when option
% \fbo{og=«, fg=»} is set.
% \begin{macrocode}
+\newcommand*{\FB@guillspace}{\penalty\@M\FBguillspace}
+\newcommand*{\FBgspchar}{\char"A0\relax}
+\newif\ifFBucsNBSP
\ifFB@luatex@punct
\DeclareRobustCommand*{\FB@og}{\leavevmode
\bgroup\FB@spacing=0 \guillemotleft\egroup
- \FB@guillspace}
+ \ifFBucsNBSP\FBgspchar\else\FB@guillspace\fi}
\DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
- \FB@guillspace
+ \ifFBucsNBSP\FBgspchar\else\FB@guillspace\fi
\bgroup\FB@spacing=0 \guillemotright\egroup}
\fi
% \end{macrocode}
@@ -2454,7 +2705,7 @@ return french_punctuation
% use \cs{babel@save} instead.}
%
% \begin{macrocode}
-\FB@addto{extras}{\babel@save\og \babel@save\fg \bbl@frenchguillemets}
+\addto\extrasfrench{\babel@save\og \babel@save\fg \bbl@frenchguillemets}
% \end{macrocode}
%
% \changes{v3.1a}{2014/05/20}{New command \cs{frquote} for imbedded or
@@ -2599,11 +2850,16 @@ return french_punctuation
% \subsection{Date in French}
% \label{sssec-date}
%
+% \begin{macro}{\frenchtoday}
+% \begin{macro}{\frenchdate}
% \begin{macro}{\datefrench}
-% The macro |\datefrench| redefines the command |\today| to
-% produce French dates. This new implementation requires \babel~3.9i
-% or newer but, as of 3.9k, doesn’t work with Plain based formats,
-% so |\date\CurrentOption| is defined the old way for these formats.
+% The following code creates a macro |\datefrench| which in turn
+% defines commands |\frenchdate| and |\frenchtoday| to produce French
+% dates (|\today| is defined as |\frenchtoday| in French).
+% The corresponding commands for the French dialect, |\dateacadian|,
+% |\acadiandate| and |\acadiantoday| are also created btw.
+% This new implementation relies on commands |\SetString| and
+% |\SetStringLoop|, therefore requires \babel~3.10 or newer.
%
% \changes{v2.0}{2006/11/06}{2 `\cs{relax}’ added in
% \cs{today}’s definition.}
@@ -2614,47 +2870,47 @@ return french_punctuation
% \changes{v3.0a}{2014/02/18}{Take advantage of babel’s \cs{SetString}
% commands for \cs{datefrench}. Doesn’t work with Plain (yet?).}
%
-% \changes{v3.0c}{2014/03/26}{\cs{SetString} still does not work for
-% Plain with babel 3.9k. Need to define \cs{datefrench}.}
-%
+% \changes{v3.4a}{2017/12/14}{Creates new command \cs{frenchdate}.}
+%
+% \changes{v3.4a}{2018/01/04}{Specific code for Plain finally removed
+% (babel bug reported).}
+%
+% Explicitly defining |\BabelLanguages| as the list of all French
+% dialects defines \emph{both} |\datefrench| and |\dateacadian|;
+% this is required as \file{french.ldf} is read only once even if
+% both language options \Lopt{french} and \Lopt{acadian} are supplied
+% to \babel. Note that coding |\StartBabelCommands*{french,acadian}|
+% would \emph{only} define |\csname date\CurrentOption\endcsname|,
+% leaving the second language undefined in \babel's sens.
+% \begin{macrocode}
+\def\BabelLanguages{french,acadian}
+\StartBabelCommands*{\BabelLanguages}{date}
+ [unicode, fontenc=TU EU1 EU2, charset=utf8]
+ \SetString\monthiiname{février}
+ \SetString\monthviiiname{août}
+ \SetString\monthxiiname{décembre}
+\StartBabelCommands*{\BabelLanguages}{date}
+ \SetStringLoop{month#1name}{%
+ janvier,f\'evrier,mars,avril,mai,juin,juillet,%
+ ao\^ut,septembre,octobre,novembre,d\'ecembre}
+ \SetString\date{\FBdatebox\FB@date}
+ \SetString\today{\FB@date{\year}{\month}{\day}}
+\EndBabelCommands
+% \end{macrocode}
+% |\frenchdate| (which produces an unbreakable string) and
+% |\frenchtoday| (breakable) both rely on |\FB@date|, the inner
+% group is needed for |\hbox|.
% \begin{macrocode}
-\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
+\newcommand*{\FB@date}[3]{%
+ {{\number#3}\ifnum1=#3{\ier}\fi\FBdatespace
+ \csname month\romannumeral#2name\endcsname
+ \ifx#1\@empty\else\FBdatespace\number#1\fi}}
+\newcommand*{\FBdatebox}{\hbox}
+\newcommand*{\FBdatespace}{\space}
% \end{macrocode}
% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \subsection{Extra utilities}
%
@@ -3066,19 +3322,19 @@ return french_punctuation
\fi
\newcommand*{\DecimalMathComma}{%
\ifFBfrench\dec@math@comma\fi
- \ifFB@icomma\else\FB@addto{extras}{\dec@math@comma}\fi
+ \ifFB@icomma\else\addto\extrasfrench{\dec@math@comma}\fi
}
\newcommand*{\StandardMathComma}{%
\std@math@comma
- \ifFB@icomma\else\FB@addto{extras}{\std@math@comma}\fi
+ \ifFB@icomma\else\addto\extrasfrench{\std@math@comma}\fi
}
\ifLaTeXe
\AtBeginDocument{\@ifpackageloaded{icomma}%
{\FB@icommatrue}%
- {\FB@addto{noextras}{\std@math@comma}}%
+ {\addto\noextrasfrench{\std@math@comma}}%
}
\else
- \FB@addto{noextras}{\std@math@comma}
+ \addto\noextrasfrench{\std@math@comma}
\fi
% \end{macrocode}
% \end{macro}
@@ -3102,29 +3358,34 @@ return french_punctuation
% \end{macrocode}
% \end{macro}
%
-% The next definitions only make sense for \LaTeXe.
-% For Plain based formats, let’s activate LuaTeX punctuation if
-% necessary, then cleanup and exit. Temporary fix: |\l@french| is
-% not properly set by \babel~3.9h with Plain LuaTeX format.
+% Let’s activate LuaTeX punctuation if necessary (LaTeX or Plain)
+% so that |\FBsetspaces| commands can be used in the preamble,
+% then cleanup and exit without loading any \file{.cfg} file
+% in case of Plain formats.
%
% \begin{macrocode}
+\ifFB@luatex@punct
+ \activate@luatexpunct
+\fi
\let\FBstop@here\relax
-\def\FBclean@on@exit{\let\ifLaTeXe\undefined
- \let\LaTeXetrue\undefined
- \let\LaTeXefalse\undefined}
+\def\FBclean@on@exit{%
+ \let\ifLaTeXe\undefined
+ \let\LaTeXetrue\undefined
+ \let\LaTeXefalse\undefined
+ \let\FB@llc\loadlocalcfg
+ \let\loadlocalcfg\@gobble}
\ifx\magnification\@undefined
\else
- \def\FBstop@here{\ifFB@luatex@punct
- \activate@luatexpunct
- \fi
- \FBclean@on@exit
- \ldf@quit\CurrentOption\endinput}
+ \def\FBstop@here{%
+ \FBclean@on@exit
+ \ldf@finish\CurrentOption
+ \let\loadlocalcfg\FB@llc
+ \endinput}
\fi
\FBstop@here
% \end{macrocode}
%
-% What follows is for \LaTeXe{} \emph{only}; as all \LaTeXe{}
-% based formats include \eTeX, we can use |\ifdefined| now.
+% What follows is for \LaTeXe{} \emph{only}.
% We redefine |\nombre| for \LaTeXe. A warning is issued
% at the first call of |\nombre| if |\numprint| is not
% defined, suggesting what to do. The package \pkg{numprint}
@@ -3152,11 +3413,14 @@ return french_punctuation
}
% \end{macrocode}
%
-% \changes{v3.3c}{2017/00/10}{New command \cs{FBthousandsep} to
+% \changes{v3.3c}{2017/08/10}{New command \cs{FBthousandsep} to
% customise numprint.}
%
+% \changes{v3.4a}{2017/12/29}{Shrink/stretch removed in
+% \cs{FBthousandsep}.}
+%
% \begin{macrocode}
-\newcommand*{\FBthousandsep}{~}
+\newcommand*{\FBthousandsep}{\kern \fontdimen2\font \relax}
% \end{macrocode}
%
% \changes{v2.0c}{2007/06/25}{There is no need to define here
@@ -3192,18 +3456,19 @@ return french_punctuation
% \changes{v3.3a}{2017/04/30}{Commands \cs{frenchpartfirst},
% \cs{frenchpartsecond} and \cs{frenchpartnameord} added.}
%
-% Let’s give a chance to a class or a package read before frenchb to
-% define |\FBfigtabshape| as |\relax|, otherwise |\FBfigtabshape|
-% will be defined as |\scshape| (can be changed with
+% Let’s give a chance to a class or a package read before \frenchb{}
+% to define |\FBfigtabshape| as |\relax|, otherwise |\FBfigtabshape|
+% will be defined as |\scshape| (can be changed with
% \fbsetup{SmallCapsFigTabCaptions=false}).
% \begin{macrocode}
-\ifx\FBfigtabshape\@undefined \let\FBfigtabshape\scshape \fi
+\providecommand*{\FBfigtabshape}{\scshape}
% \end{macrocode}
%
-% New implementation for caption names (requires \babel’s~3.9 or up).
+% New implementation for caption names( requires \babel’s~3.10 or
+% newer).
% \begin{macrocode}
\StartBabelCommands*{\BabelLanguages}{captions}
- [unicode, fontenc=EU1 EU2 TU, charset=utf8]
+ [unicode, fontenc=TU EU1 EU2, charset=utf8]
\SetString{\refname}{Références}
\SetString{\abstractname}{Résumé}
\SetString{\prefacename}{Préface}
@@ -3248,7 +3513,7 @@ return french_punctuation
\SetString{\partsecond}{Deuxi\`eme}
\SetString{\partnameord}{partie}
\SetStringLoop{ordinal#1}{%
- \frenchpartfirst,\frenchpartsecond,Troisi\`eme,Quatri\`eme,%
+ \partfirst,\partsecond,Troisi\`eme,Quatri\`eme,%
Cinqui\`eme,Sixi\`eme,Septi\`eme,Huiti\`eme,Neuvi\`eme,Dixi\`eme,%
Onzi\`eme,Douzi\`eme,Treizi\`eme,Quatorzi\`eme,Quinzi\`eme,%
Seizi\`eme,Dix-septi\`eme,Dix-huiti\`eme,Dix-neuvi\`eme,%
@@ -3258,7 +3523,7 @@ return french_punctuation
\DeclareRobustCommand*{\FB@partname}{%
\ifFBPartNameFull
\csname ordinal\romannumeral\value{part}\endcsname\space
- \frenchpartnameord\FB@emptypart
+ \partnameord\FB@emptypart
\else
Partie%
\fi}%
@@ -3266,29 +3531,6 @@ return french_punctuation
\SetString{\partname}{\FB@partname}
\EndBabelCommands
% \end{macrocode}
-%
-% \changes{v3.1g}{2015/05/10}{Bug fix for koma-scripts classes:
-% a spurious dot was added by the \cs{partformat} command.}
-%
-% The following patch is for koma-script classes: |\partformat|
-% needs to be redefined in French as this command, defined as
-% |\partname~\thepart\autodot| is incompatible with our redefinition
-% of |\partname|. The code is postponed to the end of package
-% because |\ifFB@koma| will be defined and set later on
-% (see p.~\pageref{ifFB@koma}).
-% \begin{macrocode}
-\AtEndOfPackage{%
- \ifFB@koma
- \ifdefined\partformat
- \FB@addto{captions}{%
- \ifFBPartNameFull
- \babel@save\partformat
- \renewcommand*{\partformat}{\partname}%
- \fi}%
- \fi
- \fi
-}
-% \end{macrocode}
% \end{macro}
%
% \changes{v3.0a}{2014/02/28}{Merging of \cs{captionsfrenchb},
@@ -3489,7 +3731,7 @@ return french_punctuation
\def\FBCaption@Separator{\ifFBfrench\space\fi : }%
\fi
\ifFBCustomiseFigTabCaptions
- \ifx\bbl@main@language\FB@french
+ \ifFB@mainlanguage@FR
\def\FBCaption@Separator{\CaptionSeparator}%
\fi
\fi
@@ -3589,7 +3831,7 @@ return french_punctuation
\ifdefined\mdots@\else\let\Mdots@\mathellipsis\fi
}
\def\bbl@frenchdots{\babel@save\Tdots@ \let\Tdots@\FBtextellipsis}
-\FB@addto{extras}{\bbl@frenchdots}
+\addto\extrasfrench{\bbl@frenchdots}
% \end{macrocode}
% \end{macro}
%
@@ -3758,7 +4000,7 @@ return french_punctuation
% \changes{v3.3a}{2017/04/30}{\cs{frenchbsetup} is now an alias for
% \cs{frenchsetup}.}
%
-% \changes{v3.3a}{2017/04/30}{Options INGuillSpace, ThinColonSPace no
+% \changes{v3.3a}{2017/04/30}{Options INGuillSpace, ThinColonSpace no
% longer delayed AtBeginDocument.}
%
% \begin{macrocode}
@@ -3801,19 +4043,18 @@ return french_punctuation
\newif\ifFBSmallCapsFigTabCaptions \FBSmallCapsFigTabCaptionstrue
\newif\ifFBSuppressWarning
\newif\ifFBINGuillSpace
-\newif\ifFBucsNBSP
-
% \end{macrocode}
%
% The defaults values of these flags have been choosen so that
% \frenchb{} does not change anything regarding the global layout.
% |\bbl@main@language|, set by the last option of \babel, controls
% the global layout of the document. `AtEndOfPackage’ we check the
-% main language in |\bbl@main@language|; if it is French,
-% the values of some flags have to be changed to ensure a French
-% looking layout for the whole document (even in parts written in
-% languages other than French); the end-user will then be able to
-% customise the values of all these flags with \fbsetup{}.
+% main language in |\bbl@main@language|; if it is French (or a
+% French dialect) the values of some flags have to be changed to
+% ensure a French looking layout for the whole document (even in
+% parts written in languages other than French); the end-user will
+% then be able to customise the values of all these flags with
+% \fbsetup{}.
%
% \changes{v2.5b}{2010/10/30}{Do not use the
% test \cs{iflanguage}\{french\} to check whether French is the
@@ -3823,6 +4064,29 @@ return french_punctuation
% In this case \cs{l@french} and \cs{l@english} are 0.
% Pointed out by Günter Milde.}
%
+% \changes{v3.1g}{2015/05/10}{Bug fix for koma-scripts classes:
+% a spurious dot was added by the \cs{partformat} command.}
+%
+% \changes{v3.4a}{2018/01/07}{Patch for koma-script classes moved here,
+% after \cs{ifFBPartNameFull} is defined, so that it applies to
+% \cs{extrasacadian} too: \cs{AtEndOfPackage} is too late.}
+%
+% The following patch is for koma-script classes: the |\partformat|
+% command, defined as |\partname~\thepart\autodot|, is incompatible
+% with our redefinition of |\partname|.
+% \begin{macrocode}
+\ifFB@koma
+ \ifdefined\partformat
+ \def\FB@partformat@fix{%
+ \ifFBPartNameFull
+ \babel@save\partformat
+ \renewcommand*{\partformat}{\partname}%
+ \fi}
+ \addto\extrasfrench{\FB@partformat@fix}%
+ \fi
+\fi
+% \end{macrocode}
+%
% \changes{v3.0c}{2014/03/30}{No list customisation when beamer
% class is loaded.}
%
@@ -3844,9 +4108,14 @@ return french_punctuation
% compatible with the \pkg{beamerarticle} package.
%
% \begin{macrocode}
-\edef\FB@french{\CurrentOption}
+\def\FB@french{french}
+\def\FB@acadian{acadian}
+\newif\ifFB@mainlanguage@FR
\AtEndOfPackage{%
- \ifx\bbl@main@language\FB@french
+ \ifx\bbl@main@language\FB@french \FB@mainlanguage@FRtrue
+ \else \ifx\bbl@main@language\FB@acadian \FB@mainlanguage@FRtrue \fi
+ \fi
+ \ifFB@mainlanguage@FR
\FBGlobalLayoutFrenchtrue
\@ifclassloaded{beamer}%
{\PackageInfo{french.ldf}{%
@@ -3912,7 +4181,7 @@ return french_punctuation
% is set to true while the main language is \emph{not} French.
% \begin{macrocode}
\ifFBGlobalLayoutFrench
- \ifx\bbl@main@language\FB@french
+ \ifFB@mainlanguage@FR
\else
\FBGlobalLayoutFrenchfalse
\PackageWarning{french.ldf}%
@@ -3983,7 +4252,7 @@ return french_punctuation
{\csname FBThinColonSpace#1\endcsname
\ifFBThinColonSpace
\renewcommand*{\FBcolonspace}{\FBthinspace}%
- \fi}%
+ \fi}%
\define@key{FB}{ThinSpaceInFrenchNumbers}[true]%
{\csname FBThinSpaceInFrenchNumbers#1\endcsname}%
\define@key{FB}{FrenchSuperscripts}[true]%
@@ -3996,13 +4265,13 @@ return french_punctuation
{\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{french.ldf}.
-% \begin{macrocode}
\ifFBOldFigTabCaptions
- \FB@addto{extras}{\babel@save\FBCaption@Separator
- \def\FBCaption@Separator{\CaptionSeparator}}%
+ \def\FB@capsep@fix{\babel@save\FBCaption@Separator
+ \def\FBCaption@Separator{\CaptionSeparator}}%
+ \addto\extrasfrench{\FB@capsep@fix}%
+ \ifdefined\extrasacadian
+ \addto\extrasacadian{\FB@capsep@fix}%
+ \fi
\fi}%
\define@key{FB}{SmallCapsFigTabCaptions}[true]%
{\csname FBSmallCapsFigTabCaptions#1\endcsname
@@ -4325,7 +4594,7 @@ return french_punctuation
% now in case French is the main language: \hlabel{FB@ufl}
% \begin{macrocode}
\def\FB@ufl{\update@frenchlists}
- \ifx\bbl@main@language\FB@french
+ \ifFB@mainlanguage@FR
\update@frenchlists
\fi
% \end{macrocode}
@@ -4408,7 +4677,7 @@ return french_punctuation
% is set to false.}
%
% \changes{v3.1f}{2015/05/31}{Bug fix for the beamer class:
-% figure and table captions are now consistent with frenchb’s
+% figure and table captions are now consistent with babel-french’s
% documentation. Pointed out by Denis Bitouzé.}
%
% Unless \fbo{CustomiseFigTabCaptions} has been set to \fbo{false},
@@ -4449,8 +4718,8 @@ return french_punctuation
% \begin{macrocode}
\ifFBShowOptions
\GenericWarning{* }{%
- * **** List of possible options for frenchb ****\MessageBreak
- [Default values between brackets when frenchb is loaded *LAST*]%
+ ***** List of possible options for babel-french ****\MessageBreak
+ [Default values between brackets when french is loaded *LAST*]%
\MessageBreak
ShowOptions=true [false]\MessageBreak
StandardLayout=true [false]\MessageBreak
@@ -4560,24 +4829,11 @@ return french_punctuation
% \begin{macrocode}
\FBprocess@options
% \end{macrocode}
-% The final definitions of commands ruling spacing in French
-% been known, let’s reset the corresponding toks for LuaTeX
-% and load file \file{frenchb.lua} (LuaTeX only).
-% \begin{macrocode}
- \ifFB@luatex@punct
- \FBcolonsp=\expandafter{\meaning\FBcolonspace}%
- \FBthinsp= \expandafter{\meaning\FBthinspace}%
- \FBguillsp=\expandafter{\meaning\FBguillspace}%
- \activate@luatexpunct
- \fi
-% \end{macrocode}
% When option \fbo{UnicodeNoBreakSpaces} is \fbo{true}
-% (LuaLaTeX only) we need to redefine as Unicode characters
-% |\FBguillspace| (for commands |\og| and |\fg|), |\FBmedkern|,
-% |\FBthickkern| and |\FBthousandsep|.
+% (LuaLaTeX only) we need to redefine |\FBmedkern|, |\FBthickkern|
+% and |\FBthousandsep| as Unicode characters.
% \begin{macrocode}
\ifFBucsNBSP
- \renewcommand*{\FBguillspace}{\char"A0\relax}%
\renewcommand*{\FBmedkern}{\char"202F\relax}%
\renewcommand*{\FBthickkern}{\char"A0\relax}%
\ifFBThinSpaceInFrenchNumbers
@@ -4975,7 +5231,7 @@ return french_punctuation
\FB@ufl
\fi
}
-\FB@addto{extras}{\bbl@frenchlistlayout}
+\addto\extrasfrench{\bbl@frenchlistlayout}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -5013,8 +5269,8 @@ return french_punctuation
\@afterindenttrue
\fi
\fi}
-\FB@addto{extras}{\bbl@frenchindent}
-\FB@addto{noextras}{\bbl@nonfrenchindent}
+\addto\extrasfrench{\bbl@frenchindent}
+\addto\noextrasfrench{\bbl@nonfrenchindent}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -5055,7 +5311,7 @@ return french_punctuation
\AtBeginDocument{\@ifpackageloaded{bigfoot}%
{\PackageInfo{french.ldf}%
{bigfoot package in use.\MessageBreak
- frenchb will NOT customise footnotes;%
+ babel-french will NOT customise footnotes;%
\MessageBreak reported}}%
{\let\@footnotemarkORI\@footnotemark
\def\@footnotemarkFB{\leavevmode\unskip\unkern
@@ -5301,8 +5557,8 @@ return french_punctuation
% instead of frenchb.cfg. NO NEED for .cfg files in French anyway.}
%
% \changes{v3.1h}{2015/08/19}{french.cfg from e-french conflicts with
-% frenchb. Do NOT load it (no need for .cfg files with frenchb
-% anyway).}
+% babel-french. Do NOT load it (no need for .cfg files with
+% babel-french anyway).}
%
% Final cleaning.
% The macro |\ldf@finish| takes care for setting the main language
@@ -5312,8 +5568,6 @@ return french_punctuation
% French.
% \begin{macrocode}
\FBclean@on@exit
-\let\FB@llc\loadlocalcfg
-\let\loadlocalcfg\@gobble
\ldf@finish\CurrentOption
\let\loadlocalcfg\FB@llc
% \end{macrocode}
@@ -5339,6 +5593,12 @@ return french_punctuation
% \Lopt{francais} being deprecated and force recommended options
% \Lopt{acadian} or \Lopt{french}.
% \begin{macrocode}
+%<*acadian>
+\PackageInfo{acadian.ldf}%
+ {`acadian' dialect is currently\MessageBreak
+ *absolutely identical* to the\MessageBreak
+ `french' language; reported}
+%</acadian>
%<*canadien>
\PackageWarning{canadien.ldf}%
{Option `canadien' for Babel is *deprecated*,\MessageBreak
@@ -5398,6 +5658,8 @@ return french_punctuation
\fi
%</frenchb>
%<acadian|canadien|frenchb|francais>\input french.ldf\relax
+%<acadian|canadien>\let\extrasacadian\extrasfrench
+%<acadian|canadien>\let\noextrasacadian\noextrasfrench
% \end{macrocode}
%
% \Finale
diff --git a/Master/texmf-dist/source/generic/babel-french/frenchb.ins b/Master/texmf-dist/source/generic/babel-french/frenchb.ins
index 672caafa06c..e33558d2485 100644
--- a/Master/texmf-dist/source/generic/babel-french/frenchb.ins
+++ b/Master/texmf-dist/source/generic/babel-french/frenchb.ins
@@ -2,7 +2,7 @@
%% This file will generate fast loadable files and documentation driver
%% files from the doc files in this package when run through LuaTeX.
%%
-%% Copyright 2001-2017 Daniel Flipo. All rights reserved.
+%% Copyright 2001-2018 Daniel Flipo. All rights reserved.
%%
%% This is a generated file part of the the babel-french bundle
%% to be used with the Babel system.
diff --git a/Master/texmf-dist/tex/generic/babel-french/acadian.ldf b/Master/texmf-dist/tex/generic/babel-french/acadian.ldf
index f63fb203c91..37370ec4d77 100644
--- a/Master/texmf-dist/tex/generic/babel-french/acadian.ldf
+++ b/Master/texmf-dist/tex/generic/babel-french/acadian.ldf
@@ -24,8 +24,14 @@
%% Please report errors to: <daniel (dot) flipo (at) free (dot) fr>
%%
\ProvidesLanguage{acadian}
- [2017/10/19 v3.3d French support from the babel system]
+ [2018/01/30 v3.4a French support from the babel system]
+\PackageInfo{acadian.ldf}%
+ {`acadian' dialect is currently\MessageBreak
+ *absolutely identical* to the\MessageBreak
+ `french' language; reported}
\input french.ldf\relax
+\let\extrasacadian\extrasfrench
+\let\noextrasacadian\noextrasfrench
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
diff --git a/Master/texmf-dist/tex/generic/babel-french/canadien.ldf b/Master/texmf-dist/tex/generic/babel-french/canadien.ldf
index 2964357b86b..7d6094dc33d 100644
--- a/Master/texmf-dist/tex/generic/babel-french/canadien.ldf
+++ b/Master/texmf-dist/tex/generic/babel-french/canadien.ldf
@@ -24,7 +24,7 @@
%% Please report errors to: <daniel (dot) flipo (at) free (dot) fr>
%%
\ProvidesLanguage{canadien}
- [2017/10/19 v3.3d French support from the babel system]
+ [2018/01/30 v3.4a French support from the babel system]
\PackageWarning{canadien.ldf}%
{Option `canadien' for Babel is *deprecated*,\MessageBreak
it might be removed sooner or later. Please\MessageBreak
@@ -32,6 +32,8 @@
\let\l@canadien\l@acadian
\def\CurrentOption{acadian}
\input french.ldf\relax
+\let\extrasacadian\extrasfrench
+\let\noextrasacadian\noextrasfrench
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
diff --git a/Master/texmf-dist/tex/generic/babel-french/francais.ldf b/Master/texmf-dist/tex/generic/babel-french/francais.ldf
index 51cd44b61dd..0cd6945199c 100644
--- a/Master/texmf-dist/tex/generic/babel-french/francais.ldf
+++ b/Master/texmf-dist/tex/generic/babel-french/francais.ldf
@@ -24,7 +24,7 @@
%% Please report errors to: <daniel (dot) flipo (at) free (dot) fr>
%%
\ProvidesLanguage{francais}
- [2017/10/19 v3.3d French support from the babel system]
+ [2018/01/30 v3.4a French support from the babel system]
\PackageWarning{francais.ldf}%
{Option `francais' for Babel is *deprecated*,\MessageBreak
it might be removed sooner or later. Please\MessageBreak
diff --git a/Master/texmf-dist/tex/generic/babel-french/french.ldf b/Master/texmf-dist/tex/generic/babel-french/french.ldf
index c15b624580b..94b40ae1a01 100644
--- a/Master/texmf-dist/tex/generic/babel-french/french.ldf
+++ b/Master/texmf-dist/tex/generic/babel-french/french.ldf
@@ -24,39 +24,13 @@
%% Please report errors to: <daniel (dot) flipo (at) free (dot) fr>
%%
\ProvidesLanguage{french}
- [2017/10/19 v3.3d French support from the babel system]
+ [2018/01/30 v3.4a French support from the babel system]
%%
%% Babel package for LaTeX version 2e
-%% Copyright © 1996 - 2017
+%% Copyright © 1996-2018
%% by Daniel Flipo <daniel (dot) flipo (at) free (dot) fr>
%%
-\LdfInit\CurrentOption\captionsfrench
-\def\FB@nopatterns{%
- \ifx\l@nohyphenation\@undefined
- \edef\bbl@nulllanguage{\string\language=0}%
- \adddialect\l@french0
- \else
- \adddialect\l@french\l@nohyphenation
- \edef\bbl@nulllanguage{\string\language=nohyphenation}%
- \fi
- \@nopatterns{French}}
-\ifx\l@french\@undefined
- \FB@nopatterns
-\fi
-\newif\ifLaTeXe
-\let\bbl@tempa\relax
-\ifx\magnification\@undefined
- \ifx\@compatibilitytrue\@undefined
- \PackageError{french.ldf}
- {LaTeX-2.09 format is no longer supported.\MessageBreak
- Aborting here}
- {Please upgrade to LaTeX2e!}
- \let\bbl@tempa\endinput
- \else
- \LaTeXetrue
- \fi
-\fi
-\bbl@tempa
+\LdfInit\CurrentOption{FBclean@on@exit}
\def\fb@error#1#2{%
\begingroup
\newlinechar=`\^^J
@@ -76,42 +50,70 @@
\wlog{#1}%
\endgroup}
\let\bbl@tempa\relax
-\ifx\babeltags\@undefined
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname eTeXversion\endcsname\relax
+ \let\bbl@tempa\endinput
+ \fb@error{babel-french requires eTeX.\\
+ Aborting here}
+ {Orignal PlainTeX is not supported,\\
+ please use LuaTeX or XeTeX engines.}
+\fi
+\bbl@tempa
+\let\bbl@tempa\relax
+\ifdefined\babeltags
+\else
\let\bbl@tempa\endinput
- \ifLaTeXe
+ \ifdefined\PackageError
\PackageError{french.ldf}
- {frenchb requires babel v.3.9i.\MessageBreak
+ {babel-french requires babel v.3.16.\MessageBreak
Aborting here}
{Please upgrade Babel!}
\else
- \fb@error{frenchb requires babel v.3.9i.\\
+ \fb@error{babel-french requires babel v.3.16.\\
Aborting here}
{Please upgrade Babel!}
\fi
\fi
\bbl@tempa
-\def\bbl@tempa{acadian}
-\ifx\CurrentOption\bbl@tempa
- \ifx\l@acadian\@undefined
- \adddialect\l@acadian\l@french
- \fi
+\def\FB@nopatterns{%
+ \ifdefined\l@nohyphenation
+ \adddialect\l@french\l@nohyphenation
+ \edef\bbl@nulllanguage{\string\language=nohyphenation}%
+ \else
+ \edef\bbl@nulllanguage{\string\language=0}%
+ \adddialect\l@french0
+ \fi
+ \@nopatterns{French}}
+\ifdefined\l@french \else \FB@nopatterns \fi
+\ifdefined\l@acadian \else \adddialect\l@acadian\l@french \fi
+\providehyphenmins{french}{\tw@\thr@@}
+\providehyphenmins{acadian}{\tw@\thr@@}
+\newif\ifLaTeXe
+\let\bbl@tempa\relax
+\ifdefined\magnification
+\else
+ \ifdefined\@compatibilitytrue
+ \LaTeXetrue
+ \else
+ \PackageError{french.ldf}
+ {LaTeX-2.09 format is no longer supported.\MessageBreak
+ Aborting here}
+ {Please upgrade to LaTeX2e!}
+ \let\bbl@tempa\endinput
+ \fi
\fi
-\expandafter\providehyphenmins\expandafter{\CurrentOption}{\tw@\thr@@}
+\bbl@tempa
\newif\ifFBunicode
\newif\ifFBLuaTeX
\newif\ifFBXeTeX
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname luatexversion\endcsname\relax
-\else
+\ifdefined\luatexversion
\FBunicodetrue \FBLuaTeXtrue
\fi
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname XeTeXrevision\endcsname\relax
-\else
+\ifdefined\XeTeXrevision
\FBunicodetrue \FBXeTeXtrue
\fi
\newif\ifFBfrench
-\@namedef{extras\CurrentOption}{%
+\def\extrasfrench{%
\FBfrenchtrue
\babel@savevariable{\lccode`\'}%
\ifFBunicode
@@ -121,25 +123,23 @@
\lccode`\'=`\'
\fi
}
-\@namedef{noextras\CurrentOption}{\FBfrenchfalse}
-\let\FB@CurOpt\CurrentOption
-\newcommand*{\FB@addto}[2]{%
- \expandafter\addto\csname #1\FB@CurOpt\endcsname{#2}}
-\FB@addto{extras}{\bbl@frenchspacing}
-\FB@addto{noextras}{\bbl@nonfrenchspacing}
+\def\noextrasfrench{\FBfrenchfalse}
+\addto\extrasfrench{\bbl@frenchspacing}
+\addto\noextrasfrench{\bbl@nonfrenchspacing}
\newif\ifFB@active@punct \FB@active@puncttrue
\newif\ifFB@luatex@punct
\ifFBLuaTeX
\ifnum\luatexversion<95
\ifx\PackageWarning\@undefined
\fb@warning{Please upgrade LuaTeX to version 0.95 or above!\\%
- frenchb will make high punctuation characters (;:!?) active\\%
- with LuaTeX < 0.95.}%
+ babel-french will make high punctuation characters (;:!?)\\%
+ active with LuaTeX < 0.95.}%
\else
\PackageWarning{french.ldf}{Please upgrade LuaTeX
to version 0.95 or above!\MessageBreak
- frenchb will make high punctuation characters\MessageBreak
- (;:!?) active with LuaTeX < 0.95;\MessageBreak reported}%
+ babel-french will make high punctuation characters%
+ \MessageBreak (;:!?) active with LuaTeX < 0.95;%
+ \MessageBreak reported}%
\fi
\else
\FB@luatex@puncttrue\FB@active@punctfalse
@@ -147,9 +147,7 @@
\fi
\newcount\FB@nonchar
\newif\ifFB@xetex@punct
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname XeTeXinterchartokenstate\endcsname\relax
-\else
+\ifdefined\XeTeXinterchartokenstate
\FB@xetex@puncttrue\FB@active@punctfalse
\ifdim\the\XeTeXversion\XeTeXrevision pt<0.99994pt
\FB@nonchar=255 \relax
@@ -157,10 +155,69 @@
\FB@nonchar=4095 \relax
\fi
\fi
+\newcommand*{\FBguillspace}{\hskip .8\fontdimen2\font
+ plus .3\fontdimen3\font
+ minus .8\fontdimen4\font \relax}
\newcommand*{\FBcolonspace}{\space}
-\newcommand*{\FBthinspace}{\hskip.5\fontdimen2\font \relax}
-\newtoks\FBcolonsp
-\newtoks\FBthinsp
+\newcommand*{\FBthinspace}{\hskip .5\fontdimen2\font \relax}
+\ifLaTeXe
+ \newcommand*{\FBsetspaces}[5][french]{%
+ \def\bbl@tempa{french}\def\bbl@tempb{#1}%
+ \ifx\bbl@tempa\bbl@tempb \def\bbl@tempb{}\fi
+ \@namedef{\bbl@tempb FB#2space}{\hskip #3\fontdimen2\font
+ plus #4\fontdimen3\font
+ minus #5\fontdimen4\font \relax}%
+ \ifFB@luatex@punct
+ \ifx\bbl@tempb\FB@acadian
+ \directlua{
+ FBsp.#2.gl.ac[1] = #3
+ FBsp.#2.gl.ac[2] = #4
+ FBsp.#2.gl.ac[3] = #5
+ if #3 > 0.6 then
+ FBsp.#2.ch.ac = 0xA0
+ elseif #3 > 0.2 then
+ FBsp.#2.ch.ac = 0x202F
+ else
+ FBsp.#2.ch.ac = 0x200B
+ end
+ }%
+ \fi
+ \fi
+ }
+ \@onlypreamble\FBsetspaces
+\fi
+\ifLaTeXe
+ \addto\extrasfrench{%
+ \ifFB@luatex@punct
+ \edef\bbl@tempa{\detokenize\expandafter{\languagename}}%
+ \edef\bbl@tempb{\detokenize{french}}%
+ \ifx\bbl@tempa\bbl@tempb \FB@dialect=0 \relax
+ \else \FB@dialect=1 \relax
+ \fi
+ \ifdefined\FB@once\else
+ \set@glue@table{FBcolonspace}{colon}%
+ \set@glue@table{FBthinspace}{thin}%
+ \set@glue@table{FBguillspace}{guill}%
+ \def\FB@once{}%
+ \fi
+ \fi
+ \ifcsname\languagename FBthinspace\endcsname
+ \babel@save\FBthinspace
+ \renewcommand*{\FBthinspace}{%
+ \csname\languagename FBthinspace\endcsname}%
+ \fi
+ \ifcsname\languagename FBcolonspace\endcsname
+ \babel@save\FBcolonspace
+ \renewcommand*{\FBcolonspace}{%
+ \csname\languagename FBcolonspace\endcsname}%
+ \fi
+ \ifcsname\languagename FBguillspace\endcsname
+ \babel@save\FBguillspace
+ \renewcommand*{\FBguillspace}{%
+ \csname\languagename FBguillspace\endcsname}%
+ \fi
+ }
+\fi
\newif\ifFB@spacing \FB@spacingtrue
\newcommand*{\FB@spacing@on}{%
\ifFB@luatex@punct
@@ -175,14 +232,14 @@
\FB@spacingfalse
\fi}
\ifFB@luatex@punct
- \begingroup\expandafter\expandafter\expandafter\endgroup
- \expandafter\ifx\csname newluafunction\endcsname\relax
+ \ifdefined\newluafunction\else
\input ltluatex.tex
\fi
\newattribute\FB@spacing \FB@spacing=1 \relax
\newattribute\FB@addDPspace \FB@addDPspace=1 \relax
\newattribute\FB@addGUILspace \FB@addGUILspace=0 \relax
\newattribute\FB@ucsNBSP \FB@ucsNBSP=0 \relax
+ \newattribute\FB@dialect \FB@dialect=0 \relax
\ifLaTeXe
\PackageInfo{french.ldf}{No need for active punctuation
characters\MessageBreak with this version
@@ -191,11 +248,43 @@
\fb@info{No need for active punctuation characters\\
with this version of LuaTeX!}
\fi
+ \newcommand*{\set@glue@table}[2]{%
+ \directlua {
+ local s = token.get_meaning("#1")
+ local t = FBget_glue(s)
+ if t then
+ FBsp.#2.gl.fr = t
+ if not FBsp.#2.gl.ac[1] then
+ FBsp.#2.gl.ac = t
+ end
+ if FBsp.#2.gl.fr[1] > 0.6 then
+ FBsp.#2.ch.fr = 0xA0
+ elseif FBsp.#2.gl.fr[1] > 0.2 then
+ FBsp.#2.ch.fr = 0x202F
+ else
+ FBsp.#2.ch.fr = 0x200B
+ end
+ if not FBsp.#2.ch.ac then
+ FBsp.#2.ch.ac = FBsp.#2.ch.fr
+ end
+ else
+ texio.write_nl('term and log', '')
+ texio.write_nl('term and log',
+ '*** french.ldf warning: Unexpected syntax in FB#2space,')
+ texio.write_nl('term and log',
+ '*** french.ldf warning: LuaTeX table FBsp unchanged.')
+ texio.write_nl('term and log',
+ '*** french.ldf warning: Consider using FBsetspaces to ')
+ texio.write('term and log', 'customise FB#2space.')
+ texio.write_nl('term and log', '')
+ end
+ }%
+ }
\fi
\ifFB@luatex@punct
\newcommand*{\FB@luatex@punct@french}{%
- \babel@save{\shorthandon}%
- \babel@save{\shorthandoff}%
+ \babel@save\shorthandon
+ \babel@save\shorthandoff
\def\shorthandoff##1{%
\ifx\PackageWarning\@undefined
\fb@warning{\noexpand\shorthandoff{;:!?} is helpless with
@@ -208,10 +297,10 @@
\fi}%
\def\shorthandon##1{}%
}
- \FB@addto{extras}{\FB@luatex@punct@french}
+ \addto\extrasfrench{\FB@luatex@punct@french}
\def\activate@luatexpunct{%
\directlua{%
- FR = \the\l@french
+ FR_fr = \the\l@french ; FR_ca = \the\l@acadian ;
local path = kpse.find_file("frenchb.lua", "lua")
if path then
local f = dofile(path)
@@ -316,7 +405,7 @@
{`\{,`\,,`\.,`\-,`\),`\],`\},`\%,"22,"27,"60,"2019}%
{\XeTeXcharclass\FB@char=\z@}%
}
- \FB@addto{extras}{\FB@xetex@punct@french}
+ \addto\extrasfrench{\FB@xetex@punct@french}
\fi
\ifFB@active@punct
\initiate@active@char{:}%
@@ -371,11 +460,11 @@
\declare@shorthand{system}{!}{\string!}
\declare@shorthand{system}{?}{\string?}
\declare@shorthand{system}{;}{\string;}
- \FB@addto{extras}{\languageshorthands{french}%
+ \addto\extrasfrench{\languageshorthands{french}%
\bbl@activate{:}\bbl@activate{;}%
\bbl@activate{!}\bbl@activate{?}%
}
- \FB@addto{noextras}{%
+ \addto\noextrasfrench{%
\bbl@deactivate{:}\bbl@deactivate{;}%
\bbl@deactivate{!}\bbl@deactivate{?}%
}
@@ -426,17 +515,15 @@
\fi
\let\xspace\relax
\fi
-\newcommand*{\FBguillspace}{\hskip.8\fontdimen2\font
- plus.3\fontdimen3\font
- minus.8\fontdimen4\font \relax}
\newcommand*{\FB@guillspace}{\penalty\@M\FBguillspace}
-\newtoks\FBguillsp
+\newcommand*{\FBgspchar}{\char"A0\relax}
+\newif\ifFBucsNBSP
\ifFB@luatex@punct
\DeclareRobustCommand*{\FB@og}{\leavevmode
\bgroup\FB@spacing=0 \guillemotleft\egroup
- \FB@guillspace}
+ \ifFBucsNBSP\FBgspchar\else\FB@guillspace\fi}
\DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
- \FB@guillspace
+ \ifFBucsNBSP\FBgspchar\else\FB@guillspace\fi
\bgroup\FB@spacing=0 \guillemotright\egroup}
\fi
\ifFB@xetex@punct
@@ -469,7 +556,7 @@
\def\og{\textquotedblleft}
\def\fg{\ifdim\lastskip>\z@\unskip\fi\textquotedblright}
\fi
-\FB@addto{extras}{\babel@save\og \babel@save\fg \bbl@frenchguillemets}
+\addto\extrasfrench{\babel@save\og \babel@save\fg \bbl@frenchguillemets}
\newcommand*{\ogi}{\FB@og}
\newcommand*{\fgi}{\FB@fg}
\newcommand*{\ogii}{\textquotedblleft}
@@ -543,41 +630,25 @@
\ifx\FBeverylineguill\FBguillnone\else\localleftbox{}\fi
\ifx\FBeveryparguill\FBguillnone\else\everypar=\FB@everypar\fi
}
-\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
+\def\BabelLanguages{french,acadian}
+\StartBabelCommands*{\BabelLanguages}{date}
+ [unicode, fontenc=TU EU1 EU2, charset=utf8]
+ \SetString\monthiiname{février}
+ \SetString\monthviiiname{août}
+ \SetString\monthxiiname{décembre}
+\StartBabelCommands*{\BabelLanguages}{date}
+ \SetStringLoop{month#1name}{%
+ janvier,f\'evrier,mars,avril,mai,juin,juillet,%
+ ao\^ut,septembre,octobre,novembre,d\'ecembre}
+ \SetString\date{\FBdatebox\FB@date}
+ \SetString\today{\FB@date{\year}{\month}{\day}}
+\EndBabelCommands
+\newcommand*{\FB@date}[3]{%
+ {{\number#3}\ifnum1=#3{\ier}\fi\FBdatespace
+ \csname month\romannumeral#2name\endcsname
+ \ifx#1\@empty\else\FBdatespace\number#1\fi}}
+\newcommand*{\FBdatebox}{\hbox}
+\newcommand*{\FBdatespace}{\space}
\newif\ifFB@poorman
\newdimen\FB@Mht
\ifLaTeXe
@@ -730,33 +801,39 @@
\fi
\newcommand*{\DecimalMathComma}{%
\ifFBfrench\dec@math@comma\fi
- \ifFB@icomma\else\FB@addto{extras}{\dec@math@comma}\fi
+ \ifFB@icomma\else\addto\extrasfrench{\dec@math@comma}\fi
}
\newcommand*{\StandardMathComma}{%
\std@math@comma
- \ifFB@icomma\else\FB@addto{extras}{\std@math@comma}\fi
+ \ifFB@icomma\else\addto\extrasfrench{\std@math@comma}\fi
}
\ifLaTeXe
\AtBeginDocument{\@ifpackageloaded{icomma}%
{\FB@icommatrue}%
- {\FB@addto{noextras}{\std@math@comma}}%
+ {\addto\noextrasfrench{\std@math@comma}}%
}
\else
- \FB@addto{noextras}{\std@math@comma}
+ \addto\noextrasfrench{\std@math@comma}
\fi
\newcommand*{\nombre}[1]{{#1}\fb@warning{*** \noexpand\nombre
no longer formats numbers\string! ***}}
+\ifFB@luatex@punct
+ \activate@luatexpunct
+\fi
\let\FBstop@here\relax
-\def\FBclean@on@exit{\let\ifLaTeXe\undefined
- \let\LaTeXetrue\undefined
- \let\LaTeXefalse\undefined}
+\def\FBclean@on@exit{%
+ \let\ifLaTeXe\undefined
+ \let\LaTeXetrue\undefined
+ \let\LaTeXefalse\undefined
+ \let\FB@llc\loadlocalcfg
+ \let\loadlocalcfg\@gobble}
\ifx\magnification\@undefined
\else
- \def\FBstop@here{\ifFB@luatex@punct
- \activate@luatexpunct
- \fi
- \FBclean@on@exit
- \ldf@quit\CurrentOption\endinput}
+ \def\FBstop@here{%
+ \FBclean@on@exit
+ \ldf@finish\CurrentOption
+ \let\loadlocalcfg\FB@llc
+ \endinput}
\fi
\FBstop@here
\renewcommand*{\nombre}[1]{\Warning@nombre{#1}}
@@ -774,10 +851,10 @@
{#1}%
\fi
}
-\newcommand*{\FBthousandsep}{~}
-\ifx\FBfigtabshape\@undefined \let\FBfigtabshape\scshape \fi
+\newcommand*{\FBthousandsep}{\kern \fontdimen2\font \relax}
+\providecommand*{\FBfigtabshape}{\scshape}
\StartBabelCommands*{\BabelLanguages}{captions}
- [unicode, fontenc=EU1 EU2 TU, charset=utf8]
+ [unicode, fontenc=TU EU1 EU2, charset=utf8]
\SetString{\refname}{Références}
\SetString{\abstractname}{Résumé}
\SetString{\prefacename}{Préface}
@@ -816,7 +893,7 @@
\SetString{\partsecond}{Deuxi\`eme}
\SetString{\partnameord}{partie}
\SetStringLoop{ordinal#1}{%
- \frenchpartfirst,\frenchpartsecond,Troisi\`eme,Quatri\`eme,%
+ \partfirst,\partsecond,Troisi\`eme,Quatri\`eme,%
Cinqui\`eme,Sixi\`eme,Septi\`eme,Huiti\`eme,Neuvi\`eme,Dixi\`eme,%
Onzi\`eme,Douzi\`eme,Treizi\`eme,Quatorzi\`eme,Quinzi\`eme,%
Seizi\`eme,Dix-septi\`eme,Dix-huiti\`eme,Dix-neuvi\`eme,%
@@ -826,24 +903,13 @@
\DeclareRobustCommand*{\FB@partname}{%
\ifFBPartNameFull
\csname ordinal\romannumeral\value{part}\endcsname\space
- \frenchpartnameord\FB@emptypart
+ \partnameord\FB@emptypart
\else
Partie%
\fi}%
}
\SetString{\partname}{\FB@partname}
\EndBabelCommands
-\AtEndOfPackage{%
- \ifFB@koma
- \ifdefined\partformat
- \FB@addto{captions}{%
- \ifFBPartNameFull
- \babel@save\partformat
- \renewcommand*{\partformat}{\partname}%
- \fi}%
- \fi
- \fi
-}
\newcommand{\FBWarning}[1]{\PackageWarning{french.ldf}{#1}}
\bgroup
\catcode`:=12 \catcode`>=12 \relax
@@ -899,7 +965,7 @@
\def\FBCaption@Separator{\ifFBfrench\space\fi : }%
\fi
\ifFBCustomiseFigTabCaptions
- \ifx\bbl@main@language\FB@french
+ \ifFB@mainlanguage@FR
\def\FBCaption@Separator{\CaptionSeparator}%
\fi
\fi
@@ -950,7 +1016,7 @@
\ifdefined\mdots@\else\let\Mdots@\mathellipsis\fi
}
\def\bbl@frenchdots{\babel@save\Tdots@ \let\Tdots@\FBtextellipsis}
-\FB@addto{extras}{\bbl@frenchdots}
+\addto\extrasfrench{\bbl@frenchdots}
\ifFB@active@punct
\@ifpackageloaded{listings}
{\AtBeginDocument{%
@@ -1013,11 +1079,24 @@
\newif\ifFBSmallCapsFigTabCaptions \FBSmallCapsFigTabCaptionstrue
\newif\ifFBSuppressWarning
\newif\ifFBINGuillSpace
-\newif\ifFBucsNBSP
-
-\edef\FB@french{\CurrentOption}
+\ifFB@koma
+ \ifdefined\partformat
+ \def\FB@partformat@fix{%
+ \ifFBPartNameFull
+ \babel@save\partformat
+ \renewcommand*{\partformat}{\partname}%
+ \fi}
+ \addto\extrasfrench{\FB@partformat@fix}%
+ \fi
+\fi
+\def\FB@french{french}
+\def\FB@acadian{acadian}
+\newif\ifFB@mainlanguage@FR
\AtEndOfPackage{%
- \ifx\bbl@main@language\FB@french
+ \ifx\bbl@main@language\FB@french \FB@mainlanguage@FRtrue
+ \else \ifx\bbl@main@language\FB@acadian \FB@mainlanguage@FRtrue \fi
+ \fi
+ \ifFB@mainlanguage@FR
\FBGlobalLayoutFrenchtrue
\@ifclassloaded{beamer}%
{\PackageInfo{french.ldf}{%
@@ -1067,7 +1146,7 @@
\define@key{FB}{GlobalLayoutFrench}[true]%
{\csname FBGlobalLayoutFrench#1\endcsname
\ifFBGlobalLayoutFrench
- \ifx\bbl@main@language\FB@french
+ \ifFB@mainlanguage@FR
\else
\FBGlobalLayoutFrenchfalse
\PackageWarning{french.ldf}%
@@ -1138,7 +1217,7 @@
{\csname FBThinColonSpace#1\endcsname
\ifFBThinColonSpace
\renewcommand*{\FBcolonspace}{\FBthinspace}%
- \fi}%
+ \fi}%
\define@key{FB}{ThinSpaceInFrenchNumbers}[true]%
{\csname FBThinSpaceInFrenchNumbers#1\endcsname}%
\define@key{FB}{FrenchSuperscripts}[true]%
@@ -1152,8 +1231,12 @@
\define@key{FB}{OldFigTabCaptions}[true]%
{\csname FBOldFigTabCaptions#1\endcsname
\ifFBOldFigTabCaptions
- \FB@addto{extras}{\babel@save\FBCaption@Separator
- \def\FBCaption@Separator{\CaptionSeparator}}%
+ \def\FB@capsep@fix{\babel@save\FBCaption@Separator
+ \def\FBCaption@Separator{\CaptionSeparator}}%
+ \addto\extrasfrench{\FB@capsep@fix}%
+ \ifdefined\extrasacadian
+ \addto\extrasacadian{\FB@capsep@fix}%
+ \fi
\fi}%
\define@key{FB}{SmallCapsFigTabCaptions}[true]%
{\csname FBSmallCapsFigTabCaptions#1\endcsname
@@ -1354,7 +1437,7 @@
reported}%
\fi}{}%
\def\FB@ufl{\update@frenchlists}
- \ifx\bbl@main@language\FB@french
+ \ifFB@mainlanguage@FR
\update@frenchlists
\fi
\ifFBAutoSpacePunctuation
@@ -1415,8 +1498,8 @@
\fi
\ifFBShowOptions
\GenericWarning{* }{%
- * **** List of possible options for frenchb ****\MessageBreak
- [Default values between brackets when frenchb is loaded *LAST*]%
+ ***** List of possible options for babel-french ****\MessageBreak
+ [Default values between brackets when french is loaded *LAST*]%
\MessageBreak
ShowOptions=true [false]\MessageBreak
StandardLayout=true [false]\MessageBreak
@@ -1493,14 +1576,7 @@
}%
\fi
\FBprocess@options
- \ifFB@luatex@punct
- \FBcolonsp=\expandafter{\meaning\FBcolonspace}%
- \FBthinsp= \expandafter{\meaning\FBthinspace}%
- \FBguillsp=\expandafter{\meaning\FBguillspace}%
- \activate@luatexpunct
- \fi
\ifFBucsNBSP
- \renewcommand*{\FBguillspace}{\char"A0\relax}%
\renewcommand*{\FBmedkern}{\char"202F\relax}%
\renewcommand*{\FBthickkern}{\char"A0\relax}%
\ifFBThinSpaceInFrenchNumbers
@@ -1665,7 +1741,7 @@
\FB@ufl
\fi
}
-\FB@addto{extras}{\bbl@frenchlistlayout}
+\addto\extrasfrench{\bbl@frenchlistlayout}
\def\bbl@frenchindent{%
\ifFBGlobalLayoutFrench
\else
@@ -1681,12 +1757,12 @@
\@afterindenttrue
\fi
\fi}
-\FB@addto{extras}{\bbl@frenchindent}
-\FB@addto{noextras}{\bbl@nonfrenchindent}
+\addto\extrasfrench{\bbl@frenchindent}
+\addto\noextrasfrench{\bbl@nonfrenchindent}
\AtBeginDocument{\@ifpackageloaded{bigfoot}%
{\PackageInfo{french.ldf}%
{bigfoot package in use.\MessageBreak
- frenchb will NOT customise footnotes;%
+ babel-french will NOT customise footnotes;%
\MessageBreak reported}}%
{\let\@footnotemarkORI\@footnotemark
\def\@footnotemarkFB{\leavevmode\unskip\unkern
@@ -1796,8 +1872,6 @@
\newcommand*{\FrenchFootnotes}{\FBFrenchFootnotestrue}
\newcommand*{\StandardFootnotes}{\FBFrenchFootnotesfalse}
\FBclean@on@exit
-\let\FB@llc\loadlocalcfg
-\let\loadlocalcfg\@gobble
\ldf@finish\CurrentOption
\let\loadlocalcfg\FB@llc
%%
diff --git a/Master/texmf-dist/tex/generic/babel-french/frenchb.ldf b/Master/texmf-dist/tex/generic/babel-french/frenchb.ldf
index c81e0f58666..e36542d717b 100644
--- a/Master/texmf-dist/tex/generic/babel-french/frenchb.ldf
+++ b/Master/texmf-dist/tex/generic/babel-french/frenchb.ldf
@@ -24,7 +24,7 @@
%% Please report errors to: <daniel (dot) flipo (at) free (dot) fr>
%%
\ProvidesLanguage{frenchb}
- [2017/10/19 v3.3d French support from the babel system]
+ [2018/01/30 v3.4a French support from the babel system]
\def\bbl@tempa{frenchb}
\ifx\CurrentOption\bbl@tempa
\let\l@frenchb\l@french
diff --git a/Master/texmf-dist/tex/generic/babel-french/frenchb.lua b/Master/texmf-dist/tex/generic/babel-french/frenchb.lua
index 1e706920577..76c8d5bda35 100644
--- a/Master/texmf-dist/tex/generic/babel-french/frenchb.lua
+++ b/Master/texmf-dist/tex/generic/babel-french/frenchb.lua
@@ -1,7 +1,7 @@
--[[
File `frenchb.lua’ generated from frenchb.dtx
- [2017/10/19 v3.3d French support from the babel system]
- Copyright © 2014-2017 Daniel Flipo
+ [2018/01/30 v3.4a French support from the babel system]
+ Copyright © 2014-2018 Daniel Flipo
<daniel (dot) flipo (at) free (dot) fr>
License LPPL: see french.ldf.
--]]
@@ -45,35 +45,49 @@ nobreak.penalty = 10000
local insert_node_before = node.insert_before
local insert_node_after = node.insert_after
local remove_node = node.remove
-local function get_glue(toks)
+function FBget_glue(toks)
local t = nil
- local f = string.match(toks, "\\hskip%s*([%d%.]*)%s*\\fontdimen 2")
+ local f = string.match(toks,
+ "[^%w]hskip%s*([%d%.]*)%s*[^%w]fontdimen 2")
if f == "" then f = 1 end
if tonumber(f) then
t = {tonumber(f), 0, 0}
- f = string.match(toks, "plus%s*([%d%.]*)%s*\\fontdimen 3")
+ f = string.match(toks, "plus%s*([%d%.]*)%s*[^%w]fontdimen 3")
if f == "" then f = 1 end
if tonumber(f) then
t[2] = tonumber(f)
- f = string.match(toks, "minus%s*([%d%.]*)%s*\\fontdimen 4")
+ f = string.match(toks, "minus%s*([%d%.]*)%s*[^%w]fontdimen 4")
if f == "" then f = 1 end
if tonumber(f) then
t[3] = tonumber(f)
end
end
- elseif string.match(toks, "\\F?B?thinspace") then
+ elseif string.match(toks, "[^%w]F?B?thinspace") then
t = {0.5, 0, 0}
- elseif string.match(toks, "\\space") then
+ elseif string.match(toks, "[^%w]space") then
t = {1, 1, 1}
end
return t
end
-local colngl = get_glue(tex.toks['FBcolonsp']) or {1, 1, 1}
-local thingl = get_glue(tex.toks['FBthinsp']) or {.5, 0, 0}
-local guilgl = get_glue(tex.toks['FBguillsp']) or {.8, .3, .8}
+FBsp = {}
+FBsp.thin = {}
+FBsp.thin.gl = {}
+FBsp.thin.gl.fr = {.5, 0, 0} ; FBsp.thin.gl.ac = {}
+FBsp.thin.ch = {}
+FBsp.thin.ch.fr = 0x202F ; FBsp.thin.ch.ac = nil
+FBsp.colon = {}
+FBsp.colon.gl = {}
+FBsp.colon.gl.fr = { 1, 1, 1} ; FBsp.colon.gl.ac = {}
+FBsp.colon.ch = {}
+FBsp.colon.ch.fr = 0xA0 ; FBsp.colon.ch.ac = nil
+FBsp.guill = {}
+FBsp.guill.gl = {}
+FBsp.guill.gl.fr = {.8, .3, .8} ; FBsp.guill.gl.ac = {}
+FBsp.guill.ch = {}
+FBsp.guill.ch.fr = 0xA0 ; FBsp.guill.ch.ac = nil
local font_table = {}
local function new_glue_scaled (fid,table)
- if fid > 0 then
+ if fid > 0 and table[1] then
local fp = font_table[fid]
if not fp then
local ft = font.getfont(fid)
@@ -99,6 +113,7 @@ local FBspacing = luatexbase.attributes['FB@spacing']
local addDPspace = luatexbase.attributes['FB@addDPspace']
local addGUILspace = luatexbase.attributes['FB@addGUILspace']
local FBucsNBSP = luatexbase.attributes['FB@ucsNBSP']
+local FBdialect = luatexbase.attributes['FB@dialect']
local has_attribute = node.has_attribute
local function french_punctuation (head)
for item in node.traverse_id(GLYPH, head) do
@@ -109,27 +124,15 @@ local function french_punctuation (head)
FRspacing = FRspacing and FRspacing > 0
local FRucsNBSP = has_attribute(item, FBucsNBSP)
FRucsNBSP = FRucsNBSP and FRucsNBSP > 0
- local NBthinspace = new_node("glyph")
- NBthinspace.font = fid
- NBthinspace.char = 0x202F
- local NBcolnspace = new_node("glyph")
- NBcolnspace.font = fid
- if colngl[1] <= 0.5 then
- NBcolnspace.char = 0x202F
- else
- NBcolnspace.char = 0xA0
- end
- local NBguilspace = new_node("glyph")
- NBguilspace.font = fid
- if guilgl[1] <= 0.5 then
- NBguilspace.char = 0x202F
- else
- NBguilspace.char = 0xA0
- end
+ local FRdialect = has_attribute(item, FBdialect)
+ FRdialect = FRdialect and FRdialect > 0
local SIG = has_attribute(item, addGUILspace)
SIG = SIG and SIG >0
- if lang == FR and FRspacing and
- FB_punct_left[char] and fid > 0 then
+ if lang ~= FR_fr and lang ~= FR_ca then
+ FRspacing = nil
+ end
+ local nbspace = new_node("glyph")
+ if FRspacing and FB_punct_left[char] and fid > 0 then
local prev = item.prev
local prev_id, prev_subtype, prev_char
if prev then
@@ -167,19 +170,31 @@ local function french_punctuation (head)
end
end
local fbglue
- local nbspace
+ local t
if FB_punct_thick[char] then
- fbglue = new_glue_scaled(fid,colngl)
- nbspace = NBcolnspace
+ if FRdialect then
+ t = FBsp.colon.gl.ac
+ nbspace.char = FBsp.colon.ch.ac
+ else
+ t = FBsp.colon.gl.fr
+ nbspace.char = FBsp.colon.ch.fr
+ end
else
- fbglue = new_glue_scaled(fid,thingl)
- nbspace = NBthinspace
+ if FRdialect then
+ t = FBsp.thin.gl.ac
+ nbspace.char = FBsp.thin.ch.ac
+ else
+ t = FBsp.thin.gl.fr
+ nbspace.char = FBsp.thin.ch.fr
+ end
end
+ fbglue = new_glue_scaled(fid, t)
if (realglue or auto) and fbglue then
if realglue then
head = remove_node(head,prev,true)
end
if (FRucsNBSP) then
+ nbspace.font = fid
insert_node_before(head, item, copy_node(nbspace))
else
insert_node_before(head, item, copy_node(nobreak))
@@ -195,13 +210,20 @@ local function french_punctuation (head)
if is_glue and glue_wd <= 1 then
addgl = false
end
- local fbglue = new_glue_scaled(fid,guilgl)
+ local t = FBsp.guill.gl.fr
+ nbspace.char = FBsp.guill.ch.fr
+ if FRdialect then
+ t = FBsp.guill.gl.ac
+ nbspace.char = FBsp.guill.ch.ac
+ end
+ local fbglue = new_glue_scaled(fid, t)
if addgl and fbglue then
if is_glue then
head = remove_node(head,prev,true)
end
if (FRucsNBSP) then
- insert_node_before(head, item, copy_node(NBguilspace))
+ nbspace.font = fid
+ insert_node_before(head, item, copy_node(nbspace))
else
insert_node_before(head, item, copy_node(nobreak))
insert_node_before(head, item, copy_node(fbglue))
@@ -209,8 +231,8 @@ local function french_punctuation (head)
end
end
end
- if lang == FR and FRspacing and FB_punct_right[char]
- and fid > 0 and SIG then
+ if FRspacing and FB_punct_right[char]
+ and fid > 0 and SIG then
local next = item.next
local next_id, next_subtype, next_char, nextnext, kern_wd
if next then
@@ -243,13 +265,20 @@ local function french_punctuation (head)
addgl = false
end
local fid = item.font
- local fbglue = new_glue_scaled(fid,guilgl)
+ local t = FBsp.guill.gl.fr
+ nbspace.char = FBsp.guill.ch.fr
+ if FRdialect then
+ t = FBsp.guill.gl.ac
+ nbspace.char = FBsp.guill.ch.ac
+ end
+ local fbglue = new_glue_scaled(fid, t)
if addgl and fbglue then
if is_glue then
head = remove_node(head,next,true)
end
if (FRucsNBSP) then
- insert_node_after(head, item, copy_node(NBguilspace))
+ nbspace.font = fid
+ insert_node_after(head, item, copy_node(nbspace))
else
insert_node_after(head, item, copy_node(fbglue))
insert_node_after(head, item, copy_node(nobreak))