• Tidak ada hasil yang ditemukan

Let's provide the French user with some extra utilities.

\up

\fup \up eases the typesetting of superscripts like `1er'. Up to version 2.0 of frenchb

\up was just a shortcut for \textsuperscript in LATEX2ε, but several users com- plained that \textsuperscript typesets superscripts too high and too big, so we now dene \fup as an attempt to produce better looking superscripts. \up is de- ned as \fup but can be redened by \frenchbsetup{FrenchSuperscripts=false}

as \textsuperscript for compatibility with previous versions.

When a font has built-in superscripts, the best thing to do is to just use them, otherwise \fup has to simulate superscripts by scaling and raising ordinary letters.

Scaling is done using package scalefnt which will be loaded at the end of babel's loading (frenchb being an option of babel, it cannot load a package while being read).

29.173\newif\ifFB@poorman

29.174\newdimen\FB@Mht

29.175\ifLaTeXe

29.176 \AtEndOfPackage{\RequirePackage{scalefnt}}

\FB@up@fake holds the denition of fake superscripts. The scaling ratio is 0.65, raising is computed to put the top of lower case letters (like `m') just under the top of upper case letters (like `M'), precisely 12% down. The chosen settings look correct for most fonts, but can be tuned by the end-user if necessary by changing

\FBsupR and \FBsupS commands.

\FB@lc is dened as \lowercase to inhibit the uppercasing of superscripts (this may happen in page headers with the standard classes but is wrong); \FB@lc can be redened to do nothing by option LowercaseSuperscripts=false of

\frenchbsetup{}.

29.177 \newcommand*{\FBsupR}{-0.12}

29.178 \newcommand*{\FBsupS}{0.65}

