diff options
Diffstat (limited to 'Master/texmf-dist/source/generic')
-rw-r--r-- | Master/texmf-dist/source/generic/babel-french/frenchb.dtx | 185 |
1 files changed, 114 insertions, 71 deletions
diff --git a/Master/texmf-dist/source/generic/babel-french/frenchb.dtx b/Master/texmf-dist/source/generic/babel-french/frenchb.dtx index 9bc8b728add..9b640647b54 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{3294} +%\CheckSum{3296} % %\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> - [2014/06/21 v3.1a French support from the babel system] + [2014/09/16 v3.1b French support from the babel system] %</!lua> %<*internal> \iffalse %</internal> %<*lua> -- --- File `frenchb.lua' generated from frenchb.dtx [2014/06/21 v3.1a] +-- File `frenchb.lua' generated from frenchb.dtx [2014/09/16 v3.1b] -- -- Copyright (C) 2014 Daniel Flipo <daniel.flipo at free.fr> -- License LPPL: see frenchb.dtx. @@ -59,7 +59,7 @@ \usepackage[expansion=true,protrusion=true]{microtype} \def\ColorArg{\color{PineGreen}} \usepackage{url} -\usepackage[colorlinks,urlcolor=blue]{hyperref} +\usepackage[colorlinks,urlcolor=blue,unicode]{hyperref} \newcommand*\babel{\textsf{babel}} \newcommand*\frenchb{\textsf{frenchb}} \newcommand*\note[1]{} @@ -79,6 +79,7 @@ \makeatother \hyphenation{Lua-TeX Lua-LaTeX Xe-LaTeX} \lefthyphenmin=2 \righthyphenmin=3 +\RecordChanges \AtEndDocument{% \GlossaryPrologue{\section{{Change History}}}% \clearpage\PrintChanges @@ -86,7 +87,6 @@ \begin{document} \setlength{\parindent}{0pt} \GetFileInfo{frenchb.dtx} -\RecordChanges \begin{center} \textbf{\Large A Babel language definition file for French}\\[2mm]^^A\] \textbf{\large frenchb.dtx \fileversion, \filedate}\\[3mm]^^A\] @@ -461,6 +461,10 @@ % figures' and tables' captions must be typeset as with pre~3.0 % versions of \frenchb{} (with |\CaptionSeparator| in French and % colon otherwise). Intended for standard \LaTeX{} classes only. +% \item [SmallCapsFigTabcaptions=false (true*)]; when set to +% \fbo{false}, |\figurename| and |\tablename| will be printed in +% French captions as ``Figure'' and ``Table'' instead of +% ``\textsc{Figure}'' and ``\textsc{Table}'' (the default). % \item [SuppressWarning=true (false)]; can be turned to \fbo{true} % if you are bored with \frenchb's warnings. % \item [INGuillSpace=true (false)] resets the dimensions of spaces @@ -535,25 +539,29 @@ % redefine captions, even if \babel{}'s option was entered as % |francais| or |frenchb|. % -% For \emph{all} languages, when French is the main language, -% \frenchb{} changes the separator (colon) used in figures' -% and tables' captions to |\CaptionSeparator| which defaults to -% `~--~' and can be redefined in the preamble with\\ +% When French is the main language, \frenchb{} changes the separator +% (colon) used in figures' and tables' captions \emph{for all +% languages} to |\CaptionSeparator| which defaults to `~--~' and can +% be redefined in the preamble with\\ % |\renewcommand*{\CaptionSeparator}{...}|. % % When French is not the main language, the colon is preserved for % all languages but \frenchb{} makes sure that a proper space is % typeset before it. % -% Two new options are provided: if \fbo{CustomiseFigTabCaptions} is +% Three new options are provided: if \fbo{CustomiseFigTabCaptions} is % set to \fbo{false} the colon will be used as separator in all % languages, with a proper space before the colon in French. -% The second option \fbo{OldFigTabCaptions} can be set to \fbo{true} +% The second option, \fbo{OldFigTabCaptions}, can be set to \fbo{true} % to print figures' and tables' captions as they were with versions % pre~3.0 of \frenchb{} (using |\CaptionSeparator| in French and % colon in other languages); this option only makes sense with the % standard \LaTeX{} classes \cls{article}, \cls{report} and % \cls{book}. +% The last option, \fbo{SmallCapsFigTabcaptions}, can be set to +% \fbo{false} to typeset |\figurename| and |\tablename| in French as +% ``Figure'' and ``Table'' instead of \textsc{Figure} and +% \textsc{Table} (the default). % % \subsection{Hyphenation checks} % \label{ssec-hyphen} @@ -1315,22 +1323,27 @@ local guilwd = guil10.width/65536/3.33 local guilst = guil10.stretch/65536/1.665 local guilsh = guil10.shrink/65536/1.11 % \end{macrocode} -% and a function to scale them for the current font: +% and a function to scale them for the current font (beware of null +% values for fid, see |\nullfont| in TikZ): % \begin{macrocode} local font_table = {} local function new_glue_scaled (fid,width,stretch,shrink) - local fp = font_table[fid] - if not fp then - font_table[fid] = font.getfont(fid).parameters - fp = font_table[fid] + if fid > 0 then + local fp = font_table[fid] + if not fp then + font_table[fid] = font.getfont(fid).parameters + fp = font_table[fid] + end + local gl = new_node(GLUE,0) + local gl_spec = new_node(GSPEC) + gl_spec.width = width * fp.space + gl_spec.stretch = stretch * fp.space_stretch + gl_spec.shrink = shrink * fp.space_shrink + gl.spec = gl_spec + return gl + else + return nil end - local gl = new_node(GLUE,0) - local gl_spec = new_node(GSPEC) - gl_spec.width = width * fp.space - gl_spec.stretch = stretch * fp.space_stretch - gl_spec.shrink = shrink * fp.space_shrink - gl.spec = gl_spec - return gl end % \end{macrocode} % Let's catch LuaTeX attributes |\FB@addDPspace| and @@ -1351,14 +1364,19 @@ local has_attribute = node.has_attribute % 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|). +% +% \changes{v3.1b}{2014/09/16}{frenchb.lua: add a check for null fid +% in french\_punctuation (Tikz \cs{nullfont}). +% Bug pointed out by Paul Gaborit.} +% % \begin{macrocode} local function french_punctuation (head) for item in node.traverse_id(GLYPH, head) do local lang = item.lang local char = item.char + local fid = item.font local SIG = has_attribute(item, addGUILspace) - if lang == FR and FB_punct_left[char] then - local fid = item.font + if lang == FR and FB_punct_left[char] and fid > 0 then local prev = item.prev local prev_id, prev_subtype, prev_char if prev then @@ -1405,7 +1423,7 @@ local function french_punctuation (head) % definition of `auto'.} % % \begin{macrocode} - if FB_punct_thin[char] or FB_punct_thick[char] then + if (FB_punct_thin[char] or FB_punct_thick[char]) then local SBDP = has_attribute(item, addDPspace) local fbglue if FB_punct_thick[char] then @@ -1414,10 +1432,10 @@ local function french_punctuation (head) fbglue = new_glue_scaled(fid,thinwd,thinst,thinsh) end local auto = - SBDP and SBDP > 0 and - ((prev_char and not FB_punct_null[prev_char]) or - (not prev_char and (prev_id ~= 0 or prev_subtype ~= 3)) - ) + SBDP and SBDP > 0 and + ((prev_char and not FB_punct_null[prev_char]) or + (not prev_char and (prev_id ~= 0 or prev_subtype ~= 3)) + ) if glue or auto then if glue then head = remove_node(head,prev,true) @@ -1463,7 +1481,8 @@ local function french_punctuation (head) % \emph{glue} possibly following it and to insert the proper % \emph{glue} and nobreak penalty in this order if necessary. % \begin{macrocode} - if lang == FR and FB_punct_right[char] and SIG and SIG > 0 then + if lang == FR and FB_punct_right[char] and fid > 0 + and SIG and SIG > 0 then local next = item.next local next_id, next_subtype, next_char, kern_wd, nextnext if next then @@ -1615,9 +1634,6 @@ return french_punctuation % \changes{v2.5d}{2011/01/19}{Moved the \cs{newcount} command outside % \cs{ifFB@xetex@punct} ... \cs{fi} (it broke Plain formats).} % -% \changes{v2.5g}{2012/01/02}{Add four \cs{newif} to control -% spacing of quotes (characters and control sequences).} -% % The following part holds specific code for punctuation with XeTeX % engines. % \begin{macrocode} @@ -2221,11 +2237,6 @@ return french_punctuation \let\FBeveryparguill\FBguillopen \ifFB@luatex@punct \let\FBeverylineguill\FBguillopen - \ifLaTeXe - \let\local@leftbox\luatexlocalleftbox - \else - \let\local@leftbox\localleftbox - \fi \else \let\FBeverylineguill\FBguillnone \fi @@ -2277,12 +2288,12 @@ return french_punctuation % beginning of every line. % \begin{macrocode} \ifx\FBeverylineguill\FBguillopen - \local@leftbox{\guillemotleft\kern.8\fontdimen2\font}% + \luatexlocalleftbox{\guillemotleft\kern.8\fontdimen2\font}% \let\FBeverypar@quote\relax \FB@og #1\ifFBcloseguill\FB@fg\fi \else \ifx\FBeverylineguill\FBguillclose - \local@leftbox{\guillemotright\kern.8\fontdimen2\font}% + \luatexlocalleftbox{\guillemotright\kern.8\fontdimen2\font}% \let\FBeverypar@quote\relax \FB@og #1\ifFBcloseguill\FB@fg\fi \else @@ -2535,14 +2546,18 @@ return french_punctuation % \begin{macro}{\iemes} % \begin{macro}{\iers} % \begin{macro}{\ieres} -% Some handy macros for those who don't know how to abbreviate ordinals: +% \changes{v3.1b}{2014/06/23}{Removed \cs{lowercase} from definitions +% of \cs{ieme} and co: \cs{up} already does the conversion.} +% +% Some handy macros for those who don't know how to abbreviate +% ordinals: % \begin{macrocode} -\def\ieme{\up{\lowercase{e}}\xspace} -\def\iemes{\up{\lowercase{es}}\xspace} -\def\ier{\up{\lowercase{er}}\xspace} -\def\iers{\up{\lowercase{ers}}\xspace} -\def\iere{\up{\lowercase{re}}\xspace} -\def\ieres{\up{\lowercase{res}}\xspace} +\def\ieme{\up{e}\xspace} +\def\iemes{\up{es}\xspace} +\def\ier{\up{er}\xspace} +\def\iers{\up{ers}\xspace} +\def\iere{\up{re}\xspace} +\def\ieres{\up{res}\xspace} % \end{macrocode} % \end{macro} % \end{macro} @@ -2559,13 +2574,17 @@ return french_punctuation % \begin{macro}{\nos} % \begin{macro}{\primo} % \begin{macro}{\fprimo)} +% \changes{v3.1b}{2014/06/23}{Removed \cs{lowercase} from definitions +% of \cs{FrenchEnumerate}, \dots{} \cs{No} and co: \cs{up} already +% does the conversion.} +% % And some more macros relying on |\up| for numbering, % first two support macros. % \begin{macrocode} \newcommand*{\FrenchEnumerate}[1]{% - #1\up{\lowercase{o}}\kern+.3em} + #1\up{o}\kern+.3em} \newcommand*{\FrenchPopularEnumerate}[1]{% - #1\up{\lowercase{o}})\kern+.3em} + #1\up{o})\kern+.3em} % \end{macrocode} % % Typing |\primo| should result in `$1^{\rm o}$\kern+.3em', @@ -2586,10 +2605,10 @@ return french_punctuation % Let's provide four macros for the common abbreviations % of ``Numéro''. % \begin{macrocode} -\DeclareRobustCommand*{\No}{N\up{\lowercase{o}}\kern+.2em} -\DeclareRobustCommand*{\no}{n\up{\lowercase{o}}\kern+.2em} -\DeclareRobustCommand*{\Nos}{N\up{\lowercase{os}}\kern+.2em} -\DeclareRobustCommand*{\nos}{n\up{\lowercase{os}}\kern+.2em} +\DeclareRobustCommand*{\No}{N\up{o}\kern+.2em} +\DeclareRobustCommand*{\no}{n\up{o}\kern+.2em} +\DeclareRobustCommand*{\Nos}{N\up{os}\kern+.2em} +\DeclareRobustCommand*{\nos}{n\up{os}\kern+.2em} % \end{macrocode} % \end{macro} % \end{macro} @@ -2622,7 +2641,7 @@ return french_punctuation % as a Text Symbol not to conflict with the macro |\tilde| for math % mode and use the name |\tild| instead. Note that |\boi| may % \emph{not} be used in math mode, its name in math mode is -% |\backslash|. |\degre| can be accessed by the command |\r{}| +% |\backslash|. |\degre| can be accessed by the command |\r{}| % for ring accent. % % \changes{v2.5f}{2011/07/18}{Changed definitions of \cs{at}, @@ -2838,6 +2857,17 @@ return french_punctuation % \changes{v3.0a}{2014/02/18}{Take advantage of babel's \cs{SetString} % commands for captionnames.} % +% \changes{v3.1b}{2014/09/15}{Change \cs{scshape} to customisable +% \cs{FBfigtabshape} for \cs{figurename} and \cs{tablename}.} +% +% 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 +% \end{macrocode} +% % New implementation for caption names (requires \babel's~3.9 or up). % \begin{macrocode} \StartBabelCommands*{\BabelLanguages}{captions} @@ -2864,8 +2894,8 @@ return french_punctuation \SetString{\listfigurename}{Table des figures} \SetString{\listtablename}{Liste des tableaux} \SetString{\indexname}{Index} - \SetString{\figurename}{{\scshape Figure}} - \SetString{\tablename}{{\scshape Table}} + \SetString{\figurename}{{\FBfigtabshape Figure}} + \SetString{\tablename}{{\FBfigtabshape Table}} \SetString{\pagename}{page} \SetString{\seename}{voir} \SetString{\alsoname}{voir aussi} @@ -3247,6 +3277,8 @@ return french_punctuation % \changes{v3.1a}{2014/05/20}{New options InnerGuillSingle, % EveryParGuill and EveryLineGuill to control \cs{frquote}.} % +% \changes{v3.1b}{2014/09/15}{New option SmallCapsFigTabCaptions.} +% % \begin{macrocode} \newcommand*{\frenchbsetup}[1]{% \setkeys{FB}{#1}% @@ -3280,6 +3312,7 @@ return french_punctuation \newif\ifFBPartNameFull \FBPartNameFulltrue \newif\ifFBCustomiseFigTabCaptions \FBCustomiseFigTabCaptionsfalse \newif\ifFBOldFigTabCaptions \FBOldFigTabCaptionsfalse +\newif\ifFBSmallCapsFigTabcaptions \FBSmallCapsFigTabcaptionstrue \newif\ifFBSuppressWarning \FBSuppressWarningfalse \newif\ifFBINGuillSpace \FBINGuillSpacefalse % \end{macrocode} @@ -3454,10 +3487,17 @@ return french_punctuation % |\CurrentOption| no longer defined. It's value has been saved % in |\FB@CurOpt| while reading \file{frenchb.ldf}. % \begin{macrocode} - \ifFBOldFigTabCaptions - \FB@addto{extras}{\babel@save\FBCaption@Separator - \def\FBCaption@Separator{\CaptionSeparator}}% - \fi}% + \ifFBOldFigTabCaptions + \FB@addto{extras}{\babel@save\FBCaption@Separator + \def\FBCaption@Separator{\CaptionSeparator}}% + \fi}% + \define@key{FB}{SmallCapsFigTabCaptions}[true]% + {\csname FBSmallCapsFigTabCaptions#1\endcsname + \ifFBSmallCapsFigTabCaptions + \let\FBfigtabshape\scshape + \else + \let\FBfigtabshape\relax + \fi}% \define@key{FB}{SuppressWarning}[true]% {\csname FBSuppressWarning#1\endcsname \ifFBSuppressWarning @@ -3886,6 +3926,7 @@ return french_punctuation SuppressWarning=true [false]\MessageBreak CustomiseFigTabCaptions=false [true]\MessageBreak OldFigTabCaptions=true [false]\MessageBreak + SmallCapsFigTabCaptions=false [true]\MessageBreak INGuillSpace=true [false]\MessageBreak InnerGuillSingle=true [false]\MessageBreak EveryParGuill=open, close, none [open]\MessageBreak @@ -3966,7 +4007,7 @@ return french_punctuation % \cs{ifFBunicode} and `xltxtra' changed to `fontspec'.} % % \changes{v3.1a}{2014/06/14}{fontspec is not required for T1 fonts -% used be with the luainputenc.sty package.} +% used with the luainputenc.sty package.} % % Some warnings are issued when output font encodings are not % properly set. With XeLaTeX or LuaLaTeX, \file{fontspec.sty} and @@ -4070,20 +4111,22 @@ return french_punctuation % aligned as follows:\\ % \fbox{\parbox[t]{.5\textwidth}{% % \parindent=1.5em +% \def\FBlabel{\textemdash}% +% \settowidth{\labelwidth}{\FBlabel}% % Text starting at `parindent' \\ % \noindent$\Leftarrow$ Leftmargin\\ -% \hspace*{\parindent}\textendash{} first item\dots{}\\ -% \hspace*{\parindent}\hspace*{\labelsep}% -% \textendash{} first second level item\\ -% \hspace*{\parindent}\hspace*{\labelsep}% -% \textendash{} next one\dots{}\\ -% \hspace*{\parindent}\textendash{} second item\dots{} +% \hspace*{\parindent}\textemdash{} first item\dots\\ +% \hspace*{\parindent}\hspace*{\labelwidth}% +% \textemdash{} first second level item\\ +% \hspace*{\parindent}\hspace*{\labelwidth}% +% \textemdash{} next one\dots{}\\ +% \hspace*{\parindent}\textemdash{} second item\dots % }} % \end{itemize} % % \begin{macro}{\FrenchLabelItem} -% \changes{v2.6a}{2013/01/30}{defaults to \cs{textemdash} instead of -% \cs{textendash} up to v.~2.5k.} +% \changes{v2.6a}{2013/01/30}{default changed from \cs{textendash} to +% \cs{textemdash}.} % \begin{macro}{\Frlabelitemi} % \begin{macro}{\Frlabelitemii} % \begin{macro}{\Frlabelitemiii} @@ -4270,7 +4313,7 @@ return french_punctuation % \begin{macro}{\update@frenchlists} % \begin{macro}{\bbl@frenchlistlayout} % \begin{macro}{\bbl@nonfrenchlistlayout} -% |\update@frenchlists| will setup lists according to the options +% |\update@frenchlists| will set up lists according to the options % of \fbsetup{}. % \begin{macrocode} \def\update@frenchlists{% |