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.

336 \let\bbl@opt@shorthands\@nnil<br />

337 \fi<br />

338 \ifx\<strong>Babel</strong>Modifiers\@undefined\let\<strong>Babel</strong>Modifiers\relax\fi<br />

339 \ifx\bbl@afterlang\@undefined\let\bbl@afterlang\relax\fi<br />

340 \providecommand\After<strong>Babel</strong>Language[2]{}<br />

341 \def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}%<br />

342 \chardef\bbl@engine=%<br />

343 \ifx\directlua\@undefined<br />

344 \ifx\XeTeXinputencoding\@undefined<br />

345 \z@<br />

346 \else<br />

347 \tw@<br />

348 \fi<br />

349 \else<br />

350 \@ne<br />

351 \fi<br />

\bbl@afterelse<br />

\bbl@afterfi<br />

Beca<strong>use</strong> the code that is <strong>use</strong>d in the handling of active characters may need to<br />

look ahead, we take extra care to ‘throw’ it over the \else and \fi parts of an<br />

\if-statement 22 . These macros will break if another \if...\fi statement appears<br />

in one of the arguments and it is not enclosed in braces.<br />

352 \long\def\bbl@afterelse#1\else#2\fi{\fi#1}<br />

353 \long\def\bbl@afterfi#1\fi{\fi#1}<br />

The macro \initiate@active@char takes all the necessary actions to make its<br />

argument a shorthand character. The real work is per<strong>for</strong>med once <strong>for</strong> each<br />

character.<br />

354 \def\bbl@<strong>with</strong>active#1#2{%<br />

355 \begingroup<br />

356 \lccode‘~=‘#2\relax<br />

357 \lowercase{\endgroup#1~}}<br />

\bbl@redefine<br />

\bbl@redefine@long<br />

To redefine a command, we save the old meaning of the macro. Then we redefine<br />

it to call the original macro <strong>with</strong> the ‘sanitized’ argument. The reason why we do it<br />

this way is that we don’t want to redefine the L A T E X macros completely in case<br />

their definitions change (they have changed in the past).<br />

Beca<strong>use</strong> we need to redefine a number of commands we define the command<br />

\bbl@redefine which takes care of this. It creates a new control sequence,<br />

\org@...<br />

358 \def\bbl@redefine#1{%<br />

359 \edef\bbl@tempa{\expandafter\@gobble\string#1}%<br />

360 \expandafter\let\csname org@\bbl@tempa\endcsname#1%<br />

361 \expandafter\def\csname\bbl@tempa\endcsname}<br />

This command should only be <strong>use</strong>d in the preamble of the document.<br />

362 \@onlypreamble\bbl@redefine<br />

This version of \babel@redefine can be <strong>use</strong>d to redefine \long commands such as<br />

\ifthenelse.<br />

363 \def\bbl@redefine@long#1{%<br />

364 \edef\bbl@tempa{\expandafter\@gobble\string#1}%<br />

365 \expandafter\let\csname org@\bbl@tempa\endcsname#1%<br />

366 \expandafter\long\expandafter\def\csname\bbl@tempa\endcsname}<br />

367 \@onlypreamble\bbl@redefine@long<br />

22 This code is based on code presented in TUGboat vol. 12, no2, June 1991 in “An expansion Power<br />

Lemma” by Sonja Maus.<br />

41

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

Saved successfully!

Ooh no, something went wrong!