15.04.2014 Views

Babel, a multilingual package for use with LATEX's ... - linsrv.net

Babel, a multilingual package for use with LATEX's ... - linsrv.net

Babel, a multilingual package for use with LATEX's ... - linsrv.net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

451 \def\noexpand\@sanitize{\@sanitize\@makeother#1}%<br />

452 \fi}%<br />

453 \x}<br />

The macro \x contains at this moment the following:<br />

\endgroup\def\dospecials{old contents \do〈char〉}.<br />

If \@sanitize is defined, it contains an additional definition of this macro. The last<br />

thing we have to do, is the expansion of \x. Then \endgroup is executed, which<br />

restores the old meaning of \x, \do and \@makeother. After the group is closed,<br />

the new definition of \dospecials (and \@sanitize) is assigned.<br />

\bbl@remove@special<br />

The companion of the <strong>for</strong>mer macro is \bbl@remove@special. It is <strong>use</strong>d to remove<br />

a character from the set macros \dospecials and \@sanitize.<br />

To keep all changes local, we begin a new group. Then we define a help macro \x,<br />

which expands to empty if the characters match, otherwise it expands to its<br />

nonexpandable input. Beca<strong>use</strong> T E X inserts a \relax, if the corresponding \else or<br />

\fi is scanned be<strong>for</strong>e the comparison is evaluated, we provide a ‘stop sign’ which<br />

should expand to nothing.<br />

With the help of this macro we define \do and \make@other.<br />

The rest of the work is similar to \bbl@add@special.<br />

454 \def\bbl@remove@special#1{%<br />

455 \begingroup<br />

456 \def\x##1##2{\ifnum‘#1=‘##2\noexpand\@empty<br />

457 \else\noexpand##1\noexpand##2\fi}%<br />

458 \def\do{\x\do}%<br />

459 \def\@makeother{\x\@makeother}%<br />

460 \edef\x{\endgroup<br />

461 \def\noexpand\dospecials{\dospecials}%<br />

462 \expandafter\ifx\csname @sanitize\endcsname\relax \else<br />

463 \def\noexpand\@sanitize{\@sanitize}%<br />

464 \fi}%<br />

465 \x}<br />

7.4 Shorthands<br />

\initiate@active@char<br />

A language definition file can call this macro to make a character active. This<br />

macro takes one argument, the character that is to be made active. When the<br />

character was already active this macro does nothing. Otherwise, this macro<br />

defines the control sequence \normal@char〈char〉 to expand to the character in its<br />

‘normal state’ and it defines the active character to expand to \normal@char〈char〉<br />

by default (〈char〉 being the character to be made active). Later its definition can<br />

be changed to expand to \active@char〈char〉 by calling \bbl@activate{〈char〉}.<br />

For example, to make the double quote character active one could have<br />

\initiate@active@char{"} in a language definition file. This defines " as<br />

\active@prefix "\active@char" (where the first " is the character <strong>with</strong> its<br />

original catcode, when the shorthand is created, and \active@char" is a single<br />

token). In protected contexts, it expands to \protect " or \noexpand " (ie, <strong>with</strong><br />

the original "); otherwise \active@char" is executed. This macro in turn expands<br />

to \normal@char" in “safe” contexts (eg, \label), but \<strong>use</strong>r@active" in normal<br />

“unsafe” ones. The latter search a definition in the <strong>use</strong>r, language and system<br />

levels, in this order, but if none is found, \normal@char" is <strong>use</strong>d. However, a<br />

deactivated shorthand (<strong>with</strong> \bbl@deactivate is defined as<br />

\active@prefix "\normal@char".<br />

45

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!