diff options
author | Karl Berry <karl@freefriends.org> | 2016-03-19 22:13:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-03-19 22:13:31 +0000 |
commit | 04e521880f42c9699c6b045c32176f3f59bd11c8 (patch) | |
tree | 94736c5a01a1800cb18047b756ee8bcd3fb05e1d /Master/texmf-dist/source/generic/babel-french/frenchb.dtx | |
parent | ff3c0e83bcf8933daf4eebaf87613022ca946b6a (diff) |
babel-french (19mar16)
git-svn-id: svn://tug.org/texlive/trunk@40078 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.dtx | 352 |
1 files changed, 264 insertions, 88 deletions
diff --git a/Master/texmf-dist/source/generic/babel-french/frenchb.dtx b/Master/texmf-dist/source/generic/babel-french/frenchb.dtx index 13bcf079014..5356626c9e6 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{3185} +%\CheckSum{3306} % %\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/02/13 v3.1l French support from the babel system] + [2016/03/18 v3.2a French support from the babel system] %</!lua> %<*internal> \iffalse %</internal> %<*lua> -- --- File `frenchb.lua' generated from frenchb.dtx [2016/02/13 v3.1l] +-- File `frenchb.lua' generated from frenchb.dtx [2016/03/18 v3.2a] -- -- Copyright © 2014-2016 Daniel Flipo -- <daniel (dot) flipo (at) free (dot) fr> @@ -615,6 +615,20 @@ % \subsection{Changes} % \label{ssec-changes} % +% \subsubsection*{What's new in version 3.2?} +% +% The handling of footnotes has been redesigned for the +% \cls{beamer}, \cls{memoir} and koma-script classes. +% The layout of footnotes ``à la française'' should be unchanged +% but footnotes' customisations offered by these classes +% (i.e. font or color changes) are now available even when option +% \fbo{FrenchFootnotes} is \fbo{true}. +% +% A long standing bug regarding the \pkg{xspace} package has been +% fixed: |\xspace| has been moved up from the internal command +% |\FB@fg| to |\fg|; |\frquote{}| now works properly when the +% \pkg{xspace} package is loaded. +% % \subsubsection*{What's new in version 3.1?} % % New command |\frquote{}| meant to enter French quotations, @@ -1361,12 +1375,16 @@ local guilsh = guil10.shrink/65536/1.11 % and a function to scale them 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 all glue specs will be null): +% a proper font table, in such cases the function returns |nil|): % % \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.} % +% \changes{v3.1m}{2016/02/16}{frenchb.lua: new\_glue\_scaled returns +% nil in case of invalid font table (i.e. lcircle1.pfb). In such +% cases frenchb leaves the node list unchanged.} +% % \begin{macrocode} local font_table = {} local function new_glue_scaled (fid,width,stretch,shrink) @@ -1385,9 +1403,11 @@ local function new_glue_scaled (fid,width,stretch,shrink) gl_spec.width = width * fp.space gl_spec.stretch = stretch * fp.space_stretch gl_spec.shrink = shrink * fp.space_shrink + gl.spec = gl_spec + return gl + else + return nil end - gl.spec = gl_spec - return gl else return nil end @@ -1489,7 +1509,11 @@ local function french_punctuation (head) else fbglue = new_glue_scaled(fid,thinwd,thinst,thinsh) end - if realglue or auto then +% \end{macrocode} +% In case |new_glue_scaled| fails (returns |nil|) the node list +% remains unchanged. +% \begin{macrocode} + if (realglue or auto) and fbglue then if realglue then head = remove_node(head,prev,true) end @@ -1530,11 +1554,11 @@ local function french_punctuation (head) if glue and glue_wd <= 1 then addgl = false end - if addgl then + local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh) + if addgl and fbglue then if glue then head = remove_node(head,prev,true) end - local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh) insert_node_before(head, item, copy_node(nobreak)) insert_node_before(head, item, copy_node(fbglue)) end @@ -1600,12 +1624,12 @@ local function french_punctuation (head) if glue and glue_wd == 0 then addgl = false end - if addgl then + local fid = item.font + local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh) + if addgl and fbglue then if glue then head = remove_node(head,next,true) end - local fid = item.font - local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh) insert_node_after(head, item, copy_node(fbglue)) insert_node_after(head, item, copy_node(nobreak)) end @@ -2159,24 +2183,6 @@ return french_punctuation % \subsection{Commands for French quotation marks} % \label{ssec-quotes} % -% \begin{macro}{\og} -% \begin{macro}{\fg} -% The top macros for quotation marks will be called |\og| -% (``\underline{o}uvrez \underline{g}uillemets'') and |\fg| -% (``\underline{f}ermez \underline{g}uillemets''). -% Another option for typesetting quotes in French is to use the -% command |\frquote| (see below). -% Dummy definition of |\og| and |\fg| just to ensure that this -% commands are not yet defined. The default definition of |\og| -% and |\fg| will be set later (for English) by -% |\bbl@nonfrenchguillemets|. -% \begin{macrocode} -\newcommand*{\og}{\@empty} -\newcommand*{\fg}{\@empty} -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \begin{macro}{\guillemotleft} % \begin{macro}{\guillemotright} % \begin{macro}{\textquoteddblleft} @@ -2221,6 +2227,8 @@ return french_punctuation % \end{macro} % \end{macro} % +% \begin{macro}{\FB@og} +% \begin{macro}{\FB@fg} % The next step is to provide correct spacing after |\guillemotleft| % and before |\guillemotright|: a space precedes and follows % quotation marks but no line break is allowed neither \emph{after} @@ -2230,10 +2238,6 @@ return french_punctuation % stretchability. French quotes (including spacing) are printed by % |\FB@og| and |\FB@fg|, the expansion of the top level commands % |\og| and |\og| is different in and outside French. -% We'll try to be smart to users of David~Carlisle's \pkg{xspace} -% package: if this package is loaded there will be no need for |{}| -% or |\ | to get a space after |\fg|, otherwise |\xspace| will be -% defined as |\relax| (done at the end of this file). % % \changes{v3.0a}{2014/01/10}{Definitions of \cs{FB@og} and \cs{FB@fg} % now depend on punctuation handling (LuaTeX / XeTeX / active).} @@ -2260,7 +2264,7 @@ return french_punctuation \DeclareRobustCommand*{\FB@og}{\leavevmode \bgroup\FB@addGUILspace=1 \guillemotleft\egroup} \DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi - \bgroup\FB@addGUILspace=1 \guillemotright\egroup\xspace} + \bgroup\FB@addGUILspace=1 \guillemotright\egroup} \fi % \end{macrocode} % With XeTeX, |\FBAutoSpaceGuill| is set to |false| locally to @@ -2274,7 +2278,7 @@ return french_punctuation \FBguillspace} \DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi \FBguillspace - \bgroup\FBAutoSpaceGuillfalse\guillemotright\egroup\xspace} + \bgroup\FBAutoSpaceGuillfalse\guillemotright\egroup} \fi \ifFB@active@punct \DeclareRobustCommand*{\FB@og}{\leavevmode @@ -2282,34 +2286,66 @@ return french_punctuation \FBguillspace} \DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi \FBguillspace - \guillemotright\xspace} + \guillemotright} \fi % \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\og} +% \begin{macro}{\fg} +% +% The user level macros for quotation marks are named |\og| +% (``\underline{o}uvrez \underline{g}uillemets'') and |\fg| +% (``\underline{f}ermez \underline{g}uillemets''). +% Another option for typesetting quotes in French is to use the +% command |\frquote| (see below). +% Dummy definition of |\og| and |\fg| just to ensure that this +% commands are not yet defined. +% \begin{macrocode} +\newcommand*{\og}{\@empty} +\newcommand*{\fg}{\@empty} +% \end{macrocode} % -% The top level definitions for French quotation marks are switched -% on and off through the |\extrasfrench| |\noextrasfrench| +% The definitions of |\og| and |\fg| for quotation marks are +% switched on and off through the |\extrasfrench| |\noextrasfrench| % mechanism. Outside French, |\og| and |\fg| will typeset standard % English opening and closing double quotes. +% We'll try to be smart to users of David~Carlisle's \pkg{xspace} +% package: if this package is loaded there will be no need for |{}| +% or |\ | to get a space after |\fg|, otherwise |\xspace| will be +% defined as |\relax| (done at the end of this file). % % \changes{v2.5a}{2010/08/20}{\cs{og} and \cs{fg} do not print % correctly in English when using XeTeX or LuaTeX, fixed by using % \cs{textquotedblleft} and \cs{textquotedblright} defined above.} % -% \changes{v3.0a}{2014/01/10}{\cs{bbl@nonfrenchguillemets} deleted, -% use \cs{babel@save} instead.} +% \changes{v3.2a}{2016/03/18}{\cs{xspace} moved from \cs{FB@fg} to +% \cs{fg}: \cs{xspace} messes up \cs{frquote}, pointed out by Sonia +% Labetoulle. As a side effect \cs{xspace} is now active in \cs{fg} +% in and outside French.} % % \begin{macrocode} \ifLaTeXe \def\bbl@frenchguillemets{\renewcommand*{\og}{\FB@og}% - \renewcommand*{\fg}{\FB@fg}} + \renewcommand*{\fg}{\FB@fg\xspace}} \renewcommand*{\og}{\textquotedblleft} - \renewcommand*{\fg}{\ifdim\lastskip>\z@\unskip\fi \textquotedblright} + \renewcommand*{\fg}{\ifdim\lastskip>\z@\unskip\fi + \textquotedblright\xspace} \else \def\bbl@frenchguillemets{\let\og\FB@og \let\fg\FB@fg} \def\og{\textquotedblleft} \def\fg{\ifdim\lastskip>\z@\unskip\fi\textquotedblright} \fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \changes{v3.0a}{2014/01/10}{\cs{bbl@nonfrenchguillemets} deleted, +% use \cs{babel@save} instead.} +% +% \begin{macrocode} \FB@addto{extras}{\babel@save\og \babel@save\fg \bbl@frenchguillemets} % \end{macrocode} % @@ -4653,12 +4689,13 @@ return french_punctuation % different because one was called in a French part, the other one % in English!). % -% When |\ifFBAutoSpaceFootnotes| is true, |\@footnotemark| (the -% definition of which is saved at the |\begin{document}| in order to -% include any customisation that packages might have done) is -% redefined to add a thin space before the number or symbol calling -% a footnote (any space typed in is removed first). -% This has no effect on the layout of the footnote itself. +% We save the original definition of |\@footnotemark| at the +% |\begin{document}| in order to include any customisation that +% packages might have done; we define a variant |\@footnotemarkFB| +% which just adds a thin space before the number or symbol calling +% a footnote (any space typed in is removed first). The choice +% between the two definitions (valid for the whole document) is +% controlled by flag |\ifFBAutoSpaceFootnotes|. % % \changes{v2.4a}{2009/11/23}{\cs{PackageWarning} changed to % \cs{FBWarning} (when bigfoot package in use).} @@ -4682,11 +4719,12 @@ return french_punctuation % which is responsible for the layout of footnotes, to match the % specifications of the French `Imprimerie Nationale': footnotes % will be indented by |\parindentFFN|, numbers (if any) typeset on -% the baseline (instead of superscripts) and followed by a dot -% and an half quad space. Whenever symbols are used to number -% footnotes (as in |\thanks| for instance), we switch back to the -% standard layout (the French layout of footnotes is meant for -% footnotes numbered by Arabic or Roman digits). +% the baseline (instead of superscripts), right aligned on +% |\parindentFFN| and followed by a dot and an half quad kern. +% Whenever symbols are used to number footnotes (as in |\thanks| +% for instance), we switch back to the standard layout (the French +% layout of footnotes is meant for footnotes numbered by arabic or +% roman digits). % % \changes{v2.0}{2006/11/06}{\cs{parindentFFN} not changed if % already defined (required by JA for cah-gut.cls).} @@ -4694,50 +4732,188 @@ return french_punctuation % \changes{v2.3b}{2008/12/06}{New commands \cs{dotFFN} and % \cs{kernFFN} for more flexibility (suggested by JA).} % +% \changes{v3.2a}{2016/03/14}{beamer.cls requires a specific +% definition of \cs{@makefntextFB} (pointed out by DB). +% The same is true for memoir and koma-script classes (done).} +% % The value of |\parindentFFN| will be redefined at the % |\begin{document}|, as the maximum of |\parindent| and 1.5em % \emph{unless} it has been set in the preamble (the weird value % 10in is just for testing whether |\parindentFFN| has been set % or not). -% % \begin{macrocode} -\newcommand*{\dotFFN}{.} -\newcommand*{\kernFFN}{\kern .5em} \newdimen\parindentFFN \parindentFFN=10in -\def\ftnISsymbol{\@fnsymbol\c@footnote} -\long\def\@makefntextFB#1{\ifx\thefootnote\ftnISsymbol - \@makefntextORI{#1}% - \else - \parindent=\parindentFFN - \rule\z@\footnotesep - \setbox\@tempboxa\hbox{\@thefnmark}% - \ifdim\wd\@tempboxa>\z@ - \llap{\@thefnmark}\dotFFN\kernFFN - \fi #1 - \fi}% -% \end{macrocode} -% -% We save the standard definition of |\@makefntext| at the -% |\begin{document}|, and then redefine |\@makefntext| according to -% the value of flag |\ifFBFrenchFootnotes| (true or false). -% -% \begin{macrocode} -\AtBeginDocument{\@ifpackageloaded{bigfoot}{}% - {\ifdim\parindentFFN<10in +% \end{macrocode} +% |\FBfnindent| will be set `AtBeginDocument' to the width of +% the box holding the footnote mark, |\dotFFN| and |\kernFFN| +% (flushed right). It is used by \cls{memoir} and koma-script +% classes. +% \begin{macrocode} +\newcommand*{\dotFFN}{.} +\newcommand*{\kernFFN}{\kern .5em} +\newlength\FBfnindent +% \end{macrocode} +% |\@makefntextFB|'s definition is now tuned according to the +% document's class for better compatibility. +% +% Koma-script classes provide |\deffootnote|, a handy command +% to customise the footnotes' layout (see English manual +% \file{scrguien.pdf}); it redefines |\@makefntext| and +% |\@@makefnmark|. First, save the original definitions. +% \begin{macrocode} +\ifFB@koma + \let\@makefntextORI\@makefntext + \let\@@makefnmarkORI\@@makefnmark +% \end{macrocode} +% |\@makefntextFB| and |\@@makefnmarkFB| will be used when option +% \fbo{FrenchFootnotes} is \fbo{true}. +% \begin{macrocode} + \deffootnote[\FBfnindent]{0pt}{\parindentFFN}% + {\thefootnotemark\dotFFN\kernFFN} + \let\@makefntextFB\@makefntext + \let\@@makefnmarkFB\@@makefnmark +% \end{macrocode} +% |\@makefntextTH| and |\@@makefnmarkTH| are meant for the +% |\thanks| command used by |\maketitle| when \fbo{FrenchFootnotes} +% is \fbo{true}. +% \begin{macrocode} + \deffootnote[\parindentFFN]{0pt}{\parindentFFN}% + {\textsuperscript{\thefootnotemark}} + \let\@makefntextTH\@makefntext + \let\@@makefnmarkTH\@@makefnmark +% \end{macrocode} +% Restore the original definitions. +% \begin{macrocode} + \let\@makefntext\@makefntextORI + \let\@@makefnmark\@@makefnmarkORI +\fi +% \end{macrocode} +% Definitions for the \cls{memoir} class: +% \begin{macrocode} +\@ifclassloaded{memoir} +% \end{macrocode} +% (see original definition in \file{memman.pdf}) +% \begin{macrocode} + {\newcommand{\@makefntextFB}[1]{% + \def\footscript##1{##1\dotFFN\kernFFN}% + \setlength{\footmarkwidth}{\FBfnindent}% + \setlength{\footmarksep}{-\footmarkwidth}% + \setlength{\footparindent}{\parindentFFN}% + \makefootmark #1}% + }{} +% \end{macrocode} +% Definitions for the \cls{beamer} class: +% \begin{macrocode} +\@ifclassloaded{beamer} +% \end{macrocode} +% (see original definition in \file{beamerbaseframecomponents.sty}), +% note that for the \cls{beamer} class footnotes are LR-boxes, not +% paragraphs, so |\parindentFFN| is irrelevant. +% class. +% \begin{macrocode} + {\def\@makefntextFB#1{% + \def\insertfootnotetext{#1}% + \def\insertfootnotemark{\insertfootnotemarkFB}% + \usebeamertemplate***{footnote}}% + \def\insertfootnotemarkFB{% + \usebeamercolor[fg]{footnote mark}% + \usebeamerfont*{footnote mark}% + \@thefnmark\dotFFN\kernFFN}% + }{} +% \end{macrocode} +% Now the default definition of |\@makefntextFB| for standard LaTeX +% and AMS classes. +% +% The next command prints the footnote mark according to the +% specifications of the French `Imprimerie Nationale'. +% Keep in mind that |\@thefnmark| might be empty (i.e. in +% AMS classes' titles)! +% \begin{macrocode} +\providecommand*{\insertfootnotemarkFB}{% + \parindent=\parindentFFN + \rule\z@\footnotesep + \setbox\@tempboxa\hbox{\@thefnmark}% + \ifdim\wd\@tempboxa>\z@ + \llap{\@thefnmark}\dotFFN\kernFFN + \fi} +\providecommand\@makefntextFB[1]{\insertfootnotemarkFB #1} +% \end{macrocode} +% +% The rest of |\@makefntext|'s customisation is done at the +% |\begin{document}|. We save the original definition of +% |\@makefntext|, and then redefine |\@makefntext| according +% to the value of flag |\ifFBFrenchFootnotes| (true or false). +% Koma-script classes require a special treatment. +% +% \begin{macrocode} +\AtBeginDocument{% + \@ifpackageloaded{bigfoot}{}% + {\ifdim\parindentFFN<10in + \else + \parindentFFN=\parindent + \ifdim\parindentFFN<1.5em \parindentFFN=1.5em \fi + \fi + \settowidth{\FBfnindent}{\dotFFN\kernFFN}% + \addtolength{\FBfnindent}{\parindentFFN}% + \let\@makefntextORI\@makefntext + \ifFB@koma +% \end{macrocode} +% Definition of |\@makefntext| for koma-script classes: +% \begin{macrocode} + \let\@@makefnmarkORI\@@makefnmark + \long\def\@makefntext#1{% + \ifFBFrenchFootnotes + \ifx\footnote\thanks + \let\@@makefnmark\@@makefnmarkTH + \@makefntextTH{#1}% \else - \parindentFFN=\parindent - \ifdim\parindentFFN<1.5em \parindentFFN=1.5em \fi + \let\@@makefnmark\@@makefnmarkFB + \@makefntextFB{#1}% \fi - \let\@makefntextORI\@makefntext - \long\def\@makefntext#1{% - \ifFBFrenchFootnotes - \@makefntextFB{#1}% - \else - \@makefntextORI{#1}% - \fi}% - }% - } + \else + \let\@@makefnmark\@@makefnmarkORI + \@makefntextORI{#1}% + \fi}% + \else +% \end{macrocode} +% Special add-on for the \cls{memoir} class: |\maketitle| redefines +% |\@makefntext| as |\makethanksmark| which is customised as follows +% to match the other notes' vertical alignment. +% \begin{macrocode} + \@ifclassloaded{memoir}% + {\ifFBFrenchFootnotes + \setlength{\thanksmarkwidth}{\parindentFFN}% + \setlength{\thanksmarksep}{-\thanksmarkwidth}% + \fi + }{}% +% \end{macrocode} +% Special add-on for the \cls{beamer} class: issue a warning +% in case |\parindentFFN| has been changed. +% \begin{macrocode} + \@ifclassloaded{beamer}% + {\ifFBFrenchFootnotes + \ifdim\parindentFFN=1.5em\else + \FBWarning{frenchb}{% + \protect\parindentFFN\space is ineffective% + \MessageBreak within the beamer class.\MessageBreak + Reported}% + \fi + \fi + }{}% +% \end{macrocode} +% Definition of |\@makefntext| for all classes other than +% koma-script: +% \begin{macrocode} + \long\def\@makefntext#1{% + \ifFBFrenchFootnotes + \@makefntextFB{#1}% + \else + \@makefntextORI{#1}% + \fi}% + \fi + }% +} % \end{macrocode} % % For compatibility reasons, we provide definitions for the commands |