diff options
Diffstat (limited to 'Master/texmf-dist/source/generic/babel-french/frenchb.dtx')
-rw-r--r-- | Master/texmf-dist/source/generic/babel-french/frenchb.dtx | 507 |
1 files changed, 381 insertions, 126 deletions
diff --git a/Master/texmf-dist/source/generic/babel-french/frenchb.dtx b/Master/texmf-dist/source/generic/babel-french/frenchb.dtx index 1ab4c36a678..9bc8b728add 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{3084} +%\CheckSum{3294} % %\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/04/18 v3.0c French support from the babel system] + [2014/06/21 v3.1a French support from the babel system] %</!lua> %<*internal> \iffalse %</internal> %<*lua> -- --- File `frenchb.lua' generated from frenchb.dtx [2014/04/18 v3.0c] +-- File `frenchb.lua' generated from frenchb.dtx [2014/06/21 v3.1a] -- -- Copyright (C) 2014 Daniel Flipo <daniel.flipo at free.fr> -- License LPPL: see frenchb.dtx. @@ -51,9 +51,6 @@ %<*filedriver> \documentclass[a4paper]{ltxdoc} \usepackage[left=42mm,right=42mm,top=40mm,bottom=40mm]{geometry} -\usepackage{url} -\usepackage[colorlinks,urlcolor=blue]{hyperref} -\usepackage{bookmark} \usepackage[utf8]{inputenc} \usepackage{bera} \usepackage[pdftex,dvipsnames]{xcolor} @@ -61,6 +58,8 @@ \strut\MacroFont\color{Sepia}\normalsize\string#1} \usepackage[expansion=true,protrusion=true]{microtype} \def\ColorArg{\color{PineGreen}} +\usepackage{url} +\usepackage[colorlinks,urlcolor=blue]{hyperref} \newcommand*\babel{\textsf{babel}} \newcommand*\frenchb{\textsf{frenchb}} \newcommand*\note[1]{} @@ -73,6 +72,11 @@ \renewcommand*\descriptionlabel[1]{% \hspace\labelsep \normalfont \fbo{#1}} \providecommand*\eTeX{\leavevmode\hbox{$\varepsilon$}-\TeX} +\makeatletter +\newcommand*{\FBguillspace}{\penalty\@M\hskip.8\fontdimen2\font + plus.3\fontdimen3\font + minus.8\fontdimen4\font} +\makeatother \hyphenation{Lua-TeX Lua-LaTeX Xe-LaTeX} \lefthyphenmin=2 \righthyphenmin=3 \AtEndDocument{% @@ -107,7 +111,7 @@ % % Customisation for the French language is achieved following the % book ``Lexique des règles typographiques en usage à -% l'Imprimerie nationale'' troisième édition (1994), +% l'Imprimerie Nationale'' troisième édition (1994), % ISBN-2-11-081075-0. % % First version released: 1.1 (May 1996) as part of @@ -202,17 +206,58 @@ % % |\og| and |\fg| can be used outside French, they typeset % then English quotes `` and ''. +% +% A new command |\frquote{}| has been added in version~3.1 to +% enter French quotations. |\frquote{|\textit{texte}|}| is +% equivalent to |\og| \textit{texte} |\fg{}| for short +% quotations. For quotations spreading over more than one +% paragraph, |\frquote| will add at the beginning of every +% paragraph of the quotation either an opening French +% guillemet («), or a closing one (») depending on option +% \fbo{EveryParGuill=open} or \fbo{=close}, see +% p.~\pageref{everyparguill}.\label{frquote} +% +% |\frquote| is recommended to enter embedded quotations ``à la +% française'', several variants are provided through options: +% \begin{itemize} +% \item with LuaTeX based engines, every line of the inner +% quotation will start with a French guillemet (« or ») +% depending on option \fbo{EveryLineGuill=open} (default) or +% \fbo{=close} unless you explicitly set +% \fbo{EveryLineGuill=none}, then |\frquote{}| will behave +% as with non-LuaTeX engines; +% \item with all other engines, the inner quotation is +% surrounded by double quotes (``\textit{texte}'') unless +% option \fbo{InnerGuillSingle=true}, then a) the inner +% quotation is printed as +% \guilsinglleft\FBguillspace\textit{texte}\FBguillspace +% \guilsinglright{} and b) if the inner quotation +% spreads over more than one paragraph, every paragraph +% included in the inner quotation starts with +% a \guilsinglleft{} or a \guilsinglright, depending on +% option \fbo{EveryParGuill=open} or \fbo{close}. +% \end{itemize} +% A starred variant |\frquote*| is meant for inner quotations +% which end together with the outer one: using |\frquote*| for +% the inner quotation will print only one closing quote +% character (the outer one) as recommended by the French +% `Imprimerie Nationale'. +% % \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 % ordinals: |\ier|, |\iere|, |\iers|, |\ieres|, |\ieme|, % |\iemes| (|3\iemes| prints 3\textsuperscript{es}). +% All these commands take advantage of real superscript +% letters when they are available in the current font. +% % \item Family names should be typeset in small capitals and never % be hyphenated, the macro |\bsc| (boxed small caps) does % this, e.g., |L.~\bsc{Lamport}| will print the same as % |L.~\mbox{\textsc{Lamport}}|. Note that composed names % (such as Dupont-Durant) may now be hyphenated on explicit % hyphens, this differs from \frenchb~v.~1.x. +% % \item Commands |\primo|, |\secundo|, |\tertio| and |\quarto| % print 1\textsuperscript{o}, 2\textsuperscript{o}, % 3\textsuperscript{o}, 4\textsuperscript{o}. @@ -221,12 +266,14 @@ % (N\textsuperscript{o} N\textsuperscript{os} % n\textsuperscript{o} and n\textsuperscript{os}~) % are obtained via the commands |\No|, |\Nos|, |\no|, |\nos|. +% % \item Two commands are provided to typeset the symbol for % ``degré'': |\degre| prints the raw character and % |\degres| should be used to typeset temperatures (e.g., % ``|20~\degres C|'' with an unbreakable space), or for % alcohols'' strengths (e.g., ``|45\degres|'' with \emph{no} % space in French). +% % \item In math mode the comma has to be surrounded with % braces to avoid a spurious space being inserted after it, % in decimal numbers for instance (see the \TeX{}book p.~134). @@ -236,11 +283,13 @@ % explicit space has to be added in lists and intervals: % |$[0,\ 1]$|, |$(x,\ y)$|. |\StandardMathComma| switches % back to the standard behaviour of the comma. +% % \item A command |\nombre| was provided in 1.x versions to easily % format numbers in slices of three digits separated either % by a comma in English or with a space in French; |\nombre| % is now mapped to |\numprint| from \file{numprint.sty}, see % \file{numprint.pdf} for more information. +% % \item \frenchb{} has been designed to take advantage of the % \pkg{xspace} package if present: adding % |\usepackage{xspace}| in the preamble will force macros like @@ -370,7 +419,7 @@ % automatically typeset nobreakspaces the width of which is % either |\FBthinspace| (defauts to |\thinspace|) before `|;|' % `|!|' `|?|' or |\FBcolonspace| (defauts to |\space|) before -% `|:|'; the defaults follow the French Imprimerie nationale's +% `|:|'; the defaults follow the French `Imprimerie Nationale's % recommendations. This is convenient in most cases but can lead % to addition of spurious spaces in URLs, in MS-DOS paths or in % timetables (10:55), except if they are typed in |\texttt| or @@ -391,12 +440,7 @@ % unbreakable space added before the colon `:' to a thin space, % so that the same amount of space is added before any of the % four `high punctuation' characters. The default setting is -% supported by the French Imprimerie nationale. -% \item [INGuillSpace=true (false)] resets the dimensions of spaces -% 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. +% supported by the French `Imprimerie Nationale'. % \item [LowercaseSuperscripts=false (true)]; by default \frenchb{} % inhibits the uppercasing of superscripts (for instance when % they are moved to page headers). Making this option @@ -419,7 +463,42 @@ % colon otherwise). Intended for standard \LaTeX{} classes only. % \item [SuppressWarning=true (false)]; can be turned to \fbo{true} % if you are bored with \frenchb's warnings. -% \item [\texttt{og=\guillemotleft}, \texttt{fg=\guillemotright}]; +% \item [INGuillSpace=true (false)] resets the dimensions of spaces +% 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. +% \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 +% every parapraph in case of a level 1 (outer) quotation +% spreading over more than one parapraph. This option is also +% considered for level 2 (inner) quotations to decide between +% \texttt{\guilsinglleft} and \texttt{\guilsinglright} when +% \fbo{InnerGuillSingle=true} (see below). \label{everyparguill} +% \item [EveryLineGuill=open, close, none (open in LuaTeX, none +% otherwise)]; with engines other than LuaTeX this +% option is set to \fbo{none} which means that nothing will be +% printed at the beginning of every line of inner quotations, +% trying to set this option will issue a warning in the +% \file{.log} file. +% +% With LuaTeX based engines, this option is set to \fbo{open} by +% default, it ensures that a \guillemotleft{} followed by proper +% kern will be repeated at the beginning of every line in case an +% embedded (inner) quotation spreads over more than one line +% (provided that both outer and inner quotations are entered with +% |\frquote{}|). Set this option to \fbo{close} if you want +% a \guillemotright{} instead of a \guillemotleft. +% \item [InnerGuillSingle=true (false)]; +% if \fbo{InnerGuillSingle=false} (default), inner quotations +% entered with |\frquote{}| start with~\texttt{``} and end +% with~\texttt{''}. +% If \fbo{InnerGuillSingle=true}, \texttt{\guilsinglleft} and +% \texttt{\guilsinglright} are used instead of British double +% quotes. Please note that this option only makes +% sense when \fbo{EveryLineGuill=none}. +% \item [og=\guillemotleft, fg=\guillemotright]; % when guillemets characters are available on the keyboard % (through a compose key for instance), it is nice to use them % instead of typing |\og| and |\fg|. This option tells @@ -523,6 +602,12 @@ % \subsection{Changes} % \label{ssec-changes} % +% \subsubsection*{What's new in version 3.1?} +% +% New command |\frquote{}| meant to enter French quotations, +% especially long ones (spreading over several paragraphs) and/or +% embedded ones. see p.~\pageref{frquote} for details. +% % \subsubsection*{What's new in version 3.0?} % % Many deep changes lead me to step \frenchb's version number @@ -562,7 +647,7 @@ % % Starting with version~3.0c, \frenchb{} no longer customises % lists with the \cls{beamer} class and offers a new option -% (\fbo{INGuillSpace}) to follow French Imprimerie Nationale +% (\fbo{INGuillSpace}) to follow French `Imprimerie Nationale' % recommendations regarding quotes' spacing. % % \subsubsection*{What's new in version 2.6?} @@ -1106,6 +1191,8 @@ % \changes{v3.0c}{2014/03/26}{Just load luatexbase.sty instead of % luaotfload.sty with plain formats.} % +% \changes{v3.1a}{2014/05/30}{Misplaced \cs{fi} for plain formats.} +% % We define two LuaTeX attributes to control spacing in French % for `high punctuation' and quotes, making sure that % |\newluatexattribute| is defined. @@ -1124,11 +1211,11 @@ \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname newluatexattribute\endcsname\relax \input luatexbase.sty - \newluatexattribute\FB@addDPspace \FB@addDPspace=1 \relax - \newluatexattribute\FB@addGUILspace \FB@addGUILspace=0 \relax - \fb@info{No need for active punctuation characters\\ - with this version of LuaTeX!} \fi + \newluatexattribute\FB@addDPspace \FB@addDPspace=1 \relax + \newluatexattribute\FB@addGUILspace \FB@addGUILspace=0 \relax + \fb@info{No need for active punctuation characters\\ + with this version of LuaTeX!} \fi \fi % \end{macrocode} @@ -1142,6 +1229,10 @@ % % First we define two flags to control spacing before French `high % punctuation' (thin space or inter-word space). +% +% \changes{v3.1a}{2014/06/16}{frenchb.lua: codes 0x13 and 0x14 added +% for French quotes in T1-encoding.} +% % \begin{macrocode} local FB_punct_thin = {[string.byte("!")] = true, @@ -1154,16 +1245,21 @@ local FB_punct_thick = % `\guillemotright' (U+00BB) can be done by the way; we define two % flags, |FB_punct_left| for characters requiring some space before % them and |FB_punct_right| for `\guillemotleft' which must be -% followed by some space. +% followed by some space. In case LuaTeX is used to output +% T1-encoded fonts instead of OpenType fonts, codes \texttt{0x13} +% and \texttt{0x14} have to be added for `\guillemotleft' and +% `\guillemotright'. % \begin{macrocode} local FB_punct_left = {[string.byte("!")] = true, [string.byte("?")] = true, [string.byte(";")] = true, [string.byte(":")] = true, + [0x14] = true, [0xBB] = true} local FB_punct_right = - {[0xAB] = true} + {[0x13] = true, + [0xAB] = true} % \end{macrocode} % Two more flags will be needed to avoid spurious spaces in % strings like !! ?? or (?) @@ -1189,6 +1285,7 @@ local FB_guil_null = local new_node = node.new local copy_node = node.copy local node_id = node.id +local KERN = node_id("kern") local GLUE = node_id("glue") local GSPEC = node_id("glue_spec") local GLYPH = node_id("glyph") @@ -1337,9 +1434,19 @@ local function french_punctuation (head) % options \fbo{og=\guillemotleft, fg=\guillemotright} in % \fbsetup{} and can be denied locally with |\NoAutoSpacing| % (this is controlled by the |SIG| flag). +% +% \changes{v3.1a}{2014/06/18}{frenchb.lua: added flag addgl which must +% also be true when prev or next is not a char (i.e. kern0 in +% «\cs{texttt}\{a\}»).} +% +% \changes{v3.1a}{2014/06/18}{frenchb.lua: look ahead when next is a kern +% (i.e in « \cs{texttt}\{a\} »).} +% % \begin{macrocode} elseif SIG and SIG > 0 then - if glue or (prev_char and not FB_guil_null[prev_char]) then + local addgl = (prev_char and not FB_guil_null[prev_char]) or + (not prev_char) + if glue or addgl then if glue then head = remove_node(head,prev,true) end @@ -1358,12 +1465,27 @@ local function french_punctuation (head) % \begin{macrocode} if lang == FR and FB_punct_right[char] and SIG and SIG > 0 then local next = item.next - local next_id, next_subtype, next_char + local next_id, next_subtype, next_char, kern_wd, nextnext 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} »|): +% \begin{macrocode} + elseif next_id == KERN then + kern_wd = next.kern + if kern_wd == 0 then + nextnext = next.next + if nextnext then + next = nextnext + next_id = nextnext.id + next_subtype = nextnext.subtype + next_char = nextnext.char + end + end end end local glue = next_id == GLUE and next_subtype == 0 @@ -1372,7 +1494,9 @@ local function french_punctuation (head) glue_wd = glue_spec.width end glue = glue and glue_wd > 0 - if glue or (next_char and not FB_guil_null[next_char]) then + local addgl = (next_char and not FB_guil_null[next_char]) or + (not next_char) + if glue or addgl then if glue then head = remove_node(head,next,true) end @@ -1924,9 +2048,8 @@ return french_punctuation % 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 multilingual texts -% is to use the package \pkg{csquotes} and its command -% |\enquote|. +% 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 @@ -2074,6 +2197,127 @@ return french_punctuation \FB@addto{extras}{\babel@save\og \babel@save\fg \bbl@frenchguillemets} % \end{macrocode} % +% \changes{v3.1a}{2014/05/20}{New command \cs{frquote} for imbedded or +% long French quotations.} +% +% \begin{macro}{\frquote} +% Maximum two levels are supported by |\frquote{}|. +% Let's define the default quote characters to be used for level one +% or two of quotes\dots{} +% \begin{macrocode} +\newcommand*{\ogi}{\FB@og} +\newcommand*{\fgi}{\FB@fg} +\newcommand*{\ogii}{\textquotedblleft} +\newcommand*{\fgii}{\textquotedblright} +% \end{macrocode} +% and the needed technical stuff to handle options: +% \begin{macrocode} +\newcount\FBguill@level +\newif\ifFBcloseguill \FBcloseguilltrue +\newif\ifFBInnerGuillSingle +\def\FBguillopen{\bgroup\NoAutoSpacing\guillemotleft\egroup} +\def\FBguillclose{\bgroup\NoAutoSpacing\guillemotright\egroup} +\let\FBguillnone\relax +\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 +% \end{macrocode} +% The main command |\frquote| accepts (in \LaTeXe{} only) a starred +% version which suppresses the closing quote; it is meant to be used +% for inner quotations which end together with the outer one, then +% only one closing guillemet (the outer one) should be printed. +% \begin{macrocode} +\ifLaTeXe + \DeclareRobustCommand\frquote{% + \@ifstar{\FBcloseguillfalse\fr@quote}% + {\FBcloseguilltrue\fr@quote}} +\else + \newcommand\frquote[1]{\fr@quote{#1}} +\fi +% \end{macrocode} +% The internal command |\fr@quote| takes one (long) argument: the +% quotation text. +% \begin{macrocode} +\newcommand{\fr@quote}[1]{% + \bgroup + \ifnum\FBguill@level=2 + \PackageWarning{frenchb.ldf}{% + \protect\frquote\space accepts no more than two levels + \MessageBreak of quotations. Reported} + \else + \advance\FBguill@level by \@ne + \fi + \ifnum\FBguill@level=1 +% \end{macrocode} +% Set |\FBeverypar@quote| for level 1 quotations: +% \begin{macrocode} + \ifx\FBeveryparguill\relax + \let\FBeverypar@quote\relax + \else + \def\FBeverypar@quote{\FBeveryparguill + \kern.8\fontdimen2\font}% + \fi + \expandafter\csname og\romannumeral\FBguill@level\endcsname + \everypar \expandafter{\the\everypar \FBeverypar@quote}% + #1% + \expandafter\csname fg\romannumeral\FBguill@level\endcsname + \else +% \end{macrocode} +% This for level 2 (inner) quotations: Omega's command +% |\localleftbox| (included in LuaTeX, renamed |\luatexlocalleftbox| +% in LuaLaTeX) is convenient for repeating guillemets at the +% beginning of every line. +% \begin{macrocode} + \ifx\FBeverylineguill\FBguillopen + \local@leftbox{\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}% + \let\FBeverypar@quote\relax + \FB@og #1\ifFBcloseguill\FB@fg\fi + \else +% \end{macrocode} +% otherwise we need to redefine |\FBeverypar@quote| (and eventually +% |\ogii|, |\fgii|) for level 2 quotations: +% \begin{macrocode} + \let\FBeverypar@quote\relax + \ifFBInnerGuillSingle + \def\ogii{\leavevmode + \guilsinglleft\FBguillspace}% + \def\fgii{\ifdim\lastskip>\z@\unskip\fi + \FBguillspace\guilsinglright}% + \ifx\FBeveryparguill\FBguillopen + \def\FBeverypar@quote{\guilsinglleft + \kern.8\fontdimen2\font}% + \fi + \ifx\FBeveryparguill\FBguillclose + \def\FBeverypar@quote{\guilsinglright + \kern.8\fontdimen2\font}% + \fi + \fi + \expandafter\csname og\romannumeral\FBguill@level\endcsname + #1% + \ifFBcloseguill\expandafter + \csname fg\romannumeral\FBguill@level\endcsname + \fi + \fi + \fi + \fi + \egroup +} +% \end{macrocode} +% \end{macro} +% % \subsection{Date in French} % \label{sssec-date} % @@ -3000,6 +3244,9 @@ return french_punctuation % % \changes{v3.0c}{2014/04/18}{New option INGuillSpace.} % +% \changes{v3.1a}{2014/05/20}{New options InnerGuillSingle, +% EveryParGuill and EveryLineGuill to control \cs{frquote}.} +% % \begin{macrocode} \newcommand*{\frenchbsetup}[1]{% \setkeys{FB}{#1}% @@ -3012,6 +3259,7 @@ return french_punctuation % (true or false). % % \begin{macrocode} +\newif\ifFBShowOptions \FBShowOptionsfalse \newif\ifFBStandardLayout \FBStandardLayouttrue \newif\ifFBGlobalLayoutFrench \FBGlobalLayoutFrenchtrue \newif\ifFBReduceListSpacing \FBReduceListSpacingfalse @@ -3026,7 +3274,6 @@ return french_punctuation \newif\ifFBAutoSpaceFootnotes \FBAutoSpaceFootnotesfalse \newif\ifFBOriginalTypewriter \FBOriginalTypewriterfalse \newif\ifFBThinColonSpace \FBThinColonSpacefalse -\newif\ifFBINGuillSpace \FBINGuillSpacefalse \newif\ifFBThinSpaceInFrenchNumbers \FBThinSpaceInFrenchNumbersfalse \newif\ifFBFrenchSuperscripts \FBFrenchSuperscriptstrue \newif\ifFBLowercaseSuperscripts \FBLowercaseSuperscriptstrue @@ -3034,7 +3281,7 @@ return french_punctuation \newif\ifFBCustomiseFigTabCaptions \FBCustomiseFigTabCaptionsfalse \newif\ifFBOldFigTabCaptions \FBOldFigTabCaptionsfalse \newif\ifFBSuppressWarning \FBSuppressWarningfalse -\newif\ifFBShowOptions \FBShowOptionsfalse +\newif\ifFBINGuillSpace \FBINGuillSpacefalse % \end{macrocode} % % The defaults values of these flags have been choosen so that @@ -3087,6 +3334,8 @@ return french_punctuation % \babel's loading. % \begin{macrocode} \RequirePackage{keyval}% + \define@key{FB}{ShowOptions}[true]% + {\csname FBShowOptions#1\endcsname}% \define@key{FB}{StandardLayout}[true]% {\csname FBStandardLayout#1\endcsname \ifFBStandardLayout @@ -3184,21 +3433,19 @@ return french_punctuation {\csname FBOriginalTypewriter#1\endcsname}% \define@key{FB}{ThinColonSpace}[true]% {\csname FBThinColonSpace#1\endcsname}% - \define@key{FB}{INGuillSpace}[true]% - {\csname FBINGuillSpace#1\endcsname}% \define@key{FB}{ThinSpaceInFrenchNumbers}[true]% - {\csname FBThinSpaceInFrenchNumbers#1\endcsname}% + {\csname FBThinSpaceInFrenchNumbers#1\endcsname}% \define@key{FB}{FrenchSuperscripts}[true]% - {\csname FBFrenchSuperscripts#1\endcsname} + {\csname FBFrenchSuperscripts#1\endcsname} \define@key{FB}{LowercaseSuperscripts}[true]% - {\csname FBLowercaseSuperscripts#1\endcsname} + {\csname FBLowercaseSuperscripts#1\endcsname} \define@key{FB}{PartNameFull}[true]% - {\csname FBPartNameFull#1\endcsname - \ifFBPartNameFull - \else - \FB@addto{captions}{% - \def\partname{Partie\protect\FB@Rpart}}% - \fi}% + {\csname FBPartNameFull#1\endcsname + \ifFBPartNameFull + \else + \FB@addto{captions}{% + \def\partname{Partie\protect\FB@Rpart}}% + \fi}% \define@key{FB}{CustomiseFigTabCaptions}[true]% {\csname FBCustomiseFigTabCaptions#1\endcsname}% \define@key{FB}{OldFigTabCaptions}[true]% @@ -3216,8 +3463,26 @@ return french_punctuation \ifFBSuppressWarning \renewcommand{\FBWarning}[2]{\relax}% \fi}% - \define@key{FB}{ShowOptions}[true]% - {\csname FBShowOptions#1\endcsname}% +% \end{macrocode} +% Here are the options controlling French guillemets spacing +% and the output of |\frquote{}|. +% \begin{macrocode} + \define@key{FB}{INGuillSpace}[true]% + {\csname FBINGuillSpace#1\endcsname}% + \define@key{FB}{InnerGuillSingle}[true]% + {\csname FBInnerGuillSingle#1\endcsname}% + \define@key{FB}{EveryParGuill}{\expandafter\let\expandafter + \FBeveryparguill\csname FBguill#1\endcsname}% + \define@key{FB}{EveryLineGuill}{\expandafter\let\expandafter + \FBeverylineguill\csname FBguill#1\endcsname + \ifFB@luatex@punct + \else + \let\FBeverylineguill\FBguillnone + \PackageWarning{frenchb.ldf}% + {Option `EveryLineGuill' skipped:% + \MessageBreak this option is for + LuaTeX *only*.\MessageBreak Reported}% + \fi}% % \end{macrocode} % Inputing French quotes as \emph{single characters} when they are % available on the keyboard (through a compose key for instance) @@ -3254,127 +3519,106 @@ return french_punctuation % \changes{v2.6h}{2014/01/03}{\cs{FG@og} and \cs{FG@fg} changed: % former clumsy code removed.} % +% \changes{v3.1a}{2014/06/16}{Codes "13 and "14 added for French +% quotes in T1-encoding. Support for older versions of LuaTeX and +% XeTeX dropped.} +% % \begin{macrocode} \define@key{FB}{og}{% - \ifFB@active@punct - \newcommand*{\FB@@og}{% - \iflanguage{french}% - {\ifFBAutoSpaceGuill\FB@og\ignorespaces - \else\guillemotleft - \fi}% - {\guillemotleft}}% - \fi - \ifFBunicode + \ifFBunicode % \end{macrocode} % LuaTeX or XeTeX in use, first try modern LuaTeX: we just need % to set LuaTeX's attribute |\FB@addGUILspace| to 1, % \begin{macrocode} \ifFB@luatex@punct \FB@addGUILspace=1 \relax - \else + \fi % \end{macrocode} -% then modern XeTeX, this more tricky: +% then with XeTeX it is a bit more tricky: % \begin{macrocode} - \ifFB@xetex@punct + \ifFB@xetex@punct % \end{macrocode} % |\XeTeXinterchartokenstate| is defined, we just need to set -% |\XeTeXcharclass| to |\FB@guilo| for the French opening -% quote (see subsection~\ref{ssec-punct}). +% |\XeTeXcharclass| to |\FB@guilo| for the French opening quote +% in T1 and Unicode encoding (see subsection~\ref{ssec-punct}). % \begin{macrocode} - \XeTeXcharclass"AB = \FB@guilo - \XeTeXcharclass"A0 = \FB@guilnul - \XeTeXcharclass"202F = \FB@guilnul - \else -% \end{macrocode} -% then an old LuaTeX or XeTeX in use, the following trick -% for defining the active quote character is borrowed from -% \file{inputenc.dtx}. -% \begin{macrocode} - \catcode`#1=\active - \bgroup - \uccode`\~`#1% - \uppercase{% - \egroup - \def~% - }{\FB@@og}% - \fi + \XeTeXcharclass"13 = \FB@guilo + \XeTeXcharclass"AB = \FB@guilo + \XeTeXcharclass"A0 = \FB@guilnul + \XeTeXcharclass"202F = \FB@guilnul \fi - \else + \else % \end{macrocode} % This is for conventional TeX engines: % \begin{macrocode} - \AtBeginDocument{% - \ifdefined\DeclareInputText - \ifdefined\uc@dclc + \newcommand*{\FB@@og}{% + \iflanguage{french}% + {\ifFBAutoSpaceGuill\FB@og\ignorespaces + \else\guillemotleft + \fi}% + {\guillemotleft}}% + \AtBeginDocument{% + \ifdefined\DeclareInputText + \ifdefined\uc@dclc % \end{macrocode} % Package \pkg{inputenc} with utf8x encoding loaded, use |\uc@dclc|, % \begin{macrocode} - \uc@dclc{171}{default}{\FB@@og}% - \else + \uc@dclc{171}{default}{\FB@@og}% + \else % \end{macrocode} % if encoding is not utf8x, try utf8\dots % \begin{macrocode} - \ifdefined\DeclareUnicodeCharacter + \ifdefined\DeclareUnicodeCharacter % \end{macrocode} % utf8 loaded, use |\DeclareUnicodeCharacter|, % \begin{macrocode} - \DeclareUnicodeCharacter{00AB}{\FB@@og}% - \else + \DeclareUnicodeCharacter{00AB}{\FB@@og}% + \else % \end{macrocode} % if utf8 is not loaded either, we assume 8-bit character input % encoding. Package \pkg{MULEenc} (from CJK) defines |\mule@def| % to map characters to control sequences. % \begin{macrocode} - \@tempcnta`#1\relax - \ifdefined\mule@def - \mule@def{11}{\FB@@og}% - \else - \DeclareInputText{\the\@tempcnta}{\FB@@og}% - \fi - \fi - \fi - \else + \@tempcnta`#1\relax + \ifdefined\mule@def + \mule@def{11}{\FB@@og}% + \else + \DeclareInputText{\the\@tempcnta}{\FB@@og}% + \fi + \fi + \fi + \else % \end{macrocode} % Package \pkg{inputenc} not loaded, no way\dots{} % \begin{macrocode} - \PackageWarning{frenchb.ldf}% - {Option `og' requires package inputenc.\MessageBreak}% - \fi - }% - \fi + \PackageWarning{frenchb.ldf}% + {Option `og' requires package inputenc.\MessageBreak}% + \fi + }% + \fi }% % \end{macrocode} % % Same code for the closing quote. % \begin{macrocode} \define@key{FB}{fg}{% - \ifFB@active@punct - \newcommand*{\FB@@fg}{% + \ifFBunicode + \ifFB@luatex@punct + \FB@addGUILspace=1 \relax + \fi + \ifFB@xetex@punct + \XeTeXcharclass"14 = \FB@guilf + \XeTeXcharclass"BB = \FB@guilf + \XeTeXcharclass"A0 = \FB@guilnul + \XeTeXcharclass"202F = \FB@guilnul + \fi + \else + \newcommand*{\FB@@fg}{% \iflanguage{french}% {\ifFBAutoSpaceGuill\FB@fg \else\guillemotright \fi}% {\guillemotright}}% - \fi - \ifFBunicode - \ifFB@luatex@punct - \FB@addGUILspace=1 \relax - \else - \ifFB@xetex@punct - \XeTeXcharclass"BB = \FB@guilf - \XeTeXcharclass"A0 = \FB@guilnul - \XeTeXcharclass"202F = \FB@guilnul - \else - \catcode`#1=\active - \bgroup - \uccode`\~`#1% - \uppercase{% - \egroup - \def~% - }{{\FB@@fg}}% - \fi - \fi - \else \AtBeginDocument{% \ifdefined\DeclareInputText \ifdefined\uc@dclc @@ -3393,10 +3637,10 @@ return french_punctuation \fi \else \PackageWarning{frenchb.ldf}% - {Option `fg' requires package inputenc.\MessageBreak}% + {Option `fg' requires package inputenc.\MessageBreak}% \fi }% - \fi + \fi }% } % \end{macrocode} @@ -3635,7 +3879,6 @@ return french_punctuation AutoSpacePunctuation=false [true]\MessageBreak OriginalTypewriter=true [false]\MessageBreak ThinColonSpace=true [false]\MessageBreak - INGuillSpace=true [false]\MessageBreak ThinSpaceInFrenchNumbers=true [false]\MessageBreak FrenchSuperscripts=false [true]\MessageBreak LowercaseSuperscripts=false [true]\MessageBreak @@ -3643,6 +3886,11 @@ return french_punctuation SuppressWarning=true [false]\MessageBreak CustomiseFigTabCaptions=false [true]\MessageBreak OldFigTabCaptions=true [false]\MessageBreak + INGuillSpace=true [false]\MessageBreak + InnerGuillSingle=true [false]\MessageBreak + EveryParGuill=open, close, none [open]\MessageBreak + EveryLineGuill=open, close, none + [open in LuaTeX, none otherwise]\MessageBreak og= <left quote character>, fg= <right quote character>% \MessageBreak *********************************************% @@ -3717,9 +3965,14 @@ return french_punctuation % \changes{v3.0a}{2014/01/28}{Test \cs{ifXeTeX} changed to % \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.} +% % Some warnings are issued when output font encodings are not % properly set. With XeLaTeX or LuaLaTeX, \file{fontspec.sty} and -% \file{xunicode.sty} should be loaded; with (pdf)\LaTeX, a warning +% \file{xunicode.sty} should be loaded unless T1 encoded fonts are +% used through \file{luainputenc}, in the latter case |\FB@og| and +% |\FB@fg| have to be redefined; with (pdf)\LaTeX, a warning % is issued when OT1 encoding is in use at the |\begin{document}|. % Mind that |\encodingdefault| is defined as `long', defining % |\FBOTone| with |\newcommand*| would fail! @@ -3727,9 +3980,11 @@ return french_punctuation \ifFBunicode \ifdefined\DeclareUTFcharacter \else - \PackageWarning{frenchb.ldf}% - {Add \protect\usepackage{fontspec} to the\MessageBreak - preamble of your document,}% + \@ifpackageloaded{luainputenc}{}% + {\PackageWarning{frenchb.ldf}% + {Add \protect\usepackage{fontspec} to the\MessageBreak + preamble of your document,}% + }% \fi \else \begingroup \newcommand{\FBOTone}{OT1}% |