1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
|
%%
%% This is file `switch.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% babel.dtx (with options: `kernel')
%%
%%
%% Copyright (C) 2012-2017 Javier Bezos and Johannes L. Braams.
%% Copyright (C) 1989-2012 Johannes L. Braams and
%% any individual authors listed elsewhere in this file.
%% All rights reserved.
%%
%% This file is part of the Babel system.
%% --------------------------------------
%%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% The Current Maintainer of this work is Javier Bezos.
%%
%% 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.
%%
\ifx\ProvidesFile\@undefined
\def\ProvidesFile#1[#2 #3 #4]{%
\wlog{File: #1 #4 #3 <#2>}%
\let\ProvidesFile\@undefined}
\fi
\ProvidesFile{switch.def}[2017/11/03 3.15 Babel switching mechanism]
\ifx\AtBeginDocument\@undefined
\input plain.def\relax
\fi
\ifx\language\@undefined
\csname newcount\endcsname\language
\fi
\ifx\newlanguage\@undefined
\csname newcount\endcsname\last@language
\def\addlanguage#1{%
\global\advance\last@language\@ne
\ifnum\last@language<\@cclvi
\else
\errmessage{No room for a new \string\language!}%
\fi
\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\bbl@version{3.15}
\def\bbl@date{2017/11/03}
\def\adddialect#1#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{%
\bbl@iflanguage{#1}{%
\ifnum\csname l@#1\endcsname=\language
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi}}
\let\bbl@select@type\z@
\edef\selectlanguage{%
\noexpand\protect
\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
\def\bbl@language@stack{}
\def\bbl@push@language{%
\xdef\bbl@language@stack{\languagename+\bbl@language@stack}}
\def\bbl@pop@lang#1+#2-#3{%
\edef\languagename{#1}\xdef#3{#2}}
\let\bbl@ifrestoring\@secondoftwo
\def\bbl@pop@language{%
\expandafter\bbl@pop@lang\bbl@language@stack-\bbl@language@stack
\let\bbl@ifrestoring\@firstoftwo
\expandafter\bbl@set@language\expandafter{\languagename}%
\let\bbl@ifrestoring\@secondoftwo}
\expandafter\def\csname selectlanguage \endcsname#1{%
\ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\tw@\fi
\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}%
\select@language{\languagename}%
\expandafter\ifx\csname date\languagename\endcsname\relax\else
\if@filesw
\protected@write\@auxout{}{\string\select@language{\languagename}}%
\bbl@foreach\BabelContentsFiles{%
\addtocontents{##1}{\xstring\select@language{\languagename}}}%
\bbl@usehooks{write}{}%
\fi
\fi}
\def\select@language#1{%
\ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi
\edef\languagename{#1}%
\bbl@fixname\languagename
\bbl@iflanguage\languagename{%
\expandafter\ifx\csname date\languagename\endcsname\relax
\bbl@error
{Unknown language `#1'. Either you have\\%
misspelled its name, it has not been installed,\\%
or you requested it in a previous run. Fix its name,\\%
install it or just rerun the file, respectively}%
{You may proceed, but expect wrong results}%
\else
\let\bbl@select@type\z@
\expandafter\bbl@switch\expandafter{\languagename}%
\fi}}
\let\select@language@x\select@language
\def\bbl@switch#1{%
\originalTeX
\expandafter\def\expandafter\originalTeX\expandafter{%
\csname noextras#1\endcsname
\let\originalTeX\@empty
\babel@beginsave}%
\bbl@usehooks{afterreset}{}%
\languageshorthands{none}%
\ifcase\bbl@select@type
\ifhmode
\hskip\z@skip % trick to ignore spaces
\csname captions#1\endcsname\relax
\csname date#1\endcsname\relax
\loop\ifdim\lastskip>\z@\unskip\repeat\unskip
\else
\csname captions#1\endcsname\relax
\csname date#1\endcsname\relax
\fi
\fi
\bbl@usehooks{beforeextras}{}%
\csname extras#1\endcsname\relax
\bbl@usehooks{afterextras}{}%
\ifcase\bbl@opt@hyphenmap\or
\def\BabelLower##1##2{\lccode##1=##2\relax}%
\ifnum\bbl@hymapsel>4\else
\csname\languagename @bbl@hyphenmap\endcsname
\fi
\chardef\bbl@opt@hyphenmap\z@
\else
\ifnum\bbl@hymapsel>\bbl@opt@hyphenmap\else
\csname\languagename @bbl@hyphenmap\endcsname
\fi
\fi
\global\let\bbl@hymapsel\@cclv
\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}
\long\def\otherlanguage#1{%
\ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\thr@@\fi
\csname selectlanguage \endcsname{#1}%
\ignorespaces}
\long\def\endotherlanguage{%
\global\@ignoretrue\ignorespaces}
\expandafter\def\csname otherlanguage*\endcsname#1{%
\ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi
\foreign@language{#1}}
\expandafter\let\csname endotherlanguage*\endcsname\relax
\let\bbl@beforeforeign\@empty
\edef\foreignlanguage{%
\noexpand\protect
\expandafter\noexpand\csname foreignlanguage \endcsname}
\expandafter\def\csname foreignlanguage \endcsname{%
\@ifstar\bbl@foreign@s\bbl@foreign@x}
\def\bbl@foreign@x#1#2{%
\begingroup
\let\BabelText\@firstofone
\bbl@beforeforeign
\foreign@language{#1}%
\bbl@usehooks{foreign}{}%
\BabelText{#2}% Now in horizontal mode!
\endgroup}
\def\bbl@foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par
\begingroup
{\par}%
\let\BabelText\@firstofone
\foreign@language{#1}%
\bbl@usehooks{foreign*}{}%
\bbl@dirparastext
\BabelText{#2}% Still in vertical mode!
{\par}%
\endgroup}
\def\foreign@language#1{%
\edef\languagename{#1}%
\bbl@fixname\languagename
\bbl@iflanguage\languagename{%
\expandafter\ifx\csname date\languagename\endcsname\relax
\bbl@warning
{Unknown language `#1'. Either you have\\%
misspelled its name, it has not been installed,\\%
or you requested it in a previous run. Fix its name,\\%
install it or just rerun the file, respectively.\\%
I'll proceed, but expect wrong results.\\%
Reported}%
\fi
\let\bbl@select@type\@ne
\expandafter\bbl@switch\expandafter{\languagename}}}
\let\bbl@hyphlist\@empty
\let\bbl@hyphenation@\relax
\let\bbl@pttnlist\@empty
\let\bbl@patterns@\relax
\let\bbl@hymapsel=\@cclv
\def\bbl@patterns#1{%
\language=\expandafter\ifx\csname l@#1:\f@encoding\endcsname\relax
\csname l@#1\endcsname
\edef\bbl@tempa{#1}%
\else
\csname l@#1:\f@encoding\endcsname
\edef\bbl@tempa{#1:\f@encoding}%
\fi
\@expandtwoargs\bbl@usehooks{patterns}{{#1}{\bbl@tempa}}%
\@ifundefined{bbl@hyphenation@}{}{% Can be \relax!
\begingroup
\bbl@xin@{,\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{%
\edef\bbl@tempf{#1}%
\bbl@fixname\bbl@tempf
\bbl@iflanguage\bbl@tempf{%
\expandafter\bbl@patterns\expandafter{\bbl@tempf}%
\languageshorthands{none}%
\bbl@ifunset{\bbl@tempf hyphenmins}%
{\set@hyphenmins\tw@\thr@@\relax}%
{\bbl@exp{\\\set@hyphenmins\@nameuse{\bbl@tempf hyphenmins}}}}}
\let\endhyphenrules\@empty
\def\providehyphenmins#1#2{%
\expandafter\ifx\csname #1hyphenmins\endcsname\relax
\@namedef{#1hyphenmins}{#2}%
\fi}
\def\set@hyphenmins#1#2{%
\lefthyphenmin#1\relax
\righthyphenmin#2\relax}
\ifx\ProvidesFile\@undefined
\def\ProvidesLanguage#1[#2 #3 #4]{%
\wlog{Language: #1 #4 #3 <#2>}%
}
\else
\def\ProvidesLanguage#1{%
\begingroup
\catcode`\ 10 %
\@makeother\/%
\@ifnextchar[%]
{\@provideslanguage{#1}}{\@provideslanguage{#1}[]}}
\def\@provideslanguage#1[#2]{%
\wlog{Language: #1 #2}%
\expandafter\xdef\csname ver@#1.ldf\endcsname{#2}%
\endgroup}
\fi
\def\LdfInit{%
\chardef\atcatcode=\catcode`\@
\catcode`\@=11\relax
\input babel.def\relax
\catcode`\@=\atcatcode \let\atcatcode\relax
\LdfInit}
\ifx\originalTeX\@undefined\let\originalTeX\@empty\fi
\ifx\babel@beginsave\@undefined\let\babel@beginsave\relax\fi
\providecommand\setlocale{%
\bbl@error
{Not yet available}%
{Find an armchair, sit down and wait}}
\let\uselocale\setlocale
\let\locale\setlocale
\let\selectlocale\setlocale
\let\textlocale\setlocale
\let\textlanguage\setlocale
\let\languagetext\setlocale
\edef\bbl@nulllanguage{\string\language=0}
\ifx\PackageError\@undefined
\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
\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
\@ifpackagewith{babel}{silent}
{\let\bbl@info\@gobble
\let\bbl@warning\@gobble}
{}
\def\bbl@nocaption#1#2{% 1: text to be printed 2: caption macro \langXname
\gdef#2{\textbf{?#1?}}%
#2%
\bbl@warning{%
\string#2 not set. Please, define\\%
it in the preamble with something like:\\%
\string\renewcommand\string#2{..}\\%
Reported}}
\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
\endinput
%%
%% End of file `switch.def'.
|