diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel/switch.def')
-rw-r--r-- | Master/texmf-dist/tex/generic/babel/switch.def | 338 |
1 files changed, 197 insertions, 141 deletions
diff --git a/Master/texmf-dist/tex/generic/babel/switch.def b/Master/texmf-dist/tex/generic/babel/switch.def index 2f0ab6227a5..d8fb0240f4f 100644 --- a/Master/texmf-dist/tex/generic/babel/switch.def +++ b/Master/texmf-dist/tex/generic/babel/switch.def @@ -7,6 +7,7 @@ %% babel.dtx (with options: `kernel') %% This is a generated file. %% +%% Copyright 2012-2013 Javier Bezos and Johannes L. Braams. %% Copyright 1989-2008 Johannes L. Braams and any individual authors %% listed elsewhere in this file. All rights reserved. %% @@ -23,7 +24,7 @@ %% %% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainer of this work is Johannes Braams. +%% The Current Maintainer of this work is Javier Bezos. %% %% This file may only be distributed together with a copy of the Babel %% system. You may however distribute the Babel system without @@ -36,15 +37,18 @@ %% The list of derived (unpacked) files belonging to the distribution %% and covered by LPPL is defined by the unpacking scripts (with %% extension .ins) which are part of the distribution. -%% %% File 'babel.dtx' -%%\ProvidesFile{babel.dtx}[2008/07/08 v3.8m The Babel package] +%%\ProvidesFile{babel.dtx}[2013/04/15 v3.9e The Babel package] %% Babel package for LaTeX2e. %% Copyright (C) 1989 -- 2008 by Johannes Braams, %% TeXniek %% all rights reserved. -%% Please report errors to: J.L. Braams -%% babel at braams.xs4all.nl +%% Copyright (C) 2013 by Johannes Braams +%% TeXniek +%% by Javier Bezos +%% all rights reserved. +\def\bbl@version{3.9e} +\def\bbl@date{2013/04/15} \ifx\ProvidesFile\@undefined \def\ProvidesFile#1[#2 #3 #4]{% \wlog{File: #1 #4 #3 <#2>}% @@ -66,26 +70,18 @@ \endgroup} \fi \ProvidesFile{switch.def} - [2008/07/08 v3.8m % - Babel language switching mechanism] + [2013/04/15 v3.9e % + Babel language switching mechanism] \ifx\AtBeginDocument\@undefined - \def\adddialect{} \input plain.def\relax \fi -\expandafter\ifx\csname iflanguage\endcsname\relax \else -\expandafter\endinput -\fi \ifx\language\@undefined \csname newcount\endcsname\language \fi \ifx\newlanguage\@undefined \csname newcount\endcsname\last@language -\else - \countdef\last@language=19 -\fi -\ifx\newlanguage\@undefined \def\addlanguage#1{% - \global\advance\last@language \@ne + \global\advance\last@language\@ne \ifnum\last@language<\@cclvi \else \errmessage{No room for a new \string\language!}% @@ -93,150 +89,194 @@ \global\chardef#1\last@language \wlog{\string#1 = \string\language\the\last@language}} \else + \countdef\last@language=19 \def\addlanguage{\alloc@9\language\chardef\@cclvi} \fi \def\adddialect#1#2{% - \global\chardef#1#2\relax - \wlog{\string#1 = a dialect from \string\language#2}} + \global\chardef#1#2\relax + \bbl@usehooks{adddialect}{{#1}{#2}}% + \wlog{\string#1 = a dialect from \string\language#2}} +\def\bbl@fixname#1{% + \begingroup + \def\bbl@tempe{l@}% + \edef\bbl@tempd{\noexpand\@ifundefined{\noexpand\bbl@tempe#1}}% + \bbl@tempd + {\lowercase\expandafter{\bbl@tempd}% + {\uppercase\expandafter{\bbl@tempd}% + \@empty + {\edef\bbl@tempd{\def\noexpand#1{#1}}% + \uppercase\expandafter{\bbl@tempd}}}% + {\edef\bbl@tempd{\def\noexpand#1{#1}}% + \lowercase\expandafter{\bbl@tempd}}}% + \@empty + \edef\bbl@tempd{\endgroup\def\noexpand#1{#1}}% + \bbl@tempd} +\def\bbl@iflanguage#1{% + \@ifundefined{l@#1}{\@nolanerr{#1}\@gobble}\@firstofone} \def\iflanguage#1{% - \expandafter\ifx\csname l@#1\endcsname\relax - \@nolanerr{#1}% - \else - \bbl@afterfi{\ifnum\csname l@#1\endcsname=\language + \bbl@iflanguage{#1}{% + \ifnum\csname l@#1\endcsname=\language \expandafter\@firstoftwo \else \expandafter\@secondoftwo - \fi}% - \fi} + \fi}} +\let\bbl@select@type\z@ \edef\selectlanguage{% \noexpand\protect - \expandafter\noexpand\csname selectlanguage \endcsname - } + \expandafter\noexpand\csname selectlanguage \endcsname} \ifx\@undefined\protect\let\protect\relax\fi \ifx\documentclass\@undefined \def\xstring{\string\string\string} \else \let\xstring\string \fi -\xdef\bbl@language@stack{} +\def\bbl@language@stack{} \def\bbl@push@language{% - \xdef\bbl@language@stack{\languagename+\bbl@language@stack}% - } + \xdef\bbl@language@stack{\languagename+\bbl@language@stack}} \def\bbl@pop@lang#1+#2-#3{% - \def\languagename{#1}\xdef#3{#2}% - } + \edef\languagename{#1}\xdef#3{#2}} \def\bbl@pop@language{% \expandafter\bbl@pop@lang\bbl@language@stack-\bbl@language@stack - \expandafter\bbl@set@language\expandafter{\languagename}% - } + \expandafter\bbl@set@language\expandafter{\languagename}} \expandafter\def\csname selectlanguage \endcsname#1{% \bbl@push@language \aftergroup\bbl@pop@language \bbl@set@language{#1}} +\def\BabelContentsFiles{toc,lof,lot}% \def\bbl@set@language#1{% \edef\languagename{% \ifnum\escapechar=\expandafter`\string#1\@empty - \else \string#1\@empty\fi}% + \else\string#1\@empty\fi}% \select@language{\languagename}% - \if@filesw - \protected@write\@auxout{}{\string\select@language{\languagename}}% - \addtocontents{toc}{\xstring\select@language{\languagename}}% - \addtocontents{lof}{\xstring\select@language{\languagename}}% - \addtocontents{lot}{\xstring\select@language{\languagename}}% + \expandafter\ifx\csname date\languagename\endcsname\relax\else + \if@filesw + \protected@write\@auxout{}{\string\select@language{\languagename}}% + \bbl@for\bbl@tempa\BabelContentsFiles{% + \addtocontents{\bbl@tempa}{\xstring\select@language{\languagename}}}% + \bbl@usehooks{write}{}% + \fi \fi} \def\select@language#1{% - \expandafter\ifx\csname l@#1\endcsname\relax - \@nolanerr{#1}% - \else - \expandafter\ifx\csname date#1\endcsname\relax - \@noopterr{#1}% + \edef\languagename{#1}% + \bbl@fixname\languagename + \bbl@iflanguage\languagename{% + \expandafter\ifx\csname date\languagename\endcsname\relax + \bbl@error + {You haven't loaded the language #1\space yet}% + {You may proceed, but expect unexpected results}% \else - \bbl@patterns{\languagename}% - \originalTeX - \expandafter\def\expandafter\originalTeX - \expandafter{\csname noextras#1\endcsname - \let\originalTeX\@empty}% - \languageshorthands{none}% - \babel@beginsave - \csname captions#1\endcsname - \csname date#1\endcsname - \csname extras#1\endcsname\relax - \babel@savevariable\lefthyphenmin - \babel@savevariable\righthyphenmin - \expandafter\ifx\csname #1hyphenmins\endcsname\relax - \set@hyphenmins\tw@\thr@@\relax - \else - \expandafter\expandafter\expandafter\set@hyphenmins - \csname #1hyphenmins\endcsname\relax - \fi - \fi + \let\bbl@select@type\z@ + \expandafter\bbl@switch\expandafter{\languagename}% + \fi}} +\def\select@language@x#1{% + \ifcase\bbl@select@type + \bbl@ifsamestring\languagename{#1}{}{\select@language{#1}}% + \else + \select@language{#1}% + \fi} +\def\bbl@switch#1{% + \originalTeX + \expandafter\def\expandafter\originalTeX\expandafter{% + \csname noextras#1\endcsname + \let\originalTeX\@empty + \babel@beginsave}% + \languageshorthands{none}% + \ifcase\bbl@select@type + \csname captions#1\endcsname + \csname date#1\endcsname + \fi + \bbl@usehooks{beforeextras}{}% + \csname extras#1\endcsname\relax + \bbl@usehooks{afterextras}{}% + \bbl@patterns{#1}% + \babel@savevariable\lefthyphenmin + \babel@savevariable\righthyphenmin + \expandafter\ifx\csname #1hyphenmins\endcsname\relax + \set@hyphenmins\tw@\thr@@\relax + \else + \expandafter\expandafter\expandafter\set@hyphenmins + \csname #1hyphenmins\endcsname\relax + \fi} +\def\bbl@ifsamestring#1#2{% + \protected@edef\bbl@tempb{#1}% + \edef\bbl@tempb{\expandafter\strip@prefix\meaning\bbl@tempb}% + \protected@edef\bbl@tempc{#2}% + \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}% + \ifx\bbl@tempb\bbl@tempc + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo \fi} \long\def\otherlanguage#1{% \csname selectlanguage \endcsname{#1}% - \ignorespaces - } + \ignorespaces} \long\def\endotherlanguage{% - \originalTeX - \global\@ignoretrue\ignorespaces - } + \global\@ignoretrue\ignorespaces} \expandafter\def\csname otherlanguage*\endcsname#1{% - \foreign@language{#1}% - } -\expandafter\def\csname endotherlanguage*\endcsname{% - \csname noextras\languagename\endcsname - } -\def\foreignlanguage{\protect\csname foreignlanguage \endcsname} + \foreign@language{#1}} +\expandafter\let\csname endotherlanguage*\endcsname\relax +\edef\foreignlanguage{% + \noexpand\protect + \expandafter\noexpand\csname foreignlanguage \endcsname} \expandafter\def\csname foreignlanguage \endcsname#1#2{% \begingroup - \originalTeX \foreign@language{#1}% #2% - \csname noextras#1\endcsname - \endgroup - } + \endgroup} \def\foreign@language#1{% - \def\languagename{#1}% - \expandafter\ifx\csname l@#1\endcsname\relax - \@nolanerr{#1}% - \else - \bbl@patterns{\languagename}% - \languageshorthands{none}% - \csname extras#1\endcsname - \expandafter\ifx\csname #1hyphenmins\endcsname\relax - \set@hyphenmins\tw@\thr@@\relax - \else - \expandafter\expandafter\expandafter\set@hyphenmins - \csname #1hyphenmins\endcsname\relax + \edef\languagename{#1}% + \bbl@fixname\languagename + \bbl@iflanguage\languagename{% + \expandafter\ifx\csname date\languagename\endcsname\relax + \bbl@warning + {You haven't loaded the language #1\space yet\\% + I'll proceed, but expect unexpected results.\\% + Reported}% \fi - \fi - } + \let\bbl@select@type\@ne + \expandafter\bbl@switch\expandafter{\languagename}}} +\let\bbl@hyphlist\@empty +\let\bbl@hyphenation@\relax \def\bbl@patterns#1{% \language=\expandafter\ifx\csname l@#1:\f@encoding\endcsname\relax - \csname l@#1\endcsname - \else - \csname l@#1:\f@encoding\endcsname - \fi\relax -} + \csname l@#1\endcsname + \edef\bbl@tempa{#1}% + \else + \csname l@#1:\f@encoding\endcsname + \edef\bbl@tempa{#1:\f@encoding}% + \fi\relax + \@expandtwoargs\bbl@usehooks{patterns}{{#1}{\bbl@tempa}}% + \@ifundefined{bbl@hyphenation@}{}{% + \begingroup + \@expandtwoargs\in@{,\number\language,}{,\bbl@hyphlist}% + \ifin@\else + \@expandtwoargs\bbl@usehooks{hyphenation}{{#1}{\bbl@tempa}}% + \hyphenation{% + \bbl@hyphenation@ + \@ifundefined{bbl@hyphenation@#1}% + \@empty + {\space\csname bbl@hyphenation@#1\endcsname}}% + \xdef\bbl@hyphlist{\bbl@hyphlist\number\language,}% + \fi + \endgroup}} \def\hyphenrules#1{% - \expandafter\ifx\csname l@#1\endcsname\@undefined - \@nolanerr{#1}% - \else - \bbl@patterns{#1}% + \edef\languagename{#1}% + \bbl@fixname\languagename + \bbl@iflanguage\languagename{% + \expandafter\bbl@patterns\expandafter{\languagename}% \languageshorthands{none}% - \expandafter\ifx\csname #1hyphenmins\endcsname\relax - \set@hyphenmins\tw@\thr@@\relax - \else - \expandafter\expandafter\expandafter\set@hyphenmins - \csname #1hyphenmins\endcsname\relax - \fi - \fi - } -\def\endhyphenrules{} + \expandafter\ifx\csname\languagename hyphenmins\endcsname\relax + \set@hyphenmins\tw@\thr@@\relax + \else + \expandafter\expandafter\expandafter\set@hyphenmins + \csname\languagename hyphenmins\endcsname\relax + \fi}} +\let\endhyphenrules\@empty \def\providehyphenmins#1#2{% \expandafter\ifx\csname #1hyphenmins\endcsname\relax \@namedef{#1hyphenmins}{#2}% \fi} -\def\set@hyphenmins#1#2{\lefthyphenmin#1\righthyphenmin#2} +\def\set@hyphenmins#1#2{\lefthyphenmin#1\relax\righthyphenmin#2\relax} \def\LdfInit{% \chardef\atcatcode=\catcode`\@ \catcode`\@=11\relax @@ -245,39 +285,55 @@ \LdfInit} \ifx\originalTeX\@undefined\let\originalTeX\@empty\fi \ifx\babel@beginsave\@undefined\let\babel@beginsave\relax\fi +\edef\bbl@nulllanguage{\string\language=0} \ifx\PackageError\@undefined - \def\@nolanerr#1{% - \errhelp{Your command will be ignored, type <return> to proceed}% - \errmessage{You haven't defined the language #1\space yet}} - \def\@nopatterns#1{% - \message{No hyphenation patterns were loaded for}% - \message{the language `#1'}% - \message{I will use the patterns loaded for \string\language=0 - instead}} - \def\@noopterr#1{% - \errmessage{The option #1 was not specified in \string\usepackage} - \errhelp{You may continue, but expect unexpected results}} - \def\@activated#1{% - \wlog{Package babel Info: Making #1 an active character}} + \def\bbl@error#1#2{% + \begingroup + \newlinechar=`\^^J + \def\\{^^J(babel) }% + \errhelp{#2}\errmessage{\\#1}% + \endgroup} + \def\bbl@warning#1{% + \begingroup + \newlinechar=`\^^J + \def\\{^^J(babel) }% + \message{\\#1}% + \endgroup} + \def\bbl@info#1{% + \begingroup + \newlinechar=`\^^J + \def\\{^^J}% + \wlog{#1}% + \endgroup} \else - \newcommand*{\@nolanerr}[1]{% - \PackageError{babel}% - {You haven't defined the language #1\space yet}% - {Your command will be ignored, type <return> to proceed}} - \newcommand*{\@nopatterns}[1]{% - \PackageWarningNoLine{babel}% - {No hyphenation patterns were loaded for\MessageBreak - the language `#1'\MessageBreak - I will use the patterns loaded for \string\language=0 - instead}} - \newcommand*{\@noopterr}[1]{% - \PackageError{babel}% - {You haven't loaded the option #1\space yet}% - {You may proceed, but expect unexpected results}} - \newcommand*{\@activated}[1]{% - \PackageInfo{babel}{% - Making #1 an active character}} + \def\bbl@error#1#2{% + \begingroup + \def\\{\MessageBreak}% + \PackageError{babel}{#1}{#2}% + \endgroup} + \def\bbl@warning#1{% + \begingroup + \def\\{\MessageBreak}% + \PackageWarning{babel}{#1}% + \endgroup} + \def\bbl@info#1{% + \begingroup + \def\\{\MessageBreak}% + \PackageInfo{babel}{#1}% + \endgroup} \fi +\def\@nolanerr#1{% + \bbl@error + {You haven't defined the language #1\space yet}% + {Your command will be ignored, type <return> to proceed}} +\def\@nopatterns#1{% + \bbl@warning + {No hyphenation patterns were preloaded for\\% + the language `#1' into the format.\\% + Please, configure your TeX system to add them and\\% + rebuild the format. Now I will use the patterns\\% + preloaded for \bbl@nulllanguage\space instead}} +\let\bbl@usehooks\@gobbletwo %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |