summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/babel-contrib/french/frenchb.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-11-13 03:01:42 +0000
committerNorbert Preining <norbert@preining.info>2022-11-13 03:01:42 +0000
commit1b59c3c45170420996d629b296e2214933ee1add (patch)
tree34082741a3498a4d6ccbe007c7866ac855e7ef72 /macros/latex/contrib/babel-contrib/french/frenchb.dtx
parent28e13f4c64ab0caee7ce56d51e9be2b93611d580 (diff)
CTAN sync 202211130301
Diffstat (limited to 'macros/latex/contrib/babel-contrib/french/frenchb.dtx')
-rw-r--r--macros/latex/contrib/babel-contrib/french/frenchb.dtx200
1 files changed, 88 insertions, 112 deletions
diff --git a/macros/latex/contrib/babel-contrib/french/frenchb.dtx b/macros/latex/contrib/babel-contrib/french/frenchb.dtx
index fec387a0d4..11036d0c9c 100644
--- a/macros/latex/contrib/babel-contrib/french/frenchb.dtx
+++ b/macros/latex/contrib/babel-contrib/french/frenchb.dtx
@@ -1,5 +1,3 @@
-%\CheckSum{3741}
-%
%\iffalse
% Tell the LaTeX system who we are and write an entry on the
% transcript.
@@ -13,7 +11,7 @@
%<frenchb>\ProvidesLanguage{frenchb}
%<lua>--[[
%<lua> File `frenchb.lua’ generated from frenchb.dtx
- [2022/04/18 v3.5n French support from the babel system]
+ [2022/11/11 v3.5o French support from the babel system]
%<*internal>
\iffalse
%</internal>
@@ -79,7 +77,7 @@
\newcommand*\env[1]{\texttt{#1}}
\newcommand*\exe[1]{\texttt{#1}}
\newcommand*\fbo[1]{\texttt{\ColorArg #1}}
-\newcommand*\fbsetup[1]{\cs{frenchsetup\{\fbo{#1}\}}}
+\newcommand*\fbsetup[1]{\cs{frenchsetup}\{\fbo{#1}\}}
\renewcommand\meta[1]{\textit{<#1>}} % no math mode (see doc.sty)
\let\Module\meta % no math mode (see doc.sty)
\renewcommand*\descriptionlabel[1]{%
@@ -357,7 +355,7 @@
% \label{sssec-frenchbsetup}
%
% \vspace{.5\baselineskip}
-% |\frenchsetup{}| and |\frenchbsetup{}| are synonymous;
+% |\frenchbsetup{}| and |\frenchsetup{}| are synonymous;
% the latter should be preferred as the language name for
% French in \babel{} is no longer |frenchb| but |french|.
%
@@ -587,12 +585,15 @@
% tells \frenchb{} which characters are opening and closing
% French guillemets (they depend on the input encoding), then
% you can type either \hlabel{option-og-fg}
-% \texttt{« guillemets »} or \texttt{«guillemets»} (with or
-% without spaces) to get properly typeset French quotes.
-% This option works with LuaLaTeX and XeLaTeX; with pdfLaTeX it
-% requires \file{inputenc} to be loaded with a proper encoding:
-% 8-bits encoding (latin1, latin9, ansinew, applemac,…) or
-% multi-byte encoding (utf8, utf8x).
+% \texttt{« guillemets »} or \texttt{«guillemets»}%
+% \footnote{Or even
+% \texttt{«\textasciitilde{}guillemets\textasciitilde{}»},
+% but \emph{only} with LuaLaTeX.}
+% (with or without spaces) to get properly typeset French quotes.
+% This option works with LuaLaTeX, XeLaTeX and with pdfLaTeX
+% (default encoding: utf8); with pdflatex other 8-bits encodings
+% (latin1, latin9, ansinew, applemac,…) are also supported
+% when properly declared with \file{inputenc}.
%
% \item [INGuillSpace=true (false)] resets the dimensions of spaces
% after opening French quotes and before closing French quotes to
@@ -777,6 +778,7 @@
% this kind of mismatch.
% \end{itemize}
%
+% \newpage
% \subsection{Changes}
% \label{ssec-changes}
%
@@ -918,9 +920,8 @@
% The best way to go is to upgrade to TL2016 or equivalent asap.
% Xe(La)TeX and pdf(La)TeX users can safely use \frenchb{} v.~3.2b
% and later on older installations too.
-% \enlargethispage*{.5\baselineskip}
%
-% Tne internals of commands |\NoAutoSpacing|, |\ttfamilyFB|,
+% The internals of commands |\NoAutoSpacing|, |\ttfamilyFB|,
% |\rmfamilyFB| and |\sffamilyFB| have been completely redesigned
% in version~3.2c, they behave now consistently with all engines.
%
@@ -1526,18 +1527,13 @@
% |\sffamilyFB|. These four commands will now behave the same with
% any engine (up to version 3.2b, results were engine dependent).
% \begin{macrocode}
-\newcommand*{\FB@spacing@on}{%
- \ifFB@luatex@punct
- \FB@spacing=1 \relax
- \else
- \FB@spacingtrue
- \fi}
-\newcommand*{\FB@spacing@off}{%
- \ifFB@luatex@punct
- \FB@spacing=0 \relax
- \else
- \FB@spacingfalse
- \fi}
+\ifFB@luatex@punct
+ \newcommand*{\FB@spacing@on}{\FB@spacing=1 \relax}
+ \newcommand*{\FB@spacing@off}{\FB@spacing=0 \relax}
+\else
+ \newcommand*{\FB@spacing@on}{\FB@spacingtrue}
+ \newcommand*{\FB@spacing@off}{\FB@spacingfalse}
+\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1674,7 +1670,7 @@
%</french>
% \end{macrocode}
%
-% \begin{macro}{frenchb.lua}
+% \begin{environment}{frenchb.lua}
% This is \file{frenchb.lua}. It holds Lua code to deal with `high
% punctuation’ and quotes. This code is based on suggestions from
% Paul Isambert.
@@ -2111,8 +2107,11 @@ local function french_punctuation (head)
% (i.e. in « \cs{texttt}\{a\} »).}
%
% \changes{v3.1g}{2015/06/26}{Flag addgl set to false for
-% `«’ at the end of an \cs{hbox} or a paragraph or when followed by
-% a null glue (i.e. springs).}
+% `«’ at the end of an \cs{hbox} or a paragraph or when followed by
+% a null glue (i.e. springs).}
+%
+% \changes{v3.5o}{2022/10/11}{Opening guill.: look ahead when next is
+% a penalty (nobreak space).}
%
% \begin{macrocode}
elseif SIG then
@@ -2121,13 +2120,30 @@ local function french_punctuation (head)
if next then
next_id = next.id
next_subtype = next.subtype
- if next_id == GLYPH then
- next_char = next.char
% \end{macrocode}
-% A |kern0| might hide a |glue|, so look ahead if |next| is a kern
-% (this occurs with |« \texttt{a} »|):
+% In case of coding |«~| remove the penalty and the glue:
+% \begin{macrocode}
+ if next_id == PENALTY then
+ nextnext = next.next
+ if nextnext and nextnext.id == GLUE then
+ head = remove_node(head,nextnext,true)
+ head = remove_node(head,next,true)
+ next = item.next
+ if next then
+ next_id = next.id
+ next_subtype = next.subtype
+ if next_id == GLYPH then
+ next_char = next.char
+ end
+ end
+ end
+ end
+% \end{macrocode}
+% A |kern0| might hide a |penalty| and/or |glue|, so look ahead if
+% |next| is a kern (this occurs with |« \texttt{a} »| and
+% |«~\texttt{a}~»|):
% \begin{macrocode}
- elseif next_id == KERN then
+ if next_id == KERN then
kern_wd = next.kern
if kern_wd == 0 then
nextnext = next.next
@@ -2135,17 +2151,32 @@ local function french_punctuation (head)
next = nextnext
next_id = nextnext.id
next_subtype = nextnext.subtype
- if next_id == GLYPH then
- next_char = nextnext.char
+ if next_id == PENALTY then
+ nextnext = next.next
+ if nextnext and nextnext.id == GLUE then
+ head = remove_node(head,next,true)
+ head = remove_node(head,nextnext,true)
+ next = item.next
+ if next then
+ next_id = next.id
+ next_subtype = next.subtype
+ end
+ end
end
end
end
end
+ if next_id == GLYPH then
+ next_char = next.char
+ end
end
local is_glue = next_id == GLUE
if is_glue then
glue_wd = next.width
end
+% \end{macrocode}
+% The |addgl| flag only depends on |next_char| and |is_glue|:
+% \begin{macrocode}
local addgl = (next_char and not FB_guil_null[next_char])
or (next and not next_char)
% \end{macrocode}
@@ -2188,41 +2219,7 @@ end
return french_punctuation
%</lua>
% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\FB@luatex@punct@french}
-% 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}.}
-%
-% \begin{macrocode}
-%<*french>
-\ifFB@luatex@punct
- \newcommand*{\FB@luatex@punct@french}{%
- \babel@save\shorthandon
- \babel@save\shorthandoff
- \def\shorthandoff##1{%
- \ifx\PackageWarning\@undefined
- \fb@warning{\noexpand\shorthandoff{;:!?} is helpless with
- LuaTeX,\\ use \noexpand\NoAutoSpacing
- *inside a group* instead.}%
- \else
- \PackageWarning{french.ldf}{\protect\shorthandoff{;:!?}
- is helpless with LuaTeX,\MessageBreak
- use \protect\NoAutoSpacing \space *inside a group*
- instead;\MessageBreak reported}%
- \fi}%
- \def\shorthandon##1{}%
- }
- \addto\extrasfrench{\FB@luatex@punct@french}
-% \end{macrocode}
-% \end{macro}
+% \end{environment}
%
% \changes{v3.0b}{2014/02/13}{frenchb.lua was not found by
% Lua function dofile (not kpathsea aware).
@@ -2232,12 +2229,21 @@ return french_punctuation
% inserted at the end of the `kerning’ callback (no priority)
% instead of `hpack\_filter’ and `pre\_linebreak\_filter’.}
%
+% \changes{v3.5o}{2022/11/03}{\cs{shorthandon} and \cs{shorthandoff}
+% are no longer redefined in LuaTeX (it broke \cs{shorthandoff*}).}
+%
+% As a language tag is part of glyph nodes in LuaTeX, no more
+% switching has to be done in |\extrasfrench|, setting the dialect
+% attribute has already be done (see above, p.~\pageref{extrapunct}).
+%
% The next definition will be used to activate Lua punctuation: it
% loads \file{frenchb.lua} and adds function |french_punctuation|
% to the |kerning| callback; "adding" anything actually disables
% the built-in kerning for Type1 fonts (which is now added to
% |french_punctuation|).
% \begin{macrocode}
+%<*french>
+\ifFB@luatex@punct
\def\activate@luatexpunct{%
\directlua{%
FR_fr = \the\l@french ; FR_ca = \the\l@acadian ;
@@ -2374,8 +2380,7 @@ return french_punctuation
% \begin{macro}{\FB@xetex@punct@french}
% The following command will be executed when entering French, it
% first saves the values to be modified, then fits them to our
-% needs. It also redefines |\shorthandoff| and |\shorthandon|
-% (locally) to avoid error messages with XeTeX-based engines.
+% needs.
%
% \changes{v2.5g}{2011/12/31}{XeTeXcharclass(es) for French quotes will
% be set to \cs{FB@guilo} and \cs{FB@guilf} by options
@@ -2401,25 +2406,14 @@ return french_punctuation
% \changes{v3.2c}{2016/05/14}{Switch \cs{ifFB@spacing} added to all
% \cs{XeTeXinterchartoks} commands.}
%
+%% \changes{v3.5o}{2022/11/03}{\cs{shorthandon} and \cs{shorthandoff}
+% are no longer redefined (it broke \cs{shorthandoff*}).}
+%
% \begin{macrocode}
\newcommand*{\FB@xetex@punct@french}{%
\babel@savevariable{\XeTeXinterchartokenstate}%
- \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{french.ldf}{\protect\shorthandoff{;:!?}
- is helpless with XeTeX,\MessageBreak
- use \protect\NoAutoSpacing\space *inside a group*
- instead;\MessageBreak reported}%
- \fi}%
- \def\shorthandon##1{}%
% \end{macrocode}
% Let’s now set the classes and interactions between classes.
% When false, the flag |\ifFB@spacing| switches off any interaction
@@ -5252,7 +5246,7 @@ return french_punctuation
\addtolength{\partopsep}{\@tempdima}%
}
\def\listFB#1#2{\listORI{#1}{\FB@listVsettings #2}}
-\let\endlistFB\endlist
+\let\endlistFB\endlistORI
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -5570,6 +5564,9 @@ return french_punctuation
% |\relax|, it will be redefined later `AtBeginDocument’ by
% |\FBprocess@options| as |\update@frenchlists|,
% see p.~\pageref{FB@ufl}.
+%
+% Lists’ layout changes at language switches only if
+% |GlobalLayoutFrench=false|.
% \begin{macrocode}
\def\FB@ufl{\relax}
\def\bbl@frenchlistlayout{%
@@ -5603,8 +5600,9 @@ return french_punctuation
% \changes{v3.5n}{2022/04/18}{\cs{bbl@frenchindent} changed.
% \cs{bbl@nonfrenchindent} removed.}
%
-% We will need to save the value of the flag |\if@afterindent|
-% `AtBeginDocument’ before eventually changing its value.
+% Indentation changes at language switches in only two cases:\\
+% a) |GlobalLayoutFrench=false|,\\
+% b) |IndentFirst=true| and French isn’t the main language.
%
% \begin{macrocode}
\def\bbl@frenchindent{%
@@ -6028,29 +6026,7 @@ return french_punctuation
% \end{macrocode}
%
% \Finale
-% \iffalse
-%<*!lua>
-% \fi
-%%
-%% \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
-%% Lower-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
-%% Digits \0\1\2\3\4\5\6\7\8\9
-%% Exclamation \! Double quote \" Hash (number) \#
-%% Dollar \$ Percent \% Ampersand \&
-%% Acute accent \' Left paren \( Right paren \)
-%% Asterisk \* Plus \+ Comma \,
-%% Minus \- Point \. Solidus \/
-%% Colon \: Semicolon \; Less than \<
-%% Equals \= Greater than \> Question mark \?
-%% Commercial at \@ Left bracket \[ Backslash \\
-%% Right bracket \] Circumflex \^ Underscore \_
-%% Grave accent \` Left brace \{ Vertical bar \|
-%% Right brace \} Tilde \~}
-%%
-% \iffalse
-%</!lua>
-% \fi
+%
\endinput
%%% Local Variables: