summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/babel-french/frenchb.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-02-13 22:37:35 +0000
committerKarl Berry <karl@freefriends.org>2016-02-13 22:37:35 +0000
commitf961a4d006dd02df4e8f4429e4a046121c284295 (patch)
treefe5e822f8e6a036da7481d48aa6612973cc30a13 /Master/texmf-dist/source/generic/babel-french/frenchb.dtx
parent6aad496527f7643fd4ce0ec486e8204cab355281 (diff)
babel-french (13feb16)
git-svn-id: svn://tug.org/texlive/trunk@39711 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/generic/babel-french/frenchb.dtx')
-rw-r--r--Master/texmf-dist/source/generic/babel-french/frenchb.dtx186
1 files changed, 96 insertions, 90 deletions
diff --git a/Master/texmf-dist/source/generic/babel-french/frenchb.dtx b/Master/texmf-dist/source/generic/babel-french/frenchb.dtx
index d928f66622a..13bcf079014 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{3264}
+%\CheckSum{3185}
%
%\iffalse
% Tell the \LaTeX\ system who we are and write an entry on the
@@ -13,14 +13,14 @@
%<ldf>\ProvidesLanguage{frenchb}
%\ProvidesFile{frenchb.dtx}
%<*!lua>
- [2016/01/01 v3.1k French support from the babel system]
+ [2016/02/13 v3.1l French support from the babel system]
%</!lua>
%<*internal>
\iffalse
%</internal>
%<*lua>
--
--- File `frenchb.lua' generated from frenchb.dtx [2016/01/01 v3.1k]
+-- File `frenchb.lua' generated from frenchb.dtx [2016/02/13 v3.1l]
--
-- Copyright © 2014-2016 Daniel Flipo
-- <daniel (dot) flipo (at) free (dot) fr>
@@ -53,6 +53,7 @@
\documentclass[a4paper]{ltxdoc}
\usepackage[left=42mm,right=42mm,top=40mm,bottom=40mm]{geometry}
\usepackage[utf8]{inputenc}
+\usepackage{array,textcomp}
\usepackage{bera}
\usepackage[pdftex,dvipsnames]{xcolor}
\def\PrintMacroName#1{%
@@ -1358,21 +1359,33 @@ local guilst = guil10.stretch/65536/1.665
local guilsh = guil10.shrink/65536/1.11
% \end{macrocode}
% and a function to scale them for the current font (beware of null
-% values for fid, see |\nullfont| in TikZ):
+% 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 all glue specs will be null):
+%
+% \changes{v3.1l}{2016/02/13}{frenchb.lua: font.getfont(fid) possibly
+% returns nil even for a positive fid (i.e. AMS lcircle1.pfb).
+% Reported by François Legendre.}
+%
% \begin{macrocode}
local font_table = {}
local function new_glue_scaled (fid,width,stretch,shrink)
if fid > 0 then
local fp = font_table[fid]
if not fp then
- font_table[fid] = font.getfont(fid).parameters
- fp = font_table[fid]
+ local ft = font.getfont(fid)
+ if ft then
+ font_table[fid] = ft.parameters
+ fp = font_table[fid]
+ end
end
local gl = new_node(GLUE,0)
local gl_spec = new_node(GSPEC)
- gl_spec.width = width * fp.space
- gl_spec.stretch = stretch * fp.space_stretch
- gl_spec.shrink = shrink * fp.space_shrink
+ if fp then
+ gl_spec.width = width * fp.space
+ gl_spec.stretch = stretch * fp.space_stretch
+ gl_spec.shrink = shrink * fp.space_shrink
+ end
gl.spec = gl_spec
return gl
else
@@ -1607,18 +1620,21 @@ return french_punctuation
%<*ldf>
% \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.
+%
+% \changes{v3.1l}{2016/02/07}{Use \cs{babel@save} to save and restore
+% \cs{shorthandon} and \cs{shorthandoff}.}
+%
% \begin{macrocode}
\ifFB@luatex@punct
\newcommand*{\FB@luatex@punct@french}{%
- \ifx\shorthandoffORI\@undefined
- \let\shorthandonORI\shorthandon
- \let\shorthandoffORI\shorthandoff
- \fi
+ \babel@save{\shorthandon}%
+ \babel@save{\shorthandoff}%
\def\shorthandoff##1{%
\ifx\PackageWarning\@undefined
\fb@warning{\noexpand\shorthandoff{;:!?} is helpless with
@@ -1631,16 +1647,9 @@ return french_punctuation
\fi}%
\def\shorthandon##1{}%
}
- \newcommand*{\FB@luatex@punct@nonfrench}{%
- \ifx\shorthandoffORI\@undefined
- \else
- \let\shorthandon\shorthandonORI
- \let\shorthandoff\shorthandoffORI
- \fi
- }
\FB@addto{extras}{\FB@luatex@punct@french}
- \FB@addto{noextras}{\FB@luatex@punct@nonfrench}
% \end{macrocode}
+% \end{macro}
%
% \changes{v3.0b}{2014/02/13}{frenchb.lua was not found by
% Lua function dofile (not kpathsea aware).
@@ -1714,7 +1723,6 @@ return french_punctuation
% The following part holds specific code for punctuation with XeTeX
% engines.
% \begin{macrocode}
-\newcount\FB@interchartokenstateORI
\ifFB@xetex@punct
\ifLaTeXe
\PackageInfo{frenchb.ldf}{No need for active punctuation characters%
@@ -1752,14 +1760,43 @@ return french_punctuation
\newXeTeXintercharclass\FB@guilf
\newXeTeXintercharclass\FB@guilnul
% \end{macrocode}
-% We define a command to store the |\XeTeXcharclass| values which
-% will be modified for French (as a comma separated list) and a
-% command to retrieve them.
-% \begin{macrocode}
- \def\FB@charclassesORI{}
- \def\empty{}
- \def\FB@parse#1,#2\endparse{\def\FB@class{#1}%
- \def\FB@charclassesORI{#2}}%
+%
+% \changes{v3.1l}{2016/02/07}{Add a variant of \cs{babel@savevariable}
+% to save \cs{XeTeXcharclass}(es) in a loop.}
+%
+% As |\babel@savevariable| doesn't work inside a |\bbl@for| loop,
+% we define a variant to save the |\XeTeXcharclass| values which
+% will be modified in French.
+% \begin{macrocode}
+ \def\FBsavevariable@loop#1#2{\begingroup
+ \toks@\expandafter{\originalTeX #1}%
+ \edef\x{\endgroup
+ \def\noexpand\originalTeX{\the\toks@ #2=\the#1#2\relax}}%
+ \x}
+% \end{macrocode}
+% |\FB@charlist| holds the all list of characters which have their
+% |\XeTeXcharclass| value modified in French: the first set includes
+% high punctuation, French quotes, opening delimiters and no-break
+% spaces \\[5pt]
+% \begin{tabular}{*{10}{|c}|}\hline
+% "21 &"3A &"3B &"3F &"AB &"BB &"28 &"5B &"A0 &"202F
+% \\ \hline
+% \char"21 &\char"3A &\char"3B &\char"3F & « & »
+% &\char"28 &\char"5B & & \\ \hline
+% \end{tabular}\\[5pt]
+% the second one holds those which need resetting in French when
+% \file{xeCJK.sty} is in use\\[5pt]
+% \begin{tabular}{*{12}{|c}|}\hline
+% "29 &"5D &"7B &"7D &"2C &"2D &"2E &"22 &"25 &"27 &"60 &"2019
+% \\ \hline
+% \char"29 &\char"5D &\char"7B &\char"7D &\char"2C &\char"2D
+% &\char"2E &\char"22 &\char"25 &\textquotesingle &\char"60
+% &\char"27 \\ \hline
+% \end{tabular}
+%
+% \begin{macrocode}
+ \def\FB@charlist{"21,"3A,"3B,"3F,"AB,"BB,"28,"5B,"A0,"202F,%
+ "29,"5D,"7B,"7D,"2C,"2D,"2E,"22,"25,"27,"60,"2019}
% \end{macrocode}
%
% \begin{macro}{\FB@xetex@punct@french}
@@ -1784,24 +1821,31 @@ return french_punctuation
% trigger space insertion before high ponctuation. Add a check on
% \cs{lastkip}.}
%
+% \changes{v3.1l}{2016/02/07}{Save and restore
+% \cs{XeTeXinterchartokenstate}, \cs{shorthandon}, \cs{shorthandoff}
+% using \cs{babel@savevariable} and \cs{babel@save},
+% \cs{XeTeXcharclass}(es) using \cs{FB@savevariable@loop}.}
+%
% \begin{macrocode}
\newcommand*{\FB@xetex@punct@french}{%
+ \babel@savevariable{\XeTeXinterchartokenstate}%
+ \babel@save{\shorthandon}%
+ \babel@save{\shorthandoff}%
+ \bbl@for\FB@char\FB@charlist
+ {\FBsavevariable@loop{\XeTeXcharclass}{\FB@char}}%
+ \def\shorthandoff##1{%
+ \ifx\PackageWarning\@undefined
+ \fb@warning{\noexpand\shorthandoff{;:!?} is helpless with
+ XeTeX,\\ use \noexpand\NoAutoSpacing
+ *inside a group* instead.}%
+ \else
+ \PackageWarning{frenchb.ldf}{\protect\shorthandoff{;:!?} is
+ helpless with XeTeX,\MessageBreak use \protect\NoAutoSpacing
+ \space *inside a group* instead;\MessageBreak reported}%
+ \fi}%
+ \def\shorthandon##1{}%
% \end{macrocode}
-% Saving must not be repeated if saved values are already in.
-% \begin{macrocode}
- \ifx\FB@charclassesORI\empty
- \FB@interchartokenstateORI=\XeTeXinterchartokenstate
- \bbl@for\FB@char
- {`\:,`\;,`\!,`\?,"AB,"BB,%
- `\(,`\[,`\{,`\,,`\.,`\-,`\),`\],`\},%
- `\%,"22,"27,"60,"2019,"A0,"202F}%
- {\edef\FB@charclassesORI{\FB@charclassesORI%
- \the\XeTeXcharclass\FB@char,}}%
- \let\shorthandonORI\shorthandon
- \let\shorthandoffORI\shorthandoff
- \fi
-% \end{macrocode}
-% Set the classes and interactions between classes.
+% Let's now set the classes and interactions between classes.
% \begin{macrocode}
\XeTeXinterchartokenstate=1
\XeTeXcharclass `\: = \FB@punctthick
@@ -1865,50 +1909,11 @@ return french_punctuation
\bbl@for\FB@char
{`\{,`\,,`\.,`\-,`\),`\],`\},`\%,"22,"27,"60,"2019}%
{\XeTeXcharclass\FB@char=\z@}%
-% \end{macrocode}
-% With Xe(La)TeX, French defines no active shorthands.
-% \begin{macrocode}
- \def\shorthandoff##1{%
- \ifx\PackageWarning\@undefined
- \fb@warning{\noexpand\shorthandoff{;:!?} is helpless with
- XeTeX,\\ use \noexpand\NoAutoSpacing
- *inside a group* instead.}%
- \else
- \PackageWarning{frenchb.ldf}{\protect\shorthandoff{;:!?} is
- helpless with XeTeX,\MessageBreak use \protect\NoAutoSpacing
- \space *inside a group* instead;\MessageBreak reported}%
- \fi}%
- \def\shorthandon##1{}%
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\FB@xetex@punct@nonfrench}
-% The following command will be executed when leaving French for
-% restoring classes and commands modified in French.
-% When French is not the main language, |\noextrasfrench| is
-% executed `AtBeginDocument', the test on |\FB@charclassesORI| is
-% mandatory.
-% \begin{macrocode}
- \newcommand*{\FB@xetex@punct@nonfrench}{%
- \ifx\FB@charclassesORI\empty
- \else
- \bbl@for\FB@char
- {`\:,`\;,`\!,`\?,"AB,"BB,%
- `\(,`\[,`\{,`\,,`\.,`\-,`\),`\],`\},%
- `\%,"22,"27,"60,"2019,"A0,"202F}%
- {\expandafter\FB@parse\FB@charclassesORI\endparse
- \XeTeXcharclass\FB@char=\FB@class}%
- \def\FB@charclassesORI{}%
- \XeTeXinterchartokenstate=\FB@interchartokenstateORI
- \let\shorthandon\shorthandonORI
- \let\shorthandoff\shorthandoffORI
- \fi
}
\FB@addto{extras}{\FB@xetex@punct@french}
- \FB@addto{noextras}{\FB@xetex@punct@nonfrench}
% \end{macrocode}
% \end{macro}
+%
% End of specific code for punctuation with modern XeTeX engines.
% \begin{macrocode}
\fi
@@ -3338,8 +3343,8 @@ return french_punctuation
% Math and Text mode. They default to those of amsmath-2.0, and
% will revert to standard \LaTeX{} definitions `AtBeginDocument',
% if amsmath has not been loaded. |\Mdots@| doesn't change when
-% switching from/to French, while |\Tdots@| is |\FBtextellipsis|
-% in French and |\Tdots@ORI| otherwise.
+% switching from/to French, while |\Tdots@| is redefined as
+% |\FBtextellipsis| in French.
% \begin{macrocode}
\newcommand*{\Tdots@}{\@xp\textellipsis}
\newcommand*{\Mdots@}{\@xp\mdots@}
@@ -3405,7 +3410,8 @@ return french_punctuation
% for global customisation.}
%
% \changes{v3.0a}{2014/02/24}{Options processing completely
-% reorganised.}
+% reorganised, now \cs{babel@save} and\cs{babel@savevariable} are
+% usable for French.}
%
% All setup options are handled by command \fbsetup{} using the
% keyval syntax. A list of flags is defined and set to a default
@@ -3419,10 +3425,10 @@ return french_punctuation
% \fbsetup{}: when French is the main language, |\extrasfrench{}| is
% executed by \babel{} when it switches the main language and this
% occurs \emph{before} reading the stuff postponed by \frenchb{}
-% `AtBeginDocument'. Reexecuting |\extrasfrench{}| is a possibility
+% `AtBeginDocument'. Reexecuting |\extrasfrench{}| is an option
% which was used up to v2.6h, it has been dropped in v3.0a because
% of its side-effects (f.i. |\babel@save| and |\babel@savevariable|
-% no longer work).
+% did not work for French).
%
% \begin{macro}{\frenchbsetup}
% Let's now define this command which reads and sets the options