29.179 \newcommand*{\FB@lc}[1]{\lowercase{#1}}

29.180 \DeclareRobustCommand*{\FB@up@fake}[1]{%

29.181 \settoheight{\FB@Mht}{M}%

29.182 \addtolength{\FB@Mht}{\FBsupR \FB@Mht}%

29.183 \addtolength{\FB@Mht}{-\FBsupS ex}%

29.184 \raisebox{\FB@Mht}{\scalefont{\FBsupS}{\FB@lc{#1}}}%

29.185 }

The only packages I currently know to take advantage of real superscripts are a) xltxtra used in conjunction with XeLaTeX and OpenType fonts having the font feature 'VerticalPosition=Superior' (xltxtra denes \realsuperscript and

\fakesuperscript) and b) fourier (from version 1.6) when Expert Utopia fonts are available.

\FB@up checks whether the current font is a Type1 `Expert' (or `Pro') font with real superscripts or not (the code works currently only with fourier-1.6 but could work with any Expert Type1 font with built-in superscripts, see below), and decides to use real or fake superscripts. It works as follows: the content of

\f@family (family name of the current font) is split by \FB@split into two pieces, the rst three characters (`fut' for Fourier, `ppl' for Adobe's Palatino, . . . ) stored in \FB@firstthree and the rest stored in \FB@suffix which is expected to be `x' or `j' for expert fonts.

29.186 \def\FB@split#1#2#3#4\@nil{\def\FB@firstthree{#1#2#3}%

29.187 \def\FB@suffix{#4}}

29.188 \def\FB@x{x}

29.189 \def\FB@j{j}

29.190 \DeclareRobustCommand*{\FB@up}[1]{%

29.191 \bgroup \FB@poormantrue

29.192 \expandafter\FB@split\f@family\@nil

Then \FB@up looks for a .fd le named t1fut-sup.fd (Fourier) or t1ppl-sup.fd (Palatino), etc. supposed to dene the subfamily (fut-sup or ppl-sup, etc.) giving access to the built-in superscripts. If the .fd le is not found by

\IfFileExists, \FB@up falls back on fake superscripts, otherwise \FB@suffix is checked to decide whether to use fake or real superscripts.

29.193 \edef\reserved@a{\lowercase{%

29.194 \noexpand\IfFileExists{\f@encoding\FB@firstthree -sup.fd}}}%

29.195 \reserved@a

29.196 {\ifx\FB@suffix\FB@x \FB@poormanfalse\fi

29.197 \ifx\FB@suffix\FB@j \FB@poormanfalse\fi

29.198 \ifFB@poorman \FB@up@fake{#1}%

29.199 \else \FB@up@real{#1}%

29.200 \fi}%

29.201 {\FB@up@fake{#1}}%

29.202 \egroup}

\FB@up@real just picks up the superscripts from the subfamily (and forces lower- case).

29.203 \newcommand*{\FB@up@real}[1]{\bgroup

29.204 \fontfamily{\FB@firstthree -sup}\selectfont \FB@lc{#1}\egroup}

\fup is now dened as \FB@up unless \realsuperscript is dened (occurs with XeLaTeX calling xltxtra.sty).

29.205 \DeclareRobustCommand*{\fup}[1]{%

29.206 \@ifundefined{realsuperscript}%

29.207 {\FB@up{#1}}%

29.208 {\bgroup\let\fakesuperscript\FB@up@fake

29.209 \realsuperscript{\FB@lc{#1}}\egroup}}

Temporary denition of up (redened `AtBeginDocument').

29.210 \newcommand*{\up}{\relax}

Poor man's denition of \up for Plain. In LATEX2ε, \up will be dened as \fup or \textsuperscript later on while processing the options of \frenchbsetup{}.

29.211\else

29.212 \newcommand*{\up}[1]{\leavevmode\raise1ex\hbox{\sevenrm #1}}

29.213\fi

\ieme

\ier

\iere

\iemes

\iers

\ieres

Some handy macros for those who don't know how to abbreviate ordinals:

29.214\def\ieme{\up{\lowercase{e}}\xspace}

29.215\def\iemes{\up{\lowercase{es}}\xspace}

29.216\def\ier{\up{\lowercase{er}}\xspace}

29.217\def\iers{\up{\lowercase{ers}}\xspace}

29.218\def\iere{\up{\lowercase{re}}\xspace}

29.219\def\ieres{\up{\lowercase{res}}\xspace}

\No

\no

\Nos

\nos

\primo

\fprimo)

And some more macros relying on \up for numbering, rst two support macros.

29.220\newcommand*{\FrenchEnumerate}[1]{%

29.221 #1\up{\lowercase{o}}\kern+.3em}

29.222\newcommand*{\FrenchPopularEnumerate}[1]{%

29.223 #1\up{\lowercase{o}})\kern+.3em}

Typing \primo should result in `1o',

29.224\def\primo{\FrenchEnumerate1}

29.225\def\secundo{\FrenchEnumerate2}

29.226\def\tertio{\FrenchEnumerate3}

29.227\def\quarto{\FrenchEnumerate4}

while typing \fprimo) gives `1o) .

29.228\def\fprimo){\FrenchPopularEnumerate1}

29.229\def\fsecundo){\FrenchPopularEnumerate2}

29.230\def\ftertio){\FrenchPopularEnumerate3}

29.231\def\fquarto){\FrenchPopularEnumerate4}

Let's provide four macros for the common abbreviations of Numéro.

29.232\DeclareRobustCommand*{\No}{N\up{\lowercase{o}}\kern+.2em}

29.233\DeclareRobustCommand*{\no}{n\up{\lowercase{o}}\kern+.2em}

29.234\DeclareRobustCommand*{\Nos}{N\up{\lowercase{os}}\kern+.2em}

29.235\DeclareRobustCommand*{\nos}{n\up{\lowercase{os}}\kern+.2em}

\bsc As family names should be written in small capitals and never be hyphenated, we provide a command (its name comes from Boxed Small Caps) to input them easily.

Note that this command has changed with version 2 of frenchb: a \kern0pt is used instead of \hbox because \hbox would break microtype's font expansion; as a (positive?) side eect, composed names (such as Dupont-Durand) can now be hyphenated on explicit hyphens. Usage: Jean~\bsc{Duchemin}.

29.236\DeclareRobustCommand*{\bsc}[1]{\leavevmode\begingroup\kern0pt

29.237 \scshape #1\endgroup}

29.238\ifLaTeXe\else\let\scshape\relax\fi

Some denitions for special characters. We won't dene \tilde as a Text Symbol not to conict with the macro \tilde for math mode and use the name

\tild instead. Note that \boi may not be used in math mode, its name in math mode is \backslash. \degre can be accessed by the command \r{} for ring accent.

29.239\ifLaTeXe

29.240 \DeclareTextSymbol{\at}{T1}{64}

29.241 \DeclareTextSymbol{\circonflexe}{T1}{94}

29.242 \DeclareTextSymbol{\tild}{T1}{126}

29.243 \DeclareTextSymbolDefault{\at}{T1}

29.244 \DeclareTextSymbolDefault{\circonflexe}{T1}

29.245 \DeclareTextSymbolDefault{\tild}{T1}

29.246 \DeclareRobustCommand*{\boi}{\textbackslash}

29.247 \DeclareRobustCommand*{\degre}{\r{}}

29.248\else

29.249 \def\T@one{T1}

29.250 \ifx\f@encoding\T@one

29.251 \newcommand*{\degre}{\char6}

29.252 \else

29.253 \newcommand*{\degre}{\char23}

29.254 \fi

29.255 \newcommand*{\at}{\char64}

29.256 \newcommand*{\circonflexe}{\char94}

29.257 \newcommand*{\tild}{\char126}

29.258 \newcommand*{\boi}{$\backslash$}

29.259\fi

\degres We now dene a macro \degres for typesetting the abbreviation for `degrees' (as in `degrees Celsius'). As the bounding box of the character `degree' has very dierent widths in CM/EC and PostScript fonts, we x the width of the bounding box of \degres to 0.3 em, this lets the symbol `degree' stick to the preceding (e.g., 45\degres) or following character (e.g., 20~\degres C).

If the TEX Companion fonts are available (textcomp.sty), we pick up

\textdegree from them instead of using emulating `degrees' from the \r{} accent.

Otherwise we overwrite the (poor) denition of \textdegree given in latin1.def, applemac.def etc. (called by inputenc.sty) by our denition of \degres. We also advice the user (once only) to use TS1-encoding.

29.260\ifLaTeXe

29.261 \newcommand*{\degres}{\degre}

29.262 \def\Warning@degree@TSone{%

29.263 \PackageWarning{frenchb.ldf}{%

29.264 Degrees would look better in TS1-encoding:

29.265 \MessageBreak add \protect

29.266 \usepackage{textcomp} to the preamble.

29.267 \MessageBreak Degrees used}}

29.268 \AtBeginDocument{\expandafter\ifx\csname M@TS1\endcsname\relax

29.269 \DeclareRobustCommand*{\degres}{%

29.270 \leavevmode\hbox to 0.3em{\hss\degre\hss}%

29.271 \Warning@degree@TSone

29.272 \global\let\Warning@degree@TSone\relax}%

29.273 \let\textdegree\degres

29.274 \else

29.275 \DeclareRobustCommand*{\degres}{%

29.276 \hbox{\UseTextSymbol{TS1}{\textdegree}}}%

29.277 \fi}

29.278\else

29.279 \newcommand*{\degres}{%

29.280 \leavevmode\hbox to 0.3em{\hss\degre\hss}}

29.281\fi