Debian Codegraph @

texmf-dist/source/latex/babel/babel.dtx

raw
1 % \iffalse
2 % This document requires lualatex
3 %%
4 %% Copyright (C) 2012-2026 Javier Bezos and Johannes L. Braams.
5 %% Copyright (C) 1989-2012 Johannes L. Braams and
6 %% any individual authors listed elsewhere in this file.
7 %% All rights reserved.
8 %%
9 %%
10 %% This file is part of the Babel system.
11 %% --------------------------------------
12 %%
13 %% It may be distributed and/or modified under the
14 %% conditions of the LaTeX Project Public License, either version 1.3
15 %% of this license or (at your option) any later version.
16 %% The latest version of this license is in
17 %% http://www.latex-project.org/lppl.txt
18 %% and version 1.3 or later is part of all distributions of LaTeX
19 %% version 2003/12/01 or later.
20 %%
21 %% This work has the LPPL maintenance status "maintained".
22 %%
23 %% The Current Maintainer of this work is Javier Bezos.
24 %%
25 %% The list of derived (unpacked) files belonging to the distribution
26 %% and covered by LPPL is defined by the unpacking scripts (with
27 %% extension |.ins|) which are part of the distribution.
28 %%
29 % \fi
30 %
31 % \iffalse
32 %<*filedriver>
33 % \DocumentMetadata{
34 % tagging = on,
35 % lang = en-001,
36 % }
37 \ProvidesFile{babel.dtx}%
38 [2026/05/20 v26.8
39 The multilingual framework for pdfLaTeX, LuaLaTeX and XeLaTeX]
40 \documentclass{ltxdoc}
41 \GetFileInfo{babel.dtx}
42 \usepackage{fontspec}
43 \setmainfont[
44 Scale=.88,
45 BoldFont = NotoSerif-Bold.ttf,
46 ItalicFont = NotoSerif-Italic.ttf,
47 BoldItalicFont = NotoSerif-BoldItalic.ttf]
48 {NotoSerif-Regular.ttf}
49 \setsansfont[
50 Scale=.88,
51 BoldFont = NotoSans-Bold.ttf,
52 ItalicFont = NotoSans-Italic.ttf,
53 BoldItalicFont = NotoSans-BoldItalic.ttf]
54 {NotoSans-Regular.ttf}
55 \setmonofont[Scale=.86, FakeStretch=.97]{DejaVu Sans Mono}
56 \raggedright
57 \setlength{\parindent}{.8em}
58 \frenchspacing
59 \addtolength{\oddsidemargin}{-2em}
60 \addtolength{\textwidth}{25.5pt}
61 \addtolength{\textheight}{3.5cm}
62 \addtolength{\topmargin}{-2cm}
63 \font\manual=logo10 % font used for the METAFONT logo, etc.
64 \newcommand*\MF{{\manual META}\-{\manual FONT}}
65 \newcommand*\babel{\textsf{babel}}
66 \newcommand*\Babel{\textsf{Babel}}
67 \newcommand*\xetex{\textsf{xetex}}
68 \newcommand*\pdftex{\textsf{pdftex}}
69 \newcommand*\luatex{\textsf{luatex}}
70 \newcommand\largetex{T\kern -.1517em\lower .45ex\hbox {E}\kern -.09emX}
71 \newcommand*\nb[1]{}
72 \newcommand*\m[1]{\mbox{{\fontspec{FreeSerif}〈}\normalfont\itshape#1\/}{\fontspec{FreeSerif}〉}}
73 \newcommand*\langlist{%
74 \meta{language}\texttt{,}\meta{language}\texttt{,}...}
75 \newcommand*\langvar{\m{language}}
76 \newcommand*\Lopt[1]{\textsf{#1}}
77 \newcommand*\Lenv[1]{\texttt{#1}}
78 \newcommand*\menv[1]{\char`\{#1\char`\}}
79 \newcommand*\Eenv[1]{%
80 \quad...\quad
81 \texttt{\color{thered}\string\end\menv{#1}}}
82 \newcommand*\file[1]{\texttt{#1}}
83 \newcommand*\cls[1]{\texttt{#1}}
84 \newcommand*\pkg[1]{\texttt{#1}}
85 \setlength{\leftmargini}{1.5em}
86 \usepackage{framed}
87 \usepackage{multicol}
88 \usepackage{color,colortbl}
89 \usepackage[linkcolor=blue,urlcolor=blue,colorlinks=true]{hyperref}
90 \hypersetup{%
91 pdfsubject={LaTeX Multilingual documents and localization for pdfTeX,
92 LuaTeX and XeTeX.},
93 pdfauthor={Javier Bezos, Johannes Braams},
94 pdftitle={Babel},
95 pdfkeywords={TeX, LaTeX, pdfTeX, LuaTeX, XeTeX, internationalization,
96 localization}}
97 \ExplSyntaxOn
98 \normalmarginpar
99 \newcommand\New[1]{%
100 \regex_extract_once:nnN{(\d\d?)\.(\d\d?)}{#1}\bbltempa
101 \seq_pop_right:NN\bbltempa\bbltempb
102 \seq_pop_right:NN\bbltempa\bbltempa
103 \leavevmode%\marginpar
104 {\scriptsize
105 % \enspace
106 \colorbox[rgb]{.92, .86, .73}%
107 {%New~
108 #1%
109 \quark_if_no_value:NTF\bbltempb{}%
110 {~
111 \ifnum\bbltempa>2 \ifnum\bbltempb>34
112 \href{https://latex3.github.io/babel/news/%
113 whats-new-in-babel-\bbltempa.\bbltempb.html}%
114 {\scriptsize ※}%
115 \fi\fi
116 \ifnum\bbltempa>23
117 \href{https://latex3.github.io/babel/news/%
118 whats-new-in-babel-\bbltempa.\bbltempb.html}%
119 {\scriptsize ※}%
120 \fi}}}\enspace\ignorespaces}
121 \ExplSyntaxOff
122 \definecolor{thered}{rgb}{0.65,0.04,0.07}
123 \definecolor{thegrey}{gray}{0.8}
124 \definecolor{thegreyed}{gray}{0.6}
125 \definecolor{shadecolor}{rgb}{1,1,0.97}
126 \definecolor{messages}{rgb}{.66,.13,.27}
127 \makeatletter
128 \def\@seccntformat#1{%
129 \llap{\makebox[1.7cm][l]{\csname the#1\endcsname.}}%
130 \hspace{-.7cm}}
131 \def\@begintheorem#1#2{%
132 \list{}{}%
133 \global\advance\@listdepth\m@ne
134 \item[{\sffamily\bfseries\color{messages}\hspace*{1.4em}%\hspace*{2.8em}%
135 \MakeUppercase{#1}}]}%
136 \makeatother
137 \newtheorem{warning}{Warning}
138 \newtheorem{note}{Note}
139 \newtheorem{example}{Example}
140 \newtheorem{troubleshooting}{Troubleshooting}
141 \let\bblxv\verbatim
142 \let\bblexv\endverbatim
143 \newcommand\setengine{\def\engine}
144 \let\engine\relax
145 \begingroup
146 \catcode`\<=13
147 \catcode`\>=13
148 \catcode`\|=13
149 \AtBeginDocument{%
150 \gdef|{\verb|\def<##1>{{\fontspec{FreeSerif}〈}{\rmfamily\itshape##1}{\fontspec{FreeSerif}〉}}}}
151 \endgroup
152 \def\verbatim{%
153 \fboxsep=.8em
154 \begin{snugshade*}%
155 \ifx\engine\relax\else
156 \vskip-.75\baselineskip
157 \leavevmode\llap{%
158 \fboxsep=2pt\fbox{\scriptsize\textsc{\engine}}\hskip2.8em}%
159 \vskip-1.6\baselineskip
160 \vskip0pt
161 \global\let\engine\relax
162 \fi
163 \bblxv\vskip0pt }
164 \def\endverbatim{%
165 \bblexv\vskip-7.5ex \end{snugshade*}}
166 \catcode`\_=\active
167 \def_{\bgroup\let_\egroup\leavevmode\color{thered}}
168 \def\MacroFont{\fontencoding \encodingdefault \fontfamily\ttdefault
169 \fontseries\mddefault \fontshape\updefault \small \catcode`\_=\active}
170 \definecolor{shadecolor}{rgb}{0.96,0.96,0.93}
171 %
172 \makeatletter
173 \def\Describe#1#2{%
174 \@startsection{subsubsection}{100}{\z@}%
175 {2.5ex\@plus .7ex \@minus .2ex}%
176 {1.5ex \@plus .2ex}%
177 {\hspace{-2cm}\color{thegreyed}\normalsize\ttfamily}*%
178 {\underline{\strut{\color{thered}\string#1}\color{black}#2}}}
179 \def\DescribeOther{\addvspace{-1.5ex}\Describe}
180 \AtBeginDocument{\def\DescribeMacro#1{{\ttfamily\color{thered}\string#1}}}
181 \def\macro#1{%
182 \if@noskipsec\leavevmode\vskip-1.2\baselineskip\vskip0pt\fi
183 \@startsection{paragraph}{101}{\z@}%
184 {3.25ex \@plus1ex \@minus.2ex}%
185 {-1em}%
186 {\sffamily\bfseries\color{thered}}*{\hspace*{-1em}\string#1}}
187 \let\environment\macro
188 \def\optstar{%
189 \kern1pt\relax
190 \colorbox{thegrey}{\ttfamily\hskip-.2em*\hskip-.2em}%
191 \kern1pt}
192 \def\trouble#1{\addcontentsline{tsh}{trouble}{#1}}
193 \def\toclevel@trouble{0}
194 \def\listoftroubles{\section*{Troubleshooting}\@starttoc{tsh}}
195 \let\l@trouble\l@figure
196 \def\@tocrmarg{3.5em plus 1000em}
197 \let\saved@check@percent\check@percent
198 \let\check@percent\relax
199 % Changes to doc.sty (add <<...>> syntax)
200 \def\Module#1{%
201 \mod@math@codes$\langle${\color{thered}$\mathsf{#1}$}$\rangle$}
202 \begingroup
203 \catcode`\<\active
204 \catcode`\>\active
205 \gdef\check@plus@etc{%
206 \let\bbl@next\pm@module
207 \ifx*\next
208 \let\bbl@next\star@module
209 \else\ifx/\next
210 \let\bbl@next\slash@module
211 \else\ifx<\next
212 \let\bbl@next\var@module
213 \fi\fi\fi
214 \bbl@next}
215 \gdef\var@module#1#2#3>>{%
216 $\langle$\pm@module#2#3>$\rangle$%
217 \ifx*#2\ $\equiv$\fi}
218 \endgroup
219 \def\toc@usehook#1#2#3{%
220 \UseHookWithArguments{contentsline/#1}{4}%
221 {\toclevel@section}%
222 {#2}{#3}{\@contentsline@destination}}
223 \renewcommand*\l@section[2]{%
224 \ifnum\c@tocdepth>\z@
225 \addpenalty\@secpenalty
226 \addvspace{1.0em\@plus\p@}%
227 \setlength\@tempdima{2em}%
228 \begingroup
229 \parindent\z@ \rightskip\@pnumwidth
230 \parfillskip-\@pnumwidth
231 \leavevmode\bfseries
232 \advance\leftskip\@tempdima
233 \hskip-\leftskip
234 \toc@usehook{text/before}{#1}{#2}%
235 \csname contentsline@text@1@format\endcsname{#1}
236 \toc@usehook{text/after}{#1}{#2}%
237 \nobreak\hfil\nobreak \hb@xt@\@pnumwidth
238 {\hss
239 \toc@usehook{page/before}{#1}{#2}%
240 #2%
241 \toc@usehook{page/after}{#1}{#2}%
242 \kern-\p@\kern\p@}%
243 \par
244 \endgroup
245 \fi}
246 \renewcommand*\l@subsection{\@dottedtocline{2}{2em}{3em}}
247 \renewcommand*\l@subsubsection{\@dottedtocline{3}{5em}{4em}}
248 \renewcommand*\l@paragraph{\@dottedtocline{4}{9em}{4.5em}}
249 \renewcommand\partname{Part}
250 \def\@pnumwidth{3em}
251 \makeatother
252 \begin{document}
253 \title{Babel, a multilingual package for use with \LaTeX's standard
254 document classes.}
255 \author{Johannes Braams\\
256 Javier Bezos}
257
258 \date{Typeset \today}
259 \begin{titlepage}
260 \begin{minipage}[t][0pt]{30cm}
261 \vspace{-3cm}\hspace{-6cm}
262 \sffamily
263 \begin{tabular}{p{8cm}p{15cm}}
264 \cellcolor[rgb]{.86,.73,.67}
265 &\cellcolor[rgb]{.95,.95,.95}
266 \vspace{3.6cm}%
267 \color[rgb]{.55,.4,.35}
268 \leftskip5mm
269 \sffamily\fontsize{72}{72}\selectfont Babel
270 \vspace{1.8cm}
271 \\
272 \cellcolor[rgb]{.95,.95,.95}
273 \vspace{2cm}\hspace{1.5cm}
274 \begin{minipage}{5cm}
275 \Huge
276 \ifx\babelcode\undefined
277 User guide
278 \else
279 Code
280 \fi
281
282 \Large
283 \vspace{1.2cm}
284 Version \csname @gobble\expandafter\endcsname\fileversion\newline
285 \filedate
286
287 \LARGE
288 \vspace{1.2cm}
289 Javier Bezos\\[-.5ex]
290 {\large Current maintainer}
291
292 \vspace{.3cm}
293 Johannes L. Braams\\[-.5ex]
294 {\large Original author}
295 \end{minipage}
296 &\cellcolor[rgb]{.92, .86, .73}
297 \vspace{2cm}
298 \leftskip5mm
299 \begin{minipage}{10cm}
300 \fontsize{35}{45}\selectfont
301 \setlength\parskip{3mm}\raggedright
302 Localization and internationalization\\[1cm]
303 Unicode\\
304 \largetex\\
305 Lua\largetex\\
306 pdf\largetex\\
307 Xe\largetex
308 \vspace{20cm}
309 \end{minipage}
310 \end{tabular}
311 \end{minipage}
312 \end{titlepage}
313
314 \tableofcontents
315 \ifx\babelcode\undefined
316 \listoftroubles
317 \fi
318 \clearpage
319
320 \ifx\babelcode\undefined
321
322 \begin{description}
323 \item[\sffamily\color{messages}What is this document about?] This user
324 guide focuses on internationalization and localization with \LaTeX{}
325 and \luatex{}, \pdftex{} and \xetex{} with the \babel{} package. There
326 are also some notes on its use with e-Plain and pdf-Plain \TeX.
327
328 \item[\sffamily\color{messages}I only need learn the most basic
329 features.] The first subsections (1.1-1.6) describe the ways
330 of loading a language, which is usually all you need.
331
332 \item[\sffamily\color{messages}I don’t like manuals. I prefer sample
333 files.] This manual contains lots of examples and tips, but in GitHub
334 there are many
335 \href{https://github.com/latex3/babel/tree/master/samples}{sample
336 files}.
337
338 \item[\sffamily\color{messages}What if I’m interested only in the
339 latest changes?] Changes and new features with relation to version 3.8
340 are highlighted with \New{X.XX}\hspace{-.5em}
341 ({\scriptsize ※} is a link to the \babel{} site), and there
342 are some notes for the latest versions in
343 \href{https://latex3.github.io/babel/}{the \babel{} site}. The most
344 recent features can still be unstable. Remember version 24.1 follows
345 3.99, because of a new numbering scheme.
346
347 \item[\sffamily\color{messages}Can I help?] Sure! You can follow the
348 development of \babel{} in
349 \href{https://github.com/latex3/babel}{GitHub} and make suggestions,
350 including requirements for some language or script. Feel free to fork
351 it and make pull requests. If you are the author of a package, send
352 me a few test files which I'll add to mine, so that possible issues can
353 be caught in the development phase.
354
355 \item[\sffamily\color{messages}It doesn't work for me!] You can ask for
356 help in some forums like \textsf{tex.stackexchange}, but if you have
357 found a bug, I strongly beg you to report it in
358 \href{https://github.com/latex3/babel/issues}{GitHub}, which is much
359 better than just complaining on an e-mail list or a web forum. Remember
360 \textit{warnings are not errors} by themselves, they just warn about
361 possible problems or incompatibilities. Hyphenation rules are
362 maintained separately
363 \href{https://github.com/hyphenation/tex-hyphen}{here}.
364
365 \item[\sffamily\color{messages}How can I contribute a new
366 language?] See section \ref{contribute} for contributing a language.
367
368 \item[\sffamily\color{messages}Where is the code?]
369 Run |lualatex --jobname=babel-code \let\babelcode\relax\input{babel.dtx}|.
370 \end{description}
371
372 \begin{note}
373 Now that the recommend engine for \LaTeX\ is \luatex, you can read
374 \href{https://latex3.github.io/babel/guides/migrating-pdftex-luatex.html}%
375 {Migrating from pdfTeX to LuaTeX} and
376 \href{https://latex3.github.io/babel/guides/migrating-xetex-luatex.html}%
377 {Migrating from XeTeX to LuaTeX}.
378 \end{note}
379
380 \section{The basic user interface}\label{U-I}
381
382 There are two ways to load a language with babel, namely, the old good
383 ‘classical’ one, based on mostly self-contained declarations in a file
384 with |ldf| extension, and the ‘modern’ one, based on a brand new
385 mechanism based on descriptive |ini| files.
386
387 ‘Classical’ doesn’t mean outdated or obsolete. In fact, this is the
388 recommended method in most languages where an |ldf| file exists. Below
389 is a list of the supported languages. See also
390 \href{https://latex3.github.io/%
391 babel/guides/which-method-for-which-language.html}{Which
392 method for which language} in the \babel{} site.
393
394 Basically, what you need is typically:
395 \begin{itemize}
396 \bfseries
397 \item Tell \babel{} which language or languages are required.
398 \item With non-Latin scripts and Unicode engines (\luatex\ is the
399 preferred one), select a suitable font (sec.~\ref{fonts})
400 \item In multilingual documents, switch the language in the text body
401 (sec.~\ref{selectors}).
402 \end{itemize}
403
404 You can find basic info and minimal \luatex{} example files for about
405 300 locales in the
406 \href{https://latex3.github.io/babel/guides/index-locale.html}{GitHub
407 repository}. There are also some videos on \href{https://www.youtube.com/playlist?list=PLVc2cHCI6zpJcaa1x-yK9iRjqtE3Ct2Ja}{Youtube}.
408
409 \subsection{Monolingual documents: the ‘classical’ way}
410
411 In most cases, a single language is required, and then all you need in
412 \LaTeX{} is to load the package using its standard mechanism for this
413 purpose, namely, passing that language as an optional argument. In
414 addition, you may want to set the font and input encodings.
415
416 Another approach is making the language a global option in order to let
417 other packages detect and use it. This is the standard way in \LaTeX{}
418 for an option – in this case a language – to be recognized by several
419 packages (in other words, \babel{} doesn’t set the languages, it just
420 recognizes the options passed to the class or the package).
421
422 Many languages are compatible with \textsf{luatex} and \textsf{xetex},
423 but a few only work with \pdftex. When these engines are used, the
424 Latin script is covered by default in current \LaTeX{} (provided the
425 document encoding is UTF-8). Other scripts require loading
426 \textsf{fontspec}, although \babel{} provides a higher level interface
427 (see |\babelfont| below).
428
429 \New{25.8} The PDF document language can also be set with
430 |\DocumentMetadata| before |\documentclass|. See the liked news page
431 for further info. For example, the following setting will pass
432 \texttt{british} as the main language to \babel:
433 \begin{verbatim}
434 \DocumentMetadata{_lang=en-GB_}
435 \documentclass{article}
436 \usepackage{babel}
437 \end{verbatim}
438 The basic tag lookup explained below is applied here, so that
439 \texttt{fr-Latn-FR} is valid and mapped to \texttt{fr}, which is in
440 turn mapped to \texttt{french}. This eases the localization of
441 automatically generated documents.
442
443 \begin{warning}
444 This is a \textbf{breaking change}, because until now with this
445 example the dummy language \texttt{nil} was loaded. Tags are not
446 validated, which means mistakes like |en-UK| or wrong tags like
447 |de-AUS| or |la-x-classical| might be accepted without complaining.
448 \end{warning}
449
450 \begin{example}
451 Here is a simple full example for “traditional” \TeX{} engines (see
452 below for \luatex{} and \xetex{}). The package |fontenc| does not
453 belong to \babel, but it is included in the example because typically
454 you will need it. It assumes UTF-8, the default encoding:
455 \setengine{pdftex}
456 \begin{verbatim}
457 \documentclass{article}
458
459 \usepackage[T1]{fontenc}
460
461 _\usepackage[french]{babel}_
462
463 \begin{document}
464
465 Plus ça change, plus c'est la même chose!
466
467 \end{document}
468 \end{verbatim}
469
470 Now consider something like:
471 \begin{verbatim}
472 _\documentclass[french]{article}_
473 \usepackage{babel}
474 \usepackage{varioref}
475 \end{verbatim}
476 With this setting, the package \texttt{varioref} will also see
477 the option |french| and will be able to use it.
478 \end{example}
479
480 \begin{example}
481 Now a simple monolingual document in Russian (text from the Wikipedia)
482 with \luatex{} or \xetex{}. Note neither \textsf{fontenc} nor
483 \textsf{inputenc} is necessary, and a so-called Unicode font must be
484 loaded (in this example with the help of |\babelfont|, described below).
485
486 \setengine{luatex/xetex}
487 \begin{verbatim}
488 _\documentclass[russian]{article}_
489
490 \usepackage{babel}
491
492 _\babelfont{rm}{DejaVu Serif}_
493
494 \begin{document}
495
496 Россия, находящаяся на пересечении множества культур, а также
497 с учётом многонационального характера её населения, — отличается
498 высокой степенью этнокультурного многообразия и способностью к
499 межкультурному диалогу.
500
501 \end{document}
502 \end{verbatim}
503 \end{example}
504
505 \begin{note}
506 Because of the way \babel{} has evolved, “language” can refer to
507 (1) a set of hyphenation patterns as preloaded into the format, (2) a
508 package option, (3) an |ldf| file, and (4) a name used in the
509 document to select a language. Please, read the documentation for
510 specific languages for further info.
511 \end{note}
512
513 \begin{note}
514 \Babel{} does not make any readjustments by default in font size,
515 vertical positioning or line height. This is on purpose because the
516 optimal solution depends on the document layout and the font, and
517 very likely the most appropriate one is a combination of these
518 settings. A quick and simple solution to get a more uniform vertical
519 spacing is with the option \texttt{12pt} in standard classes, and
520 then reducing the font with \texttt{Scale} (\textsf{memoir} provides
521 also larger values, like \texttt{14pt}).
522 \end{note}
523
524 \begin{note}
525 Although it has been customary to recommend placing |\title|,
526 |\author| and other elements printed by |\maketitle| after
527 |\begin{document}|, mainly because of shorthands, it is advisable to
528 keep them in the preamble. Currently there is no real need to use
529 shorthands in those macros (and if you need them, you can use
530 |\babelshorthand|).
531 \end{note}
532
533 \begin{note}
534 With \textsf{hyperref} you may want to set the PDF document language
535 with something like:
536 \begin{verbatim}
537 \usepackage[_pdflang=es-MX_]{hyperref}
538 \end{verbatim}
539 This is not currently done by \babel{} and you must set it by hand.
540 \end{note}
541
542 \begin{warning}
543 In the preamble, \textit{no} language has been selected, except
544 hyphenation patterns and the name assigned to |\localename| (and
545 |\languagename|) (in particular, shorthands, captions and date are not
546 activated). If you need to define boxes and the like in the preamble,
547 you might want to use some of the language selectors described below.
548 \end{warning}
549
550 \begin{troubleshooting}
551 \trouble{Package inputenc Error: Invalid UTF-8 byte ...}
552 \textit{Package inputenc Error: Invalid UTF-8 byte ...}
553 A common source of trouble is a wrong setting of the input encoding.
554 Make sure you set the encoding actually used by your editor, or
555 even better, make sure the encoding in your editor is set to UTF-8.
556 \end{troubleshooting}
557
558 \begin{troubleshooting}
559 Another typical error when using \babel{} is the following:
560 \trouble{Unknown language 'LANG'}
561 \begin{verbatim}
562 ! Package babel Error: Unknown language 'LANG'. Either you have
563 (babel) misspelled its name, it has not been installed,
564 (babel) or you requested it in a previous run. Fix its name,
565 (babel) install it or just rerun the file, respectively. In
566 (babel) some cases, you may need to remove the aux file
567 \end{verbatim}
568 The most frequent reason is, by far, the latest (for example, you
569 included |spanish|, but you realized this language is not used after
570 all, and therefore you removed it from the option list). In most
571 cases, the error vanishes when the document is typeset again, but in
572 more severe ones you will need to remove the |aux| file.
573 \end{troubleshooting}
574
575 \begin{troubleshooting}
576 \textit{No hyphenation patterns were preloaded...}
577 The following warning is about hyphenation patterns, which are
578 not under the direct control of \babel:
579 \trouble{No hyphenation patterns were preloaded for (babel) the
580 language 'LANG' into the format}
581 \begin{verbatim}
582 Package babel Warning: No hyphenation patterns were preloaded for
583 (babel) the language `LANG' into the format.
584 (babel) Please, configure your TeX system to add them and
585 (babel) rebuild the format. Now I will use the patterns
586 (babel) preloaded for \language=0 instead on input line 57.
587 \end{verbatim}
588 The document will be typeset, but very likely the text will not be
589 correctly hyphenated. Some languages in some system may be raising
590 this warning wrongly (because they are not hyphenated) -- just ignore
591 it. See the manual of your distribution (Mac\TeX, Mik\TeX, \TeX Live,
592 etc.)\ for further info about how to configure it.
593 \end{troubleshooting}
594
595 \begin{troubleshooting}
596 \textit{You are loading directly a language style.}
597 Loading directly
598 |sty| files in \LaTeX{} (i.e., |\usepackage{<language>}|) was deprecated
599 many years ago and you will get the error: \trouble{You are loading
600 directly a language style}
601 \begin{verbatim}
602 ! Package babel Error: You are loading directly a language style.
603 (babel) This syntax is deprecated and you must use
604 (babel) \usepackage[language]{babel}.
605 \end{verbatim}
606 \end{troubleshooting}
607
608 \begin{note}
609 You will see an ‘info’ in the log file stating some data is being
610 loaded from an |ini| file. It includes standardized names for
611 language and script used by |\babelfont|, and the BCP 47 tag, required in
612 some cases by |\Make<Xxxxx>case|.
613 \end{note}
614
615 \subsection{Monolingual documents: the ‘modern’ way}
616
617 \begin{warning}
618 \New{25.14} Languages not supported with the \texttt{ldf} mechanism
619 are new loaded without \texttt{provide=*}. This manual has not been
620 fully updated yet.
621 \end{warning}
622
623 When, for whatever reason, the ‘classical’ way with the |ldf| is not
624 suitable for the needs of a document or a document system, you have to
625 resort to a different mechanism, which is activated automatically if
626 the language is not supported by the ‘traditional’ way or with the package
627 option |provide=*| (in monolingual documents).
628
629 \begin{example}
630 Although Georgian has its own \texttt{ldf} file, here is how to
631 declare this language in Unicode engines. Here, as in a previous
632 example, we resort to |\babelfont| to set the font for this language
633 (with the |Harfbuzz| renderer, just to show how to set it, because
634 here the |Node| renderer should be fine).
635 \setengine{luatex/xetex}
636 \begin{verbatim}
637 \documentclass{book}
638
639 \usepackage[_georgian, provide=*_]{babel}
640
641 _\babelfont{rm}[Renderer=Harfbuzz]{DejaVu Sans}_
642
643 \begin{document}
644
645 \tableofcontents
646
647 \chapter{სამზარეულო და სუფრის ტრადიციები}
648
649 ქართული ტრადიციული სამზარეულო ერთ-ერთი უმდიდრესია მთელ მსოფლიოში.
650
651 \end{document}
652 \end{verbatim}
653 And with a global option:
654 \begin{verbatim}
655 \documentclass[_georgian_]{book}
656 \usepackage[_provide=*_]{babel}
657 \babelfont{rm}[Renderer=Harfbuzz]{DejaVu Sans}
658 \end{verbatim}
659 \end{example}
660
661 \begin{note}
662 This option actually loads the language with |\babelprovide| and the
663 |import| option, described below. Instead of an asterisk, you may
664 provide a list of options for |\babelprovide| enclosed in braces
665 (|import| is included by default).
666 \end{note}
667
668 \begin{example}
669 For a text in Chinese, you can write in the preamble:
670 \setengine{luatex/xetex}
671 \begin{verbatim}
672 \usepackage[_chinese_]{babel}
673 _\babelfont{rm}{FandolSong}_
674 \end{verbatim}
675 The skip between characters is 0 pt plus .1 pt, which can be modified
676 with an option (explained below) in |provide|. For example:
677 \setengine{luatex/xetex}
678 \begin{verbatim}
679 \usepackage[chinese, provide=_{ intraspace=0 .2 0 }_]{babel}
680 \end{verbatim}
681 \end{example}
682
683 \begin{warning}
684 Because of the way \LaTeX{} passes options, with \texttt{provide}
685 there must be \textit{no} space in the middle of |={|, as the
686 previous example shows.
687 \end{warning}
688
689 \subsection{Mostly monolingual documents: lazy loading}
690 \label{mostlymono}
691
692 \New{3.39} Very often, multilingual documents consist of a main
693 language with small pieces of text in another languages (words, idioms,
694 short sentences). Typically, all you need is to set the line breaking
695 rules and, perhaps, the font. In such a case, there is no need to
696 clutter the preamble (particularly the class and package options)
697 because \babel{} does not require declaring these secondary languages
698 explicitly — the basic settings are loaded on the fly when the language
699 is first selected.
700
701 This is particularly useful in documents with many languages, and also
702 when there are short texts of this kind coming from an external source
703 whose contents are not known beforehand (for example, titles in a
704 bibliography). In this regard, it is worth remembering that
705 |\babelfont| does \textit{not} load any font until required, so that it
706 can be used just in case.
707
708 \New{3.84} With \pdftex, when a language is loaded on the fly
709 (internally it’s loaded with |\babelprovide|) selectors now set the
710 font encoding based on the list provided when loading |fontenc|. Not
711 all scripts have an associated encoding, so this feature works only
712 with Latin, Cyrillic, Greek, Arabic, Hebrew, Cherokee, Armenian, and
713 Georgian, provided a suitable font is found.
714
715 \begin{example}
716 A trivial document with the default font in English and Spanish, and
717 FreeSerif in Russian is:
718 \setengine{luatex/xetex}
719 \begin{verbatim}
720 \documentclass[english]{article}
721 \usepackage{babel}
722
723 _\babelfont[russian]{rm}{FreeSerif}_
724
725 \begin{document}
726
727 English. _\foreignlanguage{russian}{Русский}_.
728 _\foreignlanguage{spanish}{Español}_.
729
730 \end{document}
731 \end{verbatim}
732 If you need the ‘modern’ way to load the main language set as global
733 option, just write:
734 \begin{verbatim}
735 \usepackage[provide=*]{babel}
736 \end{verbatim}
737 \end{example}
738
739 \begin{note}
740 Instead of its name, you may prefer to select the language with the
741 corresponding BCP 47 tag. This alternative, however, must be activated
742 explicitly, because a two- or three-letter word is a valid name for a
743 language (e.g., |lu| can be the locale name with tag |khb| or the tag
744 for |lubakatanga|). See section \ref{bcp47} for further details.
745 \end{note}
746
747 \subsection{Multilingual documents: the ‘classical’ way}
748
749 In multilingual documents, just use a list of the required languages
750 either as package or as class options. The last language is considered the
751 main one, activated by default. Sometimes, the main language changes
752 the document layout (e.g., |spanish| and |french|).
753
754 To switch the language there are two basic macros, described below in
755 detail: |\selectlanguage| is used for blocks of text, while
756 |\foreignlanguage| is for chunks of text inside paragraphs.
757
758 \begin{example}
759 In \LaTeX, the preamble of the document:
760 \begin{verbatim}
761 \documentclass{article}
762 \usepackage[dutch,english]{babel}
763 \end{verbatim}
764 would tell \LaTeX{} that the document would be written in two
765 languages, Dutch and English, and that English would be the first
766 language in use, and the main one.
767 \end{example}
768
769 \begin{example}
770 A full bilingual document with \pdftex{} follows. The main language is
771 |french|, which is activated when the document begins. It assumes UTF-8:
772 \setengine{pdftex}
773 \begin{verbatim}
774 \documentclass{article}
775
776 \usepackage[T1]{fontenc}
777
778 _\usepackage[english,french]{babel}_
779
780 \begin{document}
781
782 Plus ça change, plus c'est la même chose!
783
784 _\selectlanguage{english}_
785
786 And an English paragraph, with a short text in
787 _\foreignlanguage{french}{français}_.
788
789 \end{document}
790 \end{verbatim}
791 \end{example}
792
793 \begin{example}
794 With \luatex{} and \xetex, the following bilingual, single script
795 document in UTF-8 encoding just prints a couple of ‘captions’ and
796 |\today| in Danish and Vietnamese. No additional packages are
797 required, because the default font supports both languages.
798 \setengine{luatex/xetex}
799 \begin{verbatim}
800 \documentclass{article}
801
802 _\usepackage[vietnamese,danish]{babel}_
803
804 \begin{document}
805
806 Danish: \prefacename, \alsoname, \today.
807
808 \selectlanguage{vietnamese}
809
810 Vietnamese: \prefacename, \alsoname, \today.
811
812 \end{document}
813 \end{verbatim}
814 \end{example}
815
816 \begin{note}
817 Although strongly discouraged, languages can be set as global and as
818 package option at the same time, but in such a case you should set
819 explicitly the main language with the package option |main|,
820 described below:
821 \begin{verbatim}
822 \documentclass[_italian_]{book}
823 \usepackage[german,_main=italian_]{babel}
824 \end{verbatim}
825 \end{note}
826
827 \begin{note}
828 Once a language is loaded, you can select it with the corresponding
829 BCP 47 tag. See section \ref{bcp47} for further details.
830 \end{note}
831
832 \begin{note}
833 Documents with several input encodings are not frequent, but
834 sometimes are useful. You can set different encodings for different
835 languages as the following example shows (\pdftex):
836 \begin{verbatim}
837 \addto\extrasfrench{\inputencoding{latin1}}
838 \addto\extrasrussian{\inputencoding{koi8-r}}
839 \end{verbatim}
840 \end{note}
841
842 \subsection{Multilingual documents: the ‘modern’ way}
843
844 If lazy loading is not enough for your purposes, you can still tell
845 which languages should be loaded as either class or package options.
846 You can combine the ‘classical’ and the ‘modern’ ways with three
847 options to set which method you want, which cover the most typical
848 cases [to be revised; a new ‘value’ \texttt{!} forces the \texttt{ldf}
849 mode]:
850 \begin{itemize}
851 \item |provide=*| is the option explained above for monolingual
852 documents. If there are more languages, it applies only to the main
853 language, while the rest will be loaded in the ‘classical’ way..
854 \item |provide+=*| loads the main language in the ‘classical’ way,
855 and the rest in the ‘modern’ one.
856 \item |provide*=*| is the same for all languages, i.e., main and
857 secondary ones are loaded in the ‘modern’ way.
858 \end{itemize}
859 More complex combinations can be handled with |\babelprovide|,
860 explained below.
861
862 \begin{example}
863 Your document is written in Thai with large chunks in Dutch and German,
864 and you want the |ldf| files in the latter because, for example, you
865 need their shorthands. The font is Norasi, which covers the three
866 languages:
867 \setengine{luatex/xetex}
868 \begin{verbatim}
869 \usepackage[dutch,german,_thai_]{babel}
870 \babelfont{rm}{Norasi}
871 \end{verbatim}
872 This will load |dutch| and |german| in the classical |ldf| mode, but
873 |thai| in the modern |ini| mode. Other options are:
874 \begin{verbatim}
875 \usepackage[dutch,german,thai,_provide=!_]{babel}
876 \end{verbatim}
877 which will use the classical mode for in languages (as described in the
878 previous section; \texttt{provide=!} forces the \texttt{ldf} file, but
879 note |thai.ldf| is not supported in Unicode engines), and:
880 \begin{verbatim}
881 \usepackage[dutch,german,thai,_provide*=*_]{babel}
882 \end{verbatim}
883 which will use the modern mode in all languages (note the correct name
884 here is |german|).
885 \end{example}
886
887 \subsection{Languages supported by \babel{} in the ‘classical’ mode}
888
889 (To be updated.) In the following table most of the languages supported
890 by \babel{} with an |ldf| file are listed, together with the names of
891 the options which you can load \babel\ with for each language. Note this
892 list is open and the current options may be different. It does not
893 include |ini| files (see below).
894
895 Except in a few cases (e.g., |serbianc|, |acadian|) names are
896 those of the Unicode CLDR (or based on them).
897
898 Most of them work out of the box, but some may require extra fonts,
899 encoding files, a preprocessor or even a complete framework (like
900 \textsf{CJK} or \textsf{luatexja}).
901
902 \begingroup
903
904 \bigskip\hrule\nobreak
905
906 \makeatletter
907 \newcommand\tag[3][?]{\par
908 \hspace{-2em}\textcolor{thered}{\texttt{#2}}#3\enspace
909 \ifx\relax#1\relax\else
910 \ifx?#1%
911 \href{https://ctan.org/pkg/babel-#2}{\scriptsize ※}%
912 \else
913 \href{https://ctan.org/pkg/#1}{\scriptsize ※}%
914 \fi
915 \fi}
916 \def\subtag#1#2{\par
917 \hspace{-1em}\texttt{#1}#2\enspace}
918 \def\subtagalt#1#2{\par
919 \hspace{-1em}\textcolor{thered}{\texttt{#1}}#2\enspace}
920 \def\tagmin#1#2{\par
921 \hspace{-2em}\textcolor[gray]{.4}{\texttt{#1}}#2\enspace}
922 \def\subtagmin#1#2{\par
923 \hspace{-1em}\textcolor[gray]{.4}{\texttt{#1}}#2\enspace}
924 \def\note#1{\par{\footnotesize#1\par}}
925 \small
926
927 \bigskip
928
929 \textit{This list is still under revision.}\\
930 Recommended names are set in \textcolor{thered}{red}.\\
931 Additional languages are set in \textcolor[gray]{.4}{gray}.\\
932 Discouraged and deprecated names are not included.\\
933 There are some notes in a few languages.\\
934 The reference mark ({\scriptsize ※}) is a link to CTAN.
935
936 \bigskip\hrule\nobreak
937
938 \begin{multicols}{2}
939 \leftskip2em\parindent0pt
940 \tag[babel-dutch]{afrikaans}{}
941 \tag{albanian}{}
942 \tag{amharic}{}
943 \note{Calls \textsf{ethiop}}
944 \tag[arabi]{arabic}{}
945 \note{Calls \textsf{arabi}.}
946 \tag{azerbaijani}{}
947 \tag{basque}{}
948 \tag{belarusian}{}
949 \tag{bosnian}{}
950 \tag{breton}{}
951 \tag{bulgarian}{}
952 \tag{catalan}{}
953 \tag{croatian}{}
954 \tag{czech}{}
955 \tag{danish}{}
956 \tag{dutch}{}
957 \tag{english}{}
958 \subtagalt{american}{}
959 \subtag{USenglish}{}{}
960 \subtagalt{australian}{}
961 \subtagalt{british}{}
962 \subtag{UKenglish}{}
963 \subtagalt{canadian}{}
964 \subtag{newzealand}{}
965 \tag{esperanto}{}
966 \tag{estonian}{}
967 \tagmin{ethiop}{}
968 \note{See \textsf{amharic}.}
969 \tag[arabi]{farsi}{}
970 \note{Calls \textsf{arabi}.}
971 \tag{finnish}{}
972 \tag{french}{}
973 \subtagalt{acadian}{}
974 \tag[babel-friulan]{friulian}{}
975 \tag{galician}{}
976 \tag{georgian}{}
977 \note{Calls \textsf{geotex}.}
978 \tag{german}{}
979 \note{See the manual for the \textsf{german} babel style.}
980 % This block refers to the old ortography. For the modern one, use
981 % the names in the block \textsf{ngerman}. \textsf{swissgerman} refers to
982 % the language with tag \texttt{gsw}}
983 \subtagalt{austrian}{}
984 % \subtagalt{swissgerman}{}
985 % \note{Swiss High German}
986 \tag{greek}{}
987 \subtagalt{polytonicgreek}{}
988 \note{Calls \textsf{greek.polytonic}}
989 \subtagalt{ancientgreek}{}
990 \note{Calls \textsf{greek.ancient}}
991 \subtagmin{ibycus}{}
992 \subtagmin{bgreek}{}
993 \tag{hebrew}{}
994 \tag[devanagari]{hindi}{}
995 \note{Calls \textsf{velthuis}.}
996 \tag{hungarian}{}
997 \subtag{magyar}{}
998 \tag{icelandic}{}
999 \tag{indonesian}{}
1000 \tag{interlingua}{}
1001 \tag{irish}{}
1002 \tag{italian}{}
1003 \tag{japanese}{}
1004 \tagmin{kurmanji}{}
1005 \tag{latin}{}
1006 \subtagalt{classicallatin}{}
1007 \subtagalt{medievallatin}{}
1008 \subtagalt{ecclesiasticallatin}{}
1009 \tag{latvian}{}
1010 \tag{lithuanian}{}
1011 \tag[babel-sorbian]{lowersorbian}{}
1012 \tag{macedonian}{}
1013 \tag{malay}{}
1014 \tag[mongolian-babel]{mongolian}{}
1015 \tag[babel-german]{ngerman}{}
1016 % \note{This block refers to the new ortography.}
1017 \note{See the manual for the \textsf{german} babel style.}
1018 \subtagalt{naustrian}{}
1019 \subtagalt{nswissgerman}{}
1020 \note{Swiss High German}
1021 \tag[babel-samin]{northernsami}{}
1022 \tag[babel-norsk]{norwegian}{}
1023 \subtag{norsk}{}
1024 \tag[babel-norsk]{nynorsk}{}
1025 \tag{occitan}{}
1026 \tag{piedmontese}{}
1027 \tagmin{pinyin}{}
1028 \tag{polish}{}
1029 \tag[babel-portuges]{portuguese}{}
1030 \subtagalt{brazilian}{}
1031 \tag{romanian}{}
1032 \tag{romansh}{}
1033 \tag{russian}{}
1034 \tag[babel-scottish]{scottishgaelic}{}
1035 \subtag{scottish}{}
1036 \tag{serbianc}{}
1037 \note{Cyrillic script}
1038 \subtagalt{serbian}{}
1039 \note{Latin script}
1040 \tag{slovak}{}
1041 % \tag[]{slovene}{}
1042 \tag{slovenian}{} %%%%%% <- and ini
1043 \tag{spanglish}{}
1044 \tag{spanish}{}
1045 \tag{swedish}{}
1046 \tag{swissgerman}{}
1047 \note{Swiss German, with tag \textsf{gsw}}
1048 \tag{thai}{}
1049 \subtagmin{thaicjk}{}
1050 \tag{turkish}{}
1051 \tag[turkmen]{turkmen}{}
1052 \tag{ukrainian}{}
1053 \tag[sorbian]{uppersorbian}{}
1054 \tag{vietnamese}{}
1055 \tag{welsh}{}
1056 \end{multicols}
1057 \endgroup
1058 \hrule
1059 \bigskip
1060
1061 \begin{example}
1062 An example of a language requiring a preprocessor and a separate
1063 package is \texttt{hindi}. If you have got the
1064 \textsf{velthuis/devnag} package, create a file with
1065 extension |.dn|:
1066 \begin{verbatim}
1067 \documentclass{article}
1068 \usepackage[hindi]{babel}
1069 \begin{document}
1070 {\dn devaanaa.m priya.h}
1071 \end{document}
1072 \end{verbatim}
1073 Then preprocess it with |devnag| \m{file}, which creates
1074 \m{file}|.tex|; you can then typeset the latter with \LaTeX.
1075 \end{example}
1076
1077 \subsection{Languages supported by \babel{} in the ‘modern’ mode}
1078
1079 Here is the list of the names currently supported with |ini| locale
1080 files, with |\babelprovide| (or |provide=|). With these languages,
1081 |\babelfont| loads (if not done before) the language and script names
1082 (even if the language is defined as a package option with an
1083 \textsf{ldf} file). These are also the names recognized by
1084 |\babelprovide| with a valueless |import|, which will load the |ini|
1085 file with the tag given in parenthesis.
1086
1087 Following the current common practice (for example, the Unicode CLDR),
1088 all locales are organized in a flat structure. This eases their
1089 identification and customization.
1090
1091 Many locale are quite usable, provided captions and dates are not
1092 required (which is a very frequent case, particularly in ancient
1093 languages). So, they are included in the default \babel{} distribution.
1094 This can serve to encourage contributions, too. A warning will remember
1095 they are ‘bare minimum locales’. They are set in
1096 \textcolor[gray]{.4}{gray} in the following list.
1097
1098 \begingroup
1099 \bigskip\hrule\nobreak
1100
1101 \makeatletter
1102 \def\tag#1#2#3{\par
1103 \hspace{-2em}\textcolor{thered}{\texttt{#1}}#2\enspace
1104 \mbox{\footnotesize(#3)}\enspace
1105 \href{https://latex3.github.io/babel/guides/locale-#1.html}{\scriptsize ※}}
1106 \def\subtag#1#2#3{\par
1107 \hspace{-1em}\texttt{#1}#2\enspace
1108 \mbox{\footnotesize(#3)}}
1109 \def\subtagalt#1#2#3{\par
1110 \hspace{-1em}\textcolor{thered}{\texttt{#1}}#2\enspace
1111 \mbox{\footnotesize(#3)}}
1112 \def\tagmin#1#2#3{\par
1113 \hspace{-2em}\textcolor[gray]{.4}{\texttt{#1}}#2\enspace
1114 \mbox{\footnotesize(#3)}\enspace
1115 \href{https://latex3.github.io/babel/guides/locale-#1.html}{\scriptsize ※}}
1116 \def\subtagmin#1#2#3{\par
1117 \hspace{-1em}\textcolor[gray]{.4}{\texttt{#1}}#2\enspace
1118 \mbox{\footnotesize(#3)}}
1119 \def\hascapu{\textsuperscript{u}}
1120 \def\hascapl{\textsuperscript{l}}
1121 \def\note#1{\par{\footnotesize#1\par}}
1122 \small
1123
1124 \bigskip
1125
1126 Recommended names are set in \textcolor{thered}{red}.\\
1127 In variants with the region or the script name (which are not
1128 highlighted), prefer the full forms.\\
1129 Bare minimum locales are set in \textcolor[gray]{.4}{gray}.\\
1130 Discouraged and deprecated names are not included.\\
1131 \hascapu{} means Unicode captions; \hascapl{} means LICR captions.\\
1132 There are some notes in a few locales.\\
1133 The reference mark ({\scriptsize ※}) is a link to the \babel{} site.
1134
1135 \bigskip\hrule\nobreak
1136
1137 \begin{multicols}{2}
1138 \leftskip2em\parindent0pt
1139 \tag{abkhazian}{}{ab}
1140 \tag{afar}{}{aa}
1141 \tag{afrikaans}{\hascapu\hascapl}{af}
1142 \tag{aghem}{}{agq}
1143 \tag{akan}{}{ak}
1144 \tagmin{akkadian}{}{akk}
1145 \tag{albanian}{\hascapu\hascapl}{sq}
1146 \tagmin{algerianarabic}{}{arq}
1147 \note{Darija or Lahja Djazairia, with tag \texttt{arq}, different
1148 from Standard Arabic as spoken in Alger, with tag \texttt{ar-DZ}.}
1149 \tag{amharic}{\hascapu\hascapl}{am}
1150 \tagmin{ancientegyptian}{}{egy}
1151 \tag{ancientgreek}{\hascapu\hascapl}{grc}\note{It’s a different
1152 language from \texttt{greek}.}
1153 \tagmin{ancienthebrew}{}{hbo}
1154 \tag{arabic}{\hascapu}{ar}
1155 \subtag{arabic-algeria}{\hascapu}{ar-DZ}
1156 \subtag{arabic-dz}{\hascapu}{ar-DZ}
1157 \subtag{arabic-egypt}{\hascapu}{ar-EG}
1158 \subtag{arabic-eg}{\hascapu}{ar-EG}
1159 \subtag{arabic-iraq}{\hascapu}{ar-IQ}
1160 \subtag{arabic-iq}{\hascapu}{ar-IQ}
1161 \subtag{arabic-jordan}{\hascapu}{ar-JO}
1162 \subtag{arabic-jo}{\hascapu}{ar-JO}
1163 \subtag{arabic-lebanon}{\hascapu}{ar-LB}
1164 \subtag{arabic-lb}{\hascapu}{ar-LB}
1165 \subtag{arabic-morocco}{\hascapu}{ar-MA}
1166 \subtag{arabic-ma}{\hascapu}{ar-MA}
1167 \subtag{arabic-palestinianterritories}{\hascapu}{ar-PS}
1168 \subtag{arabic-ps}{\hascapu}{ar-PS}
1169 \subtag{arabic-saudiarabia}{\hascapu}{ar-SA}
1170 \subtag{arabic-sa}{\hascapu}{ar-SA}
1171 \subtag{arabic-syria}{\hascapu}{ar-SY}
1172 \subtag{arabic-sy}{\hascapu}{ar-SY}
1173 \subtag{arabic-tunisia}{\hascapu}{ar-TN}
1174 \subtag{arabic-tn}{\hascapu}{ar-TN}
1175 \tagmin{aramaic}{}{arc}
1176 \subtagmin{aramaic-nabataean}{}{arc-nbat}
1177 \subtagmin{aramaic-nbat}{}{arc-nbat}
1178 \subtagmin{aramaic-palmyrene}{}{arc-palm}
1179 \subtagmin{aramaic-palm}{}{arc-palm}
1180 \tag{armenian}{\hascapu\hascapl}{hy}
1181 \tag{assamese}{\hascapu}{as}
1182 \tag{asturian}{\hascapu\hascapl}{ast}
1183 \tag{asu}{}{asa}
1184 \tag{atsam}{}{cch}
1185 \tagmin{avestan}{}{ae}
1186 \tag{awadhi}{}{awa}
1187 \tagmin{aymara}{}{ay}
1188 \tag{azerbaijani}{\hascapu\hascapl}{az}
1189 \subtag{azerbaijani-cyrillic}{}{az-Cyrl}
1190 \subtag{azerbaijani-cyrl}{}{az-Cyrl}
1191 \subtag{azerbaijani-latin}{}{az-Latn}
1192 \subtag{azerbaijani-latn}{}{az-Latn}
1193 \tag{bafia}{}{ksf}
1194 \tagmin{balinese}{}{ban}
1195 \tag{baluchi}{}{bal}
1196 \tag{bambara}{}{bm}
1197 \tag{bangla}{\hascapu}{bn}
1198 \subtag{bengali}{\hascapu}{bn}
1199 \tag{basaa}{}{bas}
1200 \tagmin{bashkir}{}{ba}
1201 \tag{basque}{\hascapu\hascapl}{eu}
1202 \tagmin{bataktoba}{}{bbc}
1203 \tagmin{bavarian}{}{bar}
1204 \tag{belarusian}{\hascapu\hascapl}{be}
1205 \subtag{belarusian-taraskievica}{\hascapu\hascapl}{be-tarask}
1206 \tag{bemba}{}{bem}
1207 \tag{bena}{}{bez}
1208 \tag{betawi}{}{bew}
1209 \tag{bhojpuri}{}{bho}
1210 \tag{blin}{}{byn}
1211 \tag{bodo}{}{brx}
1212 \tag{bosnian}{\hascapu\hascapl}{bs}
1213 \subtag{bosnian-cyrillic}{}{bs-Cyrl}
1214 \subtag{bosnian-cyrl}{}{bs-Cyrl}
1215 \subtag{bosnian-latin}{\hascapu\hascapl}{bs-Latn}
1216 \subtag{bosnian-latn}{\hascapu\hascapl}{bs-Latn}
1217 \tag{breton}{\hascapu\hascapl}{br}
1218 \tag{bulgarian}{\hascapu\hascapl}{bg}
1219 \tag{buriat}{\hascapu\hascapl}{bua}
1220 \tag{burmese}{}{my}
1221 \tag{cantonese}{}{yue}
1222 \tagmin{carian}{}{xcr}
1223 \tag{catalan}{\hascapu\hascapl}{ca}
1224 \tag{cebuano}{}{ceb}
1225 \tag{centralatlastamazight}{}{tzm}
1226 \tag{centralkurdish}{\hascapu}{ckb}
1227 \subtag{sorani}{\hascapu}{ckb}
1228 \subtag{centralkurdish-latin}{\hascapu}{ckb-Latn}
1229 \subtag{centralkurdish-latn}{\hascapu}{ckb-Latn}
1230 \tag{chakma}{}{ccp}
1231 \tag{chechen}{}{ce}
1232 \tag{cherokee}{}{chr}
1233 \tag{chiga}{}{cgg}
1234 \tag{chinese}{\hascapu}{zh}
1235 \subtag{chinese-simplified}{\hascapu}{zh-Hans}
1236 \subtag{chinese-hans}{\hascapu}{zh-Hans}
1237 \subtag{chinese-traditional}{\hascapu}{zh-Hant}
1238 \subtag{chinese-hant}{\hascapu}{zh-Hant}
1239 \subtag{chinese-simplified-hongkongsarchina}{}{zh-Hans-HK}
1240 \subtag{chinese-hans-hk}{}{zh-Hans-HK}
1241 \subtag{chinese-simplified-macausarchina}{}{zh-Hans-MO}
1242 \subtag{chinese-hans-mo}{}{zh-Hans-MO}
1243 \subtag{chinese-simplified-singapore}{}{zh-Hans-SG}
1244 \subtag{chinese-hans-sg}{}{zh-Hans-SG}
1245 \subtag{chinese-hant-hk}{}{zh-Hant-HK}
1246 \subtag{chinese-traditional-hongkongsarchina}{}{zh-Hant-HK}
1247 \subtag{chinese-hant-mo}{}{zh-Hant-MO}
1248 \subtag{chinese-traditional-macausarchina}{}{zh-Hant-MO}
1249 \tag{churchslavic}{\hascapu}{cu}
1250 \subtag{churchslavic-cyrs}{\hascapu}{cu-Cyrs}
1251 \subtag{churchslavic-glag}{}{cu-Glag}
1252 \subtag{churchslavic-glagolitic}{}{cu-Glag}
1253 \subtag{churchslavic-oldcyrillic}{\hascapu}{cu-Cyrs}
1254 % \tag{churchslavonic}{\hascapu}{cu}
1255 \tag{chuvash}{}{cv}
1256 \tagmin{classicalmandaic}{}{myz}
1257 % \tag{classiclatin}{\hascapu\hascapl}{la-x-classic}
1258 \tag{colognian}{}{ksh}
1259 \tag{coptic}{}{cop}
1260 \tag{cornish}{}{kw}
1261 \tag{corsican}{}{co}
1262 \tag{croatian}{\hascapu\hascapl}{hr}
1263 \tag{czech}{\hascapu\hascapl}{cs}
1264 \tag{danish}{\hascapu\hascapl}{da}
1265 \tagmin{divehi}{}{dv}
1266 \tag{dogri}{}{doi}
1267 \tag{duala}{}{dua}
1268 \tag{dutch}{\hascapu\hascapl}{nl}
1269 \tag{dzongkha}{}{dz}
1270 % \tag{ecclesiasticlatin}{\hascapu\hascapl}{la-x-ecclesia}
1271 \tagmin{egyptianarabic}{}{arz}\note{Masri or Colloquial Egyptian, with tag
1272 \texttt{arz}, different from Standard Arabic as spoken in
1273 Egypt, with tag \texttt{ar-EG}.}
1274 \tag{embu}{}{ebu}
1275 \tag{english}{\hascapu\hascapl}{en}
1276 \subtagalt{american}{\hascapu\hascapl}{en-US}
1277 \subtag{americanenglish}{\hascapu\hascapl}{en-US}
1278 \subtag{usenglish}{\hascapu\hascapl}{en-US}
1279 \subtagalt{australian}{\hascapu\hascapl}{en-AU}
1280 \subtag{australianenglish}{\hascapu\hascapl}{en-AU}
1281 \subtagalt{british}{\hascapu\hascapl}{en-GB}
1282 \subtag{britishenglish}{\hascapu\hascapl}{en-GB}
1283 \subtag{ukenglish}{\hascapu\hascapl}{en-GB}
1284 \subtagalt{canadian}{\hascapu\hascapl}{en-CA}
1285 \subtag{canadianenglish}{\hascapu\hascapl}{en-CA}
1286 \subtag{english-australia}{\hascapu\hascapl}{en-AU}
1287 \subtag{english-au}{\hascapu\hascapl}{en-AU}
1288 \subtag{english-canada}{\hascapu\hascapl}{en-CA}
1289 \subtag{english-ca}{\hascapu\hascapl}{en-CA}
1290 \subtag{english-unitedkingdom}{\hascapu\hascapl}{en-GB}
1291 \subtag{english-gb}{\hascapu\hascapl}{en-GB}
1292 \subtag{english-newzealand}{\hascapu\hascapl}{en-NZ}
1293 \subtag{newzealand}{\hascapu\hascapl}{en-NZ}
1294 \subtag{english-unitedstates}{\hascapu\hascapl}{en-US}
1295 \subtag{english-nz}{\hascapu\hascapl}{en-NZ}
1296 \subtag{english-us}{\hascapu\hascapl}{en-US}
1297 \tag{erzya}{}{myv}
1298 \tag{esperanto}{\hascapu\hascapl}{eo}
1299 \tag{estonian}{\hascapu\hascapl}{et}
1300 \tagmin{etruscan}{}{ett}
1301 \tag{ewe}{}{ee}
1302 \tag{ewondo}{}{ewo}
1303 \tag{faroese}{}{fo}
1304 \tag{filipino}{}{fil}
1305 \tag{finnish}{\hascapu\hascapl}{fi}
1306 \tag{french}{\hascapu\hascapl}{fr}
1307 \subtagalt{acadian}{\hascapu\hascapl}{fr-x-acadian}
1308 \subtag{canadianfrench}{\hascapu\hascapl}{fr-CA}
1309 \subtag{swissfrench}{\hascapu\hascapl}{fr-CH}
1310 \subtag{french-belgium}{\hascapu\hascapl}{fr-BE}
1311 \subtag{french-be}{\hascapu\hascapl}{fr-BE}
1312 \subtag{french-canada}{\hascapu\hascapl}{fr-CA}
1313 \subtag{french-ca}{\hascapu\hascapl}{fr-CA}
1314 \subtag{french-luxembourg}{\hascapu\hascapl}{fr-LU}
1315 \subtag{french-lu}{\hascapu\hascapl}{fr-LU}
1316 \subtag{french-switzerland}{\hascapu\hascapl}{fr-CH}
1317 \subtag{french-ch}{\hascapu\hascapl}{fr-CH}
1318 \tag{friulian}{\hascapu\hascapl}{fur}
1319 \tag{fulah}{}{ff}
1320 \tag{ga}{}{gaa}
1321 \tag{galician}{\hascapu\hascapl}{gl}
1322 \tag{ganda}{}{lg}
1323 \tag{geez}{}{gez}
1324 \tag{georgian}{\hascapu}{ka}
1325 \tag{german}{\hascapu\hascapl}{de}
1326 \note{Note the \texttt{ldf} names differ. See note above and also \New{25.17}.}
1327 \subtag{german-traditional}{\hascapu\hascapl}{de-1901}
1328 \subtagalt{austrian}{\hascapu\hascapl}{de-AT}
1329 \subtag{german-austria}{\hascapu\hascapl}{de-AT}
1330 \subtag{german-at}{\hascapu\hascapl}{de-AT}
1331 \subtag{german-austria-traditional}{\hascapu\hascapl}{de-AT-1901}
1332 \subtagalt{swisshighgerman}{\hascapu\hascapl}{de-CH}\note{\texttt{swissgerman},
1333 with tag \texttt{gsw} is a different language. But see \New{25.17}.}
1334 \subtag{german-switzerland}{\hascapu\hascapl}{de-CH}
1335 \subtag{german-ch}{\hascapu\hascapl}{de-CH}
1336 \subtag{german-switzerland-traditional}{\hascapu\hascapl}{de-CH-1901}
1337 \tagmin{gothic}{}{got}
1338 \tag{greek}{\hascapu\hascapl}{el}
1339 \subtag{monotonicgreek}{\hascapu\hascapl}{el}
1340 \subtagalt{polytonicgreek}{\hascapu\hascapl}{el-polyton}
1341 \tag{guarani}{}{gn}
1342 \tag{gujarati}{\hascapu}{gu}
1343 \tag{gusii}{}{guz}
1344 \tag{haryanvi}{}{bgc}
1345 \tag{hausa}{\hascapu\hascapl}{ha}
1346 \subtag{hausa-ghana}{}{ha-GH}
1347 \subtag{hausa-gh}{}{ha-GH}
1348 \subtag{hausa-niger}{}{ha-NE}
1349 \subtag{hausa-ne}{}{ha-NE}
1350 \tag{hawaiian}{}{haw}
1351 \tag{hebrew}{\hascapu\hascapl}{he}
1352 \tag{hindi}{\hascapu}{hi}
1353 \tag{hmongnjua}{}{hnj}
1354 \tag{hungarian}{\hascapu\hascapl}{hu}
1355 \subtag{magyar}{\hascapu\hascapl}{hu}
1356 \tag{icelandic}{\hascapu\hascapl}{is}
1357 \tag{igbo}{}{ig}
1358 \tag{inarisami}{}{smn}
1359 \tag{indonesian}{\hascapu\hascapl}{id}
1360 \tagmin{ingush}{}{inh}
1361 \tag{interlingua}{\hascapu\hascapl}{ia}
1362 \tag{interslavic}{\hascapu\hascapl}{isv}
1363 \tag{inuktitut}{}{iu}
1364 \tag{irish}{\hascapu\hascapl}{ga}
1365 \tag{italian}{\hascapu\hascapl}{it}
1366 \tag{japanese}{\hascapu}{ja}
1367 \tag{javanese}{}{jv}
1368 \tag{jju}{}{kaj}
1369 \tag{jolafonyi}{}{dyo}
1370 \tag{kabuverdianu}{}{kea}
1371 \tag{kabyle}{}{kab}
1372 \tag{kaingang}{}{kgp}
1373 \tag{kako}{}{kkj}
1374 \tag{kalaallisut}{}{kl}
1375 \tag{kalenjin}{}{kln}
1376 \tag{kamba}{}{kam}
1377 \tag{kangri}{}{xnr}
1378 \tag{kannada}{\hascapu}{kn}
1379 \tag{kashmiri}{}{ks}
1380 \tag{kazakh}{}{kk}
1381 \tag{khmer}{\hascapu}{km}
1382 \tag{kikuyu}{}{ki}
1383 \tag{kinyarwanda}{}{rw}
1384 \tagmin{komi}{}{kv}
1385 \tag{konkani}{}{kok}
1386 \tag{korean}{\hascapu}{ko}
1387 \subtag{korean-han}{\hascapu}{ko-Hani}
1388 \subtag{korean-hani}{\hascapu}{ko-Hani}
1389 \tag{koyraborosenni}{}{ses}
1390 \tag{koyrachiini}{}{khq}
1391 \tag{kurdish}{\hascapu\hascapl}{ku}
1392 \subtag{kurdish-arab}{\hascapu}{ku-Arab}
1393 \subtag{kurdish-arabic}{\hascapu}{ku-Arab}
1394 \subtag{northernkurdish}{\hascapu\hascapl}{ku}
1395 \subtag{northernkurdish-arab}{\hascapu}{ku-Arab}
1396 \subtag{northernkurdish-arabic}{\hascapu}{ku-Arab}
1397 \tag{kwasio}{}{nmg}
1398 \tag{kyrgyz}{}{ky}
1399 \tagmin{ladino}{}{lad}
1400 \tag{lakota}{}{lkt}
1401 \tag{langi}{}{lag}
1402 \tag{lao}{\hascapu}{lo}
1403 \tag{latin}{\hascapu\hascapl}{la}
1404 \subtagalt{ecclesiasticallatin}{\hascapu\hascapl}{la-x-ecclesia}
1405 \subtagalt{classicallatin}{\hascapu\hascapl}{la-x-classic}
1406 \subtagalt{medievallatin}{\hascapu\hascapl}{la-x-medieval}
1407 \tag{latvian}{\hascapu\hascapl}{lv}
1408 \tagmin{lepcha}{}{lep}
1409 \tag{ligurian}{}{lij}
1410 \tagmin{limbu}{}{lif}
1411 \subtagmin{limbu-limb}{}{lif-limb}
1412 \subtagmin{limbu-limbu}{}{lif-limb}
1413 \tagmin{lineara}{}{lab}
1414 \tag{lingala}{}{ln}
1415 \tag{lithuanian}{\hascapu\hascapl\hascapl\hascapl}{lt}
1416 \tagmin{lombard}{}{lmo}
1417 \tag{lowersorbian}{\hascapu\hascapl}{dsb}
1418 \tag{lowgerman}{}{nds}
1419 % \tag{lsorbian}{\hascapu\hascapl}{dsb}
1420 \tagmin{lu}{}{khb}
1421 \tagmin{lycian}{}{xlc}
1422 \tagmin{lydian}{}{xld}
1423 \tag{lubakatanga}{}{lu}
1424 \tag{luo}{}{luo}
1425 \tag{luxembourgish}{\hascapu\hascapl}{lb}
1426 \tag{luyia}{}{luy}
1427 \tag{macedonian}{\hascapu\hascapl}{mk}
1428 \tag{machame}{}{jmc}
1429 \tag{maithili}{}{mai}
1430 \tagmin{makasar}{}{mak}
1431 \subtagmin{makasar-bugi}{}{mak-Bugi}
1432 \subtagmin{makasar-buginese}{}{mak-Bugi}
1433 \tag{makhuwa}{}{vmw}
1434 \tag{makhuwameetto}{}{mgh}
1435 \tag{makonde}{}{kde}
1436 \tag{malagasy}{}{mg}
1437 \tag{malay}{\hascapu\hascapl}{ms}
1438 \subtag{malay-brunei}{}{ms-BN}
1439 \subtag{malay-bn}{}{ms-BN}
1440 \subtag{malay-singapore}{}{ms-SG}
1441 \subtag{malay-sg}{}{ms-SG}
1442 \tag{malayalam}{\hascapu}{ml}
1443 \tag{maltese}{}{mt}
1444 \tag{manipuri}{}{mni}
1445 \tag{manx}{}{gv}
1446 \tag{maori}{}{mi}
1447 \tag{marathi}{\hascapu}{mr}
1448 \tag{masai}{}{mas}
1449 \tag{mazanderani}{}{mzn}
1450 \tag{meru}{}{mer}
1451 \tag{meta}{}{mgo}
1452 \tag{mongolian}{}{mn}
1453 \tag{monotonicgreek}{\hascapu\hascapl}{el}
1454 \tag{morisyen}{}{mfe}
1455 \tag{mundang}{}{mua}
1456 \tag{muscogee}{}{mus}
1457 \tag{nama}{}{naq}
1458 % \tag{naustrian}{\hascapu\hascapl}{de-AT}
1459 \tagmin{navajo}{}{nv}
1460 \tag{nepali}{}{ne}
1461 \tagmin{newari}{}{new}
1462 % \tag{ngerman}{\hascapu\hascapl}{de}
1463 \tag{ngiemboon}{}{nnh}
1464 \tag{ngomba}{}{jgo}
1465 \tag{nheengatu}{}{yrl}
1466 \tag{nigerianpidgin}{}{pcm}
1467 \tag{nko}{}{nqo}
1468 \tag{northernfrisian}{}{frr}
1469 \tag{northernluri}{}{lrc}
1470 \tag{northernsami}{\hascapu\hascapl}{se}
1471 \subtag{samin}{\hascapu\hascapl}{se}
1472 \tag{northernsotho}{}{nso}
1473 \tag{northndebele}{}{nd}
1474 \tag{norwegian}{\hascapu\hascapl}{no}
1475 \subtag{norsk}{\hascapu\hascapl}{no}
1476 \note{In the CLDR, \texttt{norwegianbokmal} (nb) just inherites from
1477 \texttt{norwegian}, so use the latter.}
1478 % \tag{norwegianbokmal}{\hascapu\hascapl}{nb}
1479 \tag{nuer}{}{nus}
1480 \tag{nyanja}{}{ny}
1481 \tag{nyankole}{}{nyn}
1482 \tag{nynorsk}{\hascapu\hascapl}{nn}
1483 \subtag{norwegiannynorsk}{\hascapu\hascapl}{nn}
1484 \tag{occitan}{\hascapu\hascapl}{oc}
1485 \tag{odia}{\hascapu}{or}
1486 \note{Preferred to \texttt{oriya}.}
1487 \tagmin{oldirish}{}{sga}
1488 \tagmin{oldnorse}{}{non}
1489 \tagmin{oldpersian}{}{peo}
1490 \tagmin{olduighur}{}{oui}
1491 % \tag{oriya}{\hascapu}{or}
1492 \tag{oromo}{}{om}
1493 \tag{osage}{}{osa}
1494 \tag{ossetic}{}{os}
1495 \tag{papiamento}{}{pap}
1496 \tag{pashto}{}{ps}
1497 \tag{persian}{\hascapu}{fa}
1498 \subtag{farsi}{\hascapu}{fa}
1499 \tagmin{phoenician}{}{phn}
1500 \tag{piedmontese}{\hascapu\hascapl}{pms}
1501 \tag{polish}{\hascapu\hascapl}{pl}
1502 \tag{portuguese}{\hascapu\hascapl}{pt}
1503 \subtagalt{brazilian}{\hascapu\hascapl}{pt-BR}
1504 \subtag{brazilianportuguese}{\hascapu\hascapl}{pt-BR}
1505 \subtag{portuguese-brazil}{\hascapu\hascapl}{pt-BR}
1506 \subtag{portuguese-br}{\hascapu\hascapl}{pt-BR}
1507 \subtag{europeanportuguese}{\hascapu\hascapl}{pt-PT}
1508 \subtag{portuguese-portugal}{\hascapu\hascapl}{pt-PT}
1509 \subtag{portuguese-pt}{\hascapu\hascapl}{pt-PT}
1510 \tag{prussian}{}{prg}
1511 \tag{punjabi}{\hascapu}{pa}
1512 \subtag{punjabi-arabic}{}{pa-Arab}
1513 \subtag{punjabi-arab}{}{pa-Arab}
1514 \subtag{punjabi-gurmukhi}{\hascapu}{pa-Guru}
1515 \subtag{punjabi-guru}{\hascapu}{pa-Guru}
1516 \tag{quechua}{}{qu}
1517 \tag{rajasthani}{}{raj}
1518 \tag{romanian}{\hascapu\hascapl}{ro}
1519 \subtagalt{moldavian}{\hascapu\hascapl}{ro-MD}
1520 \subtag{romanian-moldova}{\hascapu\hascapl}{ro-MD}
1521 \subtag{romanian-md}{\hascapu\hascapl}{ro-MD}
1522 \tag{romansh}{\hascapu\hascapl}{rm}
1523 \tag{rombo}{}{rof}
1524 \tag{rundi}{}{rn}
1525 \tag{russian}{\hascapu\hascapl}{ru}
1526 \tag{rwa}{}{rwk}
1527 \tagmin{sabaean}{}{xsa}
1528 \tag{saho}{}{ssy}
1529 \tag{sakha}{}{sah}
1530 \tagmin{samaritan}{}{smp}
1531 \tag{samburu}{}{saq}
1532 \tag{sango}{}{sg}
1533 \tag{sangu}{}{sbp}
1534 \tag{sanskrit}{}{sa}
1535 \subtag{sanskrit-bangla}{}{sa-Beng}
1536 \subtag{sanskrit-beng}{}{sa-Beng}
1537 % \subtag{sanskrit-bengali}{}{sa-Beng}
1538 \subtag{sanskrit-devanagari}{}{sa-Deva}
1539 \subtag{sanskrit-deva}{}{sa-Deva}
1540 \subtag{sanskrit-gujarati}{}{sa-Gujr}
1541 \subtag{sanskrit-gujr}{}{sa-Gujr}
1542 \subtag{sanskrit-kannada}{}{sa-Knda}
1543 \subtag{sanskrit-knda}{}{sa-Knda}
1544 \subtag{sanskrit-malayalam}{}{sa-Mlym}
1545 \subtag{sanskrit-mlym}{}{sa-Mlym}
1546 \subtag{sanskrit-telugu}{}{sa-Telu}
1547 \subtag{sanskrit-telu}{}{sa-Telu}
1548 \tag{santali}{}{sat}
1549 \tag{saraiki}{}{skr}
1550 \tag{sardinian}{}{sc}
1551 \tag{scottishgaelic}{\hascapu\hascapl}{gd}
1552 \subtag{scottish}{\hascapu\hascapl}{gd}
1553 \tag{sena}{}{seh}
1554 \tag{serbian}{\hascapu\hascapl}{sr}
1555 \note{Note the \texttt{ldf} names differ. See note above.}
1556 \subtag{serbian-cyrillic}{\hascapu\hascapl}{sr-Cyrl}
1557 \subtag{serbian-cyrl}{\hascapu\hascapl}{sr-Cyrl}
1558 \subtag{serbian-cyrillic-bosniaherzegovina}{\hascapu\hascapl}{sr-Cyrl-BA}
1559 \subtag{serbian-cyrl-ba}{\hascapu\hascapl}{sr-Cyrl-BA}
1560 \subtag{serbian-cyrillic-kosovo}{\hascapu\hascapl}{sr-Cyrl-XK}
1561 \subtag{serbian-cyrl-xk}{\hascapu\hascapl}{sr-Cyrl-XK}
1562 \subtag{serbian-cyrillic-montenegro}{\hascapu\hascapl}{sr-Cyrl-ME}
1563 \subtag{serbian-cyrl-me}{\hascapu\hascapl}{sr-Cyrl-ME}
1564 \subtag{serbian-latin}{\hascapu\hascapl}{sr-Latn}
1565 \subtag{serbian-latn}{\hascapu\hascapl}{sr-Latn}
1566 \subtag{serbian-latin-bosniaherzegovina}{\hascapu\hascapl}{sr-Latn-BA}
1567 \subtag{serbian-latn-ba}{\hascapu\hascapl}{sr-Latn-BA}
1568 \subtag{serbian-latin-kosovo}{\hascapu\hascapl}{sr-Latn-XK}
1569 \subtag{serbian-latn-xk}{\hascapu\hascapl}{sr-Latn-XK}
1570 \subtag{serbian-latin-montenegro}{\hascapu\hascapl}{sr-Latn-ME}
1571 \subtag{serbian-latn-me}{\hascapu\hascapl}{sr-Latn-ME}
1572 \subtag{serbian-ijekavsk}{\hascapu\hascapl}{sr-ijekavsk}
1573 \subtag{serbian-latn-ijekavsk}{\hascapu\hascapl}{sr-Latn-ijekavsk}
1574 % \tag{serbianc}{\hascapu\hascapl}{sr}
1575 \tag{shambala}{}{ksb}
1576 \tag{shona}{}{sn}
1577 \tag{sichuanyi}{}{ii}
1578 \tag{sicilian}{}{scn}
1579 \tag{silesian}{}{szl}
1580 \tag{sindhi}{}{sd}
1581 \subtag{sindhi-devanagari}{}{sd-deva}
1582 \subtag{sindhi-deva}{}{sd-deva}
1583 \subtag{sindhi-khojki}{}{sd-khoj}
1584 \subtag{sindhi-khoj}{}{sd-khoj}
1585 \subtag{sindhi-khudawadi}{}{sd-sind}
1586 \subtag{sindhi-sind}{}{sd-sind}
1587 \tag{sinhala}{\hascapu}{si}
1588 \tagmin{sinteromani}{}{rmo}
1589 \tag{slovak}{\hascapu\hascapl}{sk}
1590 \tag{slovenian}{\hascapu\hascapl}{sl}
1591 \subtag{slovene}{\hascapu\hascapl}{sl}
1592 \tag{soga}{}{xog}
1593 \tag{somali}{}{so}
1594 \tagmin{southernaltai}{}{alt}
1595 \tag{southernsotho}{}{st}
1596 \tag{southndebele}{}{nr}
1597 \tag{spanish}{\hascapu\hascapl}{es}
1598 \subtagalt{mexican}{\hascapu\hascapl}{es-MX}
1599 \subtag{mexicanspanish}{\hascapu\hascapl}{es-MX}
1600 \subtag{spanish-mexico}{\hascapu\hascapl}{es-MX}
1601 \subtag{spanish-mx}{\hascapu\hascapl}{es-MX}
1602 \tag{standardmoroccantamazight}{}{zgh}
1603 \tag{sundanese}{}{su}
1604 \tag{swahili}{}{sw}
1605 \tag{swati}{}{ss}
1606 \tag{swedish}{\hascapu\hascapl}{sv}
1607 \tag{swissgerman}{}{gsw}
1608 \note{Different from \texttt{swisshighgerman} (de-CH), which is German as spoken
1609 in Switzerland. Currently still assigned to the \texttt{de-CH-1901};
1610 see \New{25.17}.}
1611 \subtag{alemannic}{}{gsw}
1612 \subtagalt{alsatian}{}{gsw-FR}
1613 \tag{syriac}{}{syr}
1614 \tag{tachelhit}{}{shi}
1615 \subtag{tachelhit-latin}{}{shi-Latn}
1616 \subtag{tachelhit-latn}{}{shi-Latn}
1617 \subtag{tachelhit-tifinagh}{}{shi-Tfng}
1618 \subtag{tachelhit-tfng}{}{shi-Tfng}
1619 \tagmin{tainua}{}{tdd}
1620 \tag{taita}{}{dav}
1621 \tag{tajik}{}{tg}
1622 \tag{tamil}{\hascapu}{ta}
1623 \tagmin{tangut}{}{txg}
1624 \tag{taroko}{}{trv}
1625 \tag{tasawaq}{}{twq}
1626 \tag{tatar}{}{tt}
1627 \tag{telugu}{\hascapu}{te}
1628 \tag{teso}{}{teo}
1629 \tag{thai}{\hascapu\hascapl}{th}
1630 \tag{tibetan}{\hascapu}{bo}
1631 \tag{tigre}{}{tig}
1632 \tag{tigrinya}{}{ti}
1633 \tag{tokpisin}{}{tpi}
1634 \tag{tongan}{}{to}
1635 \tag{tsonga}{}{ts}
1636 \tag{tswana}{}{tn}
1637 \tag{turkish}{\hascapu\hascapl}{tr}
1638 \tag{turkmen}{\hascapu\hascapl}{tk}
1639 \tag{tyap}{}{kcg}
1640 \tagmin{ugaritic}{}{uga}
1641 \tag{ukrainian}{\hascapu\hascapl}{uk}
1642 \tag{uppersorbian}{\hascapu\hascapl}{hsb}
1643 \tag{urdu}{\hascapu}{ur}
1644 \tag{uyghur}{\hascapu}{ug}
1645 \tag{uzbek}{}{uz}
1646 \subtag{uzbek-arabic}{}{uz-Arab}
1647 \subtag{uzbek-arab}{}{uz-Arab}
1648 \subtag{uzbek-cyrillic}{}{uz-Cyrl}
1649 \subtag{uzbek-cyrl}{}{uz-Cyrl}
1650 \subtag{uzbek-latin}{}{uz-Latn}
1651 \subtag{uzbek-latn}{}{uz-Latn}
1652 \tag{vai}{}{vai}
1653 \subtag{vai-latin}{}{vai-Latn}
1654 \subtag{vai-latn}{}{vai-Latn}
1655 \subtag{vai-vai}{}{vai-Vaii}
1656 \subtag{vai-vaii}{}{vai-Vaii}
1657 \tag{venda}{}{ve}
1658 \tag{venetian}{}{vec}
1659 \tag{vietnamese}{\hascapu\hascapl}{vi}
1660 \tag{volapuk}{}{vo}
1661 \tag{vunjo}{}{vun}
1662 \tag{walser}{}{wae}
1663 \tagmin{waray}{}{war}
1664 \tag{welsh}{\hascapu\hascapl}{cy}
1665 \tag{westernfrisian}{}{fy}
1666 \tag{wolaytta}{}{wal}
1667 \tag{wolof}{}{wo}
1668 \tag{xhosa}{}{xh}
1669 \tag{yangben}{}{yav}
1670 \tag{yiddish}{}{yi}
1671 \tag{yoruba}{}{yo}
1672 \tag{zarma}{}{dje}
1673 \tag{zhuang}{}{za}
1674 \tag{zulu}{}{zu}
1675 \end{multicols}
1676 \endgroup
1677 \hrule
1678 \bigskip
1679
1680 \subsection{Fonts in Unicode engines}
1681 \label{fonts}
1682
1683 \begin{note}
1684 For \textsf{pdflatex} and the standard \textsf{fontenc} mechanism,
1685 refer to the \LaTeX{} manuals or \textit{The \LaTeX{} Companion},
1686 vol.~I, ch.~9, and vol.~II, ch.~10.
1687 \end{note}
1688
1689 \New{3.15} \Babel{} has native support for Unicode fonts (OpenType and
1690 TrueType) in \luatex{} and \xetex{} by means of a high level interface
1691 on top of |fontspec|. This makes it easier to handle a wide range of
1692 languages and scripts, and simplifies the process of typesetting
1693 multilingual documents. As described below, with \luatex{} the font can
1694 be switched automatically based on the script without explicit markup.
1695
1696 There is no need to load \textsf{fontspec} explicitly – \babel{} does
1697 it for you with the first |\babelfont|.
1698
1699 \begin{note}
1700 See also the \textsf{luaotfload} fallback mechanism for a complementary
1701 approach, which can be preferable when a font lacks a character or
1702 glyph required by a language.
1703 \end{note}
1704
1705 \Describe\babelfont{\oarg{language-list}\marg{font-family}%
1706 \oarg{font-options}\marg{font-name}}
1707 \DescribeOther\babelfont{\oarg{language-list}\marg{font-family}%
1708 \marg{font-name}\oarg{font-options}}
1709
1710 The main purpose of |\babelfont| is to define at once the fonts
1711 required by the different languages, with their corresponding language
1712 systems (script and language). So, if you load, say, 4 languages,
1713 |\babelfont{rm}{FreeSerif}| defines 4 fonts (with their variants, of
1714 course), which are switched with the language by \babel. It is a tool
1715 to make things easier and transparent to the user. \New{25.15} The
1716 \oarg{font-options} can go before or after the \marg{font-name}.
1717
1718 Here \textit{font-family} is |rm|, |sf| or |tt| (or newly defined
1719 ones, as explained below), and \textit{font-name} is the same as in
1720 \textsf{fontspec} and the like.
1721
1722 If no language is given, then it is considered the default font for the
1723 family. On the other hand, if there is one or more languages in the
1724 optional argument, the font will be assigned to all of them, overriding
1725 the default one. Alternatively, you may set a font for a script -- just
1726 precede its name (lowercase) with a star (e.g., |*devanagari|).
1727
1728 With the optional argument, the font is \textit{not} yet loaded, but
1729 just predeclared. In other words, font loading is lazy, which means you
1730 may define as many fonts as you want ‘just in case’, because if the
1731 language is never selected, the corresponding |\babelfont| declaration
1732 is just ignored.
1733
1734 \Babel{} takes care of the font language and the font script when
1735 languages are selected (as well as the writing direction). In other
1736 words, there is usually no need to set the |Language| and the |Script|
1737 explicitly; in fact, it’s even discouraged. In most cases, you will not
1738 need \textit{font-options}, which is the same as in \textsf{fontspec},
1739 but you may add further key/value pairs if necessary.
1740
1741 |\babelfont| can be used to implicitly define a new font family. Just
1742 write its name instead of |rm|, |sf| or |tt|. This is the preferred way
1743 to select fonts in addition to the three basic families.
1744
1745 \New{24.14} With \luatex, \Babel\ selects the renderer in the following
1746 way:
1747 \begin{itemize}
1748 \item The default renderer in alphabetic scripts, so that the tools
1749 provided by \textsf{luaotfload} for ligatures, kerning and the like,
1750 which are essential typographical features in these scripts, are
1751 directly available: Armenian, Coptic, Cyrillic, Georgian, Glagolitic,
1752 Gothic, Greek, Latin, Old Church Slavonic Cyrillic.
1753 \item Harfbuzz in the rest of scripts, particularly complex scripts with
1754 heavy contextual analysis (like Arabic and Devanagari).
1755 \end{itemize}
1756 You can still select a different renderer with the \textsf{fontspec}
1757 key |Renderer|. Note also the same font can be loaded with different
1758 renderers. See
1759 \href{https://github.com/latex3/luaotfload/wiki/Comparing-the-modes}{Comparing
1760 the modes} for further info.
1761
1762 \begin{note}
1763 There is a list of fonts in
1764 \href{https://latex3.github.io/babel/guides/which-method-for-which-language.html}{Which
1765 method for which language}. If you know the codepoint of a character
1766 in the script you need, you can find fonts containing it with
1767 \textsf{albatross} (requires Java) or with something like
1768 \texttt{fc-list :charset=1033C family} in the commands line (in this
1769 case, a Gothic character, the script required by the |gothic|
1770 language).
1771 \end{note}
1772
1773 \begin{note}
1774 As \babel{} sets the font language system, the following setup is
1775 redundant, so avoid it and use only the first line:
1776 \begin{verbatim}
1777 \babelfont{rm}{DejaVu Serif}
1778 \babelfont[armenian]{rm}[Script=Armenian, Language=Armenian]{DejaVu Serif}
1779 \end{verbatim}
1780 \end{note}
1781
1782 \begin{example}
1783 Usage in most cases is very simple. Let us assume you are setting up
1784 a document in Swedish, with some words in Hebrew, with a font suited
1785 for both languages. Here the option |bidi=default| activates a simple
1786 (or, rather, simplistic) bidirectional mode.
1787 \begingroup
1788 % If you are looking at the code to see how it has been written, you
1789 % will be disappointed :-). The following example is built ad hoc to
1790 % emulate the final result to avoid dependencies, and therefore it's
1791 % not "real" code.
1792 \catcode`@=13
1793 \def@#1{\ifcase#1\relax \egroup \or \bgroup\textdir TLT \else
1794 \bgroup\textdir TRT \fontspec[Scale=.87,Script=Hebrew]{Liberation
1795 Mono} \fi}
1796 \setengine{luatex/xetex}
1797 \begin{verbatim}
1798 \documentclass{article}
1799
1800 \usepackage[swedish, bidi=default]{babel}
1801
1802 _\babelfont{rm}{NewComputerModern10}_
1803
1804 \begin{document}
1805
1806 Svenska \foreignlanguage{hebrew}{@2עִבְרִית@0} svenska.
1807
1808 \end{document}
1809 \end{verbatim}
1810 \endgroup
1811
1812 If on the other hand you have to resort to different fonts, you can
1813 replace the red line above with, say:
1814 \setengine{luatex/xetex}
1815 \begin{verbatim}
1816 \babelfont{rm}{Iwona}
1817 \babelfont[hebrew]{rm}{FreeSerif}
1818 \end{verbatim}
1819 \end{example}
1820
1821 \begin{example}
1822 Thanks to this high level interface to |fontspec|, the roman fonts for
1823 all secondary languages in the Cyrillic and Greek scripts can be set
1824 at once with the following single line:
1825 \setengine{luatex/xetex}
1826 \begin{verbatim}
1827 \babelfont[_*cyrillic, *greek_]{rm}{NewComputerModern10}
1828 \end{verbatim}
1829 And if you need, say, Arabic and Devanagari:
1830 \begin{verbatim}
1831 \babelfont[_*arabic, *devanagari_]{rm}{FreeSerif}
1832 \end{verbatim}
1833 \Babel{} does the rest for you, including setting the font script
1834 \textit{and} language.
1835 \end{example}
1836
1837 \begin{example}
1838 Since each locale is a separate ‘language’, they can be assigned
1839 different fonts. In this example, we set Simplified and Tradicional
1840 Chinese:
1841 \begin{verbatim}
1842 \babelfont[chinese-_simplified_]{rm}{Noto Serif CJK _SC_}
1843 \babelfont[chinese-_simplified_]{sf}{Noto Sans CJK _SC_}
1844 \babelfont[chinese-_traditional_]{rm}{Noto Serif CJK _TC_}
1845 \babelfont[chinese-_traditional_]{sf}{Noto Sans CJK _TC_}
1846 \end{verbatim}
1847 \end{example}
1848
1849 \begin{example}
1850 Here is how to declare a new family:
1851 \setengine{luatex/xetex}
1852 \begin{verbatim}
1853 \babelfont{_kai_}{FandolKai}
1854 \end{verbatim}
1855 Now, |\kaifamily| and |\kaidefault|, as well as |\textkai| are at
1856 your disposal.
1857 \end{example}
1858
1859 \begin{note}
1860 You may load \textsf{fontspec} explicitly. For example:
1861 \setengine{luatex/xetex}
1862 \begin{verbatim}
1863 \usepackage{fontspec}
1864 \newfontscript{Devanagari}{deva}
1865 \babelfont[hindi]{rm}{Shobhika}
1866 \end{verbatim}
1867 This makes sure the OpenType script for Devanagari is |deva| and not
1868 |dev2|, in case you need it.
1869 \end{note}
1870
1871 \begin{note}
1872 |\fontspec| is not touched at all, only the preset font families
1873 (|rm|, |sf|, |tt|, and the like). If a language is switched when an
1874 \textit{ad hoc} font is active, or you select the font with this
1875 command, neither the script nor the language is passed. You must
1876 add them by hand. This is by design, for several reasons —for
1877 example, each font has its own set of features and a generic setting
1878 for several of them can be problematic, and also preserving a
1879 “lower-level” font selection is useful.
1880 \end{note}
1881
1882 \begin{note}
1883 Directionality is a property affecting margins, indentation, column
1884 order, etc., not just text. Therefore, it is under the direct control
1885 of the language, which applies both the script and the direction to
1886 the text. As a consequence, there is no need to set \texttt{Script}
1887 when declaring a font with |\babelfont| (nor \texttt{Language}). In
1888 fact, it is even discouraged.
1889 \end{note}
1890
1891 \begin{note}
1892 The keys |Language| and |Script| just pass these values to the
1893 \textit{font}, and do \textit{not} set the script for the
1894 \textit{language} (and therefore the writing direction). In other
1895 words, the |ini| file or |\babelprovide| provides default values for
1896 |\babelfont| if omitted, but the opposite is not true. See the note
1897 above for the reasons of this behavior.
1898 \end{note}
1899
1900 \begin{note}
1901 |\babelfont| is a high level interface to \textsf{fontspec}, and
1902 therefore in \xetex{} you can apply |Mapping|s. For example, there is
1903 a set of
1904 \href{https://github.com/davidmjones/brahmic-maps}{transliterations
1905 for Brahmic scripts} by David M. Jones. After installing
1906 them in you distribution, just set the map as you would do with
1907 \textsf{fontspec}.
1908 \end{note}
1909
1910 \begin{warning}
1911 Using |\set|\textit{xxxx}|font| and |\babelfont| at the same time is
1912 discouraged, but very often works as expected. However, be aware with
1913 |\set|\textit{xxxx}|font| the language system will not be set by
1914 \babel{} and should be set with |fontspec| if necessary.
1915 \end{warning}
1916
1917 \begin{troubleshooting}
1918 \trouble{Package fontspec Info: Language '<lang>' not explicitly
1919 supported within font '<font>' with script '<script>'.}
1920 \textit{Package fontspec Info: Language '<lang>' not explicitly
1921 supported within font '<font>' with script '<script>'.}.
1922
1923 \textbf{This is \textit{not} and error.} This info is shown by
1924 \textsf{fontspec}, not by \babel. If everything is okay in your
1925 document (and almost always it is), the best thing you can do is just
1926 to ignore it altogether.
1927
1928 In some forums you can find the advice to set, more or less
1929 mechanically, |Language=Default|. \textit{Do not follow it}, because
1930 font features for the language will not be applied, which can be
1931 relevant for many languages, like Urdu and Turkish. Set the
1932 |Language| explicitly only if there is a reason to do it (for
1933 example, if \textsf{fontspec}/\textsf{luaotfload} doesn’t fall back
1934 correctly a font feature to the default language). If you really want
1935 to conceal this message, use instead:
1936 \begin{verbatim}
1937 \PassOptionsToPackage{silent}{fontspec}
1938 \end{verbatim}
1939 \end{troubleshooting}
1940
1941 \begin{troubleshooting}
1942 \trouble{Package babel Info: The following fonts are not babel
1943 standard families} \textit{Package babel Info: The following fonts
1944 are not babel standard families}.
1945
1946 \textbf{This is \textit{not} an error.} \babel{} assumes that if you
1947 are using |\babelfont| for a family, very likely you want to define
1948 the rest of them. If you don't, you can find some inconsistencies
1949 between families. This checking is done at the beginning of the
1950 document, at a point where we cannot know which families will be
1951 used.
1952
1953 Actually, there is no real need to use |\babelfont| in a monolingual
1954 document, if you set the language system in |\setmainfont| (or not,
1955 depending on what you want).
1956
1957 As the message explains, \textit{there is nothing intrinsically
1958 wrong} with not defining all the families. In fact, there is nothing
1959 intrinsically wrong with not using |\babelfont| at all. But you must
1960 be aware that this may lead to some problems.
1961 \end{troubleshooting}
1962
1963 \subsection{Basic language selectors}
1964 \label{selectors}
1965
1966 This section describes the commands to be used in the document to
1967 switch the language in multilingual documents. In most cases, only the
1968 two basic macros |\selectlanguage| and |\foreignlanguage| are
1969 necessary. The environments |otherlanguage|, |otherlanguage*| are
1970 auxiliary, and described in the next section.
1971
1972 The main language is selected automatically when the |document|
1973 environment begins.
1974
1975 \Describe{\selectlanguage}{\marg{language}}
1976 \DescribeOther{\begin\menv{selectlanguage}}%
1977 {\marg{language}\Eenv{selectlanguage}}
1978
1979 When a user wants to switch from one language to another he can do so
1980 using the macro |\selectlanguage|. It is meant for blocks of texts, and
1981 therefore should be used mainly in vertical mode, although it also
1982 works in horizontal mode.
1983 \begin{verbatim}
1984 \selectlanguage{german}
1985 \end{verbatim}
1986
1987 This command can be used as environment, too, in case there are
1988 relatively short texts and you do not want to reset the language with a
1989 hardcode value.
1990
1991 \begin{note}
1992 Bear in mind |\selectlanguage| can be automatically executed, in some
1993 cases, in the auxiliary files, at heads and foots, and after the
1994 environment |otherlanguage*|.
1995 \end{note}
1996
1997 \begin{warning}
1998 If used inside braces or a group there might be some non-local
1999 changes, as it would be roughly equivalent to:
2000 \begin{verbatim}
2001 \bgroup
2002 \selectlanguage{<inner-language>}
2003 ...
2004 \egroup
2005 \selectlanguage{<outer-language>}
2006 \end{verbatim}
2007 If you want a change which is really local, you must enclose this
2008 code with an additional grouping level. The same applies to the
2009 environment version.
2010 \end{warning}
2011
2012 \begin{warning}
2013 There are a couple of issues related to the way the language
2014 information is written to the auxiliary files:
2015 \begin{itemize}
2016 \item |\selectlanguage| should not be used inside some boxed environments
2017 (like floats or |minipage|) to switch the language if you need the
2018 information written to the |aux| be correctly synchronized. This
2019 rarely happens, but if it were the case, you must use the
2020 environment version or |otherlanguage| instead.
2021 \item In addition, this macro inserts a |\write| in vertical mode,
2022 which may break the vertical spacing in some cases (for example,
2023 between lists or at the beginning of a table cell). \New{3.64} The
2024 behavior can be adjusted with
2025 |\babeladjust{select.write=<mode>}|, where \m{mode} is:
2026 \begin{itemize}
2027 \item |keep|, the default – with it the |\write| and the skips are
2028 kept in the order they are written);
2029 \item |shift|, which shifts the skips down and adds a |\penalty|;
2030 \item |omit|, which may seem a too drastic solution, because
2031 nothing is written, but more often than not this command is applied
2032 to more or less shorts texts with no sectioning or similar
2033 commands, and therefore no language synchronization is necessary.
2034 In a table cell, a |\leavevmode| just before the selector may be
2035 enough.
2036 \end{itemize}
2037 \end{itemize}
2038 \end{warning}
2039
2040 \Describe{\foreignlanguage}{\oarg{option-list}\marg{language}\marg{text}}
2041
2042 It takes two mandatory arguments; the second argument is a phrase to be
2043 typeset according to the rules of the language named in its first one.
2044
2045 This command (1) only switches the extra definitions and the
2046 hyphenation rules for the language, \emph{not} the names and dates, (2)
2047 does not send information about the language to auxiliary files (i.e.,
2048 the surrounding language is still in force), and (3) it works even if
2049 the language has not been set as package option (but in such a case it
2050 only sets the hyphenation patterns and a warning is shown). With the
2051 |bidi| option, it also enters in horizontal mode (this is not done
2052 always for backwards compatibility), and since it is meant for phrases
2053 only the text direction (and not the paragraph one) is set.
2054
2055 \New{3.44} As already said, captions and dates are not switched.
2056 However, with the optional argument you can switch them, too. So, you
2057 can write:
2058 \begin{verbatim}
2059 \foreignlanguage[date]{polish}{\today}
2060 \end{verbatim}
2061 In addition, captions can be switched with |captions| (or both, of
2062 course, with |date,| |captions|). Until 3.43 you had to write something
2063 like |{\selectlanguage{..} ..}|, which was not always the most
2064 convenient way. See also the variant |\otherlanguage*| below.
2065
2066 \begin{note}
2067 |\bibitem| is out of sync with |\selectlanguage| in the \file{aux}
2068 file. The reason is |\bibitem| uses |\immediate| (and others, in
2069 fact), while |\selectlanguage| doesn't. There is a similar issue with
2070 floats, too. There is no known workaround, but it’s not usually a
2071 real issue.
2072 \end{note}
2073
2074 \subsection{Auxiliary language selectors}
2075
2076 \Describe{\begin\menv{otherlanguage}}{\marg{language}\Eenv{otherlanguage}}
2077
2078 Same as |selectlanguage| as environment, except spaces after the
2079 |\begin| and |\end| commands are ignored. (Very likely, and because of
2080 the limitations of many old editors with bidi text, the idea was
2081 \cs{end}\texttt{\{otherlanguage\}} had to be a line by itself.) The
2082 warning above about the internal |\write| also applies here. The
2083 current mode (vertical or horizontal) also remains unchanged.
2084
2085 \Describe{\begin\menv{otherlanguage*}}%
2086 {\oarg{option-list}\marg{language}\Eenv{otherlanguage*}}
2087
2088 Same as |\foreignlanguage| but as environment. Spaces are \textit{not}
2089 ignored. \New{26.1} It can be used as a command, too, like
2090 |{\otherlanguage*{tamil}{...}|, but avoid using several of them
2091 inside a group.
2092
2093 It was originally devised for intermixing left-to-right
2094 typesetting with right-to-left typesetting in engines not supporting a
2095 change in the writing direction inside a line. However, by default it
2096 never complied with the documented behavior and it is just a version as
2097 environment of |\foreignlanguage|, except when the package option
2098 |bidi| is set -- in this case, |\foreignlanguage| emits a
2099 |\leavevmode|, while |otherlanguage*| does not. Like |\foreignlanguage|
2100 it is a \textit{text} command, and therefore it doesn’t change the
2101 paragraph direction.
2102
2103 \begin{example}
2104 Here is a document putting in practice some of the techniques described,
2105 which shows how to deal neatly with complex multilingual documents
2106 in \luatex{} and \xetex, with the help of logical markup. You are
2107 writing a book on Indic literature with many extracts in several
2108 languages, which fits in the category of ‘mostly monolingual’. Loading
2109 of locales and fonts is lazy, which greatly simplifies the preamble.
2110 \catcode`@=13 \def@#1@{{\fontspec[Script=Devanagari]{FreeSans}#1}}
2111 \begin{verbatim}
2112 \documentclass{article}
2113
2114 _\usepackage[english]{babel}_
2115
2116 _\babelfont[*devanagari]{rm}{FreeSans}_
2117
2118 \newenvironment{excerpt}[1]
2119 {\begin{quote}_\begin{otherlanguage*}{#1}_}
2120 {_\end{otherlanguage*}_\end{quote}}
2121
2122 \begin{document}
2123
2124 \section{Sanskrit literature}
2125
2126 Here is an excerpt:
2127 \begin{excerpt}{sanskrit}
2128 @संस्कृतम्@
2129 \end{excerpt}
2130
2131 \section{Hindi literature}
2132
2133 Here is an excerpt:
2134 \begin{excerpt}{hindi}
2135 @हिन्दी@
2136 \end{excerpt}
2137
2138 \section{Marathi literature}
2139
2140 Here is an excerpt:
2141 \begin{excerpt}{marathi}
2142 @मराठी@
2143 \end{excerpt}
2144
2145 \section{Nepali literature}
2146
2147 Here is an excerpt:
2148 \begin{excerpt}{nepali}
2149 @नेपाली@
2150 \end{excerpt}
2151
2152 \section{Rajasthani literature}
2153
2154 Here is an excerpt:
2155 \begin{excerpt}{rajasthani}
2156 @संस्कृतम्@
2157 \end{excerpt}
2158
2159 \end{document}
2160 \end{verbatim}
2161 \end{example}
2162
2163 \subsection{Plain}
2164
2165 In e-Plain and pdf-Plain, load languages styles with |\input| and then use
2166 |\begindocument| (the latter is defined by \babel):
2167 \begin{verbatim}
2168 \input estonian.sty
2169 \begindocument
2170 \end{verbatim}
2171
2172 \begin{warning}
2173 Not all languages provide a |sty| file and some of them are not
2174 compatible with those formats. Please, refer to
2175 \href{https://latex3.github.io/babel/guides/using-babel-with-plain.html}%
2176 {Using babel with Plain} for further details.
2177 \end{warning}
2178
2179 \section{More on language loading and selection}
2180
2181 \subsection{A few tools}
2182
2183 % Also Plain
2184 \Describe{\babeltags}{\char`\{\m{tag1} \texttt{=} \m{language1}, \m{tag2}
2185 \texttt{=} \m{language2}, \dots\char`\}}
2186
2187 \New{3.9i} In multilingual documents with many language-switches the
2188 commands above can be cumbersome. With this tool shorter names can be
2189 defined. It adds nothing really new -- it is just syntactical sugar.
2190
2191 It defines |\text<tag1>{<text>}| to be
2192 |\foreignlanguage{<language1>}{<text>}|, and |\begin{<tag1>}|
2193 to be |\begin{otherlanguage*}{<language1>}|, and so on. Note
2194 |\<tag1>| is also allowed, but remember to set it locally inside a
2195 group.
2196
2197 \begin{warning}
2198 There is a clear drawback to this feature, namely, the ‘prefix’
2199 |\text...| is heavily overloaded in \LaTeX{} and conflicts with
2200 existing macros may arise (|\textlatin|, |\textbar|, |\textit|,
2201 |\textcolor| and many others). The same applies to environments,
2202 because |arabic| conflicts with |\arabic|. Furthermore, and because of
2203 this overloading, detecting the language of a chunk of text by
2204 external tools can become unfeasible (is |\textga| the locale for the
2205 African language Gã or something else?). Except if there is a reason for
2206 this ‘syntactical sugar’, the best option is to stick to the default
2207 selectors or even to define your own alternatives.
2208 \end{warning}
2209
2210 \begin{example}
2211 With
2212 \begin{verbatim}
2213 \babeltags{de = german}
2214 \end{verbatim}
2215 you can write
2216 \begin{verbatim}
2217 text \textde{German text} text
2218 \end{verbatim}
2219 and
2220 \begin{verbatim}
2221 text
2222 \begin{de}
2223 German text
2224 \end{de}
2225 text
2226 \end{verbatim}
2227 \end{example}
2228
2229 \begin{note}
2230 Something like \verb|\babeltags{finnish = finnish}| is legitimate --
2231 it defines |\textfinnish| and |\finnish| (and, of course,
2232 |\begin{finnish}|).
2233 \end{note}
2234
2235 % Also Plain
2236 \Describe{\babelensure}{|[include=|\m{commands}|,exclude=|\m{commands}%
2237 |,fontenc=|\m{encoding}|]|\marg{language}}
2238
2239 \New{3.9i} Except in a few languages, like \textsf{russian},
2240 captions and dates are just strings, and do not switch the
2241 language. That means you should set it explicitly if you want to use
2242 them, or hyphenation (and in some cases the text itself) will be
2243 wrong. For example:
2244 \begin{verbatim}
2245 \foreignlanguage{russian}{text \foreignlanguage{polish}{\seename} text}
2246 \end{verbatim}
2247
2248 Of course, \TeX{} can do it for you. To avoid switching the language
2249 all the while, |\babelensure| redefines the captions for a given
2250 language to wrap them with a selector:
2251 \begin{verbatim}
2252 \babelensure{polish}
2253 \end{verbatim}
2254 By default only the basic captions and |\today| are redefined, but you
2255 can add further macros with the key |include| in the optional argument
2256 (without commas). Macros not to be modified are listed in
2257 |exclude|. You can also enforce a font encoding with the option
2258 |fontenc| (with it, encoded strings may not work as expected).
2259 A couple of examples:
2260 \begin{verbatim}
2261 \babelensure[include=\Today]{spanish}
2262 \babelensure[fontenc=T5]{vietnamese}
2263 \end{verbatim}
2264
2265 They are activated when the language is selected (at the |afterextras|
2266 event), and it makes some assumptions which could not be fulfilled in
2267 some languages. Note also you should include only macros defined by
2268 the language, not global macros (e.g., |\TeX| of |\dag|).
2269
2270 With |ini| files (see below), captions are ensured by default.
2271
2272 \Describe\AfterBabelLanguage{\marg{option-name}\marg{code}}
2273
2274 Executes \meta{code} when the file loaded by the corresponding package
2275 option is finished (at |\ldf@finish|). The setting is global. So
2276 \begin{verbatim}
2277 \AfterBabelLanguage{french}{...}
2278 \end{verbatim}
2279 does |...|\ at the end of |french.ldf|. It can be used in |ldf| files,
2280 too, but in such a case the code is executed only if
2281 \meta{option-name} is the same as |\CurrentOption| (which could not
2282 be the same as the option name as set in |\usepackage|!).
2283
2284 \begin{example}
2285 Consider two languages \textsf{foo} and \textsf{bar} defining the
2286 same |\macro| with |\newcommand|. An error is raised if you attempt
2287 to load both. Here is a way to overcome this problem, with the help
2288 of the \texttt{presets} hook (which has to be set before loading
2289 \babel):
2290 \begin{verbatim}
2291 \AddToHook{babel/presets}{%
2292 \AfterBabelLanguage{foo}{%
2293 \let\macroFoo\macro
2294 \let\macro\relax}}
2295 \usepackage[foo, bar]{babel}
2296 \end{verbatim}
2297 \end{example}
2298
2299 \begin{note}
2300 An alternative method to execute some code just after an |ldf| file
2301 is loaded is with the hook |file/<language>.ldf/after|. You can also
2302 execute some code before with |file/<language>.ldf/before|.
2303 \end{note}
2304
2305 \subsection{Accessing language info}
2306
2307 % Also Plain
2308 \Describe{\localename}{}
2309 \DescribeOther{\mainlocalename}{}
2310 \DescribeOther{\languagename}{}
2311
2312 \New{24.10} The control sequence |\localename| contains the name of the current
2313 locale. This is now the recommended way to retrieve the current
2314 language. In addtion, |\mainlocalename| contains the main language.
2315
2316 |\languagename| is still used internally, but it is now discouraged at
2317 the user level.
2318
2319 \begin{warning}
2320 Due to a bug, which led to some internal inconsistencies in
2321 catcodes, |\languagename| should \textit{not} be used to test which
2322 is the current language. Rely on |\localename| or, if you still need
2323 |\languagename| for some reason, on \textsf{iflang}, by Heiko Oberdiek.
2324 \end{warning}
2325
2326 \Describe{\iflanguage}{\marg{language}\marg{true}\marg{false}}
2327
2328 Here “language” is used in the \TeX{} sense, as a set of hyphenation
2329 patterns, and \textit{not} as its \textsf{babel} name. The first
2330 argument is the name of a language.
2331
2332 \Describe{\localeinfo}{\optstar{\marg{field}}}
2333
2334 \New{3.38} If an |ini| file has been loaded for the current language,
2335 you may access the information stored in it. Note with the ‘classical’
2336 |ldf| files the corresponding |ini| ones are also loaded, but only some
2337 basic data required for fonts, casing and a few more.
2338
2339 This macro is fully expandable, but raises an error if the info doesn’t
2340 exist. \New{3.75} Sometimes, it comes in handy to be able to use
2341 |\localeinfo| in a quite fully expandable way even if something went
2342 wrong (for example, the locale currently active is undefined). For
2343 these cases, |localeinfo*| just returns an empty string instead of
2344 raising an error.
2345
2346 The available fields are:
2347 \begin{description}
2348 \itemsep=-\parskip
2349 \item[|name.english|] as provided by the Unicode CLDR.
2350 \item[|tag.ini|] is the tag of the |ini| file (the way this
2351 file is identified in its name).
2352 \item[|tag.bcp47|] is the full BCP 47 tag. This
2353 is the value to be used for the ‘real' provided tag (\babel{} may
2354 fill other fields if they are considered necessary).
2355 \item[|language.tag.bcp47|] is the BCP 47 language tag.
2356 \item[|tag.opentype|] is the tag used by OpenType (usually, but not
2357 always, the same as BCP 47). It can be useful when customizing fonts
2358 with \textsf{luaotfload}.
2359 \item[|script.name|], as provided by the Unicode CLDR.
2360 \item[|script.tag.bcp47|] is the BCP 47 tag of the script
2361 used by this locale. This is a required field for the fonts to be
2362 correctly set up, and therefore it should always be defined.
2363 \item[|script.tag.opentype|] is the tag used by OpenType (usually,
2364 but not always, the same as BCP 47). It can be useful when
2365 customizing fonts with \textsf{luaotfload}.
2366 \item[|region.tag.bcp47|] is the BCP 47 tag of the region or territory.
2367 Defined only if the locale loaded actually contains it (e.g., |es-MX|
2368 does, but |es| doesn’t), which is how locales behave in the CLDR.
2369 \New{3.75}
2370 \item[|variant.tag.bcp47|] is the BCP 47 tag of the variant (in the BCP 47
2371 sense, like |1901| for German). \New{3.75}
2372 \item[|extension.|\m{s}|.tag.bcp47|] is the BCP 47 value of the
2373 extension whose singleton is \m{s} (currently the recognized
2374 singletons are |x|, |t| and |u|). The internal syntax can be somewhat
2375 complex, and this feature is still somewhat tentative. An example is
2376 \textsf{classicallatin} which sets |extension.x.tag.bcp47| to |classic|.
2377 \New{3.75}
2378 \end{description}
2379
2380 % All of these keys can be preceded by |main.| (e.g., |main.tag.ini|),
2381 % which retrieves the values of the main locale.
2382
2383 \begin{note}
2384 Currently, |x| is used for two separate functions, namely,
2385 identifying a \babel{} locale without a BCP 47 tag and setting an
2386 alternative set of rules for casing.
2387 \end{note}
2388
2389 \begin{note}
2390 Bear in mind that \babel{}, following the CLDR, may leave the region
2391 unset, which means |\getlocaleproperty*|, described below, is the
2392 preferred command, so that the existence of a field can be checked
2393 before. This also means building a string with the language and the
2394 region with something like
2395 |\localeinfo*{language.tab.bcp47}|\allowbreak |-|\allowbreak
2396 |\localeinfo*{region.tab.bcp47}| is not usually a good idea (because
2397 of the hyphen).
2398 \end{note}
2399
2400 \begin{warning}
2401 \New{3.46} As of version 3.46 |tag.bcp47| returns the full BCP 47
2402 tag. Formerly it returned just the language subtag, which was clearly
2403 counterintuitive.
2404 \end{warning}
2405
2406 \Describe{\getlocaleproperty}{%
2407 \optstar\marg{macro}\marg{locale}\marg{property}}
2408
2409 \New{3.42} The value of any locale property as set by the |ini| files
2410 (or added/modified with |\babelprovide|) can be retrieved and stored in
2411 a macro with this command. For example, after:
2412 \begin{verbatim}
2413 \getlocaleproperty\hechap{hebrew}{captions/chapter}
2414 \end{verbatim}
2415 the macro |\hechap| will contain the string
2416 {\fontspec[Scale=.87,Script=Hebrew]{Liberation Mono}\textdir TRT פרק}.
2417
2418 If the key does not exist, the macro is set to |\relax| and an error is
2419 raised. \New{3.47} With the starred version no error is raised, so that
2420 you can take your own actions with undefined properties.
2421
2422 \Describe{\localeid}{}
2423 Each language in the \babel{} sense has its own unique numeric
2424 identifier, which can be retrieved with |\localeid|.
2425
2426 The |\localeid| is not the same as the |\language| identifier, which
2427 refers to a set of hyphenation patterns (which, in turn, is just a
2428 component of the line breaking algorithm described in the next
2429 section). The data about preloaded patterns are store in an internal
2430 macro named |\bbl@languages| (see the code for further details), but
2431 note several locales may share a single |\language|, so they are
2432 separated concepts. In \luatex, the |\localeid| is saved in each node
2433 (when it makes sense) as an attribute, too.
2434
2435 \Describe{\ShowLocaleProperties}{\marg{language}}
2436 \New{3.98} Prints to the |log| file all the loaded key/value pairs from
2437 the |ini| locale file for \meta{language}.
2438
2439 \Describe{\LocaleForEach}{\marg{code}}
2440 \Babel{} remembers which |ini| files have been loaded. There is a loop
2441 named |\LocaleForEach| to traverse the list, where |#1| is the name of
2442 the current item, so that |\LocaleForEach{\message{ **#1** }}| just
2443 shows the loaded |ini|’s.
2444
2445 \subsection{Package options}
2446
2447 \New{3.9a}
2448 These package options are processed before language options, so
2449 that they are taken into account irrespective of their order. The first
2450 three options have been available in previous versions.
2451
2452 \Describe{KeepShorthandsActive}{}
2453 Tells \babel{} not to deactivate shorthands after loading a language
2454 file, so that they are also available in the preamble.
2455
2456 \Describe{headfoot=}{\meta{language}} By default, headlines and
2457 footlines are not touched (only marks), and if they contain
2458 language-dependent macros (which is not usual) there may be unexpected
2459 results. With this option you may set the language in heads and feet.
2460 An alternative is to set the language explicitly when heads and feet
2461 are redefined.
2462
2463 \Describe{noconfigs}{} Global and language default config files are
2464 not loaded, so you can make sure your document is not spoilt by an
2465 unexpected \texttt{.cfg} file. However, if the key |config| is set,
2466 this file is loaded.
2467
2468 \Describe{config=}{\meta{file}} Load \meta{file}\texttt{.cfg} instead
2469 of the default config file |bblopts.cfg| (forced even with
2470 |noconfigs|).
2471
2472 \begin{warning}
2473 \New{25.14} Configuration files are deprecated, as they can break
2474 document portability.
2475 \end{warning}
2476
2477 \Describe{showlanguages}{} Prints to the log the list of languages
2478 loaded when the format was created: number (remember dialects can
2479 share it), name, hyphenation file and exceptions file.
2480
2481 \Describe{silent}{} \New{3.9l} No warnings and no \textit{infos} are
2482 written to the log file.\footnote{You can use alternatively the
2483 package \textsf{silence}.}
2484
2485 \Describe{hyphenmap=}{\texttt{off} $\string|$ \texttt{first}
2486 $\string|$ \texttt{select} $\string|$ \texttt{other} $\string|$
2487 \texttt{other*}}
2488
2489 \New{3.9g} Sets the behavior of case mapping for hyphenation,
2490 provided the language defines it.\footnote{Turned off in plain.} It
2491 can take the following values:
2492 \begin{description}
2493 \renewcommand\makelabel[1]{%
2494 \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
2495 \itemsep=-\parskip
2496 \item[off] deactivates this feature and no case mapping is applied;
2497 \item[first] sets it at the first switching commands in the
2498 current or parent scope (typically, when the |aux| file is first read
2499 and at |\begin{document}|, but also the first |\selectlanguage| in
2500 the preamble), and it’s the default if a single language option has
2501 been stated. If a language option is repeated (e.g., |malay, malay|),
2502 it counts as several ones, even if there is only a language.
2503 \item[select] sets it only at |\selectlanguage|;
2504 \item[other] also sets it at |otherlanguage|;
2505 \item[other*] also sets it at |otherlanguage*| as well as in heads and
2506 feet (if the option |headfoot| is used) and in auxiliary files (i.e.,
2507 at |\select@language|), and it’s the default if several language
2508 options have been stated. The option |first| can be regarded as an
2509 optimized version of \texttt{other*} for monolingual
2510 documents.\footnote{Providing |foreign| is pointless, because the
2511 case mapping applied is that at the end of the paragraph, but if either
2512 \luatex{} or \xetex{} change this behavior it might be added. On
2513 the other hand, |other| is provided even if I [JBL] think it isn't
2514 really useful, but who knows.}
2515 \end{description}
2516
2517 \Describe{bidi=}{\texttt{default} $\string|$ \texttt{basic}
2518 $\string|$ \texttt{basic-r} $\string|$ \texttt{bidi-l} $\string|$
2519 \texttt{bidi-r}}
2520
2521 \New{3.14} Selects the bidi algorithm to be used in \luatex{} and
2522 \xetex{}. See sec.~\ref{bidi}.
2523
2524 \Describe{layout=}{}
2525
2526 \New{3.16} Selects which layout elements are adapted in bidi
2527 documents. See sec.~\ref{bidi}.
2528
2529 \Describe{provide=}{\texttt{*} $\string|$ \meta{option-list}}
2530 \New{3.49} An alternative to |\babelprovide| for languages passed as
2531 options. See section~\ref{inifiles}, which describes also the variants
2532 |provide+=| and |provide*=|.
2533
2534 \Describe{main=}{\meta{language}} Forces the main language, but this
2535 option should not be used except if there a need to do it. If the
2536 language is not given as such as package or global option, it is added
2537 to the list of requested languages. For example:
2538 \begin{verbatim}
2539 \documentclass{article}
2540 \usepackage[_main=english_,dutch]{babel}
2541 \end{verbatim}
2542 Some classes load \babel{} with a hardcoded language option. Sometimes,
2543 the main language can be overridden with something like that before
2544 |\documentclass|:
2545 \begin{verbatim}
2546 \PassOptionsToPackage{main=english}{babel}
2547 \end{verbatim}
2548
2549 \Describe{licr=}{\texttt{extended} $\string|$ \texttt{unextended}}
2550
2551 \New{26.7} Some languages may require extending the built-in
2552 declarations in \LaTeX\ for the TU encoding, because a package may rely
2553 solely on them (like |\cyrzh| instead of |ж|). This is now done with
2554 the Cyrillic locales (further scripts may be added in the future). You
2555 can deactivate these extra declarations (in case you have devised your
2556 own, for example) with |licr=unextended|. They are ignored with lazy
2557 loading, so if you need them you have to declare explicitly the
2558 language in the preamble.
2559
2560 \subsection{The \texttt{base} option}
2561
2562 With this package option \babel{} just loads some basic macros (mainly
2563 the selectors), defines |\AfterBabelLanguage| and exits. It also
2564 selects the hyphenation patterns for the last language passed as option
2565 (by its name in |language.dat|).
2566
2567 \begin{warning}
2568 Currently this option is not compatible with languages loaded on the
2569 fly.
2570 \end{warning}
2571
2572 \subsection{\texttt{provide} and \cs{babelprovide} – \texttt{ini} files}
2573 \label{inifiles}
2574
2575 An alternative approach to define a language (or, more precisely, a
2576 \textit{locale}) is by means of an \texttt{ini} file. Currently
2577 \babel{} provides about 380 of these files containing the basic data
2578 required for a locale, covering about 300 languages and 40 scripts,
2579 plus basic templates for about 400 locales.
2580
2581 |ini| files are not meant only for \babel, and they has been devised as
2582 a resource for other packages. To ease interoperability between \TeX{}
2583 and other systems, they are identified with the BCP 47 codes as
2584 preferred by the Unicode Common Locale Data Repository, which was
2585 used as source for most of the data provided by these files, where
2586 available.
2587
2588 Most of them set the date, and many also the captions (Unicode and
2589 LICR). They will be evolving with the time to add more features
2590 (something to keep in mind if backward compatibility is important). The
2591 following section shows how to make use of them by means of
2592 |\babelprovide|.
2593
2594 Not all languages in the CLDR are complete, and therefore neither are
2595 the |ini| files. A few languages may show a warning about the current
2596 lack of suitability of some features.
2597
2598 \begin{example}
2599 There is an example of how to use an |ini| template file
2600 \href{https://github.com/latex3/babel/issues/176#issuecomment-1080846575}{here},
2601 for Phoenician (although currently this locale is bundled with
2602 \babel).
2603 \end{example}
2604
2605 \begin{note}
2606 The \texttt{ini} files just define and set some parameters, but the
2607 corresponding behavior is not always implemented. Also, there are
2608 some limitations in the engines. A few remarks follow (which could no
2609 longer be valid when you read this manual, if the packages involved
2610 have been updated).
2611 \begin{description}
2612 \itemsep=-\parskip
2613 \item[Arabic] Math and graphical elements like |picture| are complex
2614 and requires some additional fine tuning. In \xetex{} \babel{}
2615 resorts to the \textsf{bidi} package, which seems to work.
2616 \item[Southeast scripts] Thai works in both \luatex{} and \xetex{}, but
2617 line breaking differs (rules are hard-coded in \xetex, but they can
2618 be modified in \luatex). Lao seems to work, too, but there are no
2619 patterns for the latter in \luatex{}. Some quick patterns can
2620 help, with something similar to:
2621 \begin{verbatim}
2622 \babelprovide[import, hyphenrules=+]{lao}
2623 \babelpatterns[lao]{1ດ 1ມ 1ອ 1ງ 1ກ 1າ} % Random
2624 \end{verbatim}
2625 \item[East Asia scripts] Settings for either Simplified of Traditional
2626 (Chinese) should work out of the box, with basic line breaking with any
2627 renderer. Although for a few words and shorts texts the |ini| files
2628 should be fine, CJK texts are best set with a dedicated framework
2629 (\textsf{CJK}, \textsf{luatexja}, \textsf{kotex}, \textsf{CTeX},
2630 etc.). This is what the class |ltjbook| does with \luatex, which can
2631 be used in conjunction with the |ldf| for |japanese|, because the
2632 following piece of code loads \textsf{luatexja}:
2633 \begin{verbatim}
2634 \documentclass[japanese]{ltjbook}
2635 \usepackage{babel}
2636 \end{verbatim}
2637 \item[Latin, Greek, Cyrillic] Combining chars with the default
2638 \luatex{} font renderer might be wrong; on the other hand, with the
2639 Harfbuzz renderer diacritics are stacked correctly, but many
2640 hyphenations points are discarded (this bug is related to kerning,
2641 so it depends on the font). With \xetex{} both combining characters
2642 and hyphenation work as expected (not quite, but in most cases it
2643 works; the problem here are font clusters).
2644 \end{description}
2645 \end{note}
2646
2647 \begin{note}
2648 Wikipedia defines a \textit{locale} as follows: “In computing, a
2649 locale is a set of parameters that defines the user’s language,
2650 region and any special variant preferences that the user wants to see
2651 in their user interface. Usually a locale identifier consists of at
2652 least a language code and a country/region code.” \Babel{} is moving
2653 gradually from the old and fuzzy concept of \textit{language} to the
2654 more modern of \textit{locale}. Note each locale is by itself a
2655 separate “language”, which explains why there are so many files. This
2656 is on purpose, so that possible variants can be created and/or
2657 redefined easily.
2658 \end{note}
2659
2660 \subsection{Selection based on BCP 47 tags}
2661 \label{bcp47}
2662
2663 \New{3.43} The recommended way to select languages is that described at
2664 the beginning of this document. However, BCP 47 tags are becoming
2665 customary, particularly in documents (or parts of documents) generated
2666 by external sources, and therefore \babel{} will provide a set of tools
2667 to select the locales in different situations, adapted to the
2668 particular needs of each case. Currently, \babel{} provides autoloading
2669 of locales as described in this section. In these contexts autoloading
2670 is particularly important because we may not know beforehand which
2671 languages will be requested.
2672
2673 It must be activated explicitly, because it is primarily meant for
2674 special tasks. Mapping from BCP 47 codes to locale names is not
2675 hardcoded in \babel. Instead the data is taken from the \texttt{ini}
2676 files, which means currently about 350 tags are already recognized.
2677 \Babel{} performs a simple lookup in the following way: |fr-Latn-FR| $\to$
2678 |fr-Latn| $\to$ |fr-FR| $\to$ |fr|. Languages with the same resolved
2679 name are considered the same. Case is normalized before, so that
2680 |fr-latn-fr| $\to$ |fr-Latn-FR|. If a tag and a name overlap, the tag
2681 takes precedence.
2682
2683 Here is a minimal example:
2684 \begin{verbatim}
2685 \documentclass{article}
2686
2687 \usepackage[danish]{babel}
2688
2689 _\babeladjust{_
2690 _ autoload.bcp47 = on_
2691 _}_
2692
2693 \begin{document}
2694
2695 Chapter in Danish: \chaptername.
2696
2697 _\selectlanguage{de-AT}_
2698
2699 \localedate{2020}{1}{30}
2700
2701 \end{document}
2702 \end{verbatim}
2703
2704 Currently the locales loaded are based on the \texttt{ini} files and
2705 decoupled from the main \texttt{ldf} files. This is by design, to
2706 ensure code generated externally produces the same result regardless of
2707 the languages requested in the document, but an option to use the
2708 \texttt{ldf} instead will be added in a future release, because both
2709 options make sense depending on the particular needs of each document
2710 (there will be some restrictions, however).
2711
2712 The behavior is adjusted with |\babeladjust| with the following parameters:
2713 \begin{description}
2714 \item \texttt{autoload.bcp47} with values |on| and |off|.
2715 \item \texttt{autoload.bcp47.options}, which are passed to
2716 |\babelprovide|; \New{24.14} |import| by default (features defined in
2717 the corresponding |babel-...tex| file might not be available), but
2718 you can set it to another value (even empty).
2719 \item \texttt{autoload.bcp47.prefix}. Although the public name used in
2720 selectors is the tag, the internal name will be different and
2721 generated by prepending a prefix, which by default is
2722 \texttt{bcp47-}. You may change it with this key.
2723 \end{description}
2724
2725 \New{3.46} If an |ldf| file has been loaded, you can enable the
2726 corresponding language tags as selector names with:
2727 \begin{verbatim}
2728 \babeladjust{ bcp47.toname = on }
2729 \end{verbatim}
2730 (You can deactivate it with |off|.) So, if |dutch| is one of the
2731 package (or class) options, you can write |\selectlanguage{nl}|. Note
2732 the language name does not change (in this example is still |dutch|),
2733 but you can get it with |\localeinfo| or |\getlocaleproperty|. It
2734 must be turned on explicitly for similar reasons to those explained
2735 above.
2736
2737 \section{Tailoring, customizing and modifying a language}
2738
2739 Modifying the behavior of a language (say, the chapter
2740 “caption”) is sometimes necessary.
2741
2742 Several language definition files use their own methods to set
2743 options. For example, \textsf{french} uses |\frenchsetup|,
2744 \textsf{magyar} (1.5) uses |\magyarOptions|; modifiers provided by
2745 |spanish| have no attribute counterparts. Macros setting
2746 options are also used (e.g., |\ProsodicMarksOn| in \textsf{latin}).
2747
2748 This section describes the general tools provided by the \babel{} core.
2749
2750 \subsection{Captions}
2751
2752 This is perhaps the most frequent change, so a specific macro is
2753 provided.
2754
2755 \Describe{\setlocalecaption}{%
2756 \marg{language-name}\marg{caption-name}\marg{string}}
2757
2758 \New{3.51} Here \textit{caption-name} is the name as string without the
2759 trailing |name|. An example, which also shows caption names are often a
2760 stylistic choice, is:
2761 \begin{verbatim}
2762 \setlocalecaption{english}{contents}{Table of Contents}
2763 \end{verbatim}
2764 This works not only with existing caption names, because it also serves to
2765 define new ones by setting the \textit{caption-name} to the name of
2766 your choice (|name| will be postpended). Captions so defined or
2767 redefined behave with the ‘new way’ described in the following note.
2768
2769 Note the string should not contain a language selector or changes in
2770 the text direction, which is done by \babel{} when necessary. With
2771 |arabic|, all you need is:
2772 \begingroup
2773 % If you are looking at the code to see how it has been written, you
2774 % will be disappointed :-). The following example is built ad hoc to
2775 % emulate the final result to avoid dependencies, and therefore it's
2776 % not "real" code.
2777 \setmonofont[Scale=.86, FakeStretch=.97,Script=Arabic]{DejaVu Sans Mono}
2778 \catcode`@=13
2779 \def@#1{\ifcase#1\relax \egroup \or \bgroup\textdir TLT \else
2780 \bgroup\textdir TRT \pardir TRT \fi}
2781 \begin{verbatim}
2782 \setlocalecaption{arabic}{part}{@2القسم@0}
2783 \end{verbatim}
2784 \endgroup
2785
2786 \begin{note}
2787 There are a few alternative methods:
2788 \begin{itemize}
2789 \item With data |import|’ed from |ini| files, you can modify the values
2790 of specific keys when loaded, like:
2791 \begin{verbatim}
2792 \babelprovide[import, _captions/listtable = Lista de tablas_]{spanish}
2793 \end{verbatim}
2794 (In this particular case, instead of the |captions| group you may need
2795 to modify the |captions.licr| one.)
2796
2797 \item The low-level ‘old way’ to redefine a caption, still valid for
2798 many languages but discouraged in general, is the following:
2799 \begin{verbatim}
2800 \addto\captionsenglish{%
2801 \renewcommand\contentsname{Foo}%
2802 }
2803 \end{verbatim}
2804 As of 3.15, there is no need to hide spaces with \texttt{\%%
2805 } (\babel{} removes them), but it is advisable to do so. This
2806 redefinition is not activated until the language is selected.
2807
2808 \item The ‘new way’, which is found in |bulgarian|, |azerbaijani|,
2809 |spanish|, |french|, |turkish|, |icelandic|, |vietnamese| and a few
2810 more, as well as in languages created with |\babelprovide| and its
2811 key |import|, or with the package option |provide=|, is:
2812 \begin{verbatim}
2813 \renewcommand\spanishchaptername{Foo}
2814 \end{verbatim}
2815 This redefinition is immediate. In these languages, the month names can
2816 be redefined in a similar way; names are
2817 |\|\m{language}|month|\m{roman-num}|name|, where \m{roman-num} is the
2818 month number in lowercase roman (e.g., |\spanishmonthxiiname|).
2819 \end{itemize}
2820 \end{note}
2821
2822 \begin{note} Do \textit{not} redefine a caption in the following way:
2823 \begin{verbatim}
2824 \AtBeginDocument{\renewcommand\contentsname{Foo}}
2825 \end{verbatim}
2826 The changes may be discarded with a language selector, and the original
2827 value restored.
2828 \end{note}
2829
2830 Macros to be run when a language is selected can be added to
2831 |\extras<language>|:
2832 \begin{verbatim}
2833 \addto\extrasrussian{\mymacro}
2834 \end{verbatim}
2835 There is a counterpart for code to be run when a language is
2836 unselected: |\noextras<language>|.
2837
2838 \begin{note}
2839 These macros (|\captions<language>|, |\extras<language>|) may be
2840 redefined, but \textit{must not} be used as such -- they just pass
2841 information to \babel{}, which executes them in the proper context.
2842 \end{note}
2843
2844 Another way to modify a language loaded as a package or class option
2845 is by means of |\babelprovide|, described below in depth. So,
2846 something like:
2847 \begin{verbatim}
2848 \usepackage[danish]{babel}
2849 \babelprovide[_hyphenrules=nohyphenation_]{danish}
2850 \end{verbatim}
2851 first loads |danish.ldf|, and then prevents hyphenation for this
2852 locale. The rest of the language definitions are not touched. Without
2853 the optional argument it just loads some additional tools if provided
2854 by the |ini| file, like extra counters.
2855
2856 \subsection{Modifiers}
2857
2858 \New{3.9c} The basic behavior of some languages can be modified when
2859 loading \babel{} by means of \textit{modifiers}. They are set after
2860 the language name, and are prefixed with a dot (only when the language
2861 is set as package option -- neither global options nor the |main| key
2862 accepts them). An example is (spaces are not significant and they can
2863 be added or removed):\footnote{No predefined “axis” for modifiers
2864 is provided because languages and their scripts have quite different
2865 needs.}
2866 \begin{verbatim}
2867 \usepackage[latin_.lowercasemonth_, spanish_.notilde.lcroman_, danish]{babel}
2868 \end{verbatim}
2869
2870 Attributes (described below) are considered modifiers, i.e., you can
2871 set an attribute by including it in the list of modifiers.
2872
2873 \New{3.89} Alternatively, modifiers can be set with a separate option,
2874 with the keyword |modifiers| followed by a dot and the language name
2875 (note the language is not selected or loaded with this option). It is
2876 useful to activate some feature when the language is declared as a
2877 class option:
2878 \begin{verbatim}
2879 \documentclass[spanish]{report}
2880 \usepackage[_modifiers.spanish = notilde.lcroman_]{babel}
2881 \end{verbatim}
2882
2883 \subsection{Language attributes}
2884
2885 \Describe{\languageattribute}{\marg{language}}
2886
2887 This is a user-level command, to be used in the preamble of a
2888 document (after |\usepackage[...]{babel}|), that declares which
2889 attributes are to be used for a given language. It takes two
2890 arguments: the first is the name of the language; the second,
2891 a (list of) attribute(s) to be used. Attributes must be set in the
2892 preamble and only once -- they cannot be turned on and off.
2893 The command checks whether the language is known in this document
2894 and whether the attribute(s) are known for this language.
2895
2896 \subsection{Casing}
2897
2898 \Describe{\BabelUppercaseMapping}
2899 {\marg{locale-name}\marg{codepoint}\marg{output}}
2900 \DescribeOther{\BabelLowercaseMapping}
2901 {\marg{locale-name}\marg{codepoint}\marg{output}}
2902 \DescribeOther{\BabelTitlecaseMapping}
2903 {\marg{locale-name}\marg{codepoint}\marg{output}}
2904
2905 \New{3.90} These macros are devised as a high level interface for
2906 declaring case mappings, based on the locale name as declared by or
2907 with \babel. They are the equivalent of |\DeclareUppercaseMapping|,
2908 |\DeclareLowercaseMapping|, and |\DeclareTitlecaseMapping| (see
2909 \textsf{usrguide.pdf}). The purpose is twofold: (1) a user-friendly way
2910 to declare them, because often BCP 47 tags are not known (and sometimes
2911 can be complex); (2) if for some reason the tag changes (e.g., you decide
2912 to tag |english| as |en-001| instead of |en-US|), the new mappings will
2913 still be assigned to that language.
2914
2915 \begin{example} For Classical Latin (no need to know the tag is
2916 \texttt{la-x-classic}):
2917 \begin{verbatim}
2918 \BabelUppercaseMapping{classicallatin}{`u}{V}
2919 \end{verbatim}
2920 \end{example}
2921
2922 \begin{note}
2923 There are still some rough edges when declaring a mapping with the
2924 |x| extension, or when two \babel{} languages share the same BCP 47
2925 tag. These issues are expected be sorted out in future releases.
2926 \end{note}
2927
2928 \subsection{Modifying and adding values to \texttt{ini} files}
2929
2930 \New{3.39} There is a way to modify or even add values of |ini| files
2931 when they are imported with |\babelprovide| or |provide=|. This can be
2932 used to create private variants easily. All you need is to import the
2933 same |ini| file with a different locale name and different parameters.
2934 Without |import| you may still modify the identification keys.
2935
2936 Examples of the fine-grained control you have at your disposal are the
2937 following. All of them assume |\usepackage[english]{babel}|.
2938
2939 \begin{example}
2940 Here is how to change the hyphenation rules because there are several
2941 criteria, or you must follow an editorial style. The following
2942 example just uses the default Spanish rules in English:
2943 \begin{verbatim}
2944 \babelprovide[hyphenrules=spanish]{english}
2945 \end{verbatim}
2946 \end{example}
2947
2948 \begin{example}
2949 The required native digits are already defined in the corresponding
2950 |ini| files, but they can be modified and even added as shown:
2951 \begin{verbatim}
2952 \babelprovide[numbers/digits.native=abcdefghij]{english}
2953 \end{verbatim}
2954 This example is somewhat absurd, but now |\englishdigits{264}| will
2955 print ‘cge’. (It doesn't work with \pdftex.)
2956 \end{example}
2957
2958 \begin{example}
2959 Currently the date format can be changed only with imported data, but
2960 with its high level interface it’s rather straightforward:
2961 \begin{verbatim}
2962 \babelprovide[
2963 import,
2964 date.gregorian/date.long = {[d] ([MMMM]) [y]}]
2965 {english}
2966 \end{verbatim}
2967 Here |[d]| is the day number, |[MMMM]| the month name and |[y]| the
2968 year. It will print something like ‘5 (October) 2024’. Remember
2969 \texttt{[d]} and \texttt{[y]} admit the syntax
2970 \texttt{[}\m{period}\texttt{\string|}\m{counter}\texttt{]}, where
2971 \m{counter} is a counter name as defined in the counters section. See
2972 \New{3.44} and the Greek \texttt{ini} files for examples.
2973 \end{example}
2974
2975 \begin{example}
2976 To set the hyphen to ‘none’ (only \luatex).
2977 \begin{verbatim}
2978 \babelprovide[typography/prehyphenchar = 0]{english}
2979 \end{verbatim}
2980 (This setting \textit{may} work with |xetex|, but getting rid of the
2981 hyphen char in this engine is not trivial, because you must rely on the
2982 font, and not all fonts behave the same.)
2983
2984 If, on the other hand, the language does not write by default the
2985 hyphens when breaking lines and you want them, you can set
2986 |typography/prehyphenchar = `-| (they are Kannada, Malayalam, Odia,
2987 Sanskrit, Tamil, Telugu).
2988 \end{example}
2989
2990 \begin{example}
2991 You can define new counters freely, and assign them to |\alph|:
2992 \begin{verbatim}
2993 \babelprovide[
2994 counters/acute = á é í ó ú, % Define a counter named `acute`
2995 alph = acute % Assign it to \alph
2996 ]{english}
2997 \end{verbatim}
2998 You can choose the name, and instead of |acute| it can be another one.
2999 \end{example}
3000
3001 \subsection{Hooks}
3002
3003 \New{3.9a} A hook is a piece of code to be executed at certain
3004 events. Some hooks are predefined when \luatex{} and \xetex{} are
3005 used.
3006
3007 \New{3.64} This is not the only way to inject code at those points. The
3008 events listed below can be used as a hook name in |\AddToHook| in the
3009 form |babel/<language-name>/<event-name>| (with |*| it’s applied to
3010 all languages), but there is a limitation, because the parameters
3011 passed with the \babel{} mechanism are not allowed. The |\AddToHook|
3012 mechanism does \textit{not} replace the current one in \babel. Its
3013 main advantage is you can reconfigure \babel\ even before loading it.
3014 See the example below.
3015
3016 \Describe{\AddBabelHook}{\oarg{language}\marg{name}\marg{event}\marg{code}}
3017
3018 The same name can be applied to several events. Hooks with a certain
3019 \marg{name} may be enabled and disabled for all defined events with
3020 |\EnableBabelHook|\marg{name}, |\DisableBabelHook|\marg{name}. Names
3021 containing the string |babel| are reserved (they are used, for example,
3022 by |\useshortands*| to add a hook for the event |afterextras|).
3023 \New{3.33} They may be also applied to a specific language with the
3024 optional argument; language-specific settings are executed after global
3025 ones.
3026
3027 Current events are the following; in some of them you can use one to
3028 three \TeX{} parameters (|#1|, |#2|, |#3|), with the meaning given:
3029 \begin{description}
3030 \renewcommand\makelabel[1]{%
3031 \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
3032 \itemsep=-\parskip
3033 \item[adddialect] (language name, dialect name) Used by
3034 \file{luababel.def} to load the patterns if not preloaded.
3035 \item[patterns] (language name, language with encoding) Executed just
3036 after the |\language| has been set. The second argument has the
3037 patterns name actually selected (in the form of either |lang:ENC| or
3038 |lang|).
3039 \item[hyphenation] (language name, language with encoding) Executed
3040 locally just before exceptions given in |\babelhyphenation| are
3041 actually set.
3042 \item[defaultcommands] Used (locally) in |\StartBabelCommands|.
3043 \item[encodedcommands] (input, font encodings) Used (locally) in
3044 |\StartBabelCommands|. Both \luatex{} and \xetex{} make sure the
3045 encoded text is read correctly.
3046 \item[stopcommands] Used to reset the above, if necessary.
3047 \item[write] This event comes just after the switching commands are
3048 written to the |aux| file.
3049 \item[beforeextras] Just before executing |\extras<language>|. This
3050 event and the next one should not contain language-dependent code
3051 (for that, add it to |\extras<language>|).
3052 \item[afterextras] Just after executing |\extras<language>|. For
3053 example, the following deactivates shorthands in all languages:
3054 \begin{verbatim}
3055 \AddBabelHook{noshort}{afterextras}{\languageshorthands{none}}
3056 \end{verbatim}
3057 \item[stringprocess] Instead of a parameter, you can manipulate the
3058 macro |\BabelString| containing the string to be defined with
3059 |\SetString|. For example, to use an expanded version of the string
3060 in the definition, write:
3061 \begin{verbatim}
3062 \AddBabelHook{myhook}{stringprocess}{%
3063 \protected@edef\BabelString{\BabelString}}
3064 \end{verbatim}
3065 \item[initiateactive] (char as active, char as other, original char)
3066 \New{3.9i} Executed just after a shorthand has been ‘initiated’. The three
3067 parameters are the same character with different catcodes: active,
3068 other (|\string|'ed) and the original one.
3069 \item[afterreset] \New{3.9i} Executed when selecting a language just after
3070 |\originalTeX| is run and reset to its base value, before executing
3071 |\captions<language>| and |\date<language>|.
3072 \item[begindocument] \New{3.88} Executed before the code written by
3073 |ldf| files with |\AtBeginDocument|. The optional argument with the
3074 language in this particular case is the language that wrote the code.
3075 The special value |/| means ‘return to the core \babel{} definitions’
3076 (in other words, what follows hasn’t been written by any language).
3077 \item[foreign] \New{24.8} Executed by |\foreignlanguage| after the
3078 language has been set up and just before typesetting the text from the
3079 second argument. Its main purpose it to wrap the text with some
3080 code, with the help of |\BabelWrapText|. For example, with:
3081 \begin{verbatim}
3082 \AddBabelHook{one}{foreign}{\BabelWrapText{\textit{##1}}
3083 \AddBabelHook{two}{foreign}{\BabelWrapText{\parse{##1}}
3084 \end{verbatim}
3085 the text becomes |\textit{\parse{<text>}}|.
3086 \begin{example}
3087 PDF tagging is still a work in progress, but language tags are already
3088 possible in short texts with |\foreignlanguage|. See the
3089 \href{https://github.com/latex3/babel/discussions/357}{\babel{} site}
3090 for a complete explained example.
3091 \end{example}
3092
3093 \end{description}
3094
3095 Four events are used in \file{hyphen.cfg}, which are handled in a
3096 quite different way for efficiency reasons -- unlike the precedent
3097 ones, they only have a single hook and replace a default definition.
3098 \begin{description}
3099 \renewcommand\makelabel[1]{%
3100 \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
3101 \itemsep=-\parskip
3102 \item[everylanguage] (language) Executed before every language patterns
3103 are loaded.
3104 \item[loadkernel] (file) By default just defines a few basic commands.
3105 It can be used to define different versions of them or to load a file.
3106 \item[loadpatterns] (patterns file) Loads the patterns file. Used by
3107 \file{luababel.def}.
3108 \item[loadexceptions] (exceptions file) Loads the exceptions
3109 file. Used by \file{luababel.def}.
3110 \end{description}
3111
3112 \begin{example}
3113 The generic unlocalized \LaTeX{} hooks are predefined, so that you can
3114 write:
3115 \begin{verbatim}
3116 \AddToHook{babel/*/afterextras}{\frenchspacing}
3117 \end{verbatim}
3118 which is executed always after the extras for the language being
3119 selected (and just before the non-localized hooks defined with
3120 |\AddBabelHook|).
3121
3122 In addition, locale-specific hooks in the form
3123 |babel/<language-name>/<event-name>| are \textit{recognized}
3124 (executed just before the localized \babel{} hooks), but they are
3125 \textit{not predefined}. You have to do it yourself. For example, to
3126 set |\frenchspacing| only in |bengali|:
3127 \begin{verbatim}
3128 \ActivateGenericHook{babel/bengali/afterextras}
3129 \AddToHook{babel/bengali/afterextras}{\frenchspacing}
3130 \end{verbatim}
3131 \end{example}
3132
3133 \subsection{Manage auxiliary files}
3134
3135 \Describe{\BabelContentsFiles}{}
3136 \New{3.9a} This macro contains a list of “toc” types requiring a
3137 command to switch the language. Its default value is |toc,lof,lot|, but
3138 you may redefine it with |\renewcommand| to add further types in case
3139 you need or there is a package enabling additional files, e.g., for
3140 theorems, algorithms, notation (it’s up to you to make sure no toc type
3141 is duplicated).
3142
3143 \subsection{Code based on the selector}
3144
3145 \Describe{\IfBabelSelectorTF}{\marg{selectors}\marg{true}\marg{false}}
3146
3147 \New{3.67} Sometimes a different setup is desired depending on the
3148 selector used. Values allowed in \m{selectors} are |select|, |other|,
3149 |foreign|, |other*| (and also |foreign*| for the tentative starred
3150 version), and it can consist of a comma-separated list. For example:
3151 \begin{verbatim}
3152 \IfBabelSelectorTF{other, other*}{A}{B}
3153 \end{verbatim}
3154 is true with any of these two environment selectors.
3155
3156 Its natural place of use is in hooks or in |\extras<language>|.
3157
3158 \subsection{Presets}
3159
3160 \New{24.12} Apart from configuration files, which are loaded before the
3161 locale files, you can preset some options even before loading \babel.
3162 One on the aims of this feature is to ease the integration with
3163 automated document generation or conversion workflows.
3164
3165 \Describe{\AddToHook\{babel/presets\}}{\marg{settings}}
3166
3167 This \LaTeX{} hook is executed just before locale files (either
3168 \texttt{ini} or \texttt{ldf}) are loaded. It’s in fact, similar to the
3169 config files, but it’s executed a little later and there is no need for
3170 a separate file. The following command has been devised for this hook,
3171 but other candidates are |\AfterBabelLanguage| and |\DeclareOption|
3172 (although the latter can be somewhat dangerous).
3173
3174 Note these declarations are valid ‘just in case’. If \babel{} is not
3175 loaded, they are ignored.
3176
3177 \Describe{\PassOptionsToLocale}{\marg{option-list}\marg{locale-name}}
3178
3179 Its purpose is what its name suggests, and it was devised to be used
3180 with the previous hook.
3181
3182 \begin{example}
3183 You are writing a class and expect lazy loading of secondary
3184 languages. You also want to make sure |french|, if used, activates
3185 its rules for punctuation spacing, and |malayalam|, if used, maps
3186 digits to the native ones (with \luatex):
3187 \setengine{luatex}
3188 \begin{verbatim}
3189 \AddToHook{babel/presets}{%
3190 \PassOptionsToLocale{transforms=punctuation.space}{french}%
3191 \PassOptionsToLocale{mapdigits}{malayalam}}
3192 \end{verbatim}
3193 If you want to take a step further and force \babel{} to always use
3194 |ini| files in all secondary languages, you can resort to the \LaTeX{}
3195 mechanism to pass options to packages:
3196 \begin{verbatim}
3197 \PassOptionsToPackage{provide+=*}{babel}
3198 \end{verbatim}
3199 \end{example}
3200
3201 \begin{note}
3202 Remember localized fonts are preset, too, with lazy loading. In
3203 the previous example you can set, for example,
3204 |\babelfont[malayalam]{rm}{FreeSerif}|.
3205 \end{note}
3206
3207 \section{Creating a language}
3208
3209 \New{3.10} And what if there is no style for your language or none fits
3210 your needs? You may then define quickly a language with the help of the
3211 following macro in the preamble (which may be used to modify an
3212 existing language, too, as explained in the previous subsection).
3213
3214 \Describe{\babelprovide}{\oarg{options}\marg{language-name}}
3215
3216 If the language \m{language-name} has not been loaded as class or
3217 package option and there are no \m{options}, it creates an “empty” one
3218 with some defaults in its internal structure: the hyphen rules, if not
3219 available, are set to the current ones, left and right hyphen mins are
3220 set to 2 and 3. In either case, caption, date and language system are
3221 not defined.
3222
3223 If no |ini| file is imported with |import|, \m{language-name} is still
3224 relevant because in such a case the hyphenation and like breaking rules
3225 (including those for South East Asian and CJK) are based on it as
3226 provided in the |ini| file corresponding to that name; the same applies
3227 to OpenType language and script.
3228
3229 Conveniently, some options allow to fill the language, and \babel{}
3230 warns you about what to do if there is a missing string. Very likely
3231 you will find alerts like this in the |log| file:
3232 \begin{verbatim}
3233 Package babel Warning: \chaptername not set for 'mylang'. Please,
3234 (babel) define it after the language has been loaded
3235 (babel) (typically in the preamble) with:
3236 (babel) \setlocalecaption{mylang}{chapter}{..}
3237 (babel) Reported on input line 26.
3238 \end{verbatim}
3239
3240 In most cases, you will only need to define a few macros. Note
3241 languages loaded on the fly are not yet available in the preamble.
3242
3243 \begin{example}
3244 If you need a language named |arhinish|:
3245 \begin{verbatim}
3246 \usepackage[danish]{babel}
3247 \babelprovide{arhinish}
3248 \setlocalecaption{arhinish}{chapter}{Chapitula}
3249 \setlocalecaption{arhinish}{refname}{Refirenke}
3250 \babelhyphenmins[arhinish]{2}{2}
3251 \end{verbatim}
3252 \end{example}
3253
3254 \begin{example}
3255 Sometimes treating the IPA as a language makes sense:
3256 \begin{verbatim}
3257 \documentclass{article}
3258 \usepackage[english]{babel}
3259 \babelprovide{ipa}
3260 \babelfont[ipa]{rm}{DejaVu Sans}
3261 \begin{document}
3262 Blah \foreignlanguage{ipa}{ɔːlˈðəʊ} Blah.
3263 \end{document}
3264 \end{verbatim}
3265 Then you can define shorthands, transforms (with \luatex), interchars
3266 (with \xetex) and so on, specific to this new ‘language’.
3267 \end{example}
3268
3269 \begin{example}
3270 Locales with names based on BCP 47 codes can be created with
3271 something like:
3272 \begin{verbatim}
3273 \babelprovide[import=en-US]{en-US}
3274 \end{verbatim}
3275 Note, however, mixing ways to identify locales can lead to problems.
3276 For example, is \verb|yi| the name of the language spoken by the Yi
3277 people or is it the code for Yiddish?
3278 \end{example}
3279
3280 The main language is not changed (\texttt{danish} in this example).
3281 So, you must add |\selectlanguage{arhinish}| or other selectors where
3282 necessary.
3283
3284 If the language has been loaded as an argument in |\documentclass| or
3285 |\usepackage|, then |\babelprovide| redefines the requested data.
3286
3287 \Describe{import=}{\meta{locale-tag}} The |<language-tag>| is optional.
3288 It imports the full data from the |ini| file corresponding to the locale
3289 being loaded, as set in |babel-<locale>.tex| (where |<locale>| is the
3290 last argument in |\babelprovide|), including captions and date (and
3291 also line breaking rules in newly defined languages). Unicode engines
3292 load the UTF-8 variants, while 8-bit engines load the LICR (i.e., with
3293 macros like |\'| or |\ss|) ones.
3294
3295 However, in some cases you may want to load a different |ini| file. In
3296 such a case, you can set its value.
3297
3298 \begin{example}
3299 For example, the locale |ar-DZ| is named |arabic-algeria|. You may
3300 prefer the shorter name |arabic| if there are no conflicts:
3301 \begin{verbatim}
3302 \babelprovide[_import=ar-DZ_]{arabic}
3303 \end{verbatim}
3304 \end{example}
3305
3306 Besides |\today|, this option defines an additional command for dates:
3307 |\<language>date|, which takes three arguments, namely, year, month and
3308 day numbers. In fact, |\today| calls |\<language>today|, which in turn
3309 calls |\<language>date{\the\year}{\the\month}{\the\day}|. \New{3.44}
3310 More convenient is usually |\localedate|, which prints the date for the
3311 current locale.
3312
3313 \Describe{hyphenrules=}{\meta{language-list}} With this option, with a
3314 space-separated list of hyphenation rules, \babel{} assigns to the
3315 language the first valid hyphenation rules in the list. For example:
3316 \begin{verbatim}
3317 \babelprovide[_hyphenrules=chavacano spanish italian_]{chavacano}
3318 \end{verbatim}
3319 If none of the listed hyphenrules exist, the default behavior applies.
3320 Note in this example we set |chavacano| as first option, which can seem
3321 redundant, but without it, it would select |spanish| even if
3322 |chavacano| exists.
3323
3324 A special value is |+|, which allocates a new language (in the \TeX{}
3325 sense). It only makes sense as the last value (or the only one; the
3326 subsequent ones are silently ignored). It is mostly useful with
3327 \luatex, because you can add some patterns with |\babelpatterns|, as
3328 for example:
3329 \begin{verbatim}
3330 \babelprovide[hyphenrules=+]{neo}
3331 \babelpatterns[neo]{a1 e1 i1 o1 u1}
3332 \end{verbatim}
3333 In other engines it just suppresses hyphenation (because the pattern
3334 list is empty).
3335
3336 \New{3.58} Another special value is |unhyphenated|, which is an
3337 alternative to |justification=unhyphenated|.
3338
3339 \Describe{main}{} This valueless option makes the language the main one
3340 (thus overriding that set when \babel\ is loaded).
3341 \begin{example}
3342 Let’s assume your document (\luatex{} or \xetex{}) is mainly in
3343 Polytonic Greek but with some sections in Italian. Then, the
3344 first attempt should be:
3345 \begin{verbatim}
3346 \usepackage[italian, greek.polytonic]{babel}
3347 \end{verbatim}
3348 But if, say, accents in Greek are not shown correctly, you can try
3349 \begin{verbatim}
3350 \usepackage[italian, polytonicgreek, provide=*]{babel}
3351 \end{verbatim}
3352 Remember there is an alternative syntax for the latter:
3353 \begin{verbatim}
3354 \usepackage[italian]{babel}
3355 \babelprovide[import, main]{polytonicgreek}
3356 \end{verbatim}
3357
3358 Finally, also remember you might not need to load |italian| at all if
3359 there are only a few word in this language (see~\ref{mostlymono}).
3360 \end{example}
3361
3362 \Describe{script=}{\meta{script-name}}
3363 \New{3.15} Sets the script name to be used by \textsf{fontspec} (e.g.,
3364 |Devanagari|). Overrides the value in the |ini| file. If
3365 \textsf{fontspec} does not define it, then \babel{} sets its tag to
3366 that provided by the |ini| file. This value is particularly important
3367 because it sets the writing direction, so you must use it if for some
3368 reason the default value is wrong.
3369
3370 \Describe{language=}{\meta{language-name}} \New{3.15}
3371 Sets the language name to be used by \textsf{fontspec} (e.g., |Hindi|).
3372 Overrides the value in the |ini| file. If \textsf{fontspec} does not
3373 define it, then \babel{} sets its tag to that provided by the |ini|
3374 file. Not so important, but sometimes still relevant.
3375
3376 \Describe{alph=}{\meta{counter-name}} Assigns to |\alph| that counter.
3377 See the next section.
3378
3379 \Describe{Alph=}{\meta{counter-name}} Same for |\Alph|.
3380
3381 \Describe{casing=}{\meta{rules}} \New{3.90} Selects the casing rules in a few
3382 languages. The first ones are predefined by \LaTeX{} (see
3383 \textsf{interface3.pdf}), while the following are defined by \babel:
3384 \begin{description}
3385 \item[Armenian] |yiwn| maps U+0587 to capital ech and yiwn on
3386 uppercasing.
3387 \item[German] |eszett| maps the lowercase \textit{Eszett} to a
3388 \textit{großes Eszett}.
3389 \item[Greek] |iota| converts the \textit{ypogegrammeni} (subscript muted
3390 iota) to capital iota when uppercasing.
3391 \item[Latin] |nouv| in |classicallatin| and |medievallatin| reverts
3392 the default rules, which maps u $\leftrightarrow$ V; |uv| in
3393 |ecclesiasticallatin| and the basic |latin| locale applies the map
3394 u $\leftrightarrow$ V (by default it’s u $\leftrightarrow$ U and v
3395 $\leftrightarrow$ V).
3396 \end{description}
3397
3398 \begin{example} For the latter:
3399 \begin{verbatim}
3400 \usepackage[greek]{babel}
3401 \babelprovide[_casing=iota_]{greek}
3402 \end{verbatim}
3403 \end{example}
3404
3405 \smallskip
3406 \makebox[\linewidth][c]{*\qquad*\qquad*}
3407 \smallskip
3408
3409 A few options (only \luatex) set some properties of the writing system
3410 used by the language. These properties are \textit{always} applied to
3411 the script, no matter which language is active. Although somewhat
3412 inconsistent, this makes setting a language up easier in most typical
3413 cases.
3414
3415 \Describe{onchar=}{\texttt{ids} $\string|$ \texttt{fonts}
3416 $\string|$ \texttt{letters}}
3417
3418 \New{3.38} This option is much like an ‘event’ called when a character
3419 belonging to the script of this locale is found (as its name implies,
3420 it acts on characters, not on spaces).
3421
3422 This option is particularly useful in pure Unicode multilingual text,
3423 because you can intermingle with no explicit markup differents scripts,
3424 each of which with its own hyphenation rules and font, and even its
3425 characteristic writing direction.
3426
3427 There are currently 3 ‘actions’, which can be used at the same time
3428 (separated by spaces):
3429 \begin{itemize}
3430 \item With |ids|, both |\language| and |\localeid| are set to the values
3431 associated with this locale, affecting the hyphenation rules, as well
3432 as any transforms declared for it.
3433 \item With |fonts|, the fonts are switched to those specified for this
3434 locale (as set with |\babelfont|). Characters assigned to a locale can
3435 be customized with |\babelcharproperty|.
3436 \item \New{3.81} Option |letters| restricts the ‘actions’ to letters, in
3437 the \TeX{} sense (i.e., with catcode 11). Digits and punctuation are
3438 then considered part of current locale (as set by a selector). This
3439 option is useful when the main script is non-Latin and there is a
3440 secondary one whose script is Latin.
3441 \end{itemize}
3442
3443 \begin{note}
3444 An alternative approach with \luatex{} and Harfbuzz is the font
3445 option |RawFeature={multiscript=auto}|. It does not switch the
3446 \babel{} language and therefore the line breaking rules, but in many
3447 cases it can be enough.
3448 \end{note}
3449
3450 \begin{note}
3451 \newcommand\artxt[1]{{%
3452 \fontspec[Script=Arabic]{FreeSerif}\textdir TRT #1}}
3453 There is no general rule to set the font for a punctuation mark,
3454 because it is a semantic decision and not a typographical one.
3455 Consider the following sentence: “\artxt{یک}, \artxt{دو}, and
3456 \artxt{سه} are Persian numbers”. In this case the punctuation font
3457 must be the English one, even if the commas are surrounded by
3458 non-Latin letters. Quotation marks, parenthesis, etc., are even more
3459 complex. Several criteria are possible, like the main language (the
3460 default in \babel), the first letter in the paragraph, or the
3461 surrounding letters, among others, but even so manual switching can
3462 still be necessary.
3463 \end{note}
3464
3465 \Describe{transforms=}{\meta{transform-list}}
3466 See section~\ref{transforms}.
3467
3468 \Describe{interchar=}{\meta{interchar-list}}
3469 See section~\ref{interchar}.
3470
3471 \begin{note}
3472 (1) If you need shorthands, you can define them with |\useshorthands|
3473 and |\defineshorthand| as described above. (2) Captions and |\today|
3474 are “ensured” with |\babelensure| (this is the default in
3475 |ini|-based languages).
3476 \end{note}
3477
3478 \begin{example} When creating a locale from another locale, you may want
3479 to reset some properties, like the BCP 47 tags. Here is an example of
3480 how to do it:
3481 \begin{verbatim}
3482 \babelprovide{spanish} % import=es by default
3483 \babelprovide[
3484 import=es,
3485 _identification/tag.bcp47 = es-x-medieval_,
3486 _identification/extension.x.tag.bcp47 = medieval_]
3487 {medievalspanish}
3488 \end{verbatim}
3489 \end{example}
3490
3491 \section{Locale features}
3492
3493 \subsection{Hyphenation and line breaking – 1. Commands}
3494
3495 \Babel{} deals with three kinds of line breaking rules: Western,
3496 typically the LGC group, South East Asian, like Thai, and CJK, but
3497 support depends on the engine: \textsf{pdftex} only deals with the
3498 former, \xetex{} also with the second one (although in a limited way)
3499 and CJK, while \luatex{} provides basic rules for all of them, as well
3500 as additional rules (like Uyghur and Tibetan). With \luatex{} there are
3501 also tools for non-standard hyphenation and line breaking rules,
3502 explained in the next section.
3503
3504 \Describe{\babelhyphenation}{\texttt{[}\langlist\texttt{]}%
3505 \marg{exceptions}}
3506
3507 \New{3.9a} Sets hyphenation exceptions for the languages given
3508 or, without the optional argument, for \textit{all} languages (e.g.,
3509 proper nouns or common loan words, and of course monolingual
3510 documents). Multiple declarations work much like |\hyphenation| (last
3511 wins), but language exceptions take precedence over global ones.
3512
3513 It can be used only in the preamble, and exceptions are set when the
3514 language is first selected, thus taking into account changes of
3515 |\lccodes|’s done in |\extras<language>| as well as the language-specific
3516 encoding (not set in the preamble by default). For example:
3517 \begin{verbatim}
3518 \babelhyphenation{Wal-hal-la Dar-bhan-ga}
3519 \end{verbatim}
3520
3521 Listed words are saved expanded and therefore it relies on the
3522 LICR\@. Of course, it also works without the LICR if the input and the
3523 font encodings are the same, like in Unicode based engines.
3524
3525 \begin{note}
3526 Using |\babelhyphenation| with Southeast Asian scripts is mostly
3527 pointless. But with |\babelpatterns| (below) you may fine-tune line
3528 breaking (only \luatex). For example:
3529 \begingroup
3530 \catcode`@=13
3531 \def@#1@{{\fontspec{Loma}#1}}
3532 \begin{verbatim}
3533 \babelpatterns[thai]{@ศึก@2@ษา@}
3534 \end{verbatim}
3535 \endgroup
3536 Even if there are no patterns for the language, you can add at least
3537 some typical cases.
3538 \end{note}
3539
3540 \begin{note}
3541 Use |\babelhyphenation| instead of |\hyphenation| to set hyphenation
3542 exceptions in the preamble before any language is explicitly set with
3543 a selector. In the preamble the hyphenation rules are not always
3544 fully set up and an error can be raised.
3545 \end{note}
3546
3547 \Describe{\babelpatterns}{\texttt{[}\langlist\texttt{]}%
3548 \marg{patterns}}
3549
3550 \New{3.9m} \textit{In \textsf{luatex} only},\footnote{With
3551 \textsf{luatex} exceptions and patterns can be modified almost
3552 freely. However, this is very likely a task for a separate package
3553 and \texttt{babel} only provides the most basic tools.} adds or
3554 replaces patterns for the languages given or, without the optional
3555 argument, for \textit{all} languages. If a pattern for a certain
3556 combination already exists, it gets replaced by the new one.
3557
3558 It can be used only in the preamble, and patterns are added when the
3559 language is first selected, thus taking into account changes of
3560 |\lccodes|’s done in |\extras<language>| as well as the language-specific
3561 encoding (not set in the preamble by default). Multiple
3562 |\babelpatterns|’s are allowed.
3563
3564 Listed patterns are saved expanded and therefore it relies on the
3565 LICR\@. Of course, it also works without the LICR if the input and the
3566 font encodings are the same, like in Unicode based engines.
3567
3568 \New{3.31} (Only \luatex.) With |\babelprovide| and |import|ed CJK
3569 languages, a simple generic line breaking algorithm (push-out-first) is
3570 applied, based on a selection of the Unicode rules (\New{3.32} it is
3571 disabled in verbatim mode, or more precisely when the hyphenrules
3572 are set to |nohyphenation|). It can be activated alternatively by
3573 setting explicitly the |intraspace|.
3574
3575 \New{3.27} Interword spacing for Thai, Lao and Khmer is activated
3576 automatically if a language with one of those scripts is loaded with
3577 |\babelprovide|. See the sample on the \babel{} repository. With both
3578 Unicode engines, spacing is based on the “current” em unit (the size
3579 of the previous char in \luatex, and the font size set by the last
3580 |\selectfont| in \xetex).
3581
3582 \begin{note}
3583 With Unicode engines, a line break can happen just before an explicit
3584 combining char (e.g., \textit{\~{g}}, used in Guarani and Filipino, is
3585 not included as a combined char and it’s represented in Unicode as
3586 |U+0067|~|U+0303|. This issue is not directly related to \babel, but
3587 to the hyphenation patterns and/or the font renderer. However, at
3588 least with \luatex{} there is a workaround (change the language name
3589 to what you are using):
3590 \begin{verbatim}
3591 \babelposthyphenation{guarani}{ | [{0300}-{036F}] }{ remove, {} }
3592 \end{verbatim}
3593 The Lua pattern means ‘a discretionary followed by a character in the
3594 range |U+0300|--|U+0367| (which contains combining chars)’. An
3595 alternative to a transform is |\babelpatterns|.
3596 \end{note}
3597
3598 \Describe{\babelhyphenmins}{%
3599 \optstar\texttt{[}\langlist\texttt{]}%
3600 \marg{left}\marg{right}\oarg{hyphenationmin}}
3601
3602 \New{24.10} See the news page for the rationale for this command. It
3603 sets the corresponding values for the given languages (all languages
3604 without the optional argument). With the star, the values are also
3605 applied immediately (the optional argument and the star are currently
3606 incompatible). The optional argument is available only in \luatex.
3607 \begin{example}
3608 You are typesetting a book with wide lines and want to limit the
3609 number of hyphens in all languages:
3610 \begin{verbatim}
3611 \babelhyphenmins{3}{4}
3612 \end{verbatim}
3613 But there is also some 3-column text and you want to be more flexible:
3614 \begin{verbatim}
3615 \begin{multicols}{3}
3616 \babelhyphenmins*{2}{3}
3617 ...
3618 \end{multicols}
3619 \end{verbatim}
3620 \end{example}
3621
3622 \Describe{\babelhyphen}{\optstar\marg{type}}
3623 \DescribeOther{\babelhyphen}{\optstar\marg{text}}
3624
3625 \New{3.9a} It is customary to classify hyphens in two types: (1)
3626 \textit{explicit} or \textit{hard hyphens}, which in \TeX\ are
3627 entered as \verb|-|, and (2) \textit{optional} or \textit{soft
3628 hyphens}, which are entered as \verb|\-|. Strictly, a \textit{soft
3629 hyphen} is not a hyphen, but just a breaking opportunity or, in
3630 \TeX\ terms, a “discretionary”; a \textit{hard hyphen} is a hyphen
3631 with a breaking opportunity after it. A further type is a
3632 \textit{non-breaking hyphen}, a hyphen without a breaking
3633 opportunity.
3634
3635 In \TeX, \verb|-| and \verb|\-| forbid further breaking opportunities
3636 in the word. This is the desired behavior very often, but not always,
3637 and therefore many languages provide shorthands for these
3638 cases. Unfortunately, this has not been done consistently: for
3639 example, \verb|"-| in Dutch, Portuguese, Catalan or Danish is a hard
3640 hyphen, while in German, Spanish, Norwegian, Slovak or Russian it is a
3641 soft hyphen. Furthermore, some of them even redefine |\-|, so that you
3642 cannot insert a soft hyphen without breaking opportunities in the rest
3643 of the word.
3644
3645 Therefore, some macros are provided with a set of basic “hyphens”
3646 which can be used by themselves, to define a user shorthand, or even
3647 in language files.
3648 \begin{itemize}
3649 \item |\babelhyphen{soft}| and |\babelhyphen{hard}| are self
3650 explanatory.
3651 \item |\babelhyphen{repeat}| inserts a hard hyphen which is repeated
3652 at the beginning of the next line, as done in languages like
3653 Polish, Portuguese and Spanish.
3654 \item |\babelhyphen{nobreak}| inserts a hard hyphen without a break
3655 after it (even if a space follows).
3656 \item |\babelhyphen{empty}| inserts a break opportunity without
3657 a hyphen at all.
3658 \item |\babelhyphen|\marg{text} is a hard “hyphen” using \m{text}
3659 instead. A typical case is |\babelhyphen{/}|.
3660 \end{itemize}
3661 With all of them, hyphenation in the rest of the word is enabled. If
3662 you don't want to enable it, there is a starred counterpart:
3663 |\babelhyphen*{soft}| (which in most cases is equivalent to the
3664 original |\-|), |\babelhyphen*{hard}|, etc.
3665
3666 Note |hard| is also good for isolated prefixes (e.g., \textit{anti-})
3667 and |nobreak| for isolated suffixes (e.g., \textit{-ism}), but in both
3668 cases |\babelhyphen*{nobreak}| is usually better.
3669
3670 There are also some differences with \LaTeX: (1) the character used is
3671 that set for the current font, while in \LaTeX{} it is hardwired to
3672 |-| (a typical value); (2) the hyphen to be used in fonts with a
3673 negative |\hyphenchar| is |-|, as in \LaTeX, but it can be changed to
3674 another value by redefining |\babelnullhyphen|; (3) a break after the
3675 hyphen is forbidden if preceded by a glue ${>}0$~pt (at the beginning
3676 of a word, provided it is not immediately preceded by, say, a
3677 parenthesis).
3678
3679 \Describe{\begin\menv{hyphenrules}}{\marg{language}\Eenv{hyphenrules}}
3680
3681 The environment \Lenv{hyphenrules} can be used to select \emph{only} the
3682 hyphenation rules to be used (it can be used as command, too). This can
3683 for instance be used to select ‘nohyphenation’, provided that in
3684 \file{language.dat} the ‘language’ \textsf{nohyphenation} is defined by
3685 loading \file{zerohyph.tex}. It deactivates language shorthands, too
3686 (but not user shorthands).
3687
3688 Except for these simple uses, |hyphenrules| is deprecated and
3689 |otherlanguage*| (the starred version) is preferred, because the former
3690 does not take into account possible changes in encodings of characters
3691 like, say, |'| done by some languages (e.g., \textsf{italian},
3692 \textsf{french}, \textsf{ukrainian}).
3693
3694 \begin{note}
3695 For the hyphenation to work correctly, lccodes cannot change, because
3696 \TeX{} only takes into account the values when the paragraph is
3697 hyphenated, i.e., when it has been finished.\footnote{This explains
3698 why \LaTeX{} assumes the lowercase mapping of T1 and does not provide
3699 a tool for multiple mappings. Unfortunately, \cs{savinghyphcodes} is
3700 not a solution either, because lccodes for hyphenation are frozen in
3701 the format and cannot be changed.} So, if you write a chunk of French
3702 text with |\foreignlanguage|, the apostrophes might not be taken into
3703 account. This is a limitation of \TeX, not of \babel. Alternatively,
3704 you may use |\useshorthands| to activate |'| and |\defineshorthand|,
3705 or redefine |\textquoteright| (the latter is called by the non-ASCII
3706 right quote).
3707 \end{note}
3708
3709 \subsection{Hyphenation and line breaking – 2. ‘Provide’ options}
3710
3711 \Describe{justification=}{\texttt{unhyphenated} $\string|$
3712 \texttt{kashida} $\string|$ \texttt{elongated} $\string|$
3713 \texttt{padding}}
3714 \New{3.59} There are currently 4 options. Note they are language
3715 dependent, so that they will not be applied to other languages.
3716
3717 The first one (|unhyphenated|) activates a line breaking mode that
3718 allows breaks only at spaces, which can be stretched to arbitrary
3719 amounts. Although for European standards the result may look odd, in
3720 some writing systems, like Malayalam and other Indic scripts, this has
3721 been the customary (although not always the desired) practice. Because
3722 of that, no locale enables currently this mode by default (Amharic is an
3723 exception). Unlike |\sloppy|, the |\hfuzz| and the |\vfuzz| are not
3724 changed, because this line breaking mode is not really ‘sloppy’ (in
3725 other words, overfull boxes are reported as usual).
3726
3727 The second and the third are for the Arabic script. It sets the
3728 linebreaking and justification method, which can be based on the
3729 \textsc{arabic tatweel} character or in the ‘justification
3730 alternatives’ OpenType table (\texttt{jalt}). For an explanation see
3731 the
3732 \href{https://latex3.github.io/babel/news/whats-new-in-babel-3.59.html}%
3733 {\babel\ site}.
3734
3735 \New{3.81} The option |padding| has been devised primarily for Tibetan.
3736 It’s still somewhat experimental. Again, there is an explanation in the
3737 \href{https://latex3.github.io/babel/news/whats-new-in-babel-3.81.html}%
3738 {\babel\ site}.
3739
3740 \Describe{linebreaking=}{}
3741 \New{3.59} Just a synonymous for \texttt{justification}. Depending on
3742 the language, this name can make more sense.
3743
3744 \Describe{intraspace=}{\meta{base} \meta{shrink} \meta{stretch}}
3745 Sets the interword space for the writing system of the language, in em
3746 units (so, |0 .1 0| is |0em plus .1em|). Like |\spaceskip|, the em unit
3747 applied is that of the current text (more precisely, the previous
3748 glyph). Currently used only in Southeast Asian scripts, like Thai, and
3749 CJK.
3750
3751 \Describe{intrapenalty=}{\meta{penalty}}
3752 Sets the interword penalty for the writing system of this language.
3753 Currently used only in Southeast Asian scripts, like Thai. If 0, which
3754 is the default value, no penalty is inserted.
3755
3756 \subsection{Shorthands – 1. Commands}
3757
3758 A \textit{shorthand} is a sequence of one or two characters that
3759 expands to arbitrary \TeX{} code.
3760
3761 Shorthands can be used for different kinds of things; for example:
3762 (1) in some languages shorthands such as |"a| are defined to be able
3763 to hyphenate the word if the encoding is |OT1|; (2) in some languages
3764 shorthands such as |!| are used to insert the right amount of white
3765 space; (3) several kinds of discretionaries and breaks can be inserted
3766 easily with |"-|, |"=|, etc.
3767
3768 The package \textsf{inputenc} as well as \luatex{} and \xetex{} have
3769 alleviated entering non-ASCII characters, but minority languages and
3770 some kinds of text can still require characters not directly available
3771 on the keyboards (and sometimes not even as separated or precomposed
3772 Unicode characters). As to the point 2, now \textsf{pdfTeX} provides
3773 |\knbccode|, and \luatex{} can manipulate the glyph list. Tools for
3774 point 3 can still be very useful in general.
3775
3776 There are four levels of shorthands: \textit{user}, \textit{language},
3777 \textit{system}, and \textit{language user} (by order of precedence).
3778 In most cases, you will use only shorthands provided by languages.
3779
3780 \begin{note} Keep in mind the following:
3781 \begin{enumerate}
3782 \item Activated chars used for two-char shorthands cannot be followed
3783 by a closing brace |}| and the spaces following are gobbled. With
3784 one-char shorthands (e.g.,~|:|), they are preserved.
3785 \item If on a certain level (system, language, user, language user)
3786 there is a one-char shorthand, two-char ones starting with that char
3787 and on the same level are ignored.
3788 \item Since they are active, a shorthand cannot contain the same
3789 character in its definition (except if deactivated with, e.g.,
3790 |\string|).
3791 \end{enumerate}
3792 \end{note}
3793
3794 \begin{troubleshooting}
3795 \trouble{Argument of \textbackslash language@active@arg"
3796 has an extra \textbraceright}
3797 A typical error when using shorthands is the following:
3798 \begin{verbatim}
3799 ! Argument of \language@active@arg" has an extra }.
3800 \end{verbatim}
3801 It means there is a closing brace just after a shorthand, which is not
3802 allowed (e.g.,~|"}|). Just add |{}| after (e.g.,~|"{}}|).
3803 \end{troubleshooting}
3804
3805 \Describe{\shorthandon}{\marg{shorthands-list}}
3806 \DescribeOther{\shorthandoff}{\optstar\marg{shorthands-list}}
3807 It is sometimes necessary to switch a shorthand
3808 character off temporarily, because it must be used in an
3809 entirely different way. For this purpose, the user commands
3810 |\shorthandoff| and |\shorthandon| are provided. They each take a
3811 list of characters as their arguments.
3812
3813 The command |\shorthandoff| sets the |\catcode| for each of the
3814 characters in its argument to other (12); the command |\shorthandon|
3815 sets the |\catcode| to active (13). Both commands work on only `known'
3816 shorthand characters, and an error will be raised otherwise. You can
3817 check if a character is a shorthand with |\ifbabelshorthand| (see
3818 below).
3819
3820 \New{3.9a} However, |\shorthandoff| does not behave as
3821 you would expect with characters like |~| or |^|, because they
3822 usually are not “other”. For them |\shorthandoff*| is provided,
3823 so that with
3824 \begin{verbatim}
3825 \shorthandoff*{~^}
3826 \end{verbatim}
3827 |~| is still active, very likely with the meaning of a non-breaking
3828 space, and |^| is the superscript character. The catcodes used are
3829 those when the shorthands are defined, usually when language files are
3830 loaded.
3831
3832 If you do not need shorthands, or prefer an alternative approach of
3833 your own, you may want to switch them off with the package option
3834 |shorthands=off|, as described below.
3835
3836 \begin{warning}
3837 It is worth emphasizing that these macros are meant for temporary changes.
3838 Whenever possible, shorthands must be always enabled or disabled.
3839 \end{warning}
3840
3841 \Describe{\useshorthands}{\optstar\marg{char}}
3842
3843 It initiates the definition of user-defined
3844 shorthand sequences. It has one argument, the character that starts
3845 these personal shorthands.
3846
3847 \New{3.9a} User shorthands are not always alive, as they may
3848 be deactivated by languages (for example, if you use |"| for your user
3849 shorthands and switch from \textsf{german} to \textsf{french}, they
3850 stop working). Therefore, a starred version
3851 |\useshorthands*|\marg{char} is provided, which makes sure shorthands
3852 are always activated.
3853
3854 If the package option |shorthands| is used, you must include any
3855 character to be activated with |\useshorthands|.
3856
3857 \Describe\defineshorthand{\texttt{[}\langlist\texttt{]}%
3858 \marg{shorthand}\marg{code}}
3859
3860 It takes two arguments: the first is a one- or two-character shorthand
3861 sequence, and the second is the code the shorthand should expand to.
3862
3863 \New{3.9a} An optional argument allows to (re)define language and
3864 system shorthands (some languages do not activate shorthands, so you
3865 may want to add |\languageshorthands|\marg{language} to the corresponding
3866 |\extras<language>|, as explained below). By default, user shorthands
3867 are (re)defined.
3868
3869 User shorthands override language ones, which in turn override system
3870 shorthands. Language-dependent user shorthands take precedence over
3871 “normal” user shorthands.
3872
3873 \begin{example}
3874 Let’s assume you want a unified set of shorthands for discretionaries
3875 (languages do not define shorthands consistently, and |"-|, |\-|,
3876 |"=| have different meanings). You can start with, say:
3877 \begin{verbatim}
3878 \useshorthands*{"}
3879 \defineshorthand{"*}{\babelhyphen{soft}}
3880 \defineshorthand{"-}{\babelhyphen{hard}}
3881 \end{verbatim}
3882 However, the behavior of hyphens is language-dependent. For example, in
3883 languages like Polish and Portuguese, a hard hyphen inside compound
3884 words are repeated at the beginning of the next line. You can then
3885 set:
3886 \begin{verbatim}
3887 \defineshorthand[*polish,*portuguese]{"-}{\babelhyphen{repeat}}
3888 \end{verbatim}
3889 Here, options with |*| set a language-dependent user shorthand, which
3890 means the generic declarations above for |"-| apply to all languages
3891 \textit{except} |polish| and |portuguese|; without |*| they would
3892 (re)define the language shorthands instead, which are overridden by
3893 user ones.
3894
3895 Now, you have a single unified shorthand (|"-|), with a
3896 content-based meaning (`compound word hyphen') whose visual behavior
3897 is that expected in each context.
3898 \end{example}
3899
3900 \Describe{\languageshorthands}{\marg{language}}
3901
3902 Used to switch the shorthands on the
3903 language level. It takes one argument, the name of a language or
3904 |none| (the latter does what its name suggests).\footnote{Actually,
3905 any name not corresponding to a language group does the same as
3906 \texttt{none}. However, follow this convention because it might be
3907 enforced in future releases of \babel{} to catch possible errors.}
3908 Note that for this to work the language should have been specified as
3909 an option when loading the \babel\ package. For example, you can use
3910 in \textsf{english} the shorthands defined by \textsf{german} with
3911 \begin{verbatim}
3912 \addto\extrasenglish{\languageshorthands{german}}
3913 \end{verbatim}
3914 (You may also need to activate them as user shorthands in the preamble
3915 with, for example, |\useshorthands| or |\useshorthands*|.)
3916
3917 \begin{example}
3918 Very often, this is a more convenient way to deactivate shorthands
3919 than |\shorthandoff|, for example if you want to define a macro
3920 to ease typing phonetic characters with \textsf{tipa}:
3921 \begin{verbatim}
3922 \newcommand{\myipa}[1]{{_\languageshorthands{none}_\tipaencoding#1}}
3923 \end{verbatim}
3924 \end{example}
3925
3926 \Describe{\babelshorthand}{\marg{shorthand}}
3927 With this command you can use a shorthand even if (1) not activated in
3928 \texttt{shorthands} (in this case only shorthands for the current
3929 language are taken into account, i.e., not user shorthands), (2) turned
3930 off with |\shorthandoff| or (3) deactivated with the internal
3931 |\bbl@deactivate|; for example, \verb|\babelshorthand{"u}| or
3932 \verb|\babelshorthand{:}|. (You can conveniently define your own
3933 macros, or even your own user shorthands provided they do not overlap.)
3934
3935 \begin{example}
3936 Since by default shorthands are not activated until
3937 |\begin{document}|, you may use this macro when defining the |\title|
3938 in the preamble:
3939 \begin{verbatim}
3940 \title{Documento científico_\babelshorthand{"-}_técnico}
3941 \end{verbatim}
3942 \end{example}
3943
3944 \bigskip
3945
3946 For your records, here is a list of shorthands, but you must double
3947 check them, as they may change:\footnote{Thanks to Enrico Gregorio.}
3948
3949 \begin{description}
3950 \itemsep=-\parskip
3951 \item[Languages with no shorthands] Croatian, English (any variety),
3952 Indonesian, Hebrew, Interlingua, Irish, Lower Sorbian, Malaysian,
3953 North Sami, Romanian, Scottish, Welsh
3954 \item[Languages with only \texttt{"} as defined shorthand character]
3955 Albanian, Bulgarian, Danish, Dutch, Finnish, German (old and new
3956 orthography, also Austrian), Icelandic, Italian, Norwegian, Polish,
3957 Portuguese (also Brazilian), Russian, Serbian (with Latin script),
3958 Slovene, Swedish, Ukrainian, Upper Sorbian
3959 \item[Basque] |" ' ~|
3960 \item[Breton] |: ; ? !|
3961 \item[Catalan] |" ' `|
3962 \item[Czech] |" -|
3963 \item[Esperanto] |^|
3964 \item[Estonian] |" ~|
3965 \item[French] (all varieties) |: ; ? !|
3966 \item[Galician] |" . ' ~ < >|
3967 \item[Greek] (ancient, polytonic, only 8-bit \TeX) |~|, (optional, see
3968 the manual for Greek) |;|
3969 \item[Hungarian] |`|
3970 \item[Kurmanji] |^|
3971 \item[Latin] |" ^ ' =|
3972 \item[Slovak] |" ^ ' -|
3973 \item[Spanish] |" . < > ' ~|
3974 \item[Turkish] |: ! =|
3975 \end{description}
3976 In addition, the \babel{} core declares |~| as a one-char shorthand
3977 which is let, like the standard |~|, to a non breaking space. Actually,
3978 this declaration serves to nothing, but it is preserved for backward
3979 compatibility.
3980
3981 \Describe\ifbabelshorthand{\marg{character}\marg{true}\marg{false}}
3982
3983 \New{3.23} Tests if a character has been made a shorthand.
3984
3985 \begin{note}
3986 \catcode`\|=12\relax Both \textsf{ltxdoc} and \textsf{babel} use
3987 \verb|\AtBeginDocument| to change some catcodes, and \babel{} reloads
3988 \textsf{hhline} to make sure \verb|:| has the right one, so if you
3989 want to change the catcode of \verb/|/ it has to be done using the
3990 same method at the proper place, with
3991 \begin{verbatim}
3992 \AtBeginDocument{\DeleteShortVerb{\|}}
3993 \end{verbatim}
3994 \textit{before} loading \babel. This way, when the document begins
3995 the sequence is (1) make \verb/|/ active (\textsf{ltxdoc}); (2) make
3996 it inactive (your settings); (3) make \babel{} shorthands active
3997 (\textsf{babel}); (4) reload \textsf{hhline} (\textsf{babel}, now
3998 with the correct catcodes for \verb/|/ and
3999 \verb|:|).\catcode`\|=\active
4000 \end{note}
4001
4002 \begin{note}
4003 Using a character mathematically active (i.e., with math code |"8000|) as
4004 a shorthand can make \TeX{} enter in an infinite loop in some rare
4005 cases. (There is a partial solution.)
4006 \end{note}
4007
4008 \subsection{Shorthands – 2. Package options}
4009
4010 \Describe{activeacute}{}
4011 \DescribeOther{activegrave}{}
4012
4013 For some languages \babel\ supports these options to set |'| and |`|,
4014 respectively, as a shorthand in case it is not done by default.
4015
4016 \Describe{shorthands=}{\meta{char}\meta{char}...
4017 $\string|$ \texttt{off}}
4018 The only language shorthands activated
4019 are those given, like, e.g.:
4020 \begin{verbatim}
4021 \usepackage[esperanto,french,_shorthands=:;!?_]{babel}
4022 \end{verbatim}
4023 If \verb|'| is included, \texttt{activeacute} is set; if \verb|`| is
4024 included, \texttt{activegrave} is set. Active characters (like
4025 \verb|~|) should be preceded by \verb|\string| (otherwise they will be
4026 expanded by \LaTeX{} before they are passed to the package and
4027 therefore they will not be recognized); however, |t| is provided for
4028 the common case of |~| (as well as |c| for not so common case of the
4029 comma).
4030
4031 With |shorthands=off| no language shorthands are defined.
4032 As some languages use this mechanism for tools not available
4033 otherwise, a macro \verb|\babelshorthand| is defined, which allows
4034 using them; see above.
4035
4036 \Describe{safe=}{\texttt{none} $\string|$ \texttt{ref} $\string|$
4037 \texttt{bib}} Some \LaTeX{} macros are redefined so that using
4038 shorthands is safe. With \texttt{safe=bib} only |\nocite|, |\bibcite|
4039 and |\bibitem| are redefined. With |safe=ref| only |\newlabel|, |\ref|
4040 and |\pageref| are redefined (as well as a few macros from
4041 \textsf{varioref} and \textsf{ifthen}).
4042
4043 With |safe=none| no macro is redefined. This option is strongly
4044 recommended, because a good deal of incompatibilities and errors are
4045 related to these redefinitions. As of \New{3.34}, in $\varepsilon$-\TeX{}
4046 based engines (i.e., almost every engine except the oldest ones)
4047 shorthands can be used in these macros (formerly you could not).
4048
4049 \Describe{math=}{\texttt{active} $\string|$ \texttt{normal}}
4050 Shorthands are mainly intended for text, not for math. By setting this
4051 option with the value |normal| they are deactivated in math mode
4052 (default is |active|) and things like |${a'}$| (a closing brace after
4053 a shorthand) are not a source of trouble anymore.
4054
4055 \subsection{Digits and counters}
4056
4057 \New{3.20} About thirty |ini| files define a field named
4058 |digits.native|. When it is present, two macros are created:
4059 |\<language>digits| and |\<language>counter| (only \luatex{} and
4060 \xetex{}). With the first, a string of ‘Latin’ digits are converted to
4061 the native digits of that language; the second takes a counter name as
4062 argument. With the option |maparabic| in |\babelprovide|, |\arabic| is
4063 redefined to produce the native digits.
4064
4065 \begin{note}
4066 \texttt{maparabic} redefines |\arabic| \textit{globally}, to avoid
4067 inconsistencies in, for example, page numbering; note as well dates
4068 do not rely on |\arabic|.
4069 \end{note}
4070
4071 For example:
4072 \setengine{luatex/xetex}
4073 \begin{verbatim}
4074 \usepackage[telugu]{babel}
4075 % Or also, if you want, with:
4076 % provide={ maparabic }
4077 \babelfont{rm}{Gautami}
4078 \begin{document}
4079 _\telugudigits{1234}_
4080 _\telugucounter{section}_
4081 \end{document}
4082 \end{verbatim}
4083
4084 Languages providing native digits in all or some variants are:
4085 \begin{multicols}{5}
4086 \parindent0pt
4087 Arabic\\
4088 Assamese\\
4089 Bangla\\
4090 Bhojpuri\\
4091 Bodo\\
4092 Burmese\\
4093 Cantonese\\
4094 Central Kurdish\\
4095 Chinese\\
4096 Dogri\\
4097 Dzongkha\\
4098 Gujarati\\
4099 Haryanvi\\
4100 Hindi\\
4101 Hmong Njua\\
4102 Kannada\\
4103 Kashmiri\\
4104 Khmer\\
4105 Konkani\\
4106 Korean\\
4107 Lao\\
4108 Maithili\\
4109 Malayalam\\
4110 Manipuri\\
4111 Marathi\\
4112 Mazanderani\\
4113 Nepali\\
4114 Northern Kurdish\\
4115 Northern Luri\\
4116 Odia\\
4117 Pashto\\
4118 Persian\\
4119 Punjabi\\
4120 Rajasthani\\
4121 Sanskrit\\
4122 Santali\\
4123 Sindhi\\
4124 Tamil\\
4125 Telugu\\
4126 Thai\\
4127 Tibetan\\
4128 Urdu\\
4129 Uyghur\\
4130 Uzbek\\
4131 Vai
4132 \end{multicols}
4133
4134 \New{3.30} With \luatex{} there is an alternative approach for mapping
4135 digits, namely, |mapdigits|. Conversion is based on the language and it
4136 is applied to the typeset text (not math, PDF bookmarks, etc.)\ before
4137 bidi and fonts are processed (i.e., to the node list as generated by the
4138 \TeX{} code). This means the local digits have the correct
4139 bidirectional behavior (unlike |Numbers=Arabic| in \textsf{fontspec},
4140 which is deprecated).
4141
4142 Another option is the transform |digits.native| (see \ref{transforms}),
4143 or the \texttt{digits} style with |\localenumeral| and
4144 |\localecounter| (see below).
4145
4146 \begin{note}
4147 With \xetex{} you can use the option |Mapping| when defining a
4148 font.
4149 \end{note}
4150
4151 \Describe{\localenumeral}{\marg{style}\marg{number}}
4152 \DescribeOther{\localecounter}{\marg{style}\marg{counter}}
4153
4154 \New{3.41} Many |ini| locale files provide information
4155 about non-positional numerical systems, based on those predefined in
4156 CSS\@. They only work with \luatex{} and \xetex{} and are fully
4157 expandable (even inside an unprotected |\edef|). Currently, they are
4158 limited to numbers below 10000.
4159
4160 There are several ways to use them (for the available styles in each
4161 language, see the list below):
4162
4163 \begin{itemize}
4164 \item |\localenumeral|\marg{style}\marg{number}, like
4165 |\localenumeral{abjad}{15}|
4166 \item |\localecounter|\marg{style}\marg{counter}, like
4167 |\localecounter{lower}{section}|
4168 \item In |\babelprovide|, as an argument to the keys |alph| and |Alph|,
4169 which redefine what |\alph| and |\Alph| print. For example:
4170 \begin{verbatim}
4171 \babelprovide[_alph=alphabetic_]{thai}
4172 \end{verbatim}
4173 \end{itemize}
4174
4175 The styles are:
4176 \begin{description}
4177 \itemsep=-\parskip
4178 \item[Ancient Greek] |lower.ancient|, |upper.ancient|
4179
4180 \item[Amharic] |afar|, |agaw|, |ari|, |blin|, |dizi|, |gedeo|, |gumuz|,
4181 |hadiyya|, |harari|, |kaffa|, |kebena|, |kembata|, |konso|, |kunama|,
4182 |meen|, |oromo|, |saho|, |sidama|, |silti|, |tigre|, |wolaita|, |yemsa|
4183
4184 \item[Arabic] |abjad|, |maghrebi.abjad|
4185
4186 \item[Armenian] |lower.letter|, |upper.letter|
4187
4188 \item[Belarusan, Bulgarian, Church Slavic, Macedonian, Serbian] |lower|, |upper|
4189
4190 \item[Bangla] |alphabetic|
4191
4192 \item[Central Kurdish] |alphabetic|
4193
4194 \item[Chinese] |cjk-earthly-branch|, |cjk-heavenly-stem|,
4195 |circled.ideograph|, |parenthesized.ideograph|,
4196 |fullwidth.lower.alpha|, |fullwidth.upper.alpha|
4197
4198 \item[Church Slavic (Glagolitic)] |letters|
4199
4200 \item[Coptic] |epact|, |lower.letters|
4201
4202 \item[French] |date.day| (mainly for internal use).
4203
4204 \item[Georgian] |letters|
4205
4206 \item[Greek] |lower.modern|, |upper.modern|, |lower.ancient|,
4207 |upper.ancient| (all with keraia), |lower.modern.nonumeralsign|,
4208 |upper.modern.nonumeralsign| (without keraia).
4209
4210 \item[Hebrew] |letters| (\New{3.93} if the language is loaded
4211 explicitly, also |letters.plain|, |letters.gershayim|, |letters.final|)
4212
4213 \item[Hindi] |alphabetic|
4214
4215 \item[Italian] |lower.legal|, |upper.legal|
4216
4217 \item[Japanese] |hiragana|, |hiragana.iroha|, |katakana|,
4218 |katakana.iroha|, |circled.katakana|, |informal|, |formal|,
4219 |cjk-earthly-branch|, |cjk-heavenly-stem|, |circled.ideograph|,
4220 |parenthesized.ideograph|, |fullwidth.lower.alpha|,
4221 |fullwidth.upper.alpha|
4222
4223 \item[Khmer] |consonant|
4224
4225 \item[Korean] |consonant|, |syllable|, |hanja.informal|, |hanja.formal|,
4226 |hangul.formal|, |cjk-earthly-branch|, |cjk-heavenly-stem|,
4227 |circled.ideograph|, |parenthesized.ideograph|,
4228 |fullwidth.lower.alpha|, |fullwidth.upper.alpha|
4229
4230 \item[Marathi] |alphabetic|
4231
4232 \item[Persian] |abjad|, |alphabetic|
4233
4234 \item[Russian] |lower|, |lower.full|, |upper|, |upper.full|
4235
4236 \item[Syriac] |letters|
4237
4238 \item[Tamil] |ancient|
4239
4240 \item[Thai] |alphabetic|
4241
4242 \item[Ukrainian] |lower| , |lower.full|, |upper| , |upper.full|
4243 \end{description}
4244
4245 \New{3.45} In addition, native digits (in languages defining them) may
4246 be printed with the numeral style |digits|.
4247
4248 \New{25.12} With |mapdot=|\m{text} as an option in ‘provide’, the
4249 standard counters (those starting with |\the...|) are traversed to
4250 replace each dot by the provided \m{text} in a locale-dependent way.
4251 Without a value, a default is used — currenty the only default value is
4252 for the Arabic (\texttt{ar}) locales, which is set to a hyphen (because
4253 the zero and the dot are very similar in this script). See the news
4254 page for further details.
4255
4256 \subsection{Dates}
4257
4258 \New{3.45} When the data is taken from an |ini| file, you may print the
4259 date corresponding to the Gregorian calendar and other lunisolar systems
4260 with the following command.
4261
4262 \Describe{\localedate}{\oarg{calendar=.., variant=.., convert}%
4263 {\marg{year}\marg{month}\marg{day}}}
4264
4265 By default the calendar is the Gregorian, but an |ini| file may define
4266 strings for other calendars: |am| (|ethiopic|), |ar| and
4267 |ar-|* (|islamic|), |cop| (|coptic|), |fa| (|islamic|, |persian|), |he|
4268 (|hebrew|), |hi| (|indian|), |th| (|buddhist|), and (\New{25.16}) |el| (|julian|).
4269 In the latter case, the three arguments are the year, the month, and
4270 the day for those in the corresponding calendar. They are \textit{not}
4271 the Gregorian date to be converted (which means, say, 13 is a valid
4272 month number with |calendar=hebrew| and |calendar=coptic|). However,
4273 with the option |convert| it’s converted (using internally the
4274 following command).
4275
4276 Even with a certain calendar there may be variants. In Kurdish the
4277 default variant prints something like \textit{30. Çileya Pêşîn 2019},
4278 but with |variant=izafa| it prints \textit{31’ê Çileya Pêşînê 2019}.
4279
4280 The default calendar for a language can be set in |\babelprovide|, with
4281 the key |calendar| (an empty value is the same as |gregorian|). In this
4282 case, |\today| always converts the date. Variants are preceded by a
4283 dot, so that |calendar = .genitive| in |serbian| |\today| selects the
4284 date in this variant (more explicitly is |gregorian.genitive|).
4285
4286 \begin{example}
4287 By default, |thai| prints the date with |\today| in the Buddhist
4288 calendar, but if you need a date in the Gregorian one, write:
4289 \begin{verbatim}
4290 \localedate[calendar=gregorian]{\year}{\month}{\day}
4291 \end{verbatim}
4292 (Remember |\year|, |\month| and |\day| is the current Gregorian date,
4293 so no conversion is necessary.)
4294 \end{example}
4295
4296 \begin{example}
4297 On the other hand (and following the CLDR), the preferred calendar in
4298 most locales for Arabic is |gregorian| (in |ar-SA| is
4299 |islamic-umalqura|), so to set |islamic-civil| as the
4300 default one:
4301 \begin{verbatim}
4302 \babelprovide[import, calendar=islamic-civil]{arabic}
4303 \end{verbatim}
4304 \end{example}
4305
4306 \Describe{\babelcalendar}{\oarg{date}%
4307 \marg{calendar}\marg{year-macro}\m{month-macro}\m{day-macro}}
4308
4309 \New{3.76} Although calendars aren’t the primary concern of \babel, the
4310 package should be able to, at least, generate correctly the current
4311 date in the way users would expect in their own culture. Currently,
4312 |\localedate| can print dates in a few calendars (provided the
4313 \textsf{ini} locale file has been imported), but year, month and day
4314 had to be entered by hand, which is inconvenient. With this macro,
4315 the current date is converted and stored in the three last arguments,
4316 which must be macros. Allowed calendars are:
4317 \begin{multicols}{4}
4318 |buddhist|\\
4319 |chinese| \New{3.94}\\
4320 |coptic|\\
4321 |ethiopic|\\
4322 |hebrew|\\
4323 |islamic-civil|\\
4324 |islamic-umalqura|\\
4325 |julian|\\
4326 |persian|
4327 \end{multicols}
4328 The optional argument converts the given date, in the form
4329 ‘\m{year}-\m{month}-\m{day}’, although for practical reasons most
4330 calendars accept only a restricted range of years. Please, refer to the
4331 page on the news for 3.76 in the \babel{} site for further details.
4332
4333 \subsection{Transforms}
4334 \label{transforms}
4335
4336 Transforms (only \luatex) provide a way to process the text on the
4337 typesetting level in several language-dependent ways, like non-standard
4338 hyphenation, special line breaking rules, script to script conversion,
4339 spacing conventions and so on.
4340
4341 \begin{note}
4342 They are similar in concept, but not the same, as those in Unicode.
4343 Actually, the main inspiration for this feature is the Omega
4344 transformation processes.
4345 \end{note}
4346
4347 It currently embraces |\babelprehyphenation| and
4348 |\babelposthyphenation|.
4349
4350 \New{3.57} Several \textsf{ini} files predefine some transforms. They
4351 are activated with the key |transforms| in |\babelprovide|, either if
4352 the locale is being defined with this macro or the languages has been
4353 previously loaded as a class or package option, as the following example
4354 illustrates:
4355 \begin{verbatim}
4356 \usepackage[hungarian]{babel}
4357 \babelprovide[_transforms = digraphs.hyphen_]{hungarian}
4358 \end{verbatim}
4359 \New{3.67} Transforms predefined in the |ini| locale files can be made
4360 attribute-dependent, too. When an attribute between parenthesis is
4361 inserted subsequent transforms will be assigned to it (up to the list
4362 end or another attribute). For example,
4363 and provided an attribute called |\withsigmafinal| has been declared:
4364 \begin{verbatim}
4365 transforms = transliteration.omega (\withsigmafinal) sigma.final
4366 \end{verbatim}
4367 This applies |transliteration.omega| always, but |sigma.final| only when
4368 |\withsigmafinal| is set.
4369
4370 Here are the transforms currently predefined. (A few may still require
4371 some fine-tuning. More to follow in future releases.)
4372
4373 \begingroup
4374 \def\trans#1#2#3{%
4375 \vspace{1.5mm}%
4376 \parbox[t]{2.2cm}{\raggedright\strut#1}%
4377 \hspace{2mm}%
4378 \parbox[t]{4.0cm}{\strut\ttfamily#2}%
4379 \hspace{2mm}%
4380 \parbox[t]{6.6cm}{\strut#3}\par}
4381 \bigskip\hrule\nobreak\vspace{.5mm}\parindent0pt
4382
4383 \trans{}{digits.native}{\New{24.9} An alternative to |mapdigits|,
4384 available in the same locales. This transform is applied before the
4385 first prehyphenation, while |mapdigits| is applied after the last
4386 posthyphenation. Another difference is |mapdigits| cannot be disabled
4387 in the middle of a paragraph. (This transform is \textit{not} declared
4388 explicitly in |ini| files. Instead, it’s defined by |babel| if the key
4389 \texttt{numbers/digits.native} exists.)}
4390
4391 \trans{Arabic}{transliteration.dad}{Applies the transliteration system
4392 devised by Yannis Haralambous for \textsf{dad} (simple and
4393 \TeX-friendly). Not yet complete, but sufficient for most texts.}
4394
4395 \trans{Arabic, Persian}{kashida.base}{\New{3.94}. Much like the
4396 following, but with diacritics stacked in the actual base character and
4397 not the kashida extension. With evenly inserted tatweels results are
4398 better.}
4399
4400 \trans{Arabic, Persian}{kashida.plain}{A very simple and basic
4401 transform for ‘plain’ Arabic fonts, which attempts to distribute the
4402 tatweel as evenly as possible (starting at the end of the line). See
4403 the news for version 3.59.}
4404
4405 \trans{Chinese, Japanese}{input.nospaces}{With it, and just for
4406 convenience, spaces (and new lines) in the input are ignored.}
4407
4408 \trans{Chinese, Japanese}{spacing.basic}{Basic rules for readjusting
4409 spacing. See \New{25.6} for further details.}
4410
4411 \trans{Croatian}{digraphs.ligatures}{Ligatures \textit{DŽ}, \textit{Dž},
4412 \textit{dž}, \textit{LJ}, \textit{Lj}, \textit{lj}, \textit{NJ},
4413 \textit{Nj}, \textit{nj}. It assumes they exist. This is not the
4414 recommended way to make these transformations (the best way is with
4415 OTF features), but it can get you out in a hurry.}
4416
4417 \trans{Croatian, Czech, Polish, Portuguese, Slovak,
4418 Spanish}{hyphen.repeat}{Explicit hyphens behave like
4419 |\string\babelhyphen|\allowbreak|\{repeat\}|.}
4420
4421 \trans{Czech, Polish, Slovak}{oneletter.nobreak}{Converts a space after
4422 a non-syllabic preposition or conjunction into a non-breaking space.}
4423
4424 \trans{Dutch}{diaeresis.hyphen}{Removes the diaeresis above a vowel if
4425 hyphenated just before.}
4426
4427 \trans{Finnish}{prehyphen.nobreak}{Line breaks just after hyphens
4428 prepended to words are prevented, as in “pakastekaapit ja -arkut”.}
4429
4430 \trans{French}{punctuation.space}{Rules for proper spacing with
4431 characters \textit{;:!?«»} are applied.}
4432
4433 \trans{German}{longs.unifraktur}{Implements the basic heuristic rules
4434 for the long s (ſ) from those in Unifraktur Maguntia. Although
4435 discretionaries aren’t taken into account, the transform is declared in
4436 the posthyphenation group, to ease if necessary fine tuning the rules
4437 for, e.g., prefixes and compound words. They are available in all
4438 German locales. See \New{25.5} for further details and an example.}
4439
4440 \trans{Greek}{diaeresis.hyphen}{Removes the diaeresis above iota and
4441 upsilon if hyphenated just before. It works with the three variants.}
4442
4443 \trans{Greek}{transliteration.omega}{Although the provided combinations
4444 are not the full set, this transform follows the syntax of Omega:
4445 |=| for the circumflex, |v| for digamma, and so on. For better
4446 compatibility with Levy’s system, \texttt{\string~} (as ‘string’) is an
4447 alternative to |=|. |'| is tonos in Monotonic Greek, but oxia in
4448 Polytonic and Ancient Greek.}
4449
4450 \trans{Greek}{sigma.final}{The transliteration system above does not
4451 convert the sigma at the end of a word (on purpose). This transform
4452 does it. To prevent the conversion (an abbreviation, for example), write
4453 |"s|.}
4454
4455 \trans{Hebrew, Yiddish, Ladino, Ancient Hebrew}{transliteration.cj}{A
4456 transliteration system based on that devised by Christian Justen for
4457 `cjhebrew`. Final letters are not converted, and the furtive patah is
4458 not shifted.}
4459
4460 \trans{Hebrew, Yiddish, Ladino, Ancient
4461 Hebrew}{justification.interletter}{\hspace*{2em}Hebrew
4462 justification is based on variations in the spacing between individual
4463 letters within words. This transform activates this justification
4464 method. See \New{25.8} for further details and an example.}
4465
4466 \trans{Hindi, Sanskrit}{punctuation.space}{Inserts a space before the
4467 following four characters: \textit{!?:;}\,.}
4468
4469 \trans{Hindi, Sanskrit}{transliteration.hk}{The Harvard-Kyoto system to
4470 romanize Devanagari.}
4471
4472 \trans{Hindi, Sanskrit}{transliteration.iast}{The IAST system to
4473 romanize Devanagari (thanks to Maximilian Mehner).}
4474
4475 \trans{Hungarian}{digraphs.hyphen}{Hyphenates the long digraphs
4476 \textit{ccs}, \textit{ddz}, \textit{ggy}, \textit{lly}, \textit{nny},
4477 \textit{ssz}, \textit{tty} and \textit{zzs} as \textit{cs-cs},
4478 \textit{dz-dz}, etc.}
4479
4480 \trans{Indic scripts}{danda.nobreak}{Prevents a line break before a
4481 danda or double danda if there is a space. For Assamese, Bangla,
4482 Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Tamil, Telugu.}
4483
4484 \trans{Japanese}{linebreak.strict}{Prevents line breaks before small
4485 kana variants.}
4486
4487 \trans{Latin}{digraphs.ligatures}{Replaces the groups \textit{ae},
4488 \textit{AE}, \textit{oe}, \textit{OE} with \textit{æ}, \textit{Æ},
4489 \textit{œ}, \textit{Œ}.}
4490
4491 \trans{Latin}{letters.noj}{Replaces \textit{j}, \textit{J} with
4492 \textit{i}, \textit{I}.}
4493
4494 \trans{Latin}{letters.uv}{Replaces \textit{v}, \textit{U} with
4495 \textit{u}, \textit{V}.}
4496
4497 \trans{Russian}{transliteration.gost779b}{\hspace*{1.5em}The GOST
4498 7.79-2000 System B for the romanization of Russian. \New{25.10}}
4499
4500 \trans{Serbian}{transliteration.gajica}{(Note |serbian| with |ini|
4501 files refers to the Cyrillic script, which is here the target.) The
4502 standard system devised by Ljudevit Gaj.}
4503
4504 \vspace{2mm}\hrule\nobreak
4505 \endgroup
4506
4507 \Describe{\babelposthyphenation}{\oarg{options}\marg{hyphenrules-name}%
4508 \marg{lua-pattern}\marg{replacement}}
4509
4510 \New{3.37-3.39} \textit{With \luatex{}} it is possible to define
4511 non-standard hyphenation rules, like |f-f| $\to$ |ff-f|, repeated
4512 hyphens, ranked ruled (or more precisely, ‘penalized’ hyphenation
4513 points), and so on. A few rules are currently provided (see above), but
4514 they can be defined as shown in the following example, where |{1}| is
4515 the first captured char (between |()| in the pattern):
4516 \begin{verbatim}
4517 \babelposthyphenation{german}{([fmtrp]) | {1}}
4518 {
4519 { no = {1}, pre = {1}{1}- }, % Replace first char with disc
4520 remove, % Remove automatic disc (2nd node)
4521 {} % Keep last char, untouched
4522 }
4523 \end{verbatim}
4524
4525 In the replacements, a captured char may be mapped to another, too. For
4526 example, if the first capture reads |([ΐΰ])|, the replacement could be
4527 \verb+{1|ΐΰ|ίύ}+, which maps \textit{ΐ} to \textit{ί}, and \textit{ΰ}
4528 to \textit{ύ}, so that the diaeresis is removed.
4529
4530 This feature is activated with the first |\babelposthyphenation| or
4531 |\babelprehyphenation|.
4532
4533 \New{3.67} With the optional argument you can associate a user-defined
4534 transform to an attribute, so that it’s active only when it’s set
4535 (currently its attribute value is ignored). With this mechanism
4536 transforms can be set or unset even in the middle of paragraphs, and
4537 applied to single words. To define, set and unset the attribute, the
4538 \LaTeX{} kernel provides the macros |\newattribute|, |\setattribute| and
4539 |\unsetattribute|. The following example shows how to use it, provided
4540 an attribute named |\latinnoj| has been declared:
4541 \begin{verbatim}
4542 \babelprehyphenation[attribute=\latinnoj]{latin}{ J }{ string = I }
4543 \end{verbatim}
4544
4545 See the
4546 \href{https://latex3.github.io/babel/guides/%
4547 non-standard-hyphenation-with-luatex.html}{\babel\ site} for a more
4548 detailed description and some examples. It also describes a few
4549 additional replacement types (|string|, |penalty|).
4550
4551 \New{3.85} Another option is |label|, which takes a value similar to
4552 those in |\babelprovide| key |transforms| (in fact, the latter just
4553 applies this option). This label can be used to turn on and off
4554 transforms with a higher level interface, by means of
4555 |\enablelocaletransform| and |\disablelocaletransform| (see below).
4556
4557 \New{3.85} When used in conjunction with |label|, this key makes a
4558 transform font dependent. As an example, the rules for Arabic kashida
4559 can differ depending on the font design. The value consists in a list
4560 of space-separated font tags:
4561 \begin{verbatim}
4562 \babelprehyphenation[label=transform.name, fonts=rm sf]{..}{..}
4563 \end{verbatim}
4564 Tags can adopt two forms: a family, such as |rm| or |tt|, or the set
4565 family/series/shape. If a font matches one of these conditions, the
4566 transform is enabled. The second tag in |rm rm/n/it| is redundant.
4567 There are no wildcards; so, for italics you may want to write something
4568 like |sf/m/it sf/b/it|.
4569
4570 Transforms set for specific fonts (at least once in any language) are
4571 always reset with a font selector.
4572
4573 In |\babelprovide|, transform labels can be tagged before their name,
4574 with a list separated with colons, like:
4575 \begin{verbatim}
4576 transforms = _rm:sf:_transform.name
4577 \end{verbatim}
4578
4579 Tranforms are executed in the same order they are declared. \New{25.9}
4580 They can be also added at the beginning with the key |prepend|, which
4581 is particularly useful with predefined transforms. For example:
4582 \begingroup
4583 \catcode`@=13
4584 \def@#1@{{\fontspec[Scale=.87,Script=Hebrew]{Noto Sans Hebrew}#1}}
4585 \begin{verbatim}
4586 \babelprehyphenation[prepend]{hebrew}{-}{ string = @־@ } % hyphen to maqaf
4587 \end{verbatim}
4588 \endgroup
4589
4590 Although the main purpose of post-hyphenation transforms was
4591 non-standard hyphenation, they may actually be used for other
4592 transformations (for example, rules for long s in German).
4593
4594 \Describe{\babelprehyphenation}{\oarg{options}\marg{locale-name}%
4595 \marg{lua-pattern}\marg{replacement}}
4596
4597 \New{3.44-3-52} It is similar to the latter, but (as its name implies)
4598 applied before hyphenation, which is particularly useful in
4599 transliterations. There are other differences: (1) the first argument
4600 is the locale instead of the name of the hyphenation patterns; (2) in the
4601 search patterns |=| has no special meaning, while \verb+|+ stands for
4602 an ordinary space; (3) in the replacement, discretionaries are not
4603 accepted.
4604
4605 See the description above for the optional argument.
4606
4607 This feature is activated with the first |\babelposthyphenation| or
4608 |\babelprehyphenation|.
4609
4610 \begin{example}
4611 You can replace a character (or series of them) by another character
4612 (or series of them). Thus, to enter \textit{ž} as |zh| and \textit{š}
4613 as |sh| in a newly created locale for transliterated Russian:
4614 \begin{verbatim}
4615 \babelprovide[hyphenrules=+]{russian-latin} % Create locale
4616 \babelprehyphenation{russian-latin}{([sz])h} % Create rule
4617 {
4618 string = _{1|sz|šž}_,
4619 remove
4620 }
4621 \end{verbatim}
4622 \end{example}
4623
4624 \begin{example}
4625 The following rule prevent the word “a” from being at the
4626 end of a line:
4627 \begin{verbatim}
4628 \babelprehyphenation{english}{|a|}
4629 {}, {}, % Keep first space and a
4630 { insert, penalty = 10000 }, % Insert penalty
4631 {} % Keep last space
4632 }
4633 \end{verbatim}
4634 \end{example}
4635
4636 \begin{note}
4637 With \luatex{} there is another approach to make text
4638 transformations, with the function |fonts.handlers.otf.addfeature|,
4639 which adds new features to an OTF font (substitution and
4640 positioning). These features can be made language-dependent, and
4641 \babel{} by default recognizes this setting if the font has been
4642 declared with |\babelfont|. The \textit{transforms} mechanism
4643 supplements rather than replaces OTF features.
4644
4645 With \xetex{}, where \textit{transforms} are not available, there is
4646 still another approach, with font mappings, mainly meant to perform
4647 encoding conversions and transliterations. Mappings, however, are
4648 linked to fonts, not to languages.
4649 \end{note}
4650
4651 \Describe{\enablelocaletransform}{\marg{label}}
4652 \DescribeOther{\disablelocaletransform}{\marg{label}}
4653
4654 \New{3.85} Enables and disables the transform with the given label in
4655 the current language. Font dependent transforms are always enabled and
4656 cannot be disabled.
4657
4658 \Describe{\SetTrasformValue}{\marg{locale-name}\marg{variable-name}\marg{value}}
4659
4660 This command allows adjustments (specifically numeric parameters in
4661 prehyphenation) in transform, which can be useful in those predeclared
4662 in \texttt{ini} files. Something like
4663 \verb+{<variable-name>|<default>}+
4664 employs the variable as set by this macro. The following variables are
4665 currently defined:
4666 \begin{itemize}
4667 \item For French and \texttt{punctuation.space}: \texttt{guillemet.natural},
4668 \texttt{guillemet.plus}, \texttt{guillemet.minus},
4669 \texttt{colon.natural}, \texttt{colon.plus}, \texttt{colon.minus},
4670 \texttt{high.natural}, \texttt{high.plus}, \texttt{high.minus}. A
4671 value of 1 is the current ordinary space. \New{24.13}
4672 \item For languages in the Hebrew script and \texttt{justification.interletter}:
4673 |interletter.plus|, which sets the factor for the glue ‘plus’ value. By
4674 default, .5. \New{25.8}
4675 \item For Japanese and \texttt{linebreak.strict}:
4676 \texttt{small.natural}, \texttt{small.plus} and \texttt{small.minus}.
4677 They are set when the transform is activated to the intraspace values.
4678 In addition, the penalty, by default 10000, can be set with
4679 \texttt{small.penalty}. \New{24.14}
4680 \end{itemize}
4681
4682 \begin{example}
4683 With:
4684 \begin{verbatim}
4685 \SetTransformValue{french}{colon.natural}{.8}
4686 \end{verbatim}
4687 the natural spacing with the colon is made slightly smaller (default is 1).
4688 \end{example}
4689
4690 \Describe{\ShowBabelTransforms}{\marg{string}}
4691
4692 \New{25.7} Applies the current transforms to the string and shows in
4693 the |log| the transformations performed. Don’t rely on the current
4694 format, because it may change. In the process, penalties,
4695 discretionaries, etc., can be inserted, which are currently printed as
4696 a boxed ‘?’, as a boxed ‘US’ (because it’s the ‘unit separator’) or in
4697 another way. With this macros you can better understand what’s going
4698 on, so that you can debug the transforms. Use it only in the document
4699 body.
4700
4701 \subsection{Support for \xetex{} interchar}
4702 \label{interchar}
4703
4704 \New{3.97} A few macros are provided to deal with locale dependent
4705 inter-character rules (aka ‘interchar’).
4706
4707 \Describe{\babelcharclass}{\marg{locale}\marg{name}\marg{char-list}}
4708
4709 Declares a new character class, which is assigned to the characters in
4710 \marg{char-list}, entered either as characters or in macro form
4711 (e.g.,~|\}|). If you need to enter them by their numeric value, use the
4712 \TeX{} |^|-notation (e.g.,~|^^^^1fa0|). Ranges are allowed, with a
4713 hyphen (e.g.,~|.,;a-zA-Z|). If you need the hyphen to be assigned a
4714 class, write it at the very beginning of the list.
4715
4716 There are several predefined ‘global’ classes, namely |default|,
4717 |cjkideogram|, |cjkleftpunctuation|, |cjkrightpunctuation|, |boundary|,
4718 and |ignore|, which are described in the \xetex{} manual. These classes
4719 are used by the |linebreak.basic|, described below.
4720
4721 \Describe{\babelinterchar}{\oarg{options}\marg{locale}
4722 \marg{class-first}\marg{class-second}\marg{code}}
4723
4724 \marg{class-first} and \marg{class-second} can be comma separated lists
4725 of char classes, and all combinations are defined (so that 2 first
4726 classes with 2 second classes, define 4 combinations). In the
4727 \meta{options} field a key named |label| is available, which allows to
4728 enable or to disable the rule with the following two commands. Like
4729 prehyphenation transforms in \luatex{}, interchars are not applied if the
4730 current hyphenation rules are |nohyphenation|.
4731
4732 \Describe{\enablelocaleinterchar}{\marg{label}}
4733 \DescribeOther{\disablelocaleinterchar}{\marg{label}}
4734
4735 Enable or disable the interchar rules with the given label for the
4736 current language.
4737
4738 \begin{example}
4739 Not very useful, but illustrative (taken from the unfortunately
4740 obsolete \textsf{interchar} package, by Zou Ho), to colorize the
4741 letters ‘x’ and ‘y’ (this way to group text is usually not a
4742 good idea, however).
4743 \begin{verbatim}
4744 \usepackage{color}
4745 \babelcharclass{english}{colored}{xy}
4746 \babelinterchar{english}{default, boundary}{colored}{\bgroup\color{red}}
4747 \babelinterchar{english}{colored}{default, boundary}{\egroup}
4748 \end{verbatim}
4749 A more realistic example follows, which inserts a thin space
4750 between a digit and a percent sign. Note the former is entered as a
4751 range, and the latter in command form:
4752 \begin{verbatim}
4753 \babelcharclass{english}{digit}{0-9}
4754 \babelcharclass{english}{percent}{\%}
4755 \babelinterchar[label=percent]{english}{digit}{percent}{\,}
4756 \end{verbatim}
4757 \end{example}
4758
4759 \begin{warning}
4760 Keep in mind two points: (1) a character can be assigned a single
4761 class; this is a limitation in the interchar mechanisms that often
4762 leads to incompatibilities; (2) since the character classes set with
4763 |\babelcharclass| are saved (so that they can be restored), there is a
4764 limit in the number of characters in the \marg{char-list} (which,
4765 however, must be large enough for many uses).
4766 \end{warning}
4767
4768 \Describe{interchar=}{\meta{interchar-list}}
4769
4770 \New{24.1} This key in |\babelprovide| activates predefined rules for
4771 the ‘provided’ locale. Currently the following |interchar|’s are defined:
4772
4773 \begingroup
4774 \def\trans#1#2#3{%
4775 \vspace{1.5mm}%
4776 \parbox[t]{2.2cm}{\raggedright\strut#1}%
4777 \hspace{2mm}%
4778 \parbox[t]{4.0cm}{\strut\ttfamily#2}%
4779 \hspace{2mm}%
4780 \parbox[t]{6.6cm}{\strut#3}\par}
4781 \bigskip\hrule\nobreak\vspace{.5mm}\parindent0pt
4782
4783 \trans{Cantonese, Chinese, Japanese,
4784 Korean}{linebreak.basic}{\New{24.4} Basic settings for CJK
4785 defined in (plain) \xetex. See the linked news page for details.}
4786
4787 \trans{French}{punctuation.space}{Rules for proper spacing with
4788 characters \textit{;:!?«»} are applied.}
4789
4790 \vspace{2mm}\hrule\nobreak
4791 \endgroup
4792
4793 \begin{warning}
4794 This feature requires |import|.
4795 \end{warning}
4796
4797 \begin{note}
4798 You can use |transforms| and |interchar| at the same time. Only the
4799 relevant key for the current engine is taken into account.
4800 \end{note}
4801
4802 \subsection{Scripts}
4803
4804 \Babel{} provides no standard interface to select scripts, because they
4805 are best selected with languages tied to them. In \pdftex, scripts are
4806 indirectly managed by means of the low-level |\fontencoding|, whose
4807 direct use is discouraged — even the Latin script may require different
4808 encodings (i.e., sets of glyphs) depending on the language, and
4809 therefore such a switch would be in a sense incomplete. Note the
4810 so-called Unicode fonts (in \luatex\ and \xetex) do not improve the
4811 situation either. So, a font suited for Vietnamese is not necessarily
4812 suited for, say, the romanization of Indic languages, and the fact it
4813 contains glyphs for Modern Greek does not mean it includes them for
4814 Classic Greek.
4815
4816 \begin{note}
4817 Some languages sharing the same script define macros to switch it
4818 (e.g., |\textcyrillic|), but be aware they may also set the language
4819 to a certain default. Even the \babel{} core defined |\textlatin|,
4820 but it was somewhat buggy because in some cases it messed up
4821 encodings and fonts (for example, if the main Latin encoding was
4822 |LY1|), and therefore it has been deprecated (but still defined for
4823 backwards compatibility).
4824 \end{note}
4825
4826 The locales currently available cover the following scripts:
4827 \begin{multicols}{4}
4828 \parindent-.5em
4829 \leftskip.5em
4830 Arabic\\
4831 Armenian\\
4832 Bangla\\
4833 Bengali\\
4834 Cherokee\\
4835 Coptic\\
4836 Cyrillic\\
4837 Devanagari\\
4838 Egyptian hieroglyphs\\
4839 Ethiopic\\
4840 Georgian\\
4841 Glagolitic\\
4842 Gothic\\
4843 Greek\\
4844 Gujarati\\
4845 Gurmukhi\\
4846 Han\\
4847 Hebrew\\
4848 Japanese\\
4849 Kannada\\
4850 Khmer\\
4851 Khojki\\
4852 Khudawadi\\
4853 Korean\\
4854 Lao\\
4855 Latin\\
4856 Malayalam\\
4857 Myanmar\\
4858 Nyiakeng Puachue Hmong\\
4859 N’Ko\\
4860 Ol Chiki\\
4861 Old Church Slavonic Cyrillic\\
4862 Oriya\\
4863 Phoenician\\
4864 Runic\\
4865 Simplified\\
4866 Sinhala\\
4867 Sumero-Akkadian Cuneiform\\
4868 Tamil\\
4869 Telugu\\
4870 Thaana\\
4871 Thai\\
4872 Tibetan\\
4873 Tifinagh\\
4874 Traditional\\
4875 Unified Canadian Aboriginal Syllabics\\
4876 Vai\\
4877 Yi
4878 \end{multicols}
4879
4880 \Describe{\ensureascii}{\marg{text}}
4881
4882 \New{3.9i} This macro makes sure \m{text} is typeset with a
4883 LICR-savvy encoding in the ASCII range. It is used to redefine |\TeX|
4884 and |\LaTeX| so that they are correctly typeset even with |LGR| or
4885 |X2| (the complete list is stored in |\BabelNonASCII|, which by default
4886 is |LGR|, |LGI|, |X2|, |OT2|, |OT3|, |OT6|, |LHE|, |LWN|, |LMA|, |LMC|,
4887 |LMS|, |LMU|, but you can modify it). So, in some sense it fixes the
4888 bug described in the previous paragraph.
4889
4890 If non-ASCII encodings are not loaded (or no encoding at all), it is
4891 no-op (also |\TeX| and |\LaTeX| are not redefined); otherwise,
4892 |\ensureascii| switches to the encoding at the beginning of the
4893 document if ASCII-savvy, or else the last ASCII-savvy encoding
4894 loaded. For example, if you load |LY1,LGR|, then it is set to |LY1|,
4895 but if you load |LY1,T2A| it is set to |T2A|. The symbol encodings
4896 |TS1|, |T3|, and |TS3| are not taken into account, since they are not
4897 used for “ordinary” text (they are stored in |\BabelNonText|, used
4898 in some special cases when no Latin encoding is explicitly set).
4899
4900 The foregoing rules (which are applied “at begin document”) cover
4901 most of the cases. No assumption is made on characters above
4902 127, which may not follow the LICR conventions -- the goal is just
4903 to ensure most of the ASCII letters and symbols are the right ones.
4904
4905 \subsection{Bidirectional and right-to-left text}
4906 \label{bidi}
4907
4908 No macros to select the writing direction are provided, either --
4909 writing direction is intrinsic to each script and therefore it is best
4910 set by the language (which can be a dummy one). Furthermore, there
4911 are in fact two right-to-left modes, depending on the language, which
4912 differ in the way `weak' numeric characters are ordered (e.g., Arabic
4913 \%123 \textit{vs} Hebrew 123\%).
4914
4915 \begin{warning}
4916 The current code for \textbf{text} in \luatex{} should be considered
4917 essentially stable, but, of course, it is not bug-free and there can
4918 be improvements in the future, because setting bidi text has many
4919 subtleties (see for example <https://www.w3.org/TR/html-bidi/>). A
4920 basic stable version for other engines must wait. This applies to
4921 text; there is a basic support for \textbf{graphical} elements,
4922 including the |picture| environment (with \textsf{pict2e}) and
4923 \textsf{pfg/tikz}. Also, indexes and the like are under study, as
4924 well as math (there are progresses in the latter, including
4925 \textsf{amsmath} and \textsf{mathtools} too, but for example
4926 |gathered| may fail).
4927
4928 An effort is being made to avoid incompatibilities in the future
4929 (this one of the reasons currently bidi must be explicitly requested
4930 as a package option, with a certain bidi model, and also the |layout|
4931 options described below).
4932 \end{warning}
4933
4934 \begin{warning}
4935 If characters to be mirrored are shown without changes with \luatex,
4936 try with the following line:
4937 \begin{verbatim}
4938 \babeladjust{bidi.mirroring=off}
4939 \end{verbatim}
4940 \end{warning}
4941
4942 There are some package options controlling bidi writing.
4943
4944 \Describe{bidi=}{\texttt{default} $\string|$ \texttt{basic}
4945 $\string|$ \texttt{basic-r} $\string|$ \texttt{bidi-l} $\string|$
4946 \texttt{bidi-r}}
4947
4948 \New{3.14} Selects the bidi algorithm to be used.
4949
4950 With |default| the bidi mechanism is just activated (by default it is
4951 not), but every change must be marked up. In \pdftex{} this is the only
4952 option. If the RL text consists of only letters and punctuation, it
4953 will be fine in most cases, but numbers, for example, will be rendered
4954 in the wrong order.
4955
4956 In \luatex, the preferred method is |basic|, which supports both L and
4957 R text. |basic-r| was a first attempt to create a bidi algorithm and
4958 provides a simple and fast method for R text in some typical cases.
4959 (They are named \texttt{basic} mainly because they consider only the
4960 intrinsic direction of scripts and weak directionality.)
4961
4962 In \xetex, |bidi-r| and |bidi-l| resort to the package \textsf{bidi}
4963 (by Vafa Khalighi). For RL documents use the former, and for LR ones
4964 use the latter.
4965
4966 \begin{warning}
4967 The package \textsf{bidi} patches heavily lots of macros and packages
4968 even if the RL script is not the main one, which can lead to some
4969 surprising results, so for short and simple texts (letters and
4970 punctuation) the |default| method is more often than not much
4971 preferable.
4972
4973 As of January 2026 the actual maintenance status of this package is
4974 unclear, so it’s advisable to move to \luatex, whose bidi algorithm
4975 is an integral part of \babel, and therefore doesn’t rely on external
4976 packages.
4977 \end{warning}
4978
4979 There are samples on GitHub, under \texttt{/required/babel/samples}.
4980 See particularly |lua-bidibasic.tex| and |lua-secenum.tex|.
4981
4982 \begin{example}
4983 The following text comes from the Arabic Wikipedia (article about
4984 Arabia). Copy-pasting some text from the Wikipedia is a good way to
4985 test this feature. Remember |basic| is available in \luatex{}
4986 only.
4987 \begingroup
4988 % If you are looking at the code to see how it has been written, you
4989 % will be disappointed :-). The following example is built ad hoc to
4990 % emulate the final result to avoid dependencies, and therefore it's
4991 % not "real" code.
4992 \setmonofont[Scale=.86, FakeStretch=.97,Script=Arabic]{DejaVu Sans Mono}
4993 \catcode`@=13
4994 \def@#1{\ifcase#1\relax \egroup \or \bgroup\textdir TLT \else
4995 \bgroup\textdir TRT \pardir TRT \fi}
4996 \setengine{luatex}
4997 \begin{verbatim}
4998 \documentclass[arabic]{article}
4999
5000 \usepackage[_bidi=basic_]{babel}
5001
5002 \babelfont{rm}{FreeSerif}
5003
5004 \begin{document}
5005
5006 @9وقد عرفت شبه جزيرة العرب طيلة العصر الهيليني )الاغريقي( بـ
5007 @1Arabia@0 أو @1Aravia@0 )بالاغريقية @1Αραβία@0(، استخدم الرومان ثلاث
5008 بادئات بـ@1“Arabia”@0 على ثلاث مناطق من شبه الجزيرة العربية، إلا أنها
5009 حقيقةً كانت أكبر مما تعرف عليه اليوم.
5010
5011 @0\end{document}
5012 \end{verbatim}
5013 \endgroup
5014 \end{example}
5015
5016 \begin{example}
5017 With |bidi=basic| \textit{both} L and R text can be
5018 mixed without explicit markup (the latter will be necessary only in
5019 some special cases where the Unicode algorithm fails). It is used much
5020 like |bidi=basic-r|, but with R text inside L text you may want to map
5021 the font so that the correct features are in force. This is accomplished
5022 with an option in |\babelprovide|, as illustrated:
5023 \begingroup
5024 % If you are looking at the code to see how it has been written, you
5025 % will be disappointed :-). The following example is built ad hoc to
5026 % emulate the final result to avoid dependencies, and therefore it's
5027 % not "real" code.
5028 \setmonofont[Scale=.86, FakeStretch=.97,Script=Arabic]{DejaVu Sans Mono}
5029 \catcode`@=13
5030 \def@#1{\ifcase#1\relax \egroup \or \bgroup\textdir TRT \else
5031 \bgroup\textdir TLT \pardir TLT \fi}
5032 \begin{verbatim}
5033 \documentclass{book}
5034
5035 \usepackage[english, _bidi=basic_]{babel}
5036
5037 \babelprovide[_onchar=ids fonts_]{arabic}
5038
5039 \babelfont{rm}{Crimson}
5040 \babelfont[*arabic]{rm}{FreeSerif}
5041
5042 \begin{document}
5043
5044 Most Arabic speakers consider the two varieties to be two registers
5045 of one language, although the two registers can be referred to in
5046 Arabic as @1فصحى العصر@0 \textit{fuṣḥā l-ʻaṣr} (MSA) and
5047 @1فصحى التراث@0 \textit{fuṣḥā t-turāth} (CA).
5048
5049 \end{document}
5050 \end{verbatim}
5051 \endgroup
5052 In this example, and thanks to |onchar=ids fonts|, any Arabic letter
5053 (because the language is |arabic|) changes its font to that set for
5054 this language (here defined via |*arabic|, because Crimson does not
5055 provide Arabic letters).
5056 \end{example}
5057
5058 \begin{note}
5059 Boxes are “black boxes”. Numbers inside an |\hbox| (for example
5060 in a |\ref|) do not know anything about the surrounding chars. So,
5061 |\ref{A}-\ref{B}| are not rendered in the visual order A-B, but in the
5062 wrong one B-A (because the hyphen does not “see” the digits inside the
5063 |\hbox|’es). If you need |\ref| ranges, the best option is to define
5064 a dedicated macro like this (to avoid explicit direction changes in the
5065 body; here |\texthe| must be defined to select the main language):
5066 \begin{verbatim}
5067 \newcommand\refrange[2]{\babelsublr{\texthe{\ref{#1}}-\texthe{\ref{#2}}}}
5068 \end{verbatim}
5069
5070 In the future a more complete method, reading recursively boxed text,
5071 may be added.
5072 \end{note}
5073
5074 \Describe{layout=}{\texttt{sectioning} $\string|$
5075 \texttt{counters} $\string|$
5076 \texttt{lists} $\string|$
5077 \texttt{contents} $\string|$
5078 \texttt{footnotes} $\string|$
5079 \texttt{captions} $\string|$}
5080 \DescribeOther{ }{\phantom{layout=}\texttt{columns} $\string|$
5081 \texttt{graphics} $\string|$
5082 \texttt{extras} $\string|$
5083 \texttt{pars} $\string|$
5084 \texttt{nopars}}
5085
5086 \New{3.16} \textit{To be expanded}. Selects which layout elements are
5087 adapted in bidi documents, including some text elements (except with
5088 options loading the |bidi| package, which provides its own mechanism to
5089 control these elements). You may use several options with a
5090 space-separated list, like |layout=counters contents sectioning| (in
5091 \New{3.85} spaces are to be preferred over dots, which was the former
5092 syntax). This list will be expanded in future releases. Note not all
5093 options are required by all engines.
5094
5095 \begin{description}
5096 \renewcommand\makelabel[1]{%
5097 \hspace\labelsep\normalfont\ttfamily\color{thered}#1}
5098 \itemsep=-\parskip
5099
5100 \item[sectioning] makes sure the sectioning macros are typeset in the
5101 main language, but with the title text in the current language (see
5102 below |\BabelPatchSection| for further details).
5103
5104 \item[counters] required in all engines to reorder section numbers and
5105 the like (e.g., \m{subsection}.\m{section}); required in \xetex{} and
5106 \pdftex{} for counters in general, as well as in \luatex{} with
5107 |bidi=default|; required in \luatex{} for numeric footnote marks $>$9
5108 with |bidi=basic-r| (but \textit{not} with |bidi=basic|); note,
5109 however, it can depend on the counter format.
5110
5111 With |counters|, |\arabic| is not only considered L text always (with
5112 |\babelsublr|, see below), but also an “isolated” block which does
5113 not interact with the surrounding chars. So, while |1.2| in R text is
5114 rendered in that order with |bidi=basic| (as a decimal number), in
5115 |\arabic{c1}.\arabic{c2}| the visual order is \textit{c2.c1}. Of
5116 course, you may always adjust the order by changing the language, if
5117 necessary.
5118
5119 \New{3.84} Since |\thepage| is (indirectly) redefined, |makeindex|
5120 will reject many entries as invalid. With |counters*| \babel{}
5121 attempts to remove the conflicting macros.
5122
5123 \item[lists] required in \xetex{} and \pdftex{}, but only in
5124 bidirectional (with both R and L paragraphs) documents in \luatex{}.
5125
5126 \begin{warning}
5127 As of April 2019 there is a bug with |\parshape| in \luatex{} (a
5128 \TeX{} primitive) which makes lists to be horizontally misplaced if
5129 they are inside a |\vbox| (like |minipage|) and the current direction
5130 is different from the main one. A workaround is to restore the main
5131 language before the box and then set the local one inside.
5132 \end{warning}
5133
5134 \item[contents] required in \xetex{} and \pdftex{}; in \luatex{}
5135 toc entries are R by default if the main language is R.
5136
5137 \item[columns] required in \xetex{} and \pdftex{} to reverse the
5138 column order (currently only the standard two-column mode); in
5139 \luatex{} they are R by default if the main language is R (including
5140 \textsf{multicol}).
5141
5142 \item[footnotes] not required in monolingual documents, but it may be
5143 useful in bidirectional documents (with both R and L paragraphs) in
5144 all engines, as well as in multilingual documents in general; you may
5145 use alternatively |\BabelFootnote| described below (what this option
5146 does exactly is also explained there).
5147
5148 \item[captions] is similar to |sectioning|, but for |\caption|; not
5149 required in monolingual documents with \luatex{}, but may be
5150 required in \xetex{} and \pdftex{} in some styles (support for the
5151 latter two engines is still experimental) \New{3.18}.
5152
5153 \item[tabular] required in \luatex{} for R |tabular|, so that the first
5154 column is the right one (it has been tested only with simple tables,
5155 so expect some readjustments in the future); ignored in \pdftex{} or
5156 \xetex{} (which will not support a similar option in the short term).
5157 It patches an internal command, so it might be ignored by some
5158 packages and classes (or even raise an error). \New{3.18}.
5159
5160 \item[graphics] modifies the |picture| environment so that the whole
5161 figure is L but the text is R\@. It \textit{does not} work with the
5162 standard |picture|, and \textit{pict2e} is required. It attempts to do
5163 the same for \textsf{pgf/tikz}. Somewhat experimental. \New{3.32}.
5164
5165 \item[extras] is used for miscellaneous readjustments which do not fit into
5166 the previous groups. Currently redefines in \luatex{} |\underline| and
5167 |\LaTeX2e| \New{3.19}.
5168
5169 \item[pars, nopars] When \texttt{layout} is used with any options
5170 in bidi documents, there are a few changes in |\@hangfrom| and also
5171 (only \xetex, as it’s unnecesary in \luatex) in |\raggedright|
5172 and |\raggedleft|. Using |pars| applies these adjustments even without
5173 other options; conversely, |nopars| prevents these adjustments even
5174 when other options are specified \New{25.9}.
5175 \end{description}
5176
5177 \begin{example}
5178 Typically, in an Arabic document you would need:
5179 \setengine{luatex}
5180 \begin{verbatim}
5181 \usepackage[bidi=basic,
5182 layout=counters tabular]{babel}
5183 \end{verbatim}
5184 or
5185 \setengine{xetex}
5186 \begin{verbatim}
5187 \usepackage[bidi=bidi,
5188 layout=counters tabular]{babel}
5189 \end{verbatim}
5190 \end{example}
5191
5192 \Describe{\babelsublr}{\marg{lr-text}}
5193
5194 Digits in \pdftex{} must be marked up explicitly (unlike \luatex{} with
5195 |bidi=basic| or |bidi=basic-r| and, usually, \xetex{}). This command is
5196 provided to set \marg{lr-text} in L mode if necessary. It’s intended
5197 for what Unicode calls weak characters, because words are best set with
5198 the corresponding language. For this reason, there is no |rl|
5199 counterpart.
5200
5201 Any |\babelsublr| in \textit{explicit} L mode is ignored. However, with
5202 |bidi=basic| and \textit{implicit} L, it first returns to R and then
5203 switches to explicit L. To clarify this point, consider, in an R
5204 context:
5205 \begin{verbatim}
5206 RTL A ltr text \thechapter{} and still ltr RTL B
5207 \end{verbatim}
5208 There are \textit{three} R blocks and \textit{two} L blocks, and the
5209 order is \textit{RTL B and still ltr 1 ltr text RTL A}. This is by
5210 design to provide the proper behavior in the most usual cases — but if
5211 you need to use |\ref| in an L text inside R, the L text must be marked
5212 up explicitly; for example:
5213 \begin{verbatim}
5214 RTL A \foreignlanguage{english}{ltr text \thechapter{} and still ltr} RTL B
5215 \end{verbatim}
5216
5217 \Describe{\localerestoredirs}{}
5218
5219 \New{3.86} \textit{LuaTeX}. This command resets the internal text,
5220 paragraph and body directions to those of the current locale (if
5221 different). Sometimes changing these values directly can be useful for
5222 some hacks, and this command helps in restoring the directions to the
5223 correct ones. It can be used in |>| arguments of \textsf{array}, too.
5224
5225 \Describe{\BabelPatchSection}{\marg{section-name}}
5226
5227 Mainly for bidi text, but it can be useful in other cases.
5228 |\BabelPatchSection| and the corresponding option |layout=sectioning|
5229 takes a more logical approach (at least in many cases) because it
5230 applies the global language to the section format (including the
5231 |\chaptername| in |\chapter|), while the section text is still the
5232 current language. The latter is passed to tocs and marks, too,
5233 and with |sectioning| in |layout| they both reset the “global” language
5234 to the main one, while the text uses the “local” language.
5235
5236 With |layout=sectioning| all the standard sectioning commands are
5237 redefined (it also “isolates” the page number in heads, for a proper
5238 bidi behavior), but with this command you can set them individually if
5239 necessary (but note then tocs and marks are not touched).
5240
5241 \Describe{\BabelFootnote}{\marg{cmd}\marg{local-language}%
5242 \marg{before}\marg{after}}
5243
5244 \New{3.17} Something like:
5245 \begin{verbatim}
5246 \BabelFootnote{\parsfootnote}{\localename}{(}{)}
5247 \end{verbatim}
5248 defines |\parsfootnote| so that |\parsfootnote{note}| is equivalent to:
5249 \begin{verbatim}
5250 \footnote{(\foreignlanguage{\localename}{note})}
5251 \end{verbatim}
5252 but the footnote itself is typeset in the main language (to unify its
5253 direction as well as the footnote mark). In addition,
5254 |\parsfootnotetext| is defined. The option |footnotes| just does the
5255 following:
5256 \begin{verbatim}
5257 \BabelFootnote{\footnote}{\localename}{}{}%
5258 \BabelFootnote{\localfootnote}{\localename}{}{}%
5259 \BabelFootnote{\mainfootnote}{}{}{}
5260 \end{verbatim}
5261 (which also redefine |\footnotetext| and define |\localfootnotetext|
5262 and |\mainfootnotetext|). If the language argument is empty, then no
5263 language is selected inside the argument of the footnote. (\New{25.9}
5264 Formerly only available in bidi documents and Unicode engines, now it’s
5265 always available in all engines.)
5266
5267 \begin{example}
5268 If you want to preserve directionality in footnotes and there are
5269 many footnotes entirely in English, you can define:
5270 \begin{verbatim}
5271 \BabelFootnote{\enfootnote}{english}{}{.}
5272 \end{verbatim}
5273 It adds a period outside the English part, so that it is placed
5274 at the left in the last line. This means the dot at the end of the
5275 footnote text should be omitted.
5276 \end{example}
5277
5278 \subsection{Unicode character properties in \luatex}
5279
5280 \New{3.32} Part of the \babel{} job is to apply Unicode rules to some
5281 script-specific features based on some properties. Currently, they are
5282 3, namely, direction (i.e., bidi class), mirroring glyphs, and line
5283 breaking for CJK scripts. These properties are stored in \textsf{lua}
5284 tables, which you can modify with the following macro (for example,
5285 to set them for glyphs in the PUA).
5286
5287 \Describe{\babelcharproperty}{\marg{char-code}\oarg{to-char-code}%
5288 \marg{property}\marg{value}}
5289
5290 \New{3.32} Here, \marg{char-code} is a number (with \TeX{} syntax).
5291 With the optional argument, you can set a range of values. There are
5292 three properties (with a short name, taken from Unicode): |direction|
5293 (|bc|), |mirror| (|bmg|), |linebreak| (|lb|). The settings are global,
5294 and this command is allowed only in vertical mode (the preamble or
5295 between paragraphs).
5296
5297 For example:
5298 \begin{verbatim}
5299 \babelcharproperty{`¿}{mirror}{`?}
5300 \babelcharproperty{`-}{direction}{l} % or al, r, en, an, on, et, cs
5301 \babelcharproperty{`)}{linebreak}{cl} % or id, op, cl, ns, ex, in, hy
5302 \end{verbatim}
5303
5304 Please, refer to the Unicode standard (Annex \#9 and Annex \#14) for
5305 the meaning of the available codes. For example, |en| is ‘European
5306 number’ and |id| is ‘ideographic’.
5307
5308 \New{3.39} Another property is |locale|, which adds characters to the
5309 list used by |onchar| in |\babelprovide|, or, if the last argument is
5310 empty, removes them. The last argument is the locale name:
5311 \begin{verbatim}
5312 \babelcharproperty{`,}{locale}{english}
5313 \end{verbatim}
5314
5315 \subsection{Tweaking some \babel{} features}
5316
5317 \Describe{\babeladjust}{\marg{key-value-list}}
5318
5319 \New{3.36} Sometimes you might need to disable some \babel{} features.
5320 Currently this macro understands the following keys, with values |on|
5321 or |off|:
5322 \begin{multicols}{3}
5323 \ttfamily
5324 autoload.bcp47\\
5325 bcp47.toname\\
5326 bidi.mirroring\\
5327 bidi.text\\
5328 bidi.math\\%
5329 % bidi.mapdigits\\
5330 linebreak.sea\\
5331 linebreak.cjk\\
5332 justify.arabic\\
5333 layout.tabular\\
5334 layout.lists
5335 \end{multicols}
5336 The first four are documented elsewhere. The following are by default
5337 |on|, but with |off| can disable some features: |bidi.math| (only
5338 preamble) changes for math or \textsf{amsmath}, |linebreak.sea|,
5339 |linebreak.cjk| and |justify.arabic| the corresponding algorithms,
5340 |layout.tabular| and |layout.lists| changes for tabular and lists.
5341 Some of them are reverted only to some extent.
5342
5343 Other keys are:
5344 \begin{multicols}{3}
5345 \ttfamily
5346 autoload.options\\
5347 autoload.bcp47.prefix\\
5348 autoload.bcp47.options\\
5349 prehyphenation.disable\\
5350 interchar.disable\\
5351 select.write\\
5352 select.encoding\\
5353 \end{multicols}
5354 Most of them are documented elsewhere. With |select.encoding=off|, the
5355 encoding is not set when loading a language on the fly with \pdftex{}
5356 (only |off|). |prehyphenation.disable| is by default |nohyphenation|,
5357 which means \luatex{} prehyphenation transforms are not applied if the current
5358 hyphenation rules are |nohyphenation|; with |off| they are never
5359 disabled. |interchar.disable| takes the same values, but for the
5360 \xetex{} interchar mechanism.
5361
5362 For example, you can set |\babeladjust{bidi.text=off}| if you are using
5363 an alternative algorithm or with large sections not requiring it. Use
5364 with care, because these options do not deactivate other related
5365 options (like paragraph direction with |bidi.text|).
5366
5367 \section{Relation with other packages}
5368
5369 \subsection{Compatibility}
5370
5371 There are compatibility issues with the following packages.
5372
5373 \begingroup
5374 \parindent0pt
5375 \def\trans#1#2{%
5376 \vspace{1.5mm}%
5377 \parbox[t]{3.0cm}{\strut\sffamily#1}%
5378 \hspace{2mm}%
5379 \parbox[t]{10cm}{\strut#2}\par}
5380 \bigskip\hrule\nobreak\vspace{.5mm}
5381
5382 \trans{polyglossia}{This package is not compatible at all with \babel.
5383 They should never be used together, because macros are different, and
5384 even those with the same name don’t behave in the same way. Also,
5385 languages are organized quite differently (\babel{} treats all locales
5386 on an equal footing).}
5387
5388 \trans{tikz/pgf}{There are some issues with shorthands, which are
5389 usually solved with \texttt{\string\usetikzlibrary\{babel\}}.}
5390
5391 \trans{cleveref}{Because of a long standing bug in this package, some
5392 languages can raise an error (particularly |spanish| and |greek|).}
5393
5394 \trans{natbib}{Load it before \babel.}
5395
5396 \trans{bidi}{\Babel\ relies on \textsc{bidi} with \xetex{} and
5397 |bidi=bidi|, which has a multitude of incompatibilities. Please, refer
5398 to its manual, and remember for short and simple texts you can rely on
5399 |bidi=default| instead.}
5400
5401 \vspace{2mm}\hrule\nobreak\bigskip
5402 \endgroup
5403
5404 \subsection{Related packages}
5405
5406 The following packages can be useful in multilingual contexts (the list
5407 is far from exhaustive):
5408 \begin{description}
5409 \itemsep=-\parskip
5410 \item[\sffamily babelbib] Multilingual bibliographies.
5411 \item[\sffamily biblatex] Programmable bibliographies and citations.
5412 \item[\sffamily bicaption] Bilingual captions.
5413 \item[\sffamily csquotes] Logical markup for quotes.
5414 \item[\sffamily hyphsubst] Selects a different set of patterns for a language.
5415 \item[\sffamily iflang] Tests correctly the current language.
5416 \item[\sffamily microtype] Adjusts the typesetting according to
5417 some languages (kerning and spacing). Ligatures can be disabled.
5418 Search in its manual for |babel| and |DeclareMicrotypeBabelHook|.
5419 \item[\sffamily mkpattern] Generates hyphenation patterns.
5420 \item[\sffamily siunitx] Typesetting of numbers and physical quantities.
5421 \item[\sffamily substitutefont] Combines fonts in several encodings.
5422 \item[\sffamily tracklang] Tracks which languages have been requested.
5423 \item[\sffamily translator] An open platform for packages that need to be
5424 localized.
5425 \item[\sffamily ucharclasses] (\xetex) Switches fonts when you switch from one
5426 Unicode block to another. Note it doesn’t work with RTL scripts.
5427 \item[\sffamily zhspacing] Spacing for CJK documents in \xetex.
5428 \end{description}
5429
5430 \subsection{Indexing}
5431
5432 For multilingual indexing, see \textsf{upmendex} and \textsf{xindex},
5433 currently preferred to \textsf{xindy}.
5434
5435 \section{Tentative and experimental code}
5436
5437 See the code section for |\foreignlanguage*| (a new starred
5438 version of |\foreignlanguage|).
5439
5440 For old and deprecated functions, see the \babel{} site.
5441
5442 \medskip
5443 \textbf{Options for locales loaded on the fly}
5444
5445 \New{3.51} |\babeladjust{ autoload.options = ... }| sets the options
5446 when a language is loaded on the fly. \New{24.14} By default, it is
5447 |import|, which defines captions, date, numerals, etc., but ignores the
5448 code in the |tex| file (for example, extended numerals in Greek). It
5449 can be set to empty.
5450
5451 \medskip
5452 \textbf{Labels}
5453
5454 \New{3.48} There is some work in progress for \babel{} to deal with
5455 labels, both with the relation to captions (chapters, part), and how
5456 counters are used to define them. It is still somewhat tentative
5457 because it is far from trivial -- see the \babel{} site for further
5458 details.
5459
5460 \section{Loading language hyphenation rules with \file{language.dat}}
5461
5462 \TeX{} and most engines based on it (pdf\TeX, \xetex, $\varepsilon$-\TeX,
5463 the main exception being \luatex) require hyphenation patterns to be
5464 preloaded when a format is created (e.g., \LaTeX, Xe\LaTeX, pdf\LaTeX).
5465 \babel{} provides a tool which has become standard in many
5466 distributions and based on a “configuration file” named
5467 \file{language.dat}. The exact way this file is used depends on the
5468 distribution, so please, read the documentation for the latter (note
5469 also some distributions generate the file with some tool).
5470
5471 \New{3.9q} With \luatex, however, patterns are loaded on the fly when
5472 requested by the language (except the “0th” language, typically
5473 \textsf{english}, which is preloaded always). You may want to have a
5474 local |language.dat| for a particular project (for example, a book on
5475 Chemistry). The loader for lua(e)tex is slightly different as it’s not
5476 based on \babel{}, but on \texttt{etex.src}; however, \babel{} reloads
5477 the data so that it works as expected.
5478
5479 \subsection{Format}
5480
5481 In that file the person who maintains a \TeX\ environment has to record
5482 for which languages he has hyphenation patterns \emph{and} in which
5483 files these are stored (this was because different operating systems
5484 sometimes used \emph{very} different file-naming conventions, but this
5485 issue is not currently so serious as before). When hyphenation
5486 exceptions are stored in a separate file this can be indicated by
5487 naming that file \emph{after} the file with the hyphenation patterns.
5488
5489 The file can contain empty lines and comments, as well as lines which
5490 start with an equals (\texttt{=}) sign. Such a line will instruct
5491 \LaTeX\ that the hyphenation patterns just processed have to be known
5492 under an alternative name. Here is an example:
5493 \begin{verbatim}
5494 % File : language.dat
5495 % Purpose : tell iniTeX what files with patterns to load.
5496 english english.hyphenations
5497 =british
5498
5499 dutch hyphen.dutch exceptions.dutch % Nederlands
5500 german hyphen.ger
5501 \end{verbatim}
5502
5503 You may also set the font encoding that the patterns are intended for by
5504 following the language name by a colon and the encoding code. For
5505 example:
5506 \begin{verbatim}
5507 german:T1 hyphenT1.ger
5508 german hyphen.ger
5509 \end{verbatim}
5510 With the previous settings, if the encoding when the language is
5511 selected is |T1| then the patterns in \file{hyphenT1.ger} are
5512 used, but otherwise use those in \file{hyphen.ger} (note the encoding
5513 can be set in |\extras<language>|).
5514
5515 \section{The interface between the core of \babel{} and the language
5516 definition files}
5517
5518 The \textit{language definition files} (ldf) must conform to a
5519 number of conventions, because these files have to fill in the gaps
5520 left by the common code in \file{babel.def}, i.e., the
5521 definitions of the macros that produce texts. Also the
5522 language-switching possibility which has been built into the
5523 \babel{} system has its implications.
5524
5525 The following assumptions are made:
5526 \begin{itemize}
5527 \item Some of the language-specific definitions might be used by plain
5528 \TeX\ users, so the files have to be coded so that they can be read
5529 by both \LaTeX\ and plain \TeX. The current format can be checked by
5530 looking at the value of the macro |\fmtname|.
5531 \item The common part of the \babel{} system redefines a number of
5532 macros and environments (defined previously in the document style)
5533 to put in the names of macros that replace the previously hard-wired
5534 texts. These macros have to be defined in the language definition
5535 files.
5536 \item The language definition files must define five macros, used to
5537 activate and deactivate the language-specific definitions. These
5538 macros are |\|\langvar|hyphenmins|, |\captions|\langvar,
5539 |\date|\langvar, |\extras|\langvar\ and |\noextras|\langvar (the
5540 last two may be left empty); where \langvar\ is either the name of
5541 the language definition file or the name of the \LaTeX\ option that
5542 is to be used. These macros and their functions are discussed
5543 below. You must define all or none for a language;
5544 defining, say, |\date|\langvar\ but not |\captions|\langvar\ does
5545 not raise an error but can lead to unexpected results.
5546 \item When a language definition file is loaded, it can define
5547 |\l@|\langvar\ to be a dialect of |\language0| when |\l@|\langvar\
5548 is undefined.
5549 \item Language names must be all lowercase. If an unknown language is
5550 selected, \babel{} will attempt setting it after lowercasing its
5551 name.
5552 \item The semantics of modifiers is not defined (on purpose). In most
5553 cases, they will just be simple separated options (e.g.,
5554 \texttt{spanish}), but a language might require, say, a set of
5555 options organized as a tree with suboptions (in such a case, the
5556 recommended separator is \verb|/|). How modifiers (saved in
5557 |\BabelModifiers|) are handled are left to language styles; they can
5558 use |\in@|, loop them with |\@for| or load |keyval|, for example.
5559 \end{itemize}
5560
5561 Some recommendations:
5562 \begin{itemize}
5563 \item The preferred shorthand is |"|, which is not used in \LaTeX{}
5564 (quotes are entered as |``| and |''|). Other good choices are
5565 characters which are not used in a certain context (e.g., |=| in an
5566 ancient language). Note however |=|, \texttt{<}, |>|, |:| and the like
5567 can be dangerous, because they may be used as part of the syntax
5568 of some elements (numeric expressions, key/value pairs, etc.).
5569 \item Captions should not contain shorthands or encoding-dependent
5570 commands (the latter is not always possible, but should be clearly
5571 documented). They should be defined using the LICR\@. You may
5572 also use the new tools for encoded strings, described below.
5573 \item Avoid adding things to |\noextras<language>| except for umlauthigh
5574 and friends, |\bbl@deactivate|, |\bbl@(non)frenchspacing|, and
5575 language-specific macros. Use always, wherever possible, |\babel@save| and
5576 |\babel@savevariable| (except if you still want to have access to the
5577 previous value). Do not reset a macro or a setting to a hardcoded
5578 value. Never. Instead save its value in |\extras<language>|.
5579 \item Do not switch scripts. If you want to make sure a set of glyphs
5580 is used, switch either the font encoding (low-level) or the language
5581 (high-level, which in turn may switch the font encoding). Usage of things
5582 like |\latintext| is deprecated (but not removed, for backward
5583 compatibility).
5584 \item Please, for “private” internal macros do not use the |\bbl@|
5585 prefix. It is used by \babel{} and it can lead to incompatibilities.
5586 \end{itemize}
5587
5588 There are no special requirements for documenting your language files.
5589 Just provide a standalone document suited to your needs, as well as
5590 other files you think can be useful. A PDF and a “readme” are
5591 strongly recommended.
5592
5593 \subsection{Guidelines for contributed languages}
5594 \label{contribute}
5595
5596 Currently, the easiest way to contribute a new language is by taking
5597 one of the 500 or so |ini| templates available on GitHub as a basis.
5598 Just make a pull request or download it, and then, after filling out the
5599 fields, sent it to me. Feel free to ask for help or to make feature
5600 requests.
5601
5602 As to \texttt{ldf} files, now language files are “outsourced” and are
5603 located in a separate directory
5604 (\texttt{/macros/latex/contrib/babel-contrib}), so that they are
5605 contributed directly to CTAN (please, do not send to me language styles
5606 just to upload them to CTAN).
5607
5608 Of course, placing your style files in this directory is not mandatory,
5609 but if you want to do it, here are a few guidelines.
5610
5611 \begin{itemize}
5612 \item Do not hesitate stating on the file heads you are the author and the
5613 maintainer, if you actually are. There is no need to state the \babel{}
5614 maintainer(s) as author(s) if they have not contributed significantly
5615 to your language files.
5616 \item Fonts are not strictly part of a language, so they are best placed
5617 in the corresponding TeX tree. This includes not only \texttt{tfm},
5618 \texttt{vf}, \texttt{ps1}, \texttt{otf}, \texttt{mf} files and the
5619 like, but also \texttt{fd} ones.
5620 \item Font and input encodings are usually best placed in the
5621 corresponding tree, too, but sometimes they belong more naturally to
5622 the \babel{} style. Note you may also need to define a LICR
5623 (\textit{TLC3}, I, 757f.).
5624 \item \Babel{} \texttt{ldf} files may just interface a framework, as it
5625 happens often with Oriental languages/scripts. This framework is best
5626 placed in its own directory.
5627 \end{itemize}
5628
5629 The following page provides a starting point for \texttt{ldf} files:
5630 \texttt{http://www.texnia.com/incubator.html}. See also
5631 \texttt{https://latex3.github.io/babel/guides/list-of-locale-templates.html}.
5632
5633 If you need further assistance and technical advice in the development
5634 of language styles, I will be happy to help you. And of course, you can
5635 make any suggestion you like.
5636
5637 \subsection{Basic macros}
5638
5639 In the core of the \babel{} system, several macros are defined for use
5640 in language definition files. Their purpose is to make a new language
5641 known. The first two are related to hyphenation patterns.
5642
5643 \DescribeMacro{\addlanguage}
5644 The macro |\addlanguage| is a non-outer version of the macro
5645 |\newlanguage|, defined in \file{plain.tex} version~3.x. Here
5646 “language” is used in the \TeX{} sense of set of hyphenation
5647 patterns.
5648
5649 \DescribeMacro{\adddialect}
5650 The macro |\adddialect| can be used when two languages can (or must)
5651 use the same hyphenation patterns. This can also be useful for
5652 languages for which no patterns are preloaded in the format. In such
5653 cases the default behavior of the \babel{} system is to define this
5654 language as a ‘dialect’ of the language for which the patterns were
5655 loaded as |\language0|. Here “language” is used in the \TeX{} sense
5656 of set of hyphenation patterns, while “dialect”, which is misnomer,
5657 refers just to a language with the same hyphenation patterns as another
5658 (there is no relation with its linguistic meaning).
5659
5660 \DescribeMacro{\<lang>hyphenmins}
5661 The macro |\|\langvar|hyphenmins| is used to store the values of
5662 the |\lefthyphenmin| and |\righthyphenmin|. Redefine this macro
5663 to set your own values, with two numbers corresponding to these
5664 two parameters. For example:
5665 \begin{verbatim}
5666 \renewcommand\spanishhyphenmins{34}
5667 \end{verbatim}
5668 (Assigning |\lefthyphenmin| and |\righthyphenmin| directly in
5669 |\extras<language>| has no effect.) This is a low-level setting. In
5670 documents you should rely on |\babelhyphenmins|.
5671
5672 \DescribeMacro{\providehyphenmins}
5673 The macro |\providehyphenmins| should be used in the language
5674 definition files to set |\lefthyphenmin| and |\righthyphenmin|. This
5675 macro will check whether these parameters were provided by the
5676 hyphenation file before it takes any action. If these values have been
5677 already set, this command is ignored (currently, default pattern files
5678 do \textit{not} set them).
5679
5680 \DescribeMacro{\captions\langvar}
5681 The macro |\captions|\langvar\ defines the macros that
5682 hold the texts to replace the original hard-wired texts.
5683
5684 \DescribeMacro{\date\langvar}
5685 The macro |\date|\langvar\ defines |\today|.
5686
5687 \DescribeMacro{\extras\langvar}
5688 The macro |\extras|\langvar\ contains all the extra definitions needed
5689 for a specific language. This macro, like the following, is a hook --
5690 you can add things to it, but it must not be used directly.
5691
5692 \DescribeMacro{\noextras\langvar}
5693 Because we want to let the user switch
5694 between languages, but we do not know what state \TeX\ might be in
5695 after the execution of |\extras|\langvar, a macro that brings
5696 \TeX\ into a predefined state is needed. It will be no surprise
5697 that the name of this macro is |\noextras|\langvar.
5698
5699 \DescribeMacro{\bbl@declare@ttribute}
5700 This is a command to be used in the language definition files for
5701 declaring a language attribute. It takes three arguments: the
5702 name of the language, the attribute to be defined, and the code
5703 to be executed when the attribute is to be used.
5704
5705 \DescribeMacro{\main@language}
5706 To postpone the activation of the definitions needed for a
5707 language until the beginning of a document, all language
5708 definition files should use |\main@language| instead of
5709 |\selectlanguage|. This will just store the name of the language,
5710 and the proper language will be activated at the start of the
5711 document.
5712
5713 \DescribeMacro{\ProvidesLanguage}
5714 The macro |\ProvidesLanguage| should be used to identify the
5715 language definition files. Its syntax is similar to the syntax
5716 of the \LaTeX\ command |\ProvidesPackage|.
5717
5718 \DescribeMacro{\LdfInit}
5719 The macro |\LdfInit| performs a couple of standard checks that
5720 must be made at the beginning of a language definition file,
5721 such as checking the category code of the @-sign, preventing
5722 the \file{ldf} file from being processed twice, etc.
5723
5724 \DescribeMacro{\ldf@quit}
5725 The macro |\ldf@quit| does work needed if an \file{ldf} file was
5726 processed earlier. This includes resetting the category code of the
5727 @-sign, preparing the language to be activated at |\begin{document}|
5728 time, and ending the input stream.
5729
5730 \DescribeMacro{\ldf@finish}
5731 The macro |\ldf@finish| does work needed at the end of each \file{ldf}
5732 file. This includes resetting the category code of the @-sign, loading
5733 a local configuration file, and preparing the language to be activated
5734 at |\begin{document}| time.
5735
5736 \DescribeMacro{\loadlocalcfg}
5737 After processing a language definition file,
5738 \LaTeX\ can be instructed to load a local configuration
5739 file. This file can, for instance, be used to add strings to
5740 |\captions|\langvar\ to support local document
5741 classes. The user will be informed that this
5742 configuration file has been loaded. This macro is called by
5743 |\ldf@finish|.
5744
5745 \subsection{Skeleton}
5746
5747 Here is the basic structure of an |ldf| file, with a language, a
5748 dialect and an attribute. Strings are best defined using the method
5749 explained in sec. \ref{s:strings} (\babel{} 3.9 and later).
5750
5751 \begin{verbatim}
5752 \ProvidesLanguage{<language>}
5753 [2016/04/23 v0.0 <Language> support from the babel system]
5754 \LdfInit{<language>}{captions<language>}
5755
5756 \ifx\undefined\l@<language>
5757 \@nopatterns{<Language>}
5758 \adddialect\l@<language>0
5759 \fi
5760
5761 \adddialect\l@<dialect>\l@<language>
5762
5763 \bbl@declare@ttribute{<language>}{<attrib>}{%
5764 \expandafter\addto\expandafter\extras<language>
5765 \expandafter{\extras<attrib><language>}%
5766 \let\captions<language>\captions<attrib><language>}
5767
5768 \providehyphenmins{<language>}{\tw@\thr@@}
5769
5770 \StartBabelCommands*{<language>}{captions}
5771 \SetString\chaptername{<chapter name>}
5772 % More strings
5773
5774 \StartBabelCommands*{<language>}{date}
5775 \SetString\monthiname{<name of first month>}
5776 % More strings
5777
5778 \StartBabelCommands*{<dialect>}{captions}
5779 \SetString\chaptername{<chapter name>}
5780 % More strings
5781
5782 \StartBabelCommands*{<dialect>}{date}
5783 \SetString\monthiname{<name of first month>}
5784 % More strings
5785
5786 \EndBabelCommands
5787
5788 \addto\extras<language>{}
5789 \addto\noextras<language>{}
5790 \let\extras<dialect>\extras<language>
5791 \let\noextras<dialect>\noextras<language>
5792
5793 \ldf@finish{<language>}
5794 \end{verbatim}
5795
5796 \begin{note}
5797 If for some reason you want to load a package in your style, you
5798 should be aware it cannot be done directly in the \texttt{ldf} file,
5799 but it can be delayed with |\AtEndOfPackage|. Macros from external
5800 packages can be used \textit{inside} definitions in the \textsf{ldf}
5801 itself (for example, |\extras<language>|), but if executed directly,
5802 the code must be placed inside |\AtEndOfPackage|. A trivial example
5803 illustrating these points is:
5804 \begin{verbatim}
5805 \AtEndOfPackage{%
5806 \RequirePackage{dingbat}% Delay package
5807 \savebox{\myeye}{\eye}}% And direct usage
5808 \newsavebox{\myeye}
5809 \newcommand\myanchor{\anchor}% But OK inside command
5810 \end{verbatim}
5811 \end{note}
5812
5813 \subsection{Support for active characters}
5814
5815 In quite a number of language definition files, active characters are
5816 introduced. To facilitate this, some support macros are provided.
5817
5818 \DescribeMacro{\initiate@active@char}
5819 Used in language
5820 definition files to instruct \LaTeX\ to give a character the category
5821 code `active'. When a character has been made active it will remain
5822 that way until the end of the document. Its definition may vary.
5823
5824 \DescribeMacro{\bbl@activate}
5825 \DescribeMacro{\bbl@deactivate}
5826 Used to change the way an active
5827 character expands. |\bbl@activate| `switches on' the active behavior
5828 of the character. |\bbl@deactivate| lets the active character expand
5829 to its former (mostly) non-active self.
5830
5831 \DescribeMacro{\declare@shorthand}
5832 Used to define the various
5833 shorthands. It takes three arguments: the name for the collection of
5834 shorthands this definition belongs to; the character (sequence) that
5835 makes up the shorthand, i.e., |~| or |"a|; and the code to be executed
5836 when the shorthand is encountered. (It does \textit{not} raise an
5837 error if the shorthand character has not been “initiated”.)
5838
5839 \DescribeMacro{\bbl@add@special} The \TeX book states: “Plain \TeX\
5840 includes a macro called |\dospecials| that is essentially a set macro,
5841 representing the set of all characters that have a special category
5842 code.” \cite[p.~380]{DEK} It is used to set text `verbatim'. To make
5843 this work if more characters get a special category code, you have to
5844 add this character to the macro |\dospecials|. \LaTeX\ adds another
5845 macro called |\@sanitize| representing the same character set, but
5846 without the curly braces. The macros |\bbl@add@special|\meta{char} add
5847 the character \meta{char} to these two sets.
5848
5849 \DescribeMacro{\@safe@activestrue}
5850 \DescribeMacro{\@safe@activesfalse}
5851 Enables and disables the “safe” mode. It is a tool for package and class
5852 authors. See the description below.
5853
5854 \subsection{Support for saving macro definitions}
5855
5856 Language definition files may want to \emph{re}define macros that
5857 already exist. Therefore a mechanism for saving (and restoring) the
5858 original definition of those macros is provided. We provide two macros
5859 for this.\footnote{This mechanism was introduced by Bernd Raichle.}
5860
5861 \DescribeMacro{\babel@save}
5862 To save the current meaning of any control sequence, the macro
5863 |\babel@save| is provided. It takes one argument, \meta{csname}, the
5864 control sequence for which the meaning has to be saved.
5865
5866 \DescribeMacro{\babel@savevariable}
5867 A second macro is provided to save the current value of a variable.
5868 In this context, anything that is allowed after the |\the| primitive
5869 is considered to be a variable. The macro takes one argument, the
5870 \meta{variable}.
5871
5872 The effect of the preceding macros is to append a piece of code to
5873 the current definition of |\originalTeX|. When |\originalTeX| is
5874 expanded, this code restores the previous definition of the control
5875 sequence or the previous value of the variable.
5876
5877 \subsection{Support for extending macros}
5878
5879 \DescribeMacro{\addto}
5880 The macro |\addto{|\meta{control sequence}|}{|\meta{\TeX\ code}|}| can
5881 be used to extend the definition of a macro. The macro need not be
5882 defined (i.e., it can be undefined or |\relax|). This macro can, for
5883 instance, be used in adding instructions to a macro like
5884 |\extrasenglish|.
5885
5886 Be careful when using this macro, because depending on the case the
5887 assignment can be either global (usually) or local (sometimes). That
5888 does not seem very consistent, but this behavior is preserved for
5889 backward compatibility. If you are using \pkg{etoolbox}, by Philipp
5890 Lehman, consider using the tools provided by this package instead of
5891 |\addto|.
5892
5893 \subsection{Macros common to a number of languages}
5894
5895 \DescribeMacro{\bbl@allowhyphens}
5896 In several languages compound words are used. This means that when
5897 \TeX\ has to hyphenate such a compound word, it only does so at the
5898 `\texttt{-}' that is used in such words. To allow hyphenation in the
5899 rest of such a compound word, the macro |\bbl@allowhyphens| can be
5900 used.
5901
5902 \DescribeMacro{\allowhyphens}
5903 Same as |\bbl@allowhyphens|, but does nothing if the encoding is
5904 |T1|. It is intended mainly for characters provided as real glyphs by
5905 this encoding but constructed with |\accent| in |OT1|.
5906
5907 Note the previous command (|\bbl@allowhyphens|) has different
5908 applications (hyphens and discretionaries) than this one (composite
5909 chars). Note also prior to version 3.7, |\allowhyphens| had the
5910 behavior of |\bbl@allowhyphens|.
5911
5912 \DescribeMacro{\set@low@box}
5913 For some languages, quotes need to be lowered to the baseline. For
5914 this purpose the macro |\set@low@box| is available. It takes one
5915 argument and puts that argument in an |\hbox|, at the baseline. The
5916 result is available in |\box0| for further processing.
5917
5918 \DescribeMacro{\save@sf@q}
5919 Sometimes it is necessary to preserve the |\spacefactor|. For this
5920 purpose the macro |\save@sf@q| is available. It takes one argument,
5921 saves the current spacefactor, executes the argument, and restores the
5922 spacefactor.
5923
5924 \DescribeMacro{\bbl@frenchspacing}
5925 \DescribeMacro{\bbl@nonfrenchspacing}
5926 Those commands can be
5927 used to properly switch French spacing on and off.
5928
5929 \begin{note}
5930 With |ldf| files, \babel{} does not take into account |\normalsfcodes|
5931 and (non-)French spacing is not always properly (un)set by languages
5932 However, problems are unlikely to happen and therefore this part
5933 remains untouched. With |ini| files, this issue has been addressed.
5934 \end{note}
5935
5936 \subsection{Encoding-dependent strings}
5937 \label{s:strings}
5938
5939 \New{3.9a} Babel 3.9 provides a way of defining strings in several
5940 encodings, intended mainly for \luatex{} and \xetex, although the old
5941 way of defining/switching strings still works and it’s used by default.
5942
5943 It consists in a series of blocks started with
5944 |\StartBabelCommands|. The last block is closed with
5945 |\EndBabelCommands|. Each block is a single group (i.e., local
5946 declarations apply until the next |\StartBabelCommands| or
5947 |\EndBabelCommands|). An |ldf| may contain several series of this
5948 kind.
5949
5950 Thanks to this new feature, string values and string language switching
5951 are not mixed any more. Furthermore, strings do not need to be wrapped
5952 with formatting commands (e.g., to select the writing direction)
5953 because \babel{} takes care of it automatically. (See also
5954 |\setlocalecaption|.)
5955
5956 \Describe\StartBabelCommands
5957 {\marg{language-list}\marg{category}\oarg{selector}}
5958
5959 The \m{language-list} specifies which languages the block is
5960 intended for. A block is taken into account only if the
5961 |\CurrentOption| is listed here. Alternatively, you can define
5962 |\BabelLanguages| to a comma-separated list of languages to be
5963 defined (if undefined, |\StartBabelCommands| sets it to
5964 |\CurrentOption|). You may write |\CurrentOption| as the language,
5965 but this is discouraged -- an explicit name (or names) is much better
5966 and clearer.
5967
5968 A “selector” selects a group of definition that are to be used, optionally
5969 followed by extra info about the encodings to be used. The name
5970 |unicode| must be used for \luatex{} and \xetex{}. Without a selector,
5971 the LICR representation (i.e., with macros like |\~{n}| instead of |ñ|)
5972 is assumed.
5973
5974 If a string is set several times (because several blocks are read),
5975 the first one takes precedence (i.e., it works much like
5976 |\providecommand|).
5977
5978 Encoding info is |charset=| followed by a charset, which, if given, sets
5979 how the strings should be translated to the internal representation
5980 used by the engine, typically |utf8|, which is the only value
5981 supported currently (default is no translations). Note |charset| is
5982 applied by \luatex{} and \xetex{} when reading the file, not when the
5983 macro or string is used in the document.
5984
5985 A list of font encodings which the strings are expected to work with
5986 can be given after |fontenc=| (separated with spaces, if two or more) --
5987 recommended, but not mandatory, although blocks without this key are
5988 not taken into account if you have requested |strings=encoded|.
5989
5990 Blocks without a selector are read always. They provide fallback
5991 values, and therefore they must be the last ones; they should be
5992 provided always if possible and all strings should be defined somehow
5993 inside it; they can be the only blocks (mainly LGC scripts using the
5994 LICR).
5995
5996 The \m{category} is either |captions|, |date| or |extras|. You must
5997 stick to these three categories, even if no error is raised when using
5998 other names.\footnote{In future releases further categories may be
5999 added.\nb{like `monetary', `time', `address', `name', `case' or
6000 `numeric'}} It may be empty, too, but in such a case using
6001 |\SetString| is an error.
6002
6003 \begin{verbatim}
6004 \StartBabelCommands{language}{captions}
6005 [unicode, fontenc=TU EU1 EU2, charset=utf8]
6006 \SetString{\chaptername}{utf8-string}
6007
6008 \StartBabelCommands{language}{captions}
6009 \SetString{\chaptername}{ascii-maybe-LICR-string}
6010
6011 \EndBabelCommands
6012 \end{verbatim}
6013
6014 A real example can be:
6015 \begin{verbatim}
6016 \StartBabelCommands{austrian}{date}
6017 [unicode, fontenc=TU, charset=utf8]
6018 \SetString\monthiname{Jänner}
6019
6020 \StartBabelCommands{german,austrian}{date}
6021 [unicode, fontenc=TU, charset=utf8]
6022 \SetString\monthiiiname{März}
6023
6024 \StartBabelCommands{austrian}{date}
6025 \SetString\monthiname{J\"{a}nner}
6026
6027 \StartBabelCommands{german}{date}
6028 \SetString\monthiname{Januar}
6029
6030 \StartBabelCommands{german,austrian}{date}
6031 \SetString\monthiiname{Februar}
6032 \SetString\monthiiiname{M\"{a}rz}
6033 \SetString\monthivname{April}
6034 \SetString\monthvname{Mai}
6035 \SetString\monthviname{Juni}
6036 \SetString\monthviiname{Juli}
6037 \SetString\monthviiiname{August}
6038 \SetString\monthixname{September}
6039 \SetString\monthxname{Oktober}
6040 \SetString\monthxiname{November}
6041 \SetString\monthxiiname{Dezenber}
6042 \SetString\today{\number\day.~%
6043 \csname month\romannumeral\month name\endcsname\space
6044 \number\year}
6045
6046 \StartBabelCommands{german,austrian}{captions}
6047 \SetString\prefacename{Vorwort}
6048 [etc.]
6049
6050 \EndBabelCommands
6051 \end{verbatim}
6052
6053 When used in |ldf| files, previous values of |\<category><language>|
6054 are overridden, which means the old way to define strings still works
6055 and used by default (to be precise, is first set to undefined and then
6056 strings are added). However, when used in the preamble or in a
6057 package, new settings are added to the previous ones, if the language
6058 exists (in the \babel{} sense, i.e., if |\date<language>| exists).
6059
6060 \begin{note}
6061 The package option |strings| introduced in version 3.9 (around 2013)
6062 when Unicode engines were still of marginal use, is now deprecated.
6063 \end{note}
6064
6065 \begin{note}
6066 Captions and other strings defined in |ini| files (in other words,
6067 when a locale is loaded with |\babelprovide|) are internally set
6068 with the help of these macros.
6069 \end{note}
6070
6071 \Describe\StartBabelCommands{\optstar
6072 \marg{language-list}\marg{category}\oarg{selector}}
6073 The starred version just forces |strings| to take a value -- if not set
6074 as package option (which is now deprecated), then the default for the
6075 engine is used. This is not done by default to prevent backward
6076 incompatibilities, but if you are creating a new language this version
6077 is better. It’s up to the maintainers of the current languages to
6078 decide if using it is appropriate.
6079
6080 \Describe{\EndBabelCommands}{}
6081 Marks the end of the series of blocks.
6082
6083 \Describe{\AfterBabelCommands}{\marg{code}}
6084 The code is delayed and executed at the global scope just after
6085 |\EndBabelCommands|.
6086
6087 \Describe{\SetString}{\marg{macro-name}\marg{string}}
6088 Adds \meta{macro-name} to the current category, and defines globally
6089 \meta{lang-macro-name} to \meta{code} (after applying the
6090 transformation corresponding to the current charset or defined with
6091 the hook |stringprocess|).
6092
6093 Use this command to define strings, without including any “logic” if
6094 possible, which should be a separate macro. See the example above for
6095 the date.
6096
6097 \Describe{\SetStringLoop}{\marg{macro-name}\marg{string-list}}
6098 A convenient way to define several ordered names at once. For example,
6099 to define |\abmoniname|, |\abmoniiname|, etc. (and similarly with
6100 |abday|):
6101 \begin{verbatim}
6102 \SetStringLoop{abmon#1name}{en,fb,mr,ab,my,jn,jl,ag,sp,oc,nv,dc}
6103 \SetStringLoop{abday#1name}{lu,ma,mi,ju,vi,sa,do}
6104 \end{verbatim}
6105 |#1| is replaced by the roman numeral.
6106
6107 \Describe{\SetHyphenMap}{\marg{to-lower-macros}}
6108 \New{3.9g} Case mapping for hyphenation is handled with |\SetHyphenMap|
6109 and controlled with the package option |hyphenmap|.
6110
6111 There are three helper macros to be used inside |\SetHyphenMap|:
6112 \begin{itemize}
6113 \item |\BabelLower|\marg{uccode}\marg{lccode} is
6114 similar to |\lccode| but it’s ignored if the char has been set and
6115 saves the original lccode to restore it when switching the language
6116 (except with |hyphenmap=first|).
6117 \item |\BabelLowerMM|\marg{uccode-from}\marg{uccode-to}%
6118 \marg{step}\marg{lccode-from} loops though the given uppercase
6119 codes, using the step, and assigns them the lccode, which is also
6120 increased (|MM| stands for \textit{many-to-many}).
6121 \item |\BabelLowerMO|\marg{uccode-from}\marg{uccode-to}%
6122 \marg{step}\marg{lccode} loops though the given uppercase
6123 codes, using the step, and assigns them the lccode, which is fixed
6124 (|MO| stands for \textit{many-to-one}).
6125 \end{itemize}
6126 An example is (which is redundant, because these assignments are done
6127 by both \luatex{} and \xetex{}):
6128 \begin{verbatim}
6129 \SetHyphenMap{\BabelLowerMM{"100}{"11F}{2}{"101}}
6130 \end{verbatim}
6131
6132 \begin{note}
6133 This macro is not intended to fix wrong mappings done by Unicode
6134 (which are the default in both \luatex{} and \xetex{}) -- if an
6135 assignment is wrong, fix it directly.
6136 \end{note}
6137
6138 \else
6139
6140 \DocInput{babel.dtx}
6141
6142 \fi
6143
6144 \section{Acknowledgements}
6145
6146 In the initial stages of the development of \babel, Bernd Raichle
6147 provided many helpful suggestions and Michel Goossens supplied
6148 contributions for many languages. Ideas from Nico Poppelier, Piet van
6149 Oostrum and many others have been used. Paul Wackers and Werenfried
6150 Spit helped find and repair bugs.
6151
6152 More recently, there are significant contributions by Salim Bou, Ulrike
6153 Fischer, Loren Davis and Udi Fogiel.
6154
6155 Barbara Beeton has helped in improving the manual.
6156
6157 There are also many contributors for specific languages, which are
6158 mentioned in the respective files. Without them, \babel{} just
6159 wouldn’t exist.
6160
6161 \begin{thebibliography}{9}
6162 \bibitem{AT} Huda Smitshuijzen Abifares, \textit{Arabic Typography},
6163 Saqi, 2001.
6164 \bibitem{BEP} Johannes Braams, Victor Eijkhout and Nico Poppelier,
6165 \emph{The development of national \LaTeX\ styles},
6166 \emph{TUGboat} 10 (1989) \#3, pp.~401--406.
6167 \bibitem{FE} Yannis Haralambous,
6168 \emph{Fonts \& Encodings}, O'Reilly, 2007.
6169 \bibitem{DEK} Donald E. Knuth,
6170 \emph{The \TeX book}, Addison-Wesley, 1986.
6171 \bibitem{UE} Jukka K. Korpela,
6172 \textit{Unicode Explained}, O'Reilly, 2006.
6173 \bibitem{LLbook} Leslie Lamport,
6174 \emph{\LaTeX, A document preparation System}, Addison-Wesley,
6175 1986.
6176 \bibitem{LLth} Leslie Lamport,
6177 in: \TeX hax Digest, Volume 89, \#13, 17 February 1989.
6178 \bibitem{CJKV} Ken Lunde,
6179 \textit{CJKV Information Processing}, O'Reilly, 2nd ed., 2009.
6180 \bibitem{ReinDersh} Edward M. Reingold and Nachum Dershowitz,
6181 \emph{Calendrical Calculations: The Ultimate Edition},
6182 Cambridge University Press, 2018
6183 \bibitem{HP} Hubert Partl,
6184 \emph{German \TeX},
6185 \emph{TUGboat} 9 (1988) \#1, pp.~70--72.
6186 \bibitem{ilatex} Joachim Schrod,
6187 \emph{International \LaTeX\ is ready to use},
6188 \emph{TUGboat} 11 (1990) \#1, pp.~87--90.
6189 \bibitem{STS} Apostolos Syropoulos, Antonis Tsolomitis and Nick
6190 Sofroniu,
6191 \emph{Digital typography using \LaTeX},
6192 Springer, 2002, pp.~301--373.
6193 \bibitem{treebus} K.F. Treebus.
6194 \emph{Tekstwijzer, een gids voor het grafisch verwerken van
6195 tekst},
6196 SDU Uitgeverij (’s-Gravenhage, 1988).
6197 \end{thebibliography}
6198 \end{document}
6199 %</filedriver>
6200 % \fi
6201 %
6202 % \addtolength{\oddsidemargin}{-5pt}
6203 % \addtolength{\textwidth}{50pt}
6204 % \reversemarginpar
6205 %
6206 % \small
6207 %
6208 % The \babel{} package is being developed incrementally, which means
6209 % parts of the code are under development and therefore incomplete.
6210 % Only documented features are considered complete. In other words, use
6211 % \babel{} in real documents only as documented (except, of course, if
6212 % you want to explore and test them).
6213 %
6214 % \section{Identification and loading of required files}
6215 %
6216 % The \babel{} package after unpacking consists of the following files:
6217 % \begin{description}
6218 % \itemsep=-\parskip
6219 % \item[babel.sty] is the \LaTeX{} package, which set options and
6220 % load language styles.
6221 % \item[babel.def] is loaded by Plain.
6222 % \item[switch.def] defines macros to set and switch languages (it loads
6223 % part |babel.def|).
6224 % \item[plain.def] is not used, and just loads babel.def, for
6225 % compatibility.
6226 % \item[hyphen.cfg] is the file to be used when generating the
6227 % formats to load hyphenation patterns.
6228 % \end{description}
6229 % There some additional |tex|, |def| and |lua| files.
6230 %
6231 % The \babel{} installer extends \textsf{docstrip} with a few
6232 % “pseudo-guards” to set “variables” used at installation time.
6233 % They are used with \texttt{<@name@>} at the appropriate places in the
6234 % source code and defined with either
6235 % $\langle\langle$\textit{name}=\textit{value}$\rangle\rangle$, or with
6236 % a series of lines between
6237 % $\langle\langle$|*|\textit{name}$\rangle\rangle$ and
6238 % $\langle\langle$|/|\textit{name}$\rangle\rangle$. The latter is
6239 % cumulative (e.g., with \textit{More package options}). That brings a
6240 % little bit of literate programming. The guards \texttt{<-name>} and
6241 % \texttt{<+name>} have been redefined, too. See |babel.ins| for further
6242 % details.
6243 %
6244 % \section{\texttt{locale} directory}
6245 %
6246 % A required component of \babel{} is a set of |ini| files with basic
6247 % definitions for about 300 languages. They are distributed as a
6248 % separate |zip| file, not packed as |dtx|. Many of them are
6249 % essentially finished (except bugs and mistakes, of course). Some of
6250 % them are still incomplete (but they will be usable), and there are
6251 % some omissions (e.g., there are no geographic areas in Spanish). Not
6252 % all include LICR variants.
6253 %
6254 % |babel-*.ini| files contain the actual data; |babel-*.tex| files are
6255 % basically proxies to the corresponding ini files.
6256 %
6257 % See \href{https://latex3.github.io/babel/guides/keys-in-ini-files.html}{Keys
6258 % in \texttt{ini} files} in the the \babel{} site.
6259 %
6260 % \section{Tools}
6261 %
6262 % \begin{macrocode}
6263 %<<version=26.8>>
6264 %<<date=2026/05/20>>
6265 % \end{macrocode}
6266 %
6267 % \textbf{Do not use the following macros in \texttt{ldf} files. They
6268 % may change in the future.} This applies mainly to those recently
6269 % added for replacing, trimming and looping. The older ones, like
6270 % |\bbl@afterfi|, will not change.
6271 % We define some basic macros which just make the code cleaner.
6272 % |\bbl@add| is now used internally instead of |\addto| because of
6273 % the unpredictable behavior of the latter. Used in
6274 % \file{babel.def} and in \file{babel.sty}, which means in \LaTeX{}
6275 % is executed twice, but we need them when defining options and
6276 % \file{babel.def} cannot be load until options have been defined.
6277 % This does not hurt, but should be fixed somehow.
6278 %
6279 % \begin{macrocode}
6280 %<<*Basic macros>>
6281 \bbl@trace{Basic macros}
6282 \def\bbl@stripslash{\expandafter\@gobble\string}
6283 \def\bbl@add#1#2{%
6284 \bbl@ifunset{\bbl@stripslash#1}%
6285 {\def#1{#2}}%
6286 {\expandafter\def\expandafter#1\expandafter{#1#2}}}
6287 \def\bbl@xin@{\@expandtwoargs\in@}
6288 \def\bbl@carg#1#2{\expandafter#1\csname#2\endcsname}%
6289 \def\bbl@ncarg#1#2#3{\expandafter#1\expandafter#2\csname#3\endcsname}%
6290 \def\bbl@ccarg#1#2#3{%
6291 \expandafter#1\csname#2\expandafter\endcsname\csname#3\endcsname}%
6292 \def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}%
6293 \def\bbl@cs#1{\csname bbl@#1\endcsname}
6294 \def\bbl@cl#1{\csname bbl@#1@\languagename\endcsname}
6295 \def\bbl@loop#1#2#3{\bbl@@loop#1{#3}#2,\@nnil,}
6296 \def\bbl@loopx#1#2{\expandafter\bbl@loop\expandafter#1\expandafter{#2}}
6297 \def\bbl@@loop#1#2#3,{%
6298 \ifx\@nnil#3\relax\else
6299 \def#1{#3}#2\bbl@afterfi\bbl@@loop#1{#2}%
6300 \fi}
6301 \def\bbl@for#1#2#3{\bbl@loopx#1{#2}{\ifx#1\@empty\else#3\fi}}
6302 % \end{macrocode}
6303 %
6304 % \macro{\bbl@add@list}
6305 % This internal macro adds its second argument to a comma separated
6306 % list in its first argument. When the list is not defined yet (or
6307 % empty), it will be initiated. It presumes expandable character
6308 % strings.
6309 %
6310 % \begin{macrocode}
6311 \def\bbl@add@list#1#2{%
6312 \edef#1{%
6313 \bbl@ifunset{\bbl@stripslash#1}%
6314 {}%
6315 {\ifx#1\@empty\else#1,\fi}%
6316 #2}}
6317 % \end{macrocode}
6318 %
6319 % \macro{\bbl@afterelse}
6320 % \macro{\bbl@afterfi}
6321 % Because the code that is used in the handling of active characters
6322 % may need to look ahead, we take extra care to `throw' it over the
6323 % |\else| and |\fi| parts of an |\if|-statement\footnote{This code is
6324 % based on code presented in TUGboat vol. 12, no2, June 1991 in “An
6325 % expansion Power Lemma” by Sonja Maus.}. These macros will break if
6326 % another |\if...\fi| statement appears in one of the arguments and it
6327 % is not enclosed in braces.
6328 %
6329 % \begin{macrocode}
6330 \long\def\bbl@afterelse#1\else#2\fi{\fi#1}
6331 \long\def\bbl@afterfi#1\fi{\fi#1}
6332 % \end{macrocode}
6333 %
6334 % \macro{\bbl@exp}
6335 %
6336 % Now, just syntactical sugar, but it makes partial expansion of some
6337 % code a lot more simple and readable. Here |\\| stands for
6338 % |\noexpand|, |\<..>| for |\noexpand| applied to a built macro name
6339 % (which does not define the macro if undefined to |\relax|, because it
6340 % is created locally), and |\[..]| for one-level expansion (where |..|
6341 % is the macro name without the backslash). The result may be followed
6342 % by extra arguments, if necessary.
6343 %
6344 % \begin{macrocode}
6345 \def\bbl@exp#1{%
6346 \begingroup
6347 \let\\\noexpand
6348 \let\<\bbl@exp@en
6349 \let\[\bbl@exp@ue
6350 \edef\bbl@exp@aux{\endgroup#1}%
6351 \bbl@exp@aux}
6352 \def\bbl@exp@en#1>{\expandafter\noexpand\csname#1\endcsname}%
6353 \def\bbl@exp@ue#1]{%
6354 \unexpanded\expandafter\expandafter\expandafter{\csname#1\endcsname}}%
6355 % \end{macrocode}
6356 %
6357 % \macro{\bbl@trim}
6358 % The following piece of code is stolen (with some changes) from
6359 % \textsf{keyval}, by David Carlisle. It defines two macros:
6360 % |\bbl@trim| and |\bbl@trim@def|. The first one strips the leading and
6361 % trailing spaces from the second argument and then applies the first
6362 % argument (a macro, |\toks@| and the like). The second one, as its
6363 % name suggests, defines the first argument as the stripped second
6364 % argument.
6365 %
6366 % \begin{macrocode}
6367 \def\bbl@tempa#1{%
6368 \long\def\bbl@trim##1##2{%
6369 \futurelet\bbl@trim@a\bbl@trim@c##2\@nil\@nil#1\@nil\relax{##1}}%
6370 \def\bbl@trim@c{%
6371 \ifx\bbl@trim@a\@sptoken
6372 \expandafter\bbl@trim@b
6373 \else
6374 \expandafter\bbl@trim@b\expandafter#1%
6375 \fi}%
6376 \long\def\bbl@trim@b#1##1 \@nil{\bbl@trim@i##1}}
6377 \bbl@tempa{ }
6378 \long\def\bbl@trim@i#1\@nil#2\relax#3{#3{#1}}
6379 \long\def\bbl@trim@def#1{\bbl@trim{\def#1}}
6380 % \end{macrocode}
6381 %
6382 % \macro{\bbl@ifunset}
6383 % To check if a macro is defined, we create a new macro, which does the
6384 % same as |\@ifundefined|. However, in an $\varepsilon$-tex engine, it is
6385 % based on |\ifcsname|, which is more efficient, and does not waste
6386 % memory. Defined inside a group, to avoid \cs{ifcsname} being
6387 % implicitly set to |\relax| by the |\csname| test.
6388 %
6389 % \begin{macrocode}
6390 \begingroup
6391 \gdef\bbl@ifunset#1{%
6392 \expandafter\ifx\csname#1\endcsname\relax
6393 \expandafter\@firstoftwo
6394 \else
6395 \expandafter\@secondoftwo
6396 \fi}
6397 \bbl@ifunset{ifcsname}%
6398 {}%
6399 {\gdef\bbl@ifunset#1{%
6400 \ifcsname#1\endcsname
6401 \expandafter\ifx\csname#1\endcsname\relax
6402 \bbl@afterelse\expandafter\@firstoftwo
6403 \else
6404 \bbl@afterfi\expandafter\@secondoftwo
6405 \fi
6406 \else
6407 \expandafter\@firstoftwo
6408 \fi}}
6409 \endgroup
6410 % \end{macrocode}
6411 %
6412 % \macro{\bbl@ifblank}
6413 % A tool from \textsf{url}, by Donald Arseneau, which tests if a string
6414 % is empty or space. The companion macros tests if a macro is defined
6415 % with some `real' value, i.e., not |\relax| and not empty,
6416 %
6417 % \begin{macrocode}
6418 \def\bbl@ifblank#1{%
6419 \bbl@ifblank@i#1\@nil\@nil\@secondoftwo\@firstoftwo\@nil}
6420 \long\def\bbl@ifblank@i#1#2\@nil#3#4#5\@nil{#4}
6421 \def\bbl@ifset#1#2#3{%
6422 \bbl@ifunset{#1}{#3}{\bbl@exp{\\\bbl@ifblank{\@nameuse{#1}}}{#3}{#2}}}
6423 % \end{macrocode}
6424 %
6425 % For each element in the comma separated <key>|=|<value> list,
6426 % execute <code> with |#1| and |#2| as the key and the value of
6427 % current item (trimmed). In addition, the item is passed verbatim as
6428 % |#3|. With the <key> alone, it passes |\@empty| as value (i.e., the
6429 % macro thus named, not an empty argument, which is what you get with
6430 % <key>|=| and no value).
6431 %
6432 % \begin{macrocode}
6433 \def\bbl@forkv#1#2{%
6434 \def\bbl@kvcmd##1##2##3{#2}%
6435 \bbl@kvnext#1,\@nil,}
6436 \def\bbl@kvnext#1,{%
6437 \ifx\@nil#1\relax\else
6438 \bbl@ifblank{#1}{}{\bbl@forkv@eq#1=\@empty=\@nil{#1}}%
6439 \expandafter\bbl@kvnext
6440 \fi}
6441 \def\bbl@forkv@eq#1=#2=#3\@nil#4{%
6442 \bbl@trim@def\bbl@forkv@a{#1}%
6443 \bbl@trim{\expandafter\bbl@kvcmd\expandafter{\bbl@forkv@a}}{#2}{#4}}
6444 % \end{macrocode}
6445 %
6446 % A \textit{for} loop. Each item (trimmed) is |#1|. It cannot be
6447 % nested (it’s doable, but we don't need it).
6448 %
6449 % \begin{macrocode}
6450 \def\bbl@vforeach#1#2{%
6451 \def\bbl@forcmd##1{#2}%
6452 \bbl@fornext#1,\@nil,}
6453 \def\bbl@fornext#1,{%
6454 \ifx\@nil#1\relax\else
6455 \bbl@ifblank{#1}{}{\bbl@trim\bbl@forcmd{#1}}%
6456 \expandafter\bbl@fornext
6457 \fi}
6458 \def\bbl@foreach#1{\expandafter\bbl@vforeach\expandafter{#1}}
6459 % \end{macrocode}
6460 %
6461 % Some code should be executed once. The first argument is a flag.
6462 %
6463 % \begin{macrocode}
6464 \global\let\bbl@done\@empty
6465 \def\bbl@once#1#2{%
6466 \bbl@xin@{,#1,}{,\bbl@done,}%
6467 \ifin@\else
6468 #2%
6469 \xdef\bbl@done{\bbl@done,#1,}%
6470 \fi}
6471 % \end{macrode}
6472 %
6473 % \macro{\bbl@replace}
6474 %
6475 % Returns implicitly |\toks@| with the modified string.
6476 %
6477 % \begin{macrocode}
6478 \def\bbl@replace#1#2#3{% in #1 -> repl #2 by #3
6479 \toks@{}%
6480 \def\bbl@replace@aux##1#2##2#2{%
6481 \ifx\bbl@nil##2%
6482 \toks@\expandafter{\the\toks@##1}%
6483 \else
6484 \toks@\expandafter{\the\toks@##1#3}%
6485 \bbl@afterfi
6486 \bbl@replace@aux##2#2%
6487 \fi}%
6488 \expandafter\bbl@replace@aux#1#2\bbl@nil#2%
6489 \edef#1{\the\toks@}}
6490 % \end{macrocode}
6491 %
6492 % An extension to the previous macro. It takes into account the
6493 % parameters, and it is string based (i.e., if you replace |elax| by
6494 % |ho|, then |\relax| becomes |\rho|). No checking is done at all,
6495 % because it is not a general purpose macro, and it is used by \babel{}
6496 % only when it works (an example where it does \textit{not} work is in
6497 % |\bbl@TG@@date|, and also fails if there are macros with spaces,
6498 % because they are retokenized). It may change! (or even merged with
6499 % |\bbl@replace|; I'm not sure checking the replacement is really
6500 % necessary or just paranoia).
6501 %
6502 % \begin{macrocode}
6503 \ifx\detokenize\@undefined\else % Unused macros if old Plain TeX
6504 \bbl@exp{\def\\\bbl@parsedef##1\detokenize{macro:}}#2->#3\relax{%
6505 \def\bbl@tempa{#1}%
6506 \def\bbl@tempb{#2}%
6507 \def\bbl@tempe{#3}}
6508 \def\bbl@sreplace#1#2#3{%
6509 \begingroup
6510 \expandafter\bbl@parsedef\meaning#1\relax
6511 \def\bbl@tempc{#2}%
6512 \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}%
6513 \def\bbl@tempd{#3}%
6514 \edef\bbl@tempd{\expandafter\strip@prefix\meaning\bbl@tempd}%
6515 \bbl@xin@{\bbl@tempc}{\bbl@tempe}% If not in macro, do nothing
6516 \ifin@
6517 \bbl@exp{\\\bbl@replace\\\bbl@tempe{\bbl@tempc}{\bbl@tempd}}%
6518 \def\bbl@tempc{% Expanded an executed below as 'uplevel'
6519 \\\makeatletter % "internal" macros with @ are assumed
6520 \\\scantokens{%
6521 \bbl@tempa\\\@namedef{\bbl@stripslash#1}\bbl@tempb{\bbl@tempe}%
6522 \noexpand\noexpand}%
6523 \catcode64=\the\catcode64\relax}% Restore @
6524 \else
6525 \let\bbl@tempc\@empty % Not \relax
6526 \fi
6527 \bbl@exp{% For the 'uplevel' assignments
6528 \endgroup
6529 \bbl@tempc}} % empty or expand to set #1 with changes
6530 \fi
6531 % \end{macrocode}
6532 %
6533 % Two further tools. |\bbl@ifsamestring| first expand its arguments and
6534 % then compare their expansion (sanitized, so that the catcodes do not
6535 % matter). |\bbl@engine| takes the following values: 0 is pdf\TeX, 1
6536 % is \luatex, and 2 is \xetex. You may use the latter it in your
6537 % language style if you want.
6538 %
6539 % \begin{macrocode}
6540 \def\bbl@ifsamestring#1#2{%
6541 \begingroup
6542 \protected@edef\bbl@tempb{#1}%
6543 \edef\bbl@tempb{\expandafter\strip@prefix\meaning\bbl@tempb}%
6544 \protected@edef\bbl@tempc{#2}%
6545 \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}%
6546 \ifx\bbl@tempb\bbl@tempc
6547 \aftergroup\@firstoftwo
6548 \else
6549 \aftergroup\@secondoftwo
6550 \fi
6551 \endgroup}
6552 \chardef\bbl@engine=%
6553 \ifx\directlua\@undefined
6554 \ifx\XeTeXinputencoding\@undefined
6555 \z@
6556 \else
6557 \tw@
6558 \fi
6559 \else
6560 \@ne
6561 \fi
6562 % \end{macrocode}
6563 %
6564 % A somewhat hackish tool (hence its name) to avoid spurious spaces in
6565 % some contexts.
6566 %
6567 % \begin{macrocode}
6568 \def\bbl@bsphack{%
6569 \ifhmode
6570 \hskip\z@skip
6571 \def\bbl@esphack{\loop\ifdim\lastskip>\z@\unskip\repeat\unskip}%
6572 \else
6573 \let\bbl@esphack\@empty
6574 \fi}
6575 % \end{macrocode}
6576 %
6577 % Another hackish tool, to apply case changes inside a protected
6578 % macros. It’s based on the internal |\let|’s made by |\MakeUppercase|
6579 % and |\MakeLowercase| between things like |\oe| and |\OE|.
6580 %
6581 % \begin{macrocode}
6582 \def\bbl@cased{%
6583 \ifx\oe\OE
6584 \expandafter\in@\expandafter
6585 {\expandafter\OE\expandafter}\expandafter{\oe}%
6586 \ifin@
6587 \bbl@afterelse\expandafter\MakeUppercase
6588 \else
6589 \bbl@afterfi\expandafter\MakeLowercase
6590 \fi
6591 \else
6592 \expandafter\@firstofone
6593 \fi}
6594 % \end{macrocode}
6595 %
6596 % The following adds some code to |\extras...| both before and after,
6597 % while avoiding doing it twice. It’s somewhat convoluted, to deal with
6598 % |#|’s. Used to deal with alph, Alph and frenchspacing when there are
6599 % already changes (with |\babel@save|).
6600 %
6601 % \begin{macrocode}
6602 \def\bbl@extras@wrap#1#2#3{% 1:in-test, 2:before, 3:after
6603 \toks@\expandafter\expandafter\expandafter{%
6604 \csname extras\languagename\endcsname}%
6605 \bbl@exp{\\\in@{#1}{\the\toks@}}%
6606 \ifin@\else
6607 \@temptokena{#2}%
6608 \edef\bbl@tempc{\the\@temptokena\the\toks@}%
6609 \toks@\expandafter{\bbl@tempc#3}%
6610 \expandafter\edef\csname extras\languagename\endcsname{\the\toks@}%
6611 \fi}
6612 %<</Basic macros>>
6613 % \end{macrocode}
6614 %
6615 % Some files identify themselves with a \LaTeX{} macro. The following
6616 % code is placed before them to define (and then undefine) if not in
6617 % \LaTeX.
6618 %
6619 % \begin{macrocode}
6620 %<<*Make sure ProvidesFile is defined>>
6621 \ifx\ProvidesFile\@undefined
6622 \def\ProvidesFile#1[#2 #3 #4]{%
6623 \wlog{File: #1 #4 #3 <#2>}%
6624 \let\ProvidesFile\@undefined}
6625 \fi
6626 %<</Make sure ProvidesFile is defined>>
6627 % \end{macrocode}
6628 %
6629 % \subsection{A few core definitions}
6630 %
6631 % \macro{\language}
6632 %
6633 % Just for compatibility, for not to touch |hyphen.cfg|.
6634 %
6635 % \begin{macrocode}
6636 %<<*Define core switching macros>>
6637 \ifx\language\@undefined
6638 \csname newcount\endcsname\language
6639 \fi
6640 %<</Define core switching macros>>
6641 % \end{macrocode}
6642 %
6643 % \macro{\last@language}
6644 %
6645 % Another counter is used to keep track of the allocated languages.
6646 % \TeX{} and \LaTeX{} reserves for this purpose the count 19.
6647 %
6648 % \macro{\addlanguage}
6649 %
6650 % This macro was introduced for \TeX{} $<$ 2. Preserved for
6651 % compatibility.
6652 %
6653 % \begin{macrocode}
6654 %<<*Define core switching macros>>
6655 \countdef\last@language=19
6656 \def\addlanguage{\csname newlanguage\endcsname}
6657 %<</Define core switching macros>>
6658 % \end{macrocode}
6659 %
6660 % Now we make sure all required files are loaded. When the command
6661 % |\AtBeginDocument| doesn't exist we assume that we are dealing with a
6662 % plain-based format. In that case the file \file{plain.def} is needed
6663 % (which also defines |\AtBeginDocument|, and therefore it is not
6664 % loaded twice). We need the first part when the format is created, and
6665 % |\orig@dump| is used as a flag. Otherwise, we need to use the second
6666 % part, so |\orig@dump| is not defined (\file{plain.def} undefines it).
6667 %
6668 % Check if the current version of \file{switch.def} has been previously
6669 % loaded (mainly, \file{hyphen.cfg}). If not, load it now. We cannot
6670 % load |babel.def| here because we first need to declare and process
6671 % the package options.
6672 %
6673 % \subsection{\LaTeX: \texttt{babel.sty} (start)}
6674 %
6675 % Here starts the style file for \LaTeX. It also takes care of a number
6676 % of compatibility issues with other packages.
6677 %
6678 % \begin{macrocode}
6679 %<*package>
6680 \NeedsTeXFormat{LaTeX2e}
6681 \ProvidesPackage{babel}%
6682 [<@date@> v<@version@>
6683 The multilingual framework for LuaLaTeX, pdfLaTeX and XeLaTeX]
6684 % \end{macrocode}
6685 %
6686 % Start with some “private” debugging tools, and then define macros for
6687 % errors. The global lua ‘space’ |Babel| is declared here, too (inside
6688 % the test for |debug|).
6689 %
6690 % \begin{macrocode}
6691 \@ifpackagewith{babel}{debug}
6692 {\providecommand\bbl@trace[1]{\message{^^J[ #1 ]}}%
6693 \let\bbl@debug\@firstofone
6694 \ifx\directlua\@undefined\else
6695 \directlua{
6696 Babel = Babel or {}
6697 Babel.debug = true }%
6698 \input{babel-debug.tex}%
6699 \fi}
6700 {\providecommand\bbl@trace[1]{}%
6701 \let\bbl@debug\@gobble
6702 \ifx\directlua\@undefined\else
6703 \directlua{
6704 Babel = Babel or {}
6705 Babel.debug = false }%
6706 \fi}
6707 % Temporary:
6708 \newif\ifBabelDebugGerman
6709 \@ifpackagewith{babel}{debug-german}
6710 {\BabelDebugGermantrue}
6711 {\BabelDebugGermanfalse}
6712 % \end{macrocode}
6713 %
6714 % Macros to deal with errors, warnings, etc. Errors are stored in a
6715 % separate file.
6716 %
6717 % \begin{macrocode}
6718 \def\bbl@error#1{% Implicit #2#3#4
6719 \begingroup
6720 \catcode`\\=0 \catcode`\==12 \catcode`\`=12
6721 \input errbabel.def
6722 \endgroup
6723 \bbl@error{#1}}
6724 \def\bbl@warning#1{%
6725 \begingroup
6726 \def\\{\MessageBreak}%
6727 \PackageWarning{babel}{#1}%
6728 \endgroup}
6729 \def\bbl@infowarn#1{%
6730 \begingroup
6731 \def\\{\MessageBreak}%
6732 \PackageNote{babel}{#1}%
6733 \endgroup}
6734 \def\bbl@info#1{%
6735 \begingroup
6736 \def\\{\MessageBreak}%
6737 \PackageInfo{babel}{#1}%
6738 \endgroup}
6739 % \end{macrocode}
6740 %
6741 % Many of the following options don’t do anything themselves, they are
6742 % just defined in order to make it possible for \babel{} and language
6743 % definition files to check if one of them was specified by the user.
6744 %
6745 % But first, include here the \textit{Basic macros} defined above.
6746 %
6747 % \begin{macrocode}
6748 <@Basic macros@>
6749 \@ifpackagewith{babel}{silent}
6750 {\let\bbl@info\@gobble
6751 \let\bbl@infowarn\@gobble
6752 \let\bbl@warning\@gobble}
6753 {}
6754 %
6755 \def\AfterBabelLanguage#1{%
6756 \global\expandafter\bbl@add\csname#1.ldf-h@@k\endcsname}%
6757 % \end{macrocode}
6758 %
6759 % If the format created a list of loaded languages (in
6760 % |\bbl@languages|), get the name of the 0-th to show the actual
6761 % language used. Also available with |base|, because it just shows
6762 % info.
6763 %
6764 % \begin{macrocode}
6765 \ifx\bbl@languages\@undefined\else
6766 \begingroup
6767 \catcode`\^^I=12
6768 \@ifpackagewith{babel}{showlanguages}{%
6769 \begingroup
6770 \def\bbl@elt#1#2#3#4{\wlog{#2^^I#1^^I#3^^I#4}}%
6771 \wlog{<*languages>}%
6772 \bbl@languages
6773 \wlog{</languages>}%
6774 \endgroup}{}
6775 \endgroup
6776 \def\bbl@elt#1#2#3#4{%
6777 \ifnum#2=\z@
6778 \gdef\bbl@nulllanguage{#1}%
6779 \def\bbl@elt##1##2##3##4{}%
6780 \fi}%
6781 \bbl@languages
6782 \fi
6783 % \end{macrocode}
6784 % \subsection{\texttt{base}}
6785 %
6786 % The first `real' option to be processed is |base|, which set the
6787 % hyphenation patterns then resets |[email protected]| so that \LaTeX{}
6788 % forgets about the first loading. After a subset of |babel.def| has
6789 % been loaded (the old |switch.def|) and |\AfterBabelLanguage| defined,
6790 % it exits.
6791 %
6792 % Now the \texttt{base} option. With it we can define (and load, with
6793 % \luatex) hyphenation patterns, even if we are not interested in the
6794 % rest of \babel{}.
6795 %
6796 % \begin{macrocode}
6797 \bbl@trace{Defining option 'base'}
6798 \@ifpackagewith{babel}{base}{%
6799 \let\bbl@onlyswitch\@empty
6800 \let\bbl@provide@locale\relax
6801 \input babel.def
6802 \let\bbl@onlyswitch\@undefined
6803 \ifx\directlua\@undefined
6804 \DeclareOption*{\bbl@patterns{\CurrentOption}}%
6805 \else
6806 \input luababel.def
6807 \DeclareOption*{\bbl@patterns@lua{\CurrentOption}}%
6808 \fi
6809 \DeclareOption{base}{}%
6810 \DeclareOption{showlanguages}{}%
6811 \ProcessOptions
6812 \global\expandafter\let\csname [email protected]\endcsname\relax
6813 \global\expandafter\let\csname [email protected]\endcsname\relax
6814 \global\let\@ifl@ter@@\@ifl@ter
6815 \def\@ifl@ter#1#2#3#4#5{\global\let\@ifl@ter\@ifl@ter@@}%
6816 \endinput}{}%
6817 % \end{macrocode}
6818 %
6819 % \subsection{\texttt{key=value} options and other general option}
6820 %
6821 % The following macros extract language modifiers, and only real
6822 % package options are kept in the option list. Modifiers are saved and
6823 % assigned to |\BabelModifiers| at |\bbl@load@language|; when no
6824 % modifiers have been given, the former is |\relax|.
6825 %
6826 % \begin{macrocode}
6827 \bbl@trace{key=value and another general options}
6828 \bbl@csarg\let{tempa\expandafter}\csname [email protected]\endcsname
6829 \def\bbl@tempb#1.#2{% Removes trailing dot
6830 #1\ifx\@empty#2\else,\bbl@afterfi\bbl@tempb#2\fi}%
6831 \def\bbl@tempe#1=#2\@@{%
6832 \bbl@csarg\edef{mod@#1}{\bbl@tempb#2}}
6833 \def\bbl@tempd#1.#2\@nnil{%
6834 \ifx\@empty#2%
6835 \edef\bbl@tempc{\ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1}%
6836 \else
6837 \in@{,provide=}{,#1}%
6838 \ifin@
6839 \edef\bbl@tempc{%
6840 \ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1.\bbl@tempb#2}%
6841 \else
6842 \in@{$modifiers$}{$#1$}%
6843 \ifin@
6844 \bbl@tempe#2\@@
6845 \else
6846 \in@{=}{#1}%
6847 \ifin@
6848 \edef\bbl@tempc{\ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1.#2}%
6849 \else
6850 \edef\bbl@tempc{\ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1}%
6851 \bbl@csarg\edef{mod@#1}{\bbl@tempb#2}%
6852 \fi
6853 \fi
6854 \fi
6855 \fi}
6856 \let\bbl@tempc\@empty
6857 \bbl@foreach\bbl@tempa{\bbl@tempd#1.\@empty\@nnil}
6858 \expandafter\let\csname [email protected]\endcsname\bbl@tempc
6859 % \end{macrocode}
6860 %
6861 % The next option tells \babel{} to leave shorthand characters active
6862 % at the end of processing the package. This is \emph{not} the default
6863 % as it can cause problems with other packages, but for those who want
6864 % to use the shorthand characters in the preamble of their documents
6865 % this can help.
6866 %
6867 % \begin{macrocode}
6868 \DeclareOption{KeepShorthandsActive}{}
6869 \DeclareOption{activeacute}{}
6870 \DeclareOption{activegrave}{}
6871 \DeclareOption{debug}{}
6872 \DeclareOption{debug-german}{} % Temporary
6873 \DeclareOption{noconfigs}{}
6874 \DeclareOption{showlanguages}{}
6875 \DeclareOption{silent}{}
6876 \DeclareOption{shorthands=off}{\bbl@tempa shorthands=\bbl@tempa}
6877 \chardef\bbl@iniflag\z@
6878 \DeclareOption{provide=*}{\chardef\bbl@iniflag\@ne} % main = 1
6879 \DeclareOption{provide+=*}{\chardef\bbl@iniflag\tw@} % second = 2
6880 \DeclareOption{provide*=*}{\chardef\bbl@iniflag\thr@@} % second + main
6881 \chardef\bbl@ldfflag\z@
6882 \DeclareOption{provide=!}{\chardef\bbl@ldfflag\@ne} % main = 1
6883 \DeclareOption{provide+=!}{\chardef\bbl@ldfflag\tw@} % second = 2
6884 \DeclareOption{provide*=!}{\chardef\bbl@ldfflag\thr@@} % second + main
6885 \DeclareOption{licr=extended}{}
6886 \DeclareOption{licr=unextended}{}
6887 % Don't use. Experimental.
6888 \newif\ifbbl@single
6889 \DeclareOption{selectors=off}{\bbl@singletrue}
6890 <@More package options@>
6891 % \end{macrocode}
6892 %
6893 % Handling of package options is done in three passes. (I [JBL] am not
6894 % very happy with the idea, anyway.) The first one processes options
6895 % which has been declared above or follow the syntax |<key>=<value>|,
6896 % the second one loads the requested languages, except the main one if
6897 % set with the key |main|, and the third one loads the latter. First,
6898 % we “flag” valid keys with a nil value.
6899 %
6900 % \begin{macrocode}
6901 \let\bbl@opt@shorthands\@nnil
6902 \let\bbl@opt@config\@nnil
6903 \let\bbl@opt@main\@nnil
6904 \let\bbl@opt@headfoot\@nnil
6905 \let\bbl@opt@layout\@nnil
6906 \let\bbl@opt@provide\@nnil
6907 % \end{macrocode}
6908 %
6909 % The following tool is defined temporarily to store the values of
6910 % options.
6911 %
6912 % \begin{macrocode}
6913 \def\bbl@tempa#1=#2\bbl@tempa{%
6914 \bbl@csarg\ifx{opt@#1}\@nnil
6915 \bbl@csarg\edef{opt@#1}{#2}%
6916 \else
6917 \bbl@error{bad-package-option}{#1}{#2}{}%
6918 \fi}
6919 % \end{macrocode}
6920 %
6921 % Now the option list is processed, taking into account only currently
6922 % declared options (including those declared with a |=|), and
6923 % |<key>=<value>| options (the former take precedence). Unrecognized
6924 % options are saved in |\bbl@language@opts|, because they are language
6925 % options.
6926 %
6927 % \begin{macrocode}
6928 \let\bbl@language@opts\@empty
6929 \DeclareOption*{%
6930 \bbl@xin@{\string=}{\CurrentOption}%
6931 \ifin@
6932 \expandafter\bbl@tempa\CurrentOption\bbl@tempa
6933 \else
6934 \bbl@add@list\bbl@language@opts{\CurrentOption}%
6935 \fi}
6936 % \end{macrocode}
6937 %
6938 % Now we finish the first pass (and start over).
6939 %
6940 % \begin{macrocode}
6941 \ProcessOptions*
6942 % \end{macrocode}
6943 %
6944 % \subsection{Post-process some options}
6945 %
6946 % \begin{macrocode}
6947 \ifx\bbl@opt@provide\@nnil
6948 \let\bbl@opt@provide\@empty % %%% MOVE above
6949 \else
6950 \chardef\bbl@iniflag\@ne
6951 \bbl@exp{\\\bbl@forkv{\@nameuse{@raw@[email protected]}}}{%
6952 \in@{,provide,}{,#1,}%
6953 \ifin@
6954 \def\bbl@opt@provide{#2}%
6955 \fi}
6956 \fi
6957 % \end{macrocode}
6958 %
6959 % If there is no |shorthands=<chars>|, the original \textsf{babel}
6960 % macros are left untouched, but if there is, these macros are
6961 % wrapped (in |babel.def|) to define only those given.
6962 %
6963 % A bit of optimization: if there is no |shorthands=|, then
6964 % |\bbl@ifshorthand| is always true, and it is always false if
6965 % |shorthands| is empty. Also, some code makes sense only with
6966 % |shorthands=...|.
6967 %
6968 % \begin{macrocode}
6969 \bbl@trace{Conditional loading of shorthands}
6970 \def\bbl@sh@string#1{%
6971 \ifx#1\@empty\else
6972 \ifx#1t\string~%
6973 \else\ifx#1c\string,%
6974 \else\string#1%
6975 \fi\fi
6976 \expandafter\bbl@sh@string
6977 \fi}
6978 \ifx\bbl@opt@shorthands\@nnil
6979 \def\bbl@ifshorthand#1#2#3{#2}%
6980 \else\ifx\bbl@opt@shorthands\@empty
6981 \def\bbl@ifshorthand#1#2#3{#3}%
6982 \else
6983 % \end{macrocode}
6984 %
6985 % The following macro tests if a shorthand is one of the allowed ones.
6986 %
6987 % \begin{macrocode}
6988 \def\bbl@ifshorthand#1{%
6989 \bbl@xin@{\string#1}{\bbl@opt@shorthands}%
6990 \ifin@
6991 \expandafter\@firstoftwo
6992 \else
6993 \expandafter\@secondoftwo
6994 \fi}
6995 % \end{macrocode}
6996 %
6997 % We make sure all chars in the string are `other', with the help
6998 % of an auxiliary macro defined above (which also zaps spaces).
6999 %
7000 % \begin{macrocode}
7001 \edef\bbl@opt@shorthands{%
7002 \expandafter\bbl@sh@string\bbl@opt@shorthands\@empty}%
7003 % \end{macrocode}
7004 %
7005 % The following is ignored with |shorthands=off|, since it is
7006 % intended to take some additional actions for certain chars.
7007 %
7008 % \begin{macrocode}
7009 \bbl@ifshorthand{'}%
7010 {\PassOptionsToPackage{activeacute}{babel}}{}
7011 \bbl@ifshorthand{`}%
7012 {\PassOptionsToPackage{activegrave}{babel}}{}
7013 \fi\fi
7014 % \end{macrocode}
7015 %
7016 % With |headfoot=lang| we can set the language used in heads/feet.
7017 % For example, in babel/3796 just add |headfoot=english|. It
7018 % misuses \cs{@resetactivechars}, but seems to work.
7019 %
7020 % \begin{macrocode}
7021 \ifx\bbl@opt@headfoot\@nnil\else
7022 \g@addto@macro\@resetactivechars{%
7023 \set@typeset@protect
7024 \expandafter\select@language@x\expandafter{\bbl@opt@headfoot}%
7025 \let\protect\noexpand}
7026 \fi
7027 % \end{macrocode}
7028 %
7029 % For the option safe we use a different approach -- |\bbl@opt@safe|
7030 % says which macros are redefined (B for bibs and R for refs). By
7031 % default, both are currently set, but in a future release it will be set to
7032 % |none|.
7033 %
7034 % \begin{macrocode}
7035 \ifx\bbl@opt@safe\@undefined
7036 \def\bbl@opt@safe{BR}
7037 % \let\bbl@opt@safe\@empty % Pending of \cite
7038 \fi
7039 % \end{macrocode}
7040 %
7041 % For |layout| an auxiliary macro is provided, available for packages
7042 % and language styles. Optimization: if there is no |layout|, just do
7043 % nothing.
7044 %
7045 % \begin{macrocode}
7046 \bbl@trace{Defining IfBabelLayout}
7047 \ifx\bbl@opt@layout\@nnil
7048 \newcommand\IfBabelLayout[3]{#3}%
7049 \else
7050 \bbl@exp{\\\bbl@forkv{\@nameuse{@raw@[email protected]}}}{%
7051 \in@{,layout,}{,#1,}%
7052 \ifin@
7053 \def\bbl@opt@layout{#2}%
7054 \bbl@replace\bbl@opt@layout{ }{.}%
7055 \fi}
7056 \newcommand\IfBabelLayout[1]{%
7057 \@expandtwoargs\in@{.#1.}{.\bbl@opt@layout.}%
7058 \ifin@
7059 \expandafter\@firstoftwo
7060 \else
7061 \expandafter\@secondoftwo
7062 \fi}
7063 \fi
7064 %</package>
7065 % \end{macrocode}
7066 %
7067 % \subsection{Plain: \texttt{babel.def} (start)}
7068 %
7069 % Because of the way \pkg{docstrip} works, we need to insert some code
7070 % for Plain here. However, the tools provided by the \babel{}
7071 % installer for literate programming makes this section a short
7072 % interlude, because the actual code is below, tagged as
7073 % \textit{Emulate LaTeX}.
7074 %
7075 % First, exit immediately if previouly loaded.
7076 %
7077 % \begin{macrocode}
7078 %<*core>
7079 \ifx\ldf@quit\@undefined\else
7080 \endinput\fi % Same line!
7081 <@Make sure ProvidesFile is defined@>
7082 \ProvidesFile{babel.def}[<@date@> v<@version@> Babel common definitions]
7083 \ifx\AtBeginDocument\@undefined
7084 <@Emulate LaTeX@>
7085 \fi
7086 <@Basic macros@>
7087 %</core>
7088 % \end{macrocode}
7089 %
7090 % That is all for the moment. Now follows some common stuff, for both
7091 % Plain and \LaTeX{}. After it, we will resume the \LaTeX-only stuff.
7092 %
7093 % \section{\texttt{babel.sty} and \texttt{babel.def} (common)}
7094 %
7095 % \begin{macrocode}
7096 %<*package|core>
7097 \def\bbl@version{<@version@>}
7098 \def\bbl@date{<@date@>}
7099 <@Define core switching macros@>
7100 % \end{macrocode}
7101 %
7102 % \macro{\adddialect}
7103 % The macro |\adddialect| can be used to add the name of a dialect
7104 % or variant language, for which an already defined hyphenation
7105 % table can be used.
7106 %
7107 % \begin{macrocode}
7108 \def\adddialect#1#2{%
7109 \global\chardef#1#2\relax
7110 \bbl@usehooks{adddialect}{{#1}{#2}}%
7111 \begingroup
7112 \count@#1\relax
7113 \def\bbl@elt##1##2##3##4{%
7114 \ifnum\count@=##2\relax
7115 \edef\bbl@tempa{\expandafter\@gobbletwo\string#1}%
7116 \bbl@info{Hyphen rules for '\expandafter\@gobble\bbl@tempa'
7117 set to \expandafter\string\csname l@##1\endcsname\\%
7118 (\string\language\the\count@). Reported}%
7119 \def\bbl@elt####1####2####3####4{}%
7120 \fi}%
7121 \bbl@cs{languages}%
7122 \endgroup}
7123 % \end{macrocode}
7124 %
7125 % |\bbl@iflanguage| executes code only if the language |l@| exists.
7126 % Otherwise raises an error.
7127 %
7128 % The argument of |\bbl@fixname| has to be a macro name, as it may get
7129 % “fixed” if casing (lc/uc) is wrong. It’s an attempt to fix a
7130 % long-standing bug when |\foreignlanguage| and the like appear in a
7131 % |\MakeXXXcase|. However, a lowercase form is not imposed to improve
7132 % backward compatibility (perhaps you defined a language named
7133 % |MYLANG|, but unfortunately mixed case names cannot be trapped). Note
7134 % |l@| is encapsulated, so that its case does not change.
7135 %
7136 % \begin{macrocode}
7137 \def\bbl@fixname#1{%
7138 \begingroup
7139 \def\bbl@tempe{l@}%
7140 \edef\bbl@tempd{\noexpand\@ifundefined{\noexpand\bbl@tempe#1}}%
7141 \bbl@tempd
7142 {\lowercase\expandafter{\bbl@tempd}%
7143 {\uppercase\expandafter{\bbl@tempd}%
7144 \@empty
7145 {\edef\bbl@tempd{\def\noexpand#1{#1}}%
7146 \uppercase\expandafter{\bbl@tempd}}}%
7147 {\edef\bbl@tempd{\def\noexpand#1{#1}}%
7148 \lowercase\expandafter{\bbl@tempd}}}%
7149 \@empty
7150 \edef\bbl@tempd{\endgroup\def\noexpand#1{#1}}%
7151 \bbl@tempd
7152 \bbl@exp{\\\bbl@usehooks{languagename}{{\languagename}{#1}}}}
7153 \def\bbl@iflanguage#1{%
7154 \@ifundefined{l@#1}{\@nolanerr{#1}\@gobble}\@firstofone}
7155 % \end{macrocode}
7156 %
7157 % After a name has been ‘fixed’, the selectors will try to load the
7158 % language. If even the fixed name is not defined, will load it on the
7159 % fly, either based on its name, or if activated, its BCP 47 code.
7160 %
7161 % We first need a couple of macros for a simple BCP 47 look up. It also
7162 % makes sure, with |\bbl@bcpcase|, casing is the correct one, so that
7163 % sr-latn-ba becomes fr-Latn-BA. Note |#4| may contain some
7164 % |\@empty|’s, but they are eventually removed.
7165 %
7166 % |\bbl@bcplookup| either returns the found |ini| tag or it is
7167 % |\relax|.
7168 %
7169 % \begin{macrocode}
7170 \def\bbl@bcpcase#1#2#3#4\@@#5{%
7171 \ifx\@empty#3%
7172 \uppercase{\def#5{#1#2}}%
7173 \else
7174 \uppercase{\def#5{#1}}%
7175 \lowercase{\edef#5{#5#2#3#4}}%
7176 \fi}
7177 \def\bbl@bcplookup#1-#2-#3-#4\@@{%
7178 \let\bbl@bcp\relax
7179 \lowercase{\def\bbl@tempa{#1}}%
7180 \ifx\@empty#2%
7181 \IfFileExists{babel-\[email protected]}{\let\bbl@bcp\bbl@tempa}{}%
7182 \else\ifx\@empty#3%
7183 \bbl@bcpcase#2\@empty\@empty\@@\bbl@tempb
7184 \IfFileExists{babel-\bbl@tempa-\[email protected]}%
7185 {\edef\bbl@bcp{\bbl@tempa-\bbl@tempb}}%
7186 {}%
7187 \ifx\bbl@bcp\relax
7188 \IfFileExists{babel-\[email protected]}{\let\bbl@bcp\bbl@tempa}{}%
7189 \fi
7190 \else
7191 \bbl@bcpcase#2\@empty\@empty\@@\bbl@tempb
7192 \bbl@bcpcase#3\@empty\@empty\@@\bbl@tempc
7193 \IfFileExists{babel-\bbl@tempa-\bbl@tempb-\[email protected]}%
7194 {\edef\bbl@bcp{\bbl@tempa-\bbl@tempb-\bbl@tempc}}%
7195 {}%
7196 \ifx\bbl@bcp\relax
7197 \IfFileExists{babel-\bbl@tempa-\[email protected]}%
7198 {\edef\bbl@bcp{\bbl@tempa-\bbl@tempc}}%
7199 {}%
7200 \fi
7201 \ifx\bbl@bcp\relax
7202 \IfFileExists{babel-\bbl@tempa-\[email protected]}%
7203 {\edef\bbl@bcp{\bbl@tempa-\bbl@tempc}}%
7204 {}%
7205 \fi
7206 \ifx\bbl@bcp\relax
7207 \IfFileExists{babel-\[email protected]}{\let\bbl@bcp\bbl@tempa}{}%
7208 \fi
7209 \fi\fi}
7210 \let\bbl@initoload\relax
7211 % \end{macrocode}
7212 %
7213 % \macro{\iflanguage}
7214 % Users might want to test (in a private package for instance)
7215 % which language is currently active. For this we provide a test
7216 % macro, |\iflanguage|, that has three arguments. It checks
7217 % whether the first argument is a known language. If so, it
7218 % compares the first argument with the value of |\language|. Then,
7219 % depending on the result of the comparison, it executes either the
7220 % second or the third argument.
7221 %
7222 % \begin{macrocode}
7223 \def\iflanguage#1{%
7224 \bbl@iflanguage{#1}{%
7225 \ifnum\csname l@#1\endcsname=\language
7226 \expandafter\@firstoftwo
7227 \else
7228 \expandafter\@secondoftwo
7229 \fi}}
7230 % \end{macrocode}
7231 %
7232 % \subsection{Selecting the language}
7233 %
7234 % \macro{\selectlanguage}
7235 %
7236 % It checks whether the language is
7237 % already defined before it performs its actual task, which is to
7238 % update |\language| and activate language-specific definitions.
7239 %
7240 % \begin{macrocode}
7241 \let\bbl@select@type\z@
7242 \edef\selectlanguage{%
7243 \noexpand\protect
7244 \expandafter\noexpand\csname selectlanguage \endcsname}
7245 % \end{macrocode}
7246 %
7247 % Because the command |\selectlanguage| could be used in a moving
7248 % argument it expands to \verb*=\protect\selectlanguage =.
7249 % Therefore, we have to make sure that a macro |\protect| exists.
7250 % If it doesn't it is |\let| to |\relax|.
7251 %
7252 % \begin{macrocode}
7253 \ifx\@undefined\protect\let\protect\relax\fi
7254 % \end{macrocode}
7255 %
7256 % The following definition is preserved for backwards compatibility
7257 % (e.g., \textsf{arabi}, \textsf{koma}). It is related to a trick for
7258 % 2.09, now discarded.
7259 %
7260 % \begin{macrocode}
7261 \let\xstring\string
7262 % \end{macrocode}
7263 %
7264 % Since version 3.5 \babel\ writes entries to the auxiliary files in
7265 % order to typeset table of contents etc. in the correct language
7266 % environment.
7267 %
7268 % \macro{\bbl@pop@language}
7269 %
7270 % \emph{But} when the language change happens \emph{inside} a group
7271 % the end of the group doesn't write anything to the auxiliary
7272 % files. Therefore we need \TeX’s |aftergroup| mechanism to help
7273 % us. The command |\aftergroup| stores the token immediately
7274 % following it to be executed when the current group is closed. So
7275 % we define a temporary control sequence |\bbl@pop@language| to be
7276 % executed at the end of the group. It calls |\bbl@set@language|
7277 % with the name of the current language as its argument.
7278 %
7279 % \macro{\bbl@language@stack}
7280 % The previous solution works for one level of nesting groups, but
7281 % as soon as more levels are used it is no longer adequate. For
7282 % that case we need to keep track of the nested languages using a
7283 % stack mechanism. This stack is called |\bbl@language@stack| and
7284 % initially empty.
7285 %
7286 % \begin{macrocode}
7287 \def\bbl@language@stack{}
7288 % \end{macrocode}
7289 %
7290 % When using a stack we need a mechanism to push an element on the
7291 % stack and to retrieve the information afterwards.
7292 %
7293 % \macro{\bbl@push@language}
7294 % \macro{\bbl@pop@language}
7295 % The stack is simply a list of languagenames, separated with a `+'
7296 % sign; the push function can be simple:
7297 %
7298 % \begin{macrocode}
7299 \def\bbl@push@language{%
7300 \ifx\languagename\@undefined\else
7301 \ifx\currentgrouplevel\@undefined
7302 \xdef\bbl@language@stack{\languagename+\bbl@language@stack}%
7303 \else
7304 \ifnum\currentgrouplevel=\z@
7305 \xdef\bbl@language@stack{\languagename+}%
7306 \else
7307 \xdef\bbl@language@stack{\languagename+\bbl@language@stack}%
7308 \fi
7309 \fi
7310 \fi}
7311 % \end{macrocode}
7312 %
7313 % Retrieving information from the stack is a little bit less simple, as
7314 % we need to remove the element from the stack while storing it in the
7315 % macro |\languagename|. For this we first define a helper function.
7316 %
7317 % \macro{\bbl@pop@lang}
7318 % This macro stores its first element (which is delimited by the
7319 % `+'-sign) in |\languagename| and stores the rest of the string in
7320 % |\bbl@language@stack|.
7321 %
7322 % \begin{macrocode}
7323 \def\bbl@pop@lang#1+#2\@@{%
7324 \edef\languagename{#1}%
7325 \xdef\bbl@language@stack{#2}}
7326 % \end{macrocode}
7327 %
7328 % The reason for the somewhat weird arrangement of arguments to the
7329 % helper function is the fact it is called in the following way.
7330 % This means that before |\bbl@pop@lang| is executed \TeX\ first
7331 % \emph{expands} the stack, stored in |\bbl@language@stack|. The
7332 % result of that is that the argument string of |\bbl@pop@lang|
7333 % contains one or more language names, each followed by a `+'-sign
7334 % (zero language names won't occur as this macro will only be
7335 % called after something has been pushed on the stack).
7336 %
7337 % \begin{macrocode}
7338 \let\bbl@ifrestoring\@secondoftwo
7339 \def\bbl@pop@language{%
7340 \expandafter\bbl@pop@lang\bbl@language@stack\@@
7341 \let\bbl@ifrestoring\@firstoftwo
7342 \expandafter\bbl@set@language\expandafter{\languagename}%
7343 \let\bbl@ifrestoring\@secondoftwo}
7344 % \end{macrocode}
7345 %
7346 % Once the name of the previous language is retrieved from the stack,
7347 % it is fed to |\bbl@set@language| to do the actual work of
7348 % switching everything that needs switching.
7349 %
7350 % An alternative way to identify languages (in the \babel{} sense)
7351 % with a numerical value is introduced in 3.30. This is one of the
7352 % first steps for a new interface based on the concept of locale,
7353 % which explains the name of |\localeid|. This means |\l@...| will be
7354 % reserved for hyphenation patterns (so that two locales can share the
7355 % same rules).
7356 %
7357 % \begin{macrocode}
7358 \chardef\localeid\z@
7359 \gdef\bbl@id@last{0} % No real need for a new counter
7360 \def\bbl@id@assign{%
7361 \bbl@ifunset{bbl@id@@\languagename}%
7362 {\count@\bbl@id@last\relax
7363 \advance\count@\@ne
7364 \global\bbl@csarg\chardef{id@@\languagename}\count@
7365 \xdef\bbl@id@last{\the\count@}%
7366 \ifcase\bbl@engine\or
7367 \directlua{
7368 Babel.locale_props[\bbl@id@last] = {}
7369 Babel.locale_props[\bbl@id@last].name = '\languagename'
7370 Babel.locale_props[\bbl@id@last].vars = {}
7371 }%
7372 \fi}%
7373 {}%
7374 \chardef\localeid\bbl@cl{id@}}
7375 % \end{macrocode}
7376 %
7377 % The unprotected part of |\selectlanguage|. In case it is used as
7378 % environment, declare |\endselectlaguage|, just for safety.
7379 %
7380 % \begin{macrocode}
7381 \let\bbl@select@opts\@empty
7382 \expandafter\def\csname selectlanguage \endcsname{%
7383 \@ifnextchar[\bbl@select@s{\bbl@select@s[]}}
7384 \def\bbl@select@s[#1]#2{%
7385 \def\bbl@select@opts{#1}%
7386 \ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\tw@\fi
7387 \bbl@push@language
7388 \aftergroup\bbl@pop@language
7389 \bbl@set@language{#2}}
7390 \let\endselectlanguage\relax
7391 % \end{macrocode}
7392 %
7393 % \macro{\bbl@set@language}
7394 %
7395 % The macro |\bbl@set@language| takes care of switching the language
7396 % environment \emph{and} of writing entries on the auxiliary files.
7397 % For historical reasons, language names can be either |language| of
7398 % |\language|. To catch either form a trick is used, but
7399 % unfortunately as a side effect the catcodes of letters in
7400 % |\languagename| are messed up. This is a bug, but preserved for
7401 % backwards compatibility. The list of auxiliary files can be
7402 % extended by redefining |\BabelContentsFiles|, but make sure they
7403 % are loaded inside a group (as |aux|, |toc|, |lof|, and |lot| do)
7404 % or the last language of the document will remain active
7405 % afterwards.
7406 %
7407 % We also write a command to change the current language in the
7408 % auxiliary files.
7409 %
7410 % |\bbl@savelastskip| is used to deal with skips before the write
7411 % whatsit (as suggested by U Fischer). Adapted from \textsf{hyperref},
7412 % but it might fail, so I'll consider it a temporary hack, while I
7413 % study other options (the ideal, but very likely unfeasible except
7414 % perhaps in \luatex, is to avoid the |\write| altogether when not
7415 % needed).
7416 %
7417 % \begin{macrocode}
7418 \def\BabelContentsFiles{toc,lof,lot}
7419 \def\bbl@set@language#1{% from selectlanguage, pop@
7420 % The old buggy way. Preserved for compatibility, but simplified
7421 \edef\languagename{\expandafter\string#1\@empty}%
7422 \select@language{\languagename}%
7423 \bbl@xin@{,main,}{,\bbl@select@opts,}%
7424 \ifin@
7425 \let\bbl@main@language\localename
7426 \let\mainlocalename\localename
7427 \fi
7428 \let\bbl@select@opts\@empty
7429 % write to aux files
7430 \expandafter\ifx\csname date\languagename\endcsname\relax\else
7431 \if@filesw
7432 \bbl@xin@{,nofiles,}{,\bbl@select@opts,}%
7433 \ifin@\else
7434 \ifx\babel@aux\@gobbletwo\else % Set if single in the first, redundant
7435 \bbl@savelastskip
7436 \protected@write\@auxout{}{\string\babel@aux{\bbl@auxname}{}}%
7437 \bbl@restorelastskip
7438 \fi
7439 \bbl@usehooks{write}{}%
7440 \fi
7441 \fi
7442 \fi}
7443 %
7444 \let\bbl@restorelastskip\relax
7445 \let\bbl@savelastskip\relax
7446 %
7447 \def\select@language#1{% from set@, babel@aux, babel@toc
7448 \ifx\bbl@selectorname\@empty
7449 \def\bbl@selectorname{select}%
7450 \fi
7451 % set hymap
7452 \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi
7453 % set name (when coming from babel@aux)
7454 \edef\languagename{#1}%
7455 \bbl@fixname\languagename
7456 % define \localename when coming from set@, with a trick
7457 \ifx\scantokens\@undefined
7458 \def\localename{??}%
7459 \else
7460 \bbl@exp{\\\scantokens{\def\\\localename{\languagename}\\\noexpand}\relax}%
7461 \fi
7462 \bbl@provide@locale
7463 \bbl@iflanguage\languagename{%
7464 \let\bbl@select@type\z@
7465 \expandafter\bbl@switch\expandafter{\languagename}}}
7466 \def\babel@aux#1#2{%
7467 \select@language{#1}%
7468 \bbl@foreach\BabelContentsFiles{% \relax -> don't assume vertical mode
7469 \@writefile{##1}{\babel@toc{#1}{#2}\relax}}}%
7470 \def\babel@toc#1#2{%
7471 \select@language{#1}}
7472 % \end{macrocode}
7473 %
7474 % First, check if the user asks for a known language. If so,
7475 % update the value of |\language| and call |\originalTeX|
7476 % to bring \TeX\ in a certain pre-defined state.
7477 %
7478 % The name of the language is stored in the control sequence
7479 % |\languagename|.
7480 %
7481 % Then we have to \emph{re}define |\originalTeX| to compensate for
7482 % the things that have been activated. To save memory space for
7483 % the macro definition of |\originalTeX|, we construct the control
7484 % sequence name for the |\noextras|\langvar\ command at definition
7485 % time by expanding the |\csname| primitive.
7486 %
7487 % Now activate the language-specific definitions. This is done by
7488 % constructing the names of three macros by concatenating three
7489 % words with the argument of |\selectlanguage|, and calling these
7490 % macros. \nb{What if \cs{hyphenation} was used in |extras|? Patch
7491 % temporarily |\set@hyphenmins| and hyphenation. It can be done in
7492 % hooks if necessary.}
7493 %
7494 % The switching of the values of |\lefthyphenmin| and
7495 % |\righthyphenmin| is somewhat different. First we save their
7496 % current values, then we check if |\|\langvar|hyphenmins| is
7497 % defined. If it is not, we set default values (2 and 3), otherwise
7498 % the values in |\|\langvar|hyphenmins| will be used.
7499 %
7500 % No text is supposed to be added with switching captions and date, so
7501 % we remove any spurious spaces with |\bbl@bsphack| and |\bbl@esphack|.
7502 %
7503 % \begin{macrocode}
7504 \newif\ifbbl@usedategroup
7505 \let\bbl@savedextras\@empty
7506 \def\bbl@switch#1{% from select@, foreign@
7507 % restore
7508 \originalTeX
7509 \expandafter\def\expandafter\originalTeX\expandafter{%
7510 \csname noextras#1\endcsname
7511 \let\originalTeX\@empty
7512 \babel@beginsave}%
7513 \bbl@usehooks{afterreset}{}%
7514 \languageshorthands{none}%
7515 % set the locale id
7516 \bbl@id@assign
7517 % switch captions, date
7518 \bbl@bsphack
7519 \ifcase\bbl@select@type
7520 \csname captions#1\endcsname\relax
7521 \csname date#1\endcsname\relax
7522 \else
7523 \bbl@xin@{,captions,}{,\bbl@select@opts,}%
7524 \ifin@
7525 \csname captions#1\endcsname\relax
7526 \fi
7527 \bbl@xin@{,date,}{,\bbl@select@opts,}%
7528 \ifin@ % if \foreign... within \<language>date
7529 \csname date#1\endcsname\relax
7530 \fi
7531 \fi
7532 \bbl@esphack
7533 % switch extras
7534 \csname bbl@preextras@#1\endcsname
7535 \bbl@usehooks{beforeextras}{}%
7536 \csname extras#1\endcsname\relax
7537 \bbl@usehooks{afterextras}{}%
7538 % > babel-ensure
7539 % > babel-sh-<short>
7540 % > babel-bidi
7541 % > babel-fontspec
7542 \let\bbl@savedextras\@empty
7543 % hyphenation - case mapping
7544 \ifcase\bbl@opt@hyphenmap\or
7545 \def\BabelLower##1##2{\lccode##1=##2\relax}%
7546 \ifnum\bbl@hymapsel>4\else
7547 \csname\languagename @bbl@hyphenmap\endcsname
7548 \fi
7549 \chardef\bbl@opt@hyphenmap\z@
7550 \else
7551 \ifnum\bbl@hymapsel>\bbl@opt@hyphenmap\else
7552 \csname\languagename @bbl@hyphenmap\endcsname
7553 \fi
7554 \fi
7555 \let\bbl@hymapsel\@cclv
7556 % hyphenation - select rules
7557 \ifnum\csname l@\languagename\endcsname=\l@unhyphenated
7558 \edef\bbl@tempa{u}%
7559 \else
7560 \edef\bbl@tempa{\bbl@cl{lnbrk}}%
7561 \fi
7562 % linebreaking - handle u, e, k (v in the future)
7563 \bbl@xin@{/u}{/\bbl@tempa}%
7564 \ifin@\else\bbl@xin@{/e}{/\bbl@tempa}\fi % elongated forms
7565 \ifin@\else\bbl@xin@{/k}{/\bbl@tempa}\fi % only kashida
7566 \ifin@\else\bbl@xin@{/p}{/\bbl@tempa}\fi % padding (e.g., Tibetan)
7567 \ifin@\else\bbl@xin@{/v}{/\bbl@tempa}\fi % variable font
7568 % hyphenation - save mins
7569 \babel@savevariable\lefthyphenmin
7570 \babel@savevariable\righthyphenmin
7571 \ifnum\bbl@engine=\@ne
7572 \babel@savevariable\hyphenationmin
7573 \fi
7574 \ifin@
7575 % unhyphenated/kashida/elongated/padding = allow stretching
7576 \language\l@unhyphenated
7577 \babel@savevariable\emergencystretch
7578 \emergencystretch\maxdimen
7579 \babel@savevariable\hbadness
7580 \hbadness\@M
7581 \else
7582 % other = select patterns
7583 \bbl@patterns{#1}%
7584 \fi
7585 % hyphenation - set mins
7586 \expandafter\ifx\csname #1hyphenmins\endcsname\relax
7587 \set@hyphenmins\tw@\thr@@\relax
7588 \@nameuse{bbl@hyphenmins@}%
7589 \else
7590 \expandafter\expandafter\expandafter\set@hyphenmins
7591 \csname #1hyphenmins\endcsname\relax
7592 \fi
7593 \@nameuse{bbl@hyphenmins@}%
7594 \@nameuse{bbl@hyphenmins@\languagename}%
7595 \@nameuse{bbl@hyphenatmin@}%
7596 \@nameuse{bbl@hyphenatmin@\languagename}%
7597 \let\bbl@selectorname\@empty}
7598 % \end{macrocode}
7599 %
7600 % \environment{otherlanguage}
7601 % It can be used as an alternative to
7602 % using the |\selectlanguage| declarative command. The |\ignorespaces|
7603 % command is necessary to hide the environment when it is entered in
7604 % horizontal mode.
7605 %
7606 % \begin{macrocode}
7607 \edef\otherlanguage{%
7608 \noexpand\protect
7609 \expandafter\noexpand\csname otherlanguage \endcsname}
7610 \expandafter\def\csname otherlanguage \endcsname{%
7611 \@ifstar{\@nameuse{otherlanguage*}}\bbl@otherlanguage}
7612 \def\bbl@otherlanguage#1{%
7613 \def\bbl@selectorname{other}%
7614 \ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\thr@@\fi
7615 \csname selectlanguage \endcsname{#1}%
7616 \ignorespaces}
7617 % \end{macrocode}
7618 %
7619 % The |\endotherlanguage| part of the environment tries to hide
7620 % itself when it is called in horizontal mode.
7621 %
7622 % \begin{macrocode}
7623 \long\def\endotherlanguage{\@ignoretrue\ignorespaces}
7624 % \end{macrocode}
7625 %
7626 % \environment{otherlanguage*}
7627 % It is meant to be used when a
7628 % large part of text from a different language needs to be typeset,
7629 % but without changing the translation of words such as `figure'.
7630 % It makes use of |\foreign@language|.
7631 %
7632 % \begin{macrocode}
7633 \expandafter\def\csname otherlanguage*\endcsname{%
7634 \@ifnextchar[\bbl@otherlanguage@s{\bbl@otherlanguage@s[]}}
7635 \def\bbl@otherlanguage@s[#1]#2{%
7636 \def\bbl@selectorname{other*}%
7637 \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi
7638 \def\bbl@select@opts{#1}%
7639 \foreign@language{#2}}
7640 % \end{macrocode}
7641 %
7642 % At the end of the environment we need to switch off the extra
7643 % definitions. The grouping mechanism of the environment will take
7644 % care of resetting the correct hyphenation rules and “extras”.
7645 %
7646 % \begin{macrocode}
7647 \expandafter\let\csname endotherlanguage*\endcsname\relax
7648 % \end{macrocode}
7649 %
7650 % \macro{\foreignlanguage}
7651 %
7652 % This command takes two arguments, the first argument is the name of
7653 % the language to use for typesetting the text specified in the second
7654 % argument.
7655 %
7656 % Unlike |\selectlanguage| this command doesn't switch
7657 % \emph{everything}, it only switches the hyphenation rules and the
7658 % extra definitions for the language specified. It does this within
7659 % a group and assumes the |\extras|\langvar\ command doesn't make
7660 % any |\global| changes. The coding is very similar to part of
7661 % |\selectlanguage|.
7662 %
7663 % |\bbl@beforeforeign| is a trick to fix a bug in bidi
7664 % texts. |\foreignlanguage| is supposed to be a `text' command, and
7665 % therefore it must emit a |\leavevmode|, but it does not, and
7666 % therefore the indent is placed on the opposite margin. For
7667 % backward compatibility, however, it is done only if a
7668 % right-to-left script is requested; otherwise, it is no-op.
7669 %
7670 % (3.11) |\foreignlanguage*| is a temporary, experimental macro for
7671 % a few lines with a different script direction, while preserving
7672 % the paragraph format (thank the braces around |\par|, things like
7673 % |\hangindent| are not reset). Do not use it in production,
7674 % because its semantics and its syntax may change (and very likely
7675 % will, or even it could be removed altogether). Currently it
7676 % enters in vmode and then selects the language (which in turn sets the
7677 % paragraph direction).
7678 %
7679 % (3.11) Also experimental are the hook |foreign| and |foreign*|.
7680 % With them you can redefine |\BabelText| which by default does
7681 % nothing. Its behavior is not well defined yet. So, use it in
7682 % horizontal mode only if you do not want surprises.
7683 %
7684 % In other words, at the beginning of a paragraph |\foreignlanguage|
7685 % enters into hmode with the surrounding lang, and with
7686 % |\foreignlanguage*| with the new lang.
7687 %
7688 % \begin{macrocode}
7689 \providecommand\bbl@beforeforeign{}
7690 \edef\foreignlanguage{%
7691 \noexpand\protect
7692 \expandafter\noexpand\csname foreignlanguage \endcsname}
7693 \expandafter\def\csname foreignlanguage \endcsname{%
7694 \@ifstar\bbl@foreign@s\bbl@foreign@x}
7695 \providecommand\bbl@foreign@x[3][]{%
7696 \begingroup
7697 \def\bbl@selectorname{foreign}%
7698 \def\bbl@select@opts{#1}%
7699 \let\BabelText\@firstofone
7700 \bbl@beforeforeign
7701 \foreign@language{#2}%
7702 \bbl@usehooks{foreign}{}%
7703 \BabelText{#3}% Now in horizontal mode!
7704 \endgroup}
7705 \def\bbl@foreign@s#1#2{%
7706 \begingroup
7707 {\par}%
7708 \def\bbl@selectorname{foreign*}%
7709 \let\bbl@select@opts\@empty
7710 \let\BabelText\@firstofone
7711 \foreign@language{#1}%
7712 \bbl@usehooks{foreign*}{}%
7713 \bbl@dirparastext
7714 \BabelText{#2}% Still in vertical mode!
7715 {\par}%
7716 \endgroup}
7717 \providecommand\BabelWrapText[1]{%
7718 \def\bbl@tempa{\def\BabelText####1}%
7719 \expandafter\bbl@tempa\expandafter{\BabelText{#1}}}
7720 % \end{macrocode}
7721 %
7722 % \macro{\foreign@language}
7723 %
7724 % This macro does the work for |\foreignlanguage| and the
7725 % \Lenv{otherlanguage*} environment. First we need to store the name
7726 % of the language and check that it is a known language. Then it
7727 % just calls |bbl@switch|.
7728 %
7729 % \begin{macrocode}
7730 \def\foreign@language#1{%
7731 % set name
7732 \edef\languagename{#1}%
7733 \ifbbl@usedategroup
7734 \bbl@add\bbl@select@opts{,date,}%
7735 \bbl@usedategroupfalse
7736 \fi
7737 \bbl@fixname\languagename
7738 \let\localename\languagename
7739 \bbl@provide@locale
7740 \bbl@iflanguage\languagename{%
7741 \let\bbl@select@type\@ne
7742 \expandafter\bbl@switch\expandafter{\languagename}}}
7743 % \end{macrocode}
7744 %
7745 % The following macro executes conditionally some code based on the
7746 % selector being used.
7747 %
7748 % \begin{macrocode}
7749 \def\IfBabelSelectorTF#1{%
7750 \bbl@xin@{,\bbl@selectorname,}{,\zap@space#1 \@empty,}%
7751 \ifin@
7752 \expandafter\@firstoftwo
7753 \else
7754 \expandafter\@secondoftwo
7755 \fi}
7756 % \end{macrocode}
7757 %
7758 % \macro{\bbl@patterns}
7759 %
7760 % This macro selects the hyphenation patterns by changing the
7761 % \cs{language} register. If special hyphenation patterns
7762 % are available specifically for the current font encoding,
7763 % use them instead of the default.
7764 %
7765 % It also sets hyphenation exceptions, but only once, because they
7766 % are global (here language |\lccode|’s has been set, too).
7767 % |\bbl@hyphenation@| is set to relax until the very first
7768 % |\babelhyphenation|, so do nothing with this value. If the
7769 % exceptions for a language (by its number, not its name, so that
7770 % |:ENC| is taken into account) has been set, then use
7771 % |\hyphenation| with both global and language exceptions and empty
7772 % the latter to mark they must not be set again.
7773 %
7774 % \begin{macrocode}
7775 \let\bbl@hyphlist\@empty
7776 \let\bbl@hyphenation@\relax
7777 \let\bbl@pttnlist\@empty
7778 \let\bbl@patterns@\relax
7779 \let\bbl@hymapsel=\@cclv
7780 \def\bbl@patterns#1{%
7781 \language=\expandafter\ifx\csname l@#1:\f@encoding\endcsname\relax
7782 \csname l@#1\endcsname
7783 \edef\bbl@tempa{#1}%
7784 \else
7785 \csname l@#1:\f@encoding\endcsname
7786 \edef\bbl@tempa{#1:\f@encoding}%
7787 \fi
7788 \@expandtwoargs\bbl@usehooks{patterns}{{#1}{\bbl@tempa}}%
7789 % > luatex
7790 \@ifundefined{bbl@hyphenation@}{}{% Can be \relax!
7791 \begingroup
7792 \bbl@xin@{,\number\language,}{,\bbl@hyphlist}%
7793 \ifin@\else
7794 \@expandtwoargs\bbl@usehooks{hyphenation}{{#1}{\bbl@tempa}}%
7795 \hyphenation{%
7796 \bbl@hyphenation@
7797 \@ifundefined{bbl@hyphenation@#1}%
7798 \@empty
7799 {\space\csname bbl@hyphenation@#1\endcsname}}%
7800 \xdef\bbl@hyphlist{\bbl@hyphlist\number\language,}%
7801 \fi
7802 \endgroup}}
7803 % \end{macrocode}
7804 %
7805 % \environment{hyphenrules}
7806 %
7807 % It can be used to select
7808 % \emph{just} the hyphenation rules. It does
7809 % \emph{not} change |\languagename| and when the hyphenation rules
7810 % specified were not loaded it has no effect. Note however,
7811 % |\lccode|’s and font encodings are not set at all, so in most
7812 % cases you should use |otherlanguage*|.
7813 %
7814 % \begin{macrocode}
7815 \def\hyphenrules#1{%
7816 \edef\bbl@tempf{#1}%
7817 \bbl@fixname\bbl@tempf
7818 \bbl@iflanguage\bbl@tempf{%
7819 \expandafter\bbl@patterns\expandafter{\bbl@tempf}%
7820 \ifx\languageshorthands\@undefined\else
7821 \languageshorthands{none}%
7822 \fi
7823 \expandafter\ifx\csname\bbl@tempf hyphenmins\endcsname\relax
7824 \set@hyphenmins\tw@\thr@@\relax
7825 \else
7826 \expandafter\expandafter\expandafter\set@hyphenmins
7827 \csname\bbl@tempf hyphenmins\endcsname\relax
7828 \fi}}
7829 \let\endhyphenrules\@empty
7830 % \end{macrocode}
7831 %
7832 % \macro{\providehyphenmins}
7833 % The macro |\providehyphenmins| should be used in the language
7834 % definition files to provide a \emph{default} setting for the
7835 % hyphenation parameters |\lefthyphenmin| and |\righthyphenmin|. If
7836 % the macro |\|\langvar|hyphenmins| is already defined this command
7837 % has no effect.
7838 %
7839 % \begin{macrocode}
7840 \def\providehyphenmins#1#2{%
7841 \expandafter\ifx\csname #1hyphenmins\endcsname\relax
7842 \@namedef{#1hyphenmins}{#2}%
7843 \fi}
7844 % \end{macrocode}
7845 %
7846 % \macro{\set@hyphenmins}
7847 % This macro sets the values of |\lefthyphenmin| and |\righthyphenmin|.
7848 % It expects two values as its argument.
7849 %
7850 % \begin{macrocode}
7851 \def\set@hyphenmins#1#2{%
7852 \lefthyphenmin#1\relax
7853 \righthyphenmin#2\relax}
7854 % \end{macrocode}
7855 %
7856 % \macro{\ProvidesLanguage}
7857 % The identification code for each file is something that was
7858 % introduced in \LaTeXe. When the command |\ProvidesFile| does not
7859 % exist, a dummy definition is provided temporarily. For use in the
7860 % language definition file the command |\ProvidesLanguage| is
7861 % defined by \babel.
7862 %
7863 % Depending on the format, i.e., or if the former is defined, we use
7864 % a similar definition or not.
7865 %
7866 % \begin{macrocode}
7867 \ifx\ProvidesFile\@undefined
7868 \def\ProvidesLanguage#1[#2 #3 #4]{%
7869 \wlog{Language: #1 #4 #3 <#2>}%
7870 }
7871 \else
7872 \def\ProvidesLanguage#1{%
7873 \begingroup
7874 \catcode`\ 10 %
7875 \@makeother\/%
7876 \@ifnextchar[%]
7877 {\@provideslanguage{#1}}{\@provideslanguage{#1}[]}}
7878 \def\@provideslanguage#1[#2]{%
7879 \wlog{Language: #1 #2}%
7880 \expandafter\xdef\csname ver@#1.ldf\endcsname{#2}%
7881 \endgroup}
7882 \fi
7883 % \end{macrocode}
7884 %
7885 % \macro{\originalTeX}
7886 % The macro|\originalTeX| should be known to \TeX\ at this moment. As
7887 % it has to be expandable we |\let| it to |\@empty| instead of
7888 % |\relax|.
7889 %
7890 % \begin{macrocode}
7891 \ifx\originalTeX\@undefined\let\originalTeX\@empty\fi
7892 % \end{macrocode}
7893 %
7894 % Because this part of the code can be included in a format, we make
7895 % sure that the macro which initializes the save mechanism,
7896 % |\babel@beginsave|, is not considered to be undefined.
7897 %
7898 % \begin{macrocode}
7899 \ifx\babel@beginsave\@undefined\let\babel@beginsave\relax\fi
7900 % \end{macrocode}
7901 %
7902 % A few macro names are reserved for future releases of \babel, which
7903 % will use the concept of `locale':
7904 %
7905 % \begin{macrocode}
7906 \providecommand\setlocale{\bbl@error{not-yet-available}{}{}{}}
7907 \let\uselocale\setlocale
7908 \let\locale\setlocale
7909 \let\selectlocale\setlocale
7910 \let\textlocale\setlocale
7911 \let\textlanguage\setlocale
7912 \let\languagetext\setlocale
7913 % \end{macrocode}
7914 %
7915 % \subsection{Errors}
7916 %
7917 % \macro{\@nolanerr}
7918 % \macro{\@nopatterns}
7919 %
7920 % The \babel\ package will signal an error when a documents tries
7921 % to select a language that hasn't been defined earlier. When a
7922 % user selects a language for which no hyphenation patterns were
7923 % loaded into the format he will be given a warning about that
7924 % fact. We revert to the patterns for |\language|=0 in that case.
7925 % In most formats that will be (US)english, but it might also be
7926 % empty.
7927 %
7928 % \macro{\@noopterr}
7929 % When the package was loaded without options not everything will
7930 % work as expected. An error message is issued in that case.
7931 %
7932 % When the format knows about |\PackageError| it must be \LaTeXe,
7933 % so we can safely use its error handling interface. Otherwise
7934 % we'll have to `keep it simple'.
7935 %
7936 % Infos are not written to the console, but on the other hand many
7937 % people think warnings are errors, so a further message type is
7938 % defined: an important info which is sent to the console.
7939 %
7940 % \begin{macrocode}
7941 \edef\bbl@nulllanguage{\string\language=0}
7942 \def\bbl@nocaption{\protect\bbl@nocaption@i}
7943 \def\bbl@nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
7944 \global\@namedef{#2}{\textbf{?#1?}}%
7945 \@nameuse{#2}%
7946 \edef\bbl@tempa{#1}%
7947 \bbl@sreplace\bbl@tempa{name}{}%
7948 \bbl@sreplace\bbl@tempa{NAME}{}%
7949 \bbl@warning{%
7950 \@backslashchar#1 not set for '\languagename'. Please,\\%
7951 define it after the language has been loaded\\%
7952 (typically in the preamble) with:\\%
7953 \string\setlocalecaption{\languagename}{\bbl@tempa}{..}\\%
7954 Feel free to contribute on github.com/latex3/babel.\\%
7955 Reported}}
7956 \def\bbl@tentative{\protect\bbl@tentative@i}
7957 \def\bbl@tentative@i#1{%
7958 \bbl@warning{%
7959 Some functions for '#1' are tentative.\\%
7960 They might not work as expected and their behavior\\%
7961 could change in the future.\\%
7962 Reported}}
7963 \def\@nolanerr#1{\bbl@error{undefined-language}{#1}{}{}}
7964 \def\@nopatterns#1{%
7965 \bbl@warning
7966 {No hyphenation patterns were preloaded for\\%
7967 the language '#1' into the format.\\%
7968 Please, configure your TeX system to add them and\\%
7969 rebuild the format. Now I will use the patterns\\%
7970 preloaded for \bbl@nulllanguage\space instead}}
7971 \let\bbl@usehooks\@gobbletwo
7972 % \end{macrocode}
7973 %
7974 % Here ended the now discarded |switch.def|.
7975 %
7976 % Here also (currently) ends the \textsf{base} option.
7977 %
7978 % \begin{macrocode}
7979 \ifx\bbl@onlyswitch\@empty\endinput\fi
7980 % \end{macrocode}
7981 %
7982 % \subsection{More on selection}
7983 %
7984 % \macro{\babelensure}
7985 %
7986 % The user command just parses the optional argument and creates a
7987 % new macro named |\bbl@e@<language>|. We register a hook at the
7988 % |afterextras| event which just executes this macro in a
7989 % “complete” selection (which, if undefined, is |\relax| and does
7990 % nothing). This part is somewhat involved because we have to make
7991 % sure things are expanded the correct number of times.
7992 %
7993 % The macro |\bbl@e@<language>| contains
7994 % |\bbl@ensure|\marg{include}\marg{exclude}\marg{fontenc}, which in in
7995 % turn loops over the macros names in |\bbl@captionslist|, excluding
7996 % (with the help of |\in@|) those in the |exclude| list. If the
7997 % |fontenc| is given (and not |\relax|), the |\fontencoding| is also
7998 % added. Then we loop over the |include| list, but if the macro
7999 % already contains |\foreignlanguage|, nothing is done. Note this
8000 % macro (1) is not restricted to the preamble, and (2) changes are
8001 % local.
8002 %
8003 % \begin{macrocode}
8004 \bbl@trace{Defining babelensure}
8005 \newcommand\babelensure[2][]{%
8006 \AddBabelHook{babel-ensure}{afterextras}{%
8007 \ifcase\bbl@select@type
8008 \bbl@cl{e}%
8009 \fi}%
8010 \begingroup
8011 \let\bbl@ens@include\@empty
8012 \let\bbl@ens@exclude\@empty
8013 \def\bbl@ens@fontenc{\relax}%
8014 \def\bbl@tempb##1{%
8015 \ifx\@empty##1\else\noexpand##1\expandafter\bbl@tempb\fi}%
8016 \edef\bbl@tempa{\bbl@tempb#1\@empty}%
8017 \def\bbl@tempb##1=##2\@@{\@namedef{bbl@ens@##1}{##2}}%
8018 \bbl@foreach\bbl@tempa{\bbl@tempb##1\@@}%
8019 \def\bbl@tempc{\bbl@ensure}%
8020 \expandafter\bbl@add\expandafter\bbl@tempc\expandafter{%
8021 \expandafter{\bbl@ens@include}}%
8022 \expandafter\bbl@add\expandafter\bbl@tempc\expandafter{%
8023 \expandafter{\bbl@ens@exclude}}%
8024 \toks@\expandafter{\bbl@tempc}%
8025 \bbl@exp{%
8026 \endgroup
8027 \def\<bbl@e@#2>{\the\toks@{\bbl@ens@fontenc}}}}
8028 \def\bbl@ensure#1#2#3{% 1: include 2: exclude 3: fontenc
8029 \def\bbl@tempb##1{% elt for (excluding) \bbl@captionslist list
8030 \ifx##1\@undefined % 3.32 - Don't assume the macro exists
8031 \edef##1{\noexpand\bbl@nocaption
8032 {\bbl@stripslash##1}{\languagename\bbl@stripslash##1}}%
8033 \fi
8034 \ifx##1\@empty\else
8035 \in@{##1}{#2}%
8036 \ifin@\else
8037 \let\bbl@tempc\languagename
8038 \bbl@replace\bbl@tempc{-}{@@}%
8039 \bbl@ifunset{bbl@ensure@\bbl@tempc}%
8040 {\bbl@exp{%
8041 \\\DeclareRobustCommand\<bbl@ensure@\bbl@tempc>[1]{%
8042 \\\foreignlanguage{\languagename}%
8043 {\ifx\relax#3\else
8044 \\\fontencoding{#3}\\\selectfont
8045 \fi
8046 ########1}}}}%
8047 {}%
8048 \toks@\expandafter{##1}%
8049 \edef##1{%
8050 \bbl@csarg\noexpand{ensure@\bbl@tempc}%
8051 {\the\toks@}}%
8052 \fi
8053 \expandafter\bbl@tempb
8054 \fi}%
8055 \expandafter\bbl@tempb\bbl@captionslist\today\@empty
8056 \def\bbl@tempa##1{% elt for include list
8057 \ifx##1\@empty\else
8058 \let\bbl@tempc\languagename
8059 \bbl@replace\bbl@tempc{-}{@@}%
8060 \bbl@csarg\in@{ensure@\bbl@tempc\expandafter}\expandafter{##1}%
8061 \ifin@\else
8062 \bbl@tempb##1\@empty
8063 \fi
8064 \expandafter\bbl@tempa
8065 \fi}%
8066 \bbl@tempa#1\@empty}
8067 \def\bbl@captionslist{%
8068 \prefacename\refname\abstractname\bibname\chaptername\appendixname
8069 \contentsname\listfigurename\listtablename\indexname\figurename
8070 \tablename\partname\enclname\ccname\headtoname\pagename\seename
8071 \alsoname\proofname\glossaryname}
8072 % \end{macrocode}
8073 %
8074 % \subsection{Short tags}
8075 %
8076 % \macro{\babeltags}
8077 % This macro is straightforward. After zapping spaces, we
8078 % loop over the list and define the macros |\text<tag>| and
8079 % |\<tag>|. Definitions are first expanded so that they don't
8080 % contain |\csname| but the actual macro.
8081 %
8082 % \begin{macrocode}
8083 \bbl@trace{Short tags}
8084 \newcommand\babeltags[1]{%
8085 \edef\bbl@tempa{\zap@space#1 \@empty}%
8086 \def\bbl@tempb##1=##2\@@{%
8087 \edef\bbl@tempc{%
8088 \noexpand\newcommand
8089 \expandafter\noexpand\csname ##1\endcsname{%
8090 \noexpand\protect
8091 \expandafter\noexpand\csname otherlanguage*\endcsname{##2}}
8092 \noexpand\newcommand
8093 \expandafter\noexpand\csname text##1\endcsname{%
8094 \noexpand\foreignlanguage{##2}}}
8095 \bbl@tempc}%
8096 \bbl@for\bbl@tempa\bbl@tempa{%
8097 \expandafter\bbl@tempb\bbl@tempa\@@}}
8098 % \end{macrocode}
8099 %
8100 % \subsection{Compatibility with language.def}
8101 %
8102 % Plain e-\TeX{} doesn’t rely on language.dat, but babel can be made
8103 % compatible with this format easily.
8104 %
8105 % \begin{macrocode}
8106 \bbl@trace{Compatibility with language.def}
8107 \ifx\directlua\@undefined\else
8108 \ifx\bbl@luapatterns\@undefined
8109 \input luababel.def
8110 \fi
8111 \fi
8112 \ifx\bbl@languages\@undefined
8113 \ifx\directlua\@undefined
8114 \openin1 = language.def
8115 \ifeof1
8116 \closein1
8117 \message{I couldn't find the file language.def}
8118 \else
8119 \closein1
8120 \begingroup
8121 \def\addlanguage#1#2#3#4#5{%
8122 \expandafter\ifx\csname lang@#1\endcsname\relax\else
8123 \global\expandafter\let\csname l@#1\expandafter\endcsname
8124 \csname lang@#1\endcsname
8125 \fi}%
8126 \def\uselanguage#1{}%
8127 \input language.def
8128 \endgroup
8129 \fi
8130 \fi
8131 \chardef\l@english\z@
8132 \fi
8133 % \end{macrocode}
8134 %
8135 % \macro{\addto}
8136 % It takes two arguments, a \meta{control sequence} and \TeX-code to
8137 % be added to the \meta{control sequence}.
8138 %
8139 % If the \meta{control sequence} has not been defined before it is
8140 % defined now. The control sequence could also expand to |\relax|,
8141 % in which case a circular definition results. The net result is a
8142 % stack overflow. Note there is an inconsistency, because the
8143 % assignment in the last branch is global.
8144 %
8145 % \begin{macrocode}
8146 \def\addto#1#2{%
8147 \ifx#1\@undefined
8148 \def#1{#2}%
8149 \else
8150 \ifx#1\relax
8151 \def#1{#2}%
8152 \else
8153 {\toks@\expandafter{#1#2}%
8154 \xdef#1{\the\toks@}}%
8155 \fi
8156 \fi}
8157 % \end{macrocode}
8158 %
8159 % \subsection{Hooks}
8160 %
8161 % Admittedly, the current implementation is a somewhat simplistic and
8162 % does very little to catch errors, but it is meant for developers,
8163 % after all. |\bbl@usehooks| is the commands used by \babel{} to execute
8164 % hooks defined for an event.
8165 %
8166 % \begin{macrocode}
8167 \bbl@trace{Hooks}
8168 \newcommand\AddBabelHook[3][]{%
8169 \bbl@ifunset{bbl@hk@#2}{\EnableBabelHook{#2}}{}%
8170 \def\bbl@tempa##1,#3=##2,##3\@empty{\def\bbl@tempb{##2}}%
8171 \expandafter\bbl@tempa\bbl@evargs,#3=,\@empty
8172 \bbl@ifunset{bbl@ev@#2@#3@#1}%
8173 {\bbl@csarg\bbl@add{ev@#3@#1}{\bbl@elth{#2}}}%
8174 {\bbl@csarg\let{ev@#2@#3@#1}\relax}%
8175 \bbl@csarg\newcommand{ev@#2@#3@#1}[\bbl@tempb]}
8176 \newcommand\EnableBabelHook[1]{\bbl@csarg\let{hk@#1}\@firstofone}
8177 \newcommand\DisableBabelHook[1]{\bbl@csarg\let{hk@#1}\@gobble}
8178 \def\bbl@usehooks{\bbl@usehooks@lang\languagename}
8179 \def\bbl@usehooks@lang#1#2#3{% Test for Plain
8180 \ifx\UseHook\@undefined\else\UseHook{babel/*/#2}\fi
8181 \def\bbl@elth##1{%
8182 \bbl@cs{hk@##1}{\bbl@cs{ev@##1@#2@}#3}}%
8183 \bbl@cs{ev@#2@}%
8184 \ifx\languagename\@undefined\else % Test required for Plain (?)
8185 \ifx\UseHook\@undefined\else\UseHook{babel/#1/#2}\fi
8186 \def\bbl@elth##1{%
8187 \bbl@cs{hk@##1}{\bbl@cs{ev@##1@#2@#1}#3}}%
8188 \bbl@cs{ev@#2@#1}%
8189 \fi}
8190 % \end{macrocode}
8191 %
8192 % To ensure forward compatibility, arguments in hooks are set
8193 % implicitly. So, if a further argument is added in the future,
8194 % there is no need to change the existing code. Note events
8195 % intended for \textsf{hyphen.cfg} are also loaded (just in
8196 % case you need them for some reason).
8197 %
8198 % \begin{macrocode}
8199 \def\bbl@evargs{,% <- don't delete this comma
8200 everylanguage=1,loadkernel=1,loadpatterns=1,loadexceptions=1,%
8201 adddialect=2,patterns=2,defaultcommands=0,encodedcommands=2,write=0,%
8202 beforeextras=0,afterextras=0,stopcommands=0,stringprocess=0,%
8203 hyphenation=2,initiateactive=3,afterreset=0,foreign=0,foreign*=0,%
8204 beforestart=0,languagename=2,begindocument=1}
8205 \ifx\NewHook\@undefined\else % Test for Plain (?)
8206 \def\bbl@tempa#1=#2\@@{\NewHook{babel/#1}}
8207 \bbl@foreach\bbl@evargs{\bbl@tempa#1\@@}
8208 \fi
8209 % \end{macrocode}
8210 %
8211 % Since the following command is meant for a hook (although a \LaTeX{}
8212 % one), it’s placed here.
8213 %
8214 % \begin{macrocode}
8215 \providecommand\PassOptionsToLocale[2]{%
8216 \bbl@csarg\bbl@add@list{passto@#2}{#1}}
8217 % \end{macrocode}
8218 %
8219 % \subsection{Setting up language files}
8220 %
8221 % \macro{\LdfInit}
8222 %
8223 % |\LdfInit| macro takes two arguments. The first
8224 % argument is the name of the language that will be defined in the
8225 % language definition file; the second argument is either a control
8226 % sequence or a string from which a control sequence should be
8227 % constructed. The existence of the control sequence indicates that
8228 % the file has been processed before.
8229 %
8230 % At the start of processing a language definition file we always
8231 % check the category code of the at-sign. We make sure that it is
8232 % a ‘letter’ during the processing of the file. We also save its
8233 % name as the last called option, even if not loaded.
8234 %
8235 % Another character that needs to have the correct category code
8236 % during processing of language definition files is the equals sign,
8237 % `=', because it is sometimes used in constructions with the
8238 % |\let| primitive. Therefore we store its current catcode and
8239 % restore it later on.
8240 %
8241 % Now we check whether we should perhaps stop the processing of
8242 % this file. To do this we first need to check whether the second
8243 % argument that is passed to |\LdfInit| is a control sequence. We
8244 % do that by looking at the first token after passing |#2| through
8245 % |string|. When it is equal to |\@backslashchar| we are dealing
8246 % with a control sequence which we can compare with |\@undefined|.
8247 %
8248 % If so, we call |\ldf@quit| to set the main language, restore the
8249 % category code of the @-sign and call |\endinput|
8250 %
8251 % When |#2| was \emph{not} a control sequence we construct one and
8252 % compare it with |\relax|.
8253 %
8254 % Finally we check |\originalTeX|.
8255 %
8256 % \begin{macrocode}
8257 \bbl@trace{Macros for setting language files up}
8258 \def\bbl@ldfinit{%
8259 \let\bbl@screset\@empty
8260 \let\BabelStrings\bbl@opt@string
8261 \let\BabelOptions\@empty
8262 \let\BabelLanguages\relax
8263 \ifx\originalTeX\@undefined
8264 \let\originalTeX\@empty
8265 \else
8266 \originalTeX
8267 \fi}
8268 \def\LdfInit#1#2{%
8269 \chardef\atcatcode=\catcode`\@
8270 \catcode`\@=11\relax
8271 \chardef\eqcatcode=\catcode`\=
8272 \catcode`\==12\relax
8273 \@ifpackagewith{babel}{ensureinfo=off}{}%
8274 {\ifx\InputIfFileExists\@undefined\else
8275 \bbl@ifunset{bbl@lname@#1}%
8276 {{\let\bbl@ensuring\@empty % Flag used in babel-serbianc.tex
8277 \def\languagename{#1}%
8278 \bbl@id@assign
8279 \bbl@load@info{#1}}}%
8280 {}%
8281 \fi}%
8282 \expandafter\if\expandafter\@backslashchar
8283 \expandafter\@car\string#2\@nil
8284 \ifx#2\@undefined\else
8285 \ldf@quit{#1}%
8286 \fi
8287 \else
8288 \expandafter\ifx\csname#2\endcsname\relax\else
8289 \ldf@quit{#1}%
8290 \fi
8291 \fi
8292 \bbl@ldfinit}
8293 % \end{macrocode}
8294 %
8295 % \macro{\ldf@quit}
8296 % This macro interrupts the processing of a language definition file.
8297 % Remember |\endinput| is not executed immediately, but delayed to
8298 % the end of the current line in the input file.
8299 %
8300 % \begin{macrocode}
8301 \def\ldf@quit#1{%
8302 \expandafter\main@language\expandafter{#1}%
8303 \catcode`\@=\atcatcode \let\atcatcode\relax
8304 \catcode`\==\eqcatcode \let\eqcatcode\relax
8305 \endinput}
8306 % \end{macrocode}
8307 %
8308 % \macro{\ldf@finish}
8309 % This macro takes one argument. It is the name of the language that
8310 % was defined in the language definition file.
8311 %
8312 % We load the local configuration file if one is present, we set the
8313 % main language (taking into account that the argument might be a
8314 % control sequence that needs to be expanded) and reset the category
8315 % code of the @-sign.
8316 %
8317 % \begin{macrocode}
8318 \def\bbl@afterldf{%
8319 \bbl@afterlang
8320 \let\bbl@afterlang\relax
8321 \let\BabelModifiers\relax
8322 \let\bbl@screset\relax}%
8323 \def\ldf@finish#1{%
8324 \loadlocalcfg{#1}%
8325 \bbl@afterldf
8326 \expandafter\main@language\expandafter{#1}%
8327 \catcode`\@=\atcatcode \let\atcatcode\relax
8328 \catcode`\==\eqcatcode \let\eqcatcode\relax}
8329 % \end{macrocode}
8330 %
8331 % After the preamble of the document the commands |\LdfInit|,
8332 % |\ldf@quit| and |\ldf@finish| are no longer needed. Therefore they
8333 % are turned into warning messages in \LaTeX.
8334 %
8335 % \begin{macrocode}
8336 \@onlypreamble\LdfInit
8337 \@onlypreamble\ldf@quit
8338 \@onlypreamble\ldf@finish
8339 % \end{macrocode}
8340 %
8341 % \macro{\main@language}
8342 % \macro{\bbl@main@language}
8343 % This command should be used in the various language definition files.
8344 % It stores its argument in |\bbl@main@language|; to be used to switch
8345 % to the correct language at the beginning of the document.
8346 %
8347 % \begin{macrocode}
8348 \def\main@language#1{%
8349 \def\bbl@main@language{#1}%
8350 \let\languagename\bbl@main@language
8351 \let\localename\bbl@main@language
8352 \let\mainlocalename\bbl@main@language
8353 \bbl@id@assign
8354 \ifcase\bbl@engine\or
8355 \ifx\setattribute\@undefined\else
8356 \setattribute\bbl@attr@locale\localeid
8357 \fi
8358 \fi
8359 \bbl@patterns{\languagename}}
8360 % \end{macrocode}
8361 %
8362 % We also have to make sure that some code gets executed at the
8363 % beginning of the document, either when the |aux| file is read or, if
8364 % it does not exist, when the |\AtBeginDocument| is executed. Languages
8365 % do not set |\pagedir|, so we set here for the whole document to the
8366 % main |\bodydir|.
8367 %
8368 % The code written to the |aux| file attempts to avoid errors if
8369 % \babel\ is removed from the document.
8370 %
8371 % \begin{macrocode}
8372 \def\bbl@beforestart{%
8373 \def\@nolanerr##1{%
8374 \bbl@carg\chardef{l@##1}\z@
8375 \bbl@warning{Undefined language '##1' in aux.\\Reported}}%
8376 \bbl@usehooks{beforestart}{}%
8377 \global\let\bbl@beforestart\relax}
8378 \AtBeginDocument{%
8379 {\@nameuse{bbl@beforestart}}% Group!
8380 \if@filesw
8381 \providecommand\babel@aux[2]{}%
8382 \immediate\write\@mainaux{\unexpanded{%
8383 \providecommand\babel@aux[2]{\global\let\babel@toc\@gobbletwo}}}%
8384 \immediate\write\@mainaux{\string\@nameuse{bbl@beforestart}}%
8385 \fi
8386 \expandafter\selectlanguage\expandafter{\bbl@main@language}%
8387 \ifbbl@single % must go after the line above.
8388 \renewcommand\selectlanguage[1]{}%
8389 \renewcommand\foreignlanguage[2]{#2}%
8390 \global\let\babel@aux\@gobbletwo % Also as flag
8391 \fi}
8392 %
8393 \ifcase\bbl@engine\or
8394 \AtBeginDocument{\pagedir\bodydir}
8395 \fi
8396 % \end{macrocode}
8397 %
8398 % A bit of optimization. Select in heads/feet the language only if
8399 % necessary.
8400 %
8401 % \begin{macrocode}
8402 \def\select@language@x#1{%
8403 \ifcase\bbl@select@type
8404 \bbl@ifsamestring\languagename{#1}{}{\select@language{#1}}%
8405 \else
8406 \select@language{#1}%
8407 \fi}
8408 % \end{macrocode}
8409 %
8410 % \subsection{Shorthands}
8411 %
8412 % The macro |\initiate@active@char| below takes all the necessary
8413 % actions to make its argument a shorthand character. The real work
8414 % is performed once for each character. But first we define a little
8415 % tool.
8416 %
8417 % \begin{macrocode}
8418 \bbl@trace{Shorhands}
8419 \def\bbl@withactive#1#2{%
8420 \begingroup
8421 \lccode`~=`#2\relax
8422 \lowercase{\endgroup#1~}}
8423 % \end{macrocode}
8424 %
8425 % \macro{\bbl@add@special}
8426 % The macro |\bbl@add@special| is used to add a new character (or
8427 % single character control sequence) to the macro |\dospecials| (and
8428 % |\@sanitize| if \LaTeX\ is used). It is used only at one place,
8429 % namely when |\initiate@active@char| is called (which is ignored if
8430 % the char has been made active before). Because |\@sanitize| can be
8431 % undefined, we put the definition inside a conditional.
8432 %
8433 % Items are added to the lists without checking its existence or the
8434 % original catcode. It does not hurt, but should be fixed. It’s already
8435 % done with |\nfss@catcodes|, added in 3.10.
8436 %
8437 % \begin{macrocode}
8438 \def\bbl@add@special#1{% 1:a macro like \", \?, etc.
8439 \bbl@add\dospecials{\do#1}% test @sanitize = \relax, for back. compat.
8440 \bbl@ifunset{@sanitize}{}{\bbl@add\@sanitize{\@makeother#1}}%
8441 \ifx\nfss@catcodes\@undefined\else
8442 \begingroup
8443 \catcode`#1\active
8444 \nfss@catcodes
8445 \ifnum\catcode`#1=\active
8446 \endgroup
8447 \bbl@add\nfss@catcodes{\@makeother#1}%
8448 \else
8449 \endgroup
8450 \fi
8451 \fi}
8452 % \end{macrocode}
8453 %
8454 % \macro{\initiate@active@char}
8455 % A language definition file can call this macro to make a character
8456 % active. This macro takes one argument, the character that is to be
8457 % made active. When the character was already active this macro does
8458 % nothing. Otherwise, this macro defines the control sequence
8459 % |\normal@char<char>| to expand to the character in its `normal
8460 % state' and it defines the active character to expand to
8461 % |\normal@char<char>| by default (\m{char} being the character to be
8462 % made active). Later its definition can be changed to expand to
8463 % |\active@char<char>| by calling |\bbl@activate{<char>}|.
8464 %
8465 % For example, to make the double quote character active one could have
8466 % |\initiate@active@char{"}| in a language definition file. This
8467 % defines |"| as |\active@prefix "\active@char"| (where the first |"|
8468 % is the character with its original catcode, when the shorthand is
8469 % created, and |\active@char"| is a single token). In protected
8470 % contexts, it expands to |\protect "| or |\noexpand "| (i.e., with the
8471 % original |"|); otherwise |\active@char"| is executed. This macro in
8472 % turn expands to |\normal@char"| in “safe” contexts (e.g., |\label|),
8473 % but |\user@active"| in normal “unsafe” ones. The latter search a
8474 % definition in the user, language and system levels, in this order,
8475 % but if none is found, |\normal@char"| is used. However, a deactivated
8476 % shorthand (with |\bbl@deactivate| is defined as
8477 % |\active@prefix "\normal@char"|.
8478 %
8479 % The following macro is used to define shorthands in the three levels.
8480 % It takes 4 arguments: the (string'ed) character, |\<level>@group|,
8481 % |<level>@active| and |<next-level>@active| (except in |system|).
8482 %
8483 % \begin{macrocode}
8484 \def\bbl@active@def#1#2#3#4{%
8485 \@namedef{#3#1}{%
8486 \expandafter\ifx\csname#2@sh@#1@\endcsname\relax
8487 \bbl@afterelse\bbl@sh@select#2#1{#3@arg#1}{#4#1}%
8488 \else
8489 \bbl@afterfi\csname#2@sh@#1@\endcsname
8490 \fi}%
8491 % \end{macrocode}
8492 %
8493 % When there is also no current-level shorthand with an argument we
8494 % will check whether there is a next-level defined shorthand for this
8495 % active character.
8496 %
8497 % \begin{macrocode}
8498 \long\@namedef{#3@arg#1}##1{%
8499 \expandafter\ifx\csname#2@sh@#1@\string##1@\endcsname\relax
8500 \bbl@afterelse\csname#4#1\endcsname##1%
8501 \else
8502 \bbl@afterfi\csname#2@sh@#1@\string##1@\endcsname
8503 \fi}}%
8504 % \end{macrocode}
8505 %
8506 % |\initiate@active@char| calls |\@initiate@active@char| with 3
8507 % arguments. All of them are the same character with different
8508 % catcodes: active, other (|\string|'ed) and the original one. This
8509 % trick simplifies the code a lot.
8510 %
8511 % \begin{macrocode}
8512 \def\initiate@active@char#1{%
8513 \bbl@ifunset{active@char\string#1}%
8514 {\bbl@withactive
8515 {\expandafter\@initiate@active@char\expandafter}#1\string#1#1}%
8516 {}}
8517 % \end{macrocode}
8518 %
8519 % The very first thing to do is saving the original catcode and the
8520 % original definition, even if not active, which is possible (undefined
8521 % characters require a special treatment to avoid making them |\relax|
8522 % and preserving some degree of protection).
8523 %
8524 % \begin{macrocode}
8525 \def\@initiate@active@char#1#2#3{%
8526 \bbl@csarg\edef{oricat@#2}{\catcode`#2=\the\catcode`#2\relax}%
8527 \ifx#1\@undefined
8528 \bbl@csarg\def{oridef@#2}{\def#1{\active@prefix#1\@undefined}}%
8529 \else
8530 \bbl@csarg\let{oridef@@#2}#1%
8531 \bbl@csarg\edef{oridef@#2}{%
8532 \let\noexpand#1%
8533 \expandafter\noexpand\csname bbl@oridef@@#2\endcsname}%
8534 \fi
8535 % \end{macrocode}
8536 %
8537 % If the character is already active we provide the default expansion
8538 % under this shorthand mechanism. Otherwise we write a message in the
8539 % transcript file, and define |\normal@char<char>| to expand to the
8540 % character in its default state. If the character is mathematically
8541 % active when \babel{} is loaded (for example |'|) the normal expansion
8542 % is somewhat different to avoid an infinite loop (but it does not
8543 % prevent the loop if the mathcode is set to |"8000| \textit{a
8544 % posteriori}).
8545 %
8546 % \begin{macrocode}
8547 \ifx#1#3\relax
8548 \expandafter\let\csname normal@char#2\endcsname#3%
8549 \else
8550 \bbl@info{Making #2 an active character}%
8551 \ifnum\mathcode`#2=\ifodd\bbl@engine"1000000 \else"8000 \fi
8552 \@namedef{normal@char#2}{%
8553 \textormath{#3}{\csname bbl@oridef@@#2\endcsname}}%
8554 \else
8555 \@namedef{normal@char#2}{#3}%
8556 \fi
8557 % \end{macrocode}
8558 %
8559 % To prevent problems with the loading of other packages after \babel\
8560 % we reset the catcode of the character to the original one at the end
8561 % of the package and of each language file (except with
8562 % \textsf{KeepShorthandsActive}). It is re-activate again at
8563 % |\begin{document}|. We also need to make sure that the shorthands are
8564 % active during the processing of the \file{aux} file. Otherwise some
8565 % citations may give unexpected results in the printout when a
8566 % shorthand was used in the optional argument of |\bibitem| for
8567 % example. Then we make it active (not strictly necessary, but done for
8568 % backward compatibility).
8569 %
8570 % \begin{macrocode}
8571 \bbl@restoreactive{#2}%
8572 \AtBeginDocument{%
8573 \catcode`#2\active
8574 \if@filesw
8575 \immediate\write\@mainaux{\catcode`\string#2\active}%
8576 \fi}%
8577 \expandafter\bbl@add@special\csname#2\endcsname
8578 \catcode`#2\active
8579 \fi
8580 % \end{macrocode}
8581 %
8582 % Now we have set |\normal@char<char>|, we must define
8583 % |\active@char<char>|, to be executed when the character is
8584 % activated. We define the first level expansion of
8585 % |\active@char<char>| to check the status of the |@safe@actives|
8586 % flag. If it is set to true we expand to the `normal' version of this
8587 % character, otherwise we call |\user@active<char>| to start the
8588 % search of a definition in the user, language and system levels (or
8589 % eventually |normal@char<char>|).
8590 %
8591 % \begin{macrocode}
8592 \let\bbl@tempa\@firstoftwo
8593 \if\string^#2%
8594 \def\bbl@tempa{\noexpand\textormath}%
8595 \else
8596 \ifx\bbl@mathnormal\@undefined\else
8597 \let\bbl@tempa\bbl@mathnormal
8598 \fi
8599 \fi
8600 \expandafter\edef\csname active@char#2\endcsname{%
8601 \bbl@tempa
8602 {\noexpand\if@safe@actives
8603 \noexpand\expandafter
8604 \expandafter\noexpand\csname normal@char#2\endcsname
8605 \noexpand\else
8606 \noexpand\expandafter
8607 \expandafter\noexpand\csname bbl@doactive#2\endcsname
8608 \noexpand\fi}%
8609 {\expandafter\noexpand\csname normal@char#2\endcsname}}%
8610 \bbl@csarg\edef{doactive#2}{%
8611 \expandafter\noexpand\csname user@active#2\endcsname}%
8612 % \end{macrocode}
8613 %
8614 % We now define the default values which the shorthand is set to when
8615 % activated or deactivated. It is set to the deactivated form
8616 % (globally), so that the character expands to
8617 % \begin{center}
8618 % |\active@prefix| \m{char} |\normal@char<char>|
8619 % \end{center}
8620 % (where |\active@char<char>| is \emph{one} control sequence!).
8621 %
8622 % \begin{macrocode}
8623 \bbl@csarg\edef{active@#2}{%
8624 \noexpand\active@prefix\noexpand#1%
8625 \expandafter\noexpand\csname active@char#2\endcsname}%
8626 \bbl@csarg\edef{normal@#2}{%
8627 \noexpand\active@prefix\noexpand#1%
8628 \expandafter\noexpand\csname normal@char#2\endcsname}%
8629 \bbl@ncarg\let#1{bbl@normal@#2}%
8630 % \end{macrocode}
8631 %
8632 % The next level of the code checks whether a user has defined a
8633 % shorthand for himself with this character. First we check for a
8634 % single character shorthand. If that doesn't exist we check for a
8635 % shorthand with an argument.
8636 %
8637 % \begin{macrocode}
8638 \bbl@active@def#2\user@group{user@active}{language@active}%
8639 \bbl@active@def#2\language@group{language@active}{system@active}%
8640 \bbl@active@def#2\system@group{system@active}{normal@char}%
8641 % \end{macrocode}
8642 %
8643 % In order to do the right thing when a shorthand with an argument
8644 % is used by itself at the end of the line we provide a definition
8645 % for the case of an empty argument. For that case we let the
8646 % shorthand character expand to its non-active self. Also, When a
8647 % shorthand combination such as |''| ends up in a heading \TeX\
8648 % would see |\protect'\protect'|. To prevent this from happening a
8649 % couple of shorthand needs to be defined at user level.
8650 %
8651 % \begin{macrocode}
8652 \expandafter\edef\csname\user@group @sh@#2@@\endcsname
8653 {\expandafter\noexpand\csname normal@char#2\endcsname}%
8654 \expandafter\edef\csname\user@group @sh@#2@\string\protect@\endcsname
8655 {\expandafter\noexpand\csname user@active#2\endcsname}%
8656 % \end{macrocode}
8657 %
8658 % Finally, a couple of special cases are taken care of. (1) If we
8659 % are making the right quote (|'|) active we need to change |\pr@m@s| as
8660 % well. Also, make sure that a single |'| in math mode `does the
8661 % right thing'. (2) If we are using the caret (|^|) as a shorthand
8662 % character special care should be taken to make sure math still
8663 % works. Therefore an extra level of expansion is introduced with a
8664 % check for math mode on the upper level.
8665 %
8666 % \begin{macrocode}
8667 \if\string'#2%
8668 \let\prim@s\bbl@prim@s
8669 \let\active@math@prime#1%
8670 \fi
8671 \bbl@usehooks{initiateactive}{{#1}{#2}{#3}}}
8672 % \end{macrocode}
8673 %
8674 % The following package options control the behavior of shorthands in
8675 % math mode.
8676 %
8677 % \begin{macrocode}
8678 %<<*More package options>>
8679 \DeclareOption{math=active}{}
8680 \DeclareOption{math=normal}{\def\bbl@mathnormal{\noexpand\textormath}}
8681 %<</More package options>>
8682 % \end{macrocode}
8683 %
8684 % Initiating a shorthand makes active the char. That is not strictly
8685 % necessary but it is still done for backward compatibility. So we need
8686 % to restore the original catcode at the end of package \textit{and}
8687 % and the end of the |ldf|.
8688 %
8689 % \begin{macrocode}
8690 \@ifpackagewith{babel}{KeepShorthandsActive}%
8691 {\let\bbl@restoreactive\@gobble}%
8692 {\def\bbl@restoreactive#1{%
8693 \bbl@exp{%
8694 \\\AfterBabelLanguage\\\CurrentOption
8695 {\catcode`#1=\the\catcode`#1\relax}%
8696 \\\AtEndOfPackage
8697 {\catcode`#1=\the\catcode`#1\relax}}}%
8698 \AtEndOfPackage{\let\bbl@restoreactive\@gobble}}
8699 % \end{macrocode}
8700 %
8701 % \macro{\bbl@sh@select}
8702 % This command helps the shorthand supporting macros to select how to
8703 % proceed. Note that this macro needs to be expandable as do all the
8704 % shorthand macros in order for them to work in expansion-only
8705 % environments such as the argument of |\hyphenation|.
8706 %
8707 % This macro expects the name of a group of shorthands in its first
8708 % argument and a shorthand character in its second argument. It will
8709 % expand to either |\bbl@firstcs| or |\bbl@scndcs|. Hence two more
8710 % arguments need to follow it.
8711 %
8712 % \begin{macrocode}
8713 \def\bbl@sh@select#1#2{%
8714 \expandafter\ifx\csname#1@sh@#2@sel\endcsname\relax
8715 \bbl@afterelse\bbl@scndcs
8716 \else
8717 \bbl@afterfi\csname#1@sh@#2@sel\endcsname
8718 \fi}
8719 % \end{macrocode}
8720 %
8721 % \macro{\active@prefix}
8722 % Used in the expansion of active
8723 % characters has a function similar to |\OT1-cmd| in that it
8724 % |\protect|s the active character whenever |\protect| is \emph{not}
8725 % |\@typeset@protect|. The |\@gobble| is needed to remove a token such
8726 % as |\activechar:| (when the double colon was the active character to
8727 % be dealt with). There are two definitions, depending of |\ifincsname|
8728 % is available. If there is, the expansion will be more robust.
8729 %
8730 % \begin{macrocode}
8731 \begingroup
8732 \bbl@ifunset{ifincsname}
8733 {\gdef\active@prefix#1{%
8734 \ifx\protect\@typeset@protect
8735 \else
8736 \ifx\protect\@unexpandable@protect
8737 \noexpand#1%
8738 \else
8739 \protect#1%
8740 \fi
8741 \expandafter\@gobble
8742 \fi}}
8743 {\gdef\active@prefix#1{%
8744 \ifincsname
8745 \string#1%
8746 \expandafter\@gobble
8747 \else
8748 \ifx\protect\@typeset@protect
8749 \else
8750 \ifx\protect\@unexpandable@protect
8751 \noexpand#1%
8752 \else
8753 \protect#1%
8754 \fi
8755 \expandafter\expandafter\expandafter\@gobble
8756 \fi
8757 \fi}}
8758 \endgroup
8759 % \end{macrocode}
8760 %
8761 % \macro{if@safe@actives}
8762 %
8763 % In some circumstances it is necessary to be able to reset the
8764 % shorthand to its ‘normal’ value (usually the character with catcode
8765 % ‘other’) on the fly. For this purpose the switch |@safe@actives| is
8766 % available. The setting of this switch should be checked in the first
8767 % level expansion of |\active@char<char>|. When this expansion mode
8768 % is active (with |\@safe@activestrue|), something like
8769 % |"|$\sb{13}$|"|$\sb{13}$ becomes |"|$\sb{12}$|"|$\sb{12}$ in an
8770 % |\edef| (in other words, shorthands are |\string|’ed). This contrasts
8771 % with |\protected@edef|, where catcodes are always left unchanged.
8772 % Once converted, they can be used safely even after this expansion
8773 % mode is deactivated (with |\@safe@activefalse|).
8774 %
8775 % \begin{macrocode}
8776 \newif\if@safe@actives
8777 \@safe@activesfalse
8778 % \end{macrocode}
8779 %
8780 % \macro{\bbl@restore@actives}
8781 % When the output routine kicks in while the active characters were
8782 % made “safe” this must be undone in the headers to prevent
8783 % unexpected typeset results. For this situation we define a command to
8784 % make them “unsafe” again.
8785 %
8786 % \begin{macrocode}
8787 \def\bbl@restore@actives{\if@safe@actives\@safe@activesfalse\fi}
8788 % \end{macrocode}
8789 %
8790 % \macro{\bbl@activate}
8791 % \macro{\bbl@deactivate}
8792 %
8793 % Both macros take one argument, like |\initiate@active@char|. The
8794 % macro is used to change the definition of an active character to
8795 % expand to |\active@char<char>| in the case of |\bbl@activate|,
8796 % or |\normal@char<char>| in the case of |\bbl@deactivate|.
8797 %
8798 % \begin{macrocode}
8799 \chardef\bbl@activated\z@
8800 \def\bbl@activate#1{%
8801 \chardef\bbl@activated\@ne
8802 \bbl@withactive{\expandafter\let\expandafter}#1%
8803 \csname bbl@active@\string#1\endcsname}
8804 \def\bbl@deactivate#1{%
8805 \chardef\bbl@activated\tw@
8806 \bbl@withactive{\expandafter\let\expandafter}#1%
8807 \csname bbl@normal@\string#1\endcsname}
8808 % \end{macrocode}
8809 %
8810 % \macro{\bbl@firstcs}
8811 % \macro{\bbl@scndcs}
8812 %
8813 % These macros are used only as a trick when declaring shorthands.
8814 %
8815 % \begin{macrocode}
8816 \def\bbl@firstcs#1#2{\csname#1\endcsname}
8817 \def\bbl@scndcs#1#2{\csname#2\endcsname}
8818 % \end{macrocode}
8819 %
8820 % \macro{\declare@shorthand}
8821 % Used to declare a shorthand
8822 % on a certain level. It takes three arguments:
8823 % \begin{enumerate}
8824 % \item a name for the collection of shorthands, i.e., `system', or
8825 % `dutch';
8826 % \item the character (sequence) that makes up the shorthand,
8827 % i.e., |~| or |"a|;
8828 % \item the code to be executed when the shorthand is encountered.
8829 % \end{enumerate}
8830 %
8831 % The auxiliary macro |\babel@texpdf| improves the interoperativity with
8832 % \textsf{hyperref} and takes 4 arguments: (1) The \TeX{} code in text
8833 % mode, (2) the string for \textsf{hyperref}, (3) the \TeX{} code in
8834 % math mode, and (4), which is currently ignored, but it’s meant for a
8835 % string in math mode, like a minus sign instead of an hyphen
8836 % (currently \textsf{hyperref} doesn't discriminate the mode). This
8837 % macro may be used in |ldf| files.
8838 %
8839 % \begin{macrocode}
8840 \def\babel@texpdf#1#2#3#4{%
8841 \ifx\texorpdfstring\@undefined
8842 \textormath{#1}{#3}%
8843 \else
8844 \texorpdfstring{\textormath{#1}{#3}}{#2}%
8845 % \texorpdfstring{\textormath{#1}{#3}}{\textormath{#2}{#4}}%
8846 \fi}
8847 %
8848 \def\declare@shorthand#1#2{\@decl@short{#1}#2\@nil}
8849 \def\@decl@short#1#2#3\@nil#4{%
8850 \def\bbl@tempa{#3}%
8851 \ifx\bbl@tempa\@empty
8852 \expandafter\let\csname #1@sh@\string#2@sel\endcsname\bbl@scndcs
8853 \bbl@ifunset{#1@sh@\string#2@}{}%
8854 {\def\bbl@tempa{#4}%
8855 \expandafter\ifx\csname#1@sh@\string#2@\endcsname\bbl@tempa
8856 \else
8857 \bbl@info
8858 {Redefining #1 shorthand \string#2\\%
8859 in language \CurrentOption}%
8860 \fi}%
8861 \@namedef{#1@sh@\string#2@}{#4}%
8862 \else
8863 \expandafter\let\csname #1@sh@\string#2@sel\endcsname\bbl@firstcs
8864 \bbl@ifunset{#1@sh@\string#2@\string#3@}{}%
8865 {\def\bbl@tempa{#4}%
8866 \expandafter\ifx\csname#1@sh@\string#2@\string#3@\endcsname\bbl@tempa
8867 \else
8868 \bbl@info
8869 {Redefining #1 shorthand \string#2\string#3\\%
8870 in language \CurrentOption}%
8871 \fi}%
8872 \@namedef{#1@sh@\string#2@\string#3@}{#4}%
8873 \fi}
8874 % \end{macrocode}
8875 %
8876 % \macro{\textormath}
8877 % Some of the shorthands that will be declared by the language
8878 % definition files have to be usable in both text and mathmode. To
8879 % achieve this the helper macro |\textormath| is provided.
8880 %
8881 % \begin{macrocode}
8882 \def\textormath{%
8883 \ifmmode
8884 \expandafter\@secondoftwo
8885 \else
8886 \expandafter\@firstoftwo
8887 \fi}
8888 % \end{macrocode}
8889 %
8890 % \macro{\user@group}
8891 % \macro{\language@group}
8892 % \macro{\system@group}
8893 % The current concept of `shorthands' supports three levels or groups
8894 % of shorthands. For each level the name of the level or group is
8895 % stored in a macro. The default is to have a user group; use language
8896 % group `english' and have a system group called `system'.
8897 %
8898 % \begin{macrocode}
8899 \def\user@group{user}
8900 \def\language@group{english}
8901 \def\system@group{system}
8902 % \end{macrocode}
8903 %
8904 % \macro{\useshorthands}
8905 %
8906 % This is the user level macro. It initializes and activates the
8907 % character for use as a shorthand character (i.e., it’s active in the
8908 % preamble). Languages can deactivate shorthands, so a starred version
8909 % is also provided which activates them always after the language has
8910 % been switched.
8911 %
8912 % \begin{macrocode}
8913 \def\useshorthands{%
8914 \@ifstar\bbl@usesh@s{\bbl@usesh@x{}}}
8915 \def\bbl@usesh@s#1{%
8916 \bbl@usesh@x
8917 {\AddBabelHook{babel-sh-\string#1}{afterextras}{\bbl@activate{#1}}}%
8918 {#1}}
8919 \def\bbl@usesh@x#1#2{%
8920 \bbl@ifshorthand{#2}%
8921 {\def\user@group{user}%
8922 \initiate@active@char{#2}%
8923 #1%
8924 \bbl@activate{#2}}%
8925 {\bbl@error{shorthand-is-off}{}{#2}{}}}
8926 % \end{macrocode}
8927 %
8928 % \macro{\defineshorthand}
8929 %
8930 % Currently we only support two groups of user level shorthands,
8931 % named internally |user| and |user@<language>| (language-dependent
8932 % user shorthands). By default, only the first one is taken into
8933 % account, but if the former is also used (in the optional argument
8934 % of |\defineshorthand|) a new level is inserted for it
8935 % (|user@generic|, done by |\bbl@set@user@generic|); we make also
8936 % sure |{}| and |\protect| are taken into account in this new top
8937 % level.
8938 %
8939 % \begin{macrocode}
8940 \def\user@language@group{user@\language@group}
8941 \def\bbl@set@user@generic#1#2{%
8942 \bbl@ifunset{user@generic@active#1}%
8943 {\bbl@active@def#1\user@language@group{user@active}{user@generic@active}%
8944 \bbl@active@def#1\user@group{user@generic@active}{language@active}%
8945 \expandafter\edef\csname#2@sh@#1@@\endcsname{%
8946 \expandafter\noexpand\csname normal@char#1\endcsname}%
8947 \expandafter\edef\csname#2@sh@#1@\string\protect@\endcsname{%
8948 \expandafter\noexpand\csname user@active#1\endcsname}}%
8949 \@empty}
8950 \newcommand\defineshorthand[3][user]{%
8951 \edef\bbl@tempa{\zap@space#1 \@empty}%
8952 \bbl@for\bbl@tempb\bbl@tempa{%
8953 \if*\expandafter\@car\bbl@tempb\@nil
8954 \edef\bbl@tempb{user@\expandafter\@gobble\bbl@tempb}%
8955 \@expandtwoargs
8956 \bbl@set@user@generic{\expandafter\string\@car#2\@nil}\bbl@tempb
8957 \fi
8958 \declare@shorthand{\bbl@tempb}{#2}{#3}}}
8959 % \end{macrocode}
8960 %
8961 % \macro{\languageshorthands}
8962 %
8963 % A user level command to change the language from which shorthands are
8964 % used. Unfortunately, \babel{} currently does not keep track of
8965 % defined groups, and therefore there is no way to catch a possible
8966 % change in casing to fix it in the same way languages names are fixed.
8967 %
8968 % \begin{macrocode}
8969 \def\languageshorthands#1{%
8970 \bbl@ifsamestring{none}{#1}{}{%
8971 \bbl@once{short-\localename-#1}{%
8972 \bbl@info{'\localename' activates '#1' shorthands.\\Reported}}}%
8973 \def\language@group{#1}}
8974 % \end{macrocode}
8975 %
8976 % \macro{\aliasshorthand}
8977 %
8978 % \textit{Deprecated}. First the new shorthand needs to be
8979 % initialized. Then, we define the new shorthand in terms of the
8980 % original one, but note with |\aliasshorthands{"}{/}| is
8981 % |\active@prefix /\active@char/|, so we still need to let the
8982 % latter to |\active@char"|.
8983 %
8984 % \begin{macrocode}
8985 \def\aliasshorthand#1#2{%
8986 \bbl@ifshorthand{#2}%
8987 {\expandafter\ifx\csname active@char\string#2\endcsname\relax
8988 \ifx\document\@notprerr
8989 \@notshorthand{#2}%
8990 \else
8991 \initiate@active@char{#2}%
8992 \bbl@ccarg\let{active@char\string#2}{active@char\string#1}%
8993 \bbl@ccarg\let{normal@char\string#2}{normal@char\string#1}%
8994 \bbl@activate{#2}%
8995 \fi
8996 \fi}%
8997 {\bbl@error{shorthand-is-off}{}{#2}{}}}
8998 % \end{macrocode}
8999 %
9000 % \macro{\@notshorthand}
9001 %
9002 % \begin{macrocode}
9003 \def\@notshorthand#1{\bbl@error{not-a-shorthand}{#1}{}{}}
9004 % \end{macrocode}
9005 %
9006 % \macro{\shorthandon}
9007 % \macro{\shorthandoff}
9008 %
9009 % The first level definition of these macros just passes the
9010 % argument on to |\bbl@switch@sh|, adding |\@nil| at the end to
9011 % denote the end of the list of characters.
9012 %
9013 % \begin{macrocode}
9014 \newcommand*\shorthandon[1]{\bbl@switch@sh\@ne#1\@nnil}
9015 \DeclareRobustCommand*\shorthandoff{%
9016 \@ifstar{\bbl@shorthandoff\tw@}{\bbl@shorthandoff\z@}}
9017 \def\bbl@shorthandoff#1#2{\bbl@switch@sh#1#2\@nnil}
9018 % \end{macrocode}
9019 %
9020 % \macro{\bbl@switch@sh}
9021 %
9022 % The macro |\bbl@switch@sh| takes the list of characters apart one
9023 % by one and subsequently switches the category code of the
9024 % shorthand character according to the first argument of
9025 % |\bbl@switch@sh|.
9026 %
9027 % But before any of this switching takes place we make sure that the
9028 % character we are dealing with is known as a shorthand character.
9029 % If it is, a macro such as |\active@char"| should exist.
9030 %
9031 % Switching off and on is easy -- we just set the category code to
9032 % `other' (12) and |\active|. With the starred version, the original
9033 % catcode and the original definition, saved in
9034 % |@initiate@active@char|, are restored.
9035 %
9036 % \begin{macrocode}
9037 \def\bbl@switch@sh#1#2{%
9038 \ifx#2\@nnil\else
9039 \bbl@ifunset{bbl@active@\string#2}%
9040 {\bbl@error{not-a-shorthand-b}{}{#2}{}}%
9041 {\ifcase#1% off, on, off*
9042 \catcode`#212\relax
9043 \or
9044 \catcode`#2\active
9045 \bbl@ifunset{bbl@shdef@\string#2}%
9046 {}%
9047 {\bbl@withactive{\expandafter\let\expandafter}#2%
9048 \csname bbl@shdef@\string#2\endcsname
9049 \bbl@csarg\let{shdef@\string#2}\relax}%
9050 \ifcase\bbl@activated\or
9051 \bbl@activate{#2}%
9052 \else
9053 \bbl@deactivate{#2}%
9054 \fi
9055 \or
9056 \bbl@ifunset{bbl@shdef@\string#2}%
9057 {\bbl@withactive{\bbl@csarg\let{shdef@\string#2}}#2}%
9058 {}%
9059 \csname bbl@oricat@\string#2\endcsname
9060 \csname bbl@oridef@\string#2\endcsname
9061 \fi}%
9062 \bbl@afterfi\bbl@switch@sh#1%
9063 \fi}
9064 % \end{macrocode}
9065 %
9066 % Note the value is that at the expansion time; e.g., in the preamble
9067 % shorthands are usually deactivated.
9068 %
9069 % \begin{macrocode}
9070 \def\babelshorthand{\active@prefix\babelshorthand\bbl@putsh}
9071 \def\bbl@putsh#1{%
9072 \bbl@ifunset{bbl@active@\string#1}%
9073 {\bbl@putsh@i#1\@empty\@nnil}%
9074 {\csname bbl@active@\string#1\endcsname}}
9075 \def\bbl@putsh@i#1#2\@nnil{%
9076 \csname\language@group @sh@\string#1@%
9077 \ifx\@empty#2\else\string#2@\fi\endcsname}
9078 %
9079 \ifx\bbl@opt@shorthands\@nnil\else
9080 \let\bbl@s@initiate@active@char\initiate@active@char
9081 \def\initiate@active@char#1{%
9082 \bbl@ifshorthand{#1}{\bbl@s@initiate@active@char{#1}}{}}
9083 \let\bbl@s@switch@sh\bbl@switch@sh
9084 \def\bbl@switch@sh#1#2{%
9085 \ifx#2\@nnil\else
9086 \bbl@afterfi
9087 \bbl@ifshorthand{#2}{\bbl@s@switch@sh#1{#2}}{\bbl@switch@sh#1}%
9088 \fi}
9089 \let\bbl@s@activate\bbl@activate
9090 \def\bbl@activate#1{%
9091 \bbl@ifshorthand{#1}{\bbl@s@activate{#1}}{}}
9092 \let\bbl@s@deactivate\bbl@deactivate
9093 \def\bbl@deactivate#1{%
9094 \bbl@ifshorthand{#1}{\bbl@s@deactivate{#1}}{}}
9095 \fi
9096 % \end{macrocode}
9097 %
9098 % You may want to test if a character is a shorthand. Note it does not
9099 % test whether the shorthand is on or off.
9100 %
9101 % \begin{macrocode}
9102 \newcommand\ifbabelshorthand[3]{\bbl@ifunset{bbl@active@\string#1}{#3}{#2}}
9103 % \end{macrocode}
9104 %
9105 % \macro{\bbl@prim@s}
9106 % \macro{\bbl@pr@m@s}
9107 %
9108 % One of the internal macros that are involved in substituting |\prime|
9109 % for each right quote in mathmode is |\prim@s|. This checks if the
9110 % next character is a right quote. When the right quote is active, the
9111 % definition of this macro needs to be adapted to look also for an
9112 % active right quote; the hat could be active, too.
9113 %
9114 % \begin{macrocode}
9115 \def\bbl@prim@s{%
9116 \prime\futurelet\@let@token\bbl@pr@m@s}
9117 \def\bbl@if@primes#1#2{%
9118 \ifx#1\@let@token
9119 \expandafter\@firstoftwo
9120 \else\ifx#2\@let@token
9121 \bbl@afterelse\expandafter\@firstoftwo
9122 \else
9123 \bbl@afterfi\expandafter\@secondoftwo
9124 \fi\fi}
9125 \begingroup
9126 \catcode`\^=7 \catcode`\*=\active \lccode`\*=`\^
9127 \catcode`\'=12 \catcode`\"=\active \lccode`\"=`\'
9128 \lowercase{%
9129 \gdef\bbl@pr@m@s{%
9130 \bbl@if@primes"'%
9131 \pr@@@s
9132 {\bbl@if@primes*^\pr@@@t\egroup}}}
9133 \endgroup
9134 % \end{macrocode}
9135 %
9136 % Usually the |~| is active and expands to \verb*=\penalty\@M\ =.
9137 % When it is written to the \file{aux} file it is written
9138 % expanded. To prevent that and to be able to use the character |~|
9139 % as a start character for a shorthand, it is redefined here as a
9140 % one character shorthand on system level. The system declaration
9141 % is in most cases redundant (when |~| is still a non-break space),
9142 % and in some cases is inconvenient (if |~| has been redefined);
9143 % however, for backward compatibility it is maintained (some
9144 % existing documents may rely on the \babel{} value).
9145 %
9146 % \begin{macrocode}
9147 \initiate@active@char{~}
9148 \declare@shorthand{system}{~}{\leavevmode\nobreak\ }
9149 \bbl@activate{~}
9150 % \end{macrocode}
9151 %
9152 % \macro{\OT1dqpos}
9153 % \macro{\T1dqpos}
9154 % The position of the double quote character is different for the OT1
9155 % and T1 encodings. It will later be selected using the |\f@encoding|
9156 % macro. Therefore we define two macros here to store the position of
9157 % the character in these encodings.
9158 %
9159 % \begin{macrocode}
9160 \expandafter\def\csname OT1dqpos\endcsname{127}
9161 \expandafter\def\csname T1dqpos\endcsname{4}
9162 % \end{macrocode}
9163 %
9164 % When the macro |\f@encoding| is undefined (as it is in plain \TeX) we
9165 % define it here to expand to \texttt{OT1}
9166 %
9167 % \begin{macrocode}
9168 \ifx\f@encoding\@undefined
9169 \def\f@encoding{OT1}
9170 \fi
9171 % \end{macrocode}
9172 %
9173 % \subsection{Language attributes}
9174 %
9175 % Language attributes provide a means to give the user control over
9176 % which features of the language definition files he wants to enable.
9177 %
9178 % \macro{\languageattribute}
9179 %
9180 % The macro |\languageattribute| checks whether its arguments are valid
9181 % and then activates the selected language attribute. First check
9182 % whether the language is known, and then process each attribute in the
9183 % list.
9184 %
9185 % \begin{macrocode}
9186 \bbl@trace{Language attributes}
9187 \newcommand\languageattribute[2]{%
9188 \def\bbl@tempc{#1}%
9189 \bbl@fixname\bbl@tempc
9190 \bbl@iflanguage\bbl@tempc{%
9191 \bbl@vforeach{#2}{%
9192 % \end{macrocode}
9193 %
9194 % To make sure each attribute is selected only once, we store the
9195 % already selected attributes in |\bbl@known@attribs|. When that
9196 % control sequence is not yet defined this attribute is certainly
9197 % not selected before.
9198 %
9199 % \begin{macrocode}
9200 \ifx\bbl@known@attribs\@undefined
9201 \in@false
9202 \else
9203 \bbl@xin@{,\bbl@tempc-##1,}{,\bbl@known@attribs,}%
9204 \fi
9205 \ifin@
9206 \bbl@warning{%
9207 You have more than once selected the attribute '##1'\\%
9208 for language #1. Reported}%
9209 \else
9210 % \end{macrocode}
9211 %
9212 % When we end up here the attribute is not selected before. So, we
9213 % add it to the list of selected attributes and execute the
9214 % associated \TeX-code.
9215 %
9216 % \begin{macrocode}
9217 \bbl@info{Activated '##1' attribute for\\%
9218 '\bbl@tempc'. Reported}%
9219 \bbl@exp{%
9220 \\\bbl@add@list\\\bbl@known@attribs{\bbl@tempc-##1}}%
9221 \edef\bbl@tempa{\bbl@tempc-##1}%
9222 \expandafter\bbl@ifknown@ttrib\expandafter{\bbl@tempa}\bbl@attributes%
9223 {\csname\bbl@tempc @attr@##1\endcsname}%
9224 {\@attrerr{\bbl@tempc}{##1}}%
9225 \fi}}}
9226 \@onlypreamble\languageattribute
9227 % \end{macrocode}
9228 %
9229 % The error text to be issued when an unknown attribute is selected.
9230 %
9231 % \begin{macrocode}
9232 \newcommand*{\@attrerr}[2]{%
9233 \bbl@error{unknown-attribute}{#1}{#2}{}}
9234 % \end{macrocode}
9235 %
9236 % \macro{\bbl@declare@ttribute}
9237 % This command adds the new language/attribute combination to the list
9238 % of known attributes.
9239 %
9240 % Then it defines a control sequence to be executed when the attribute
9241 % is used in a document. The result of this should be that the macro
9242 % |\extras...| for the current language is extended, otherwise the
9243 % attribute will not work as its code is removed from memory at
9244 % |\begin{document}|.
9245 %
9246 % \begin{macrocode}
9247 \def\bbl@declare@ttribute#1#2#3{%
9248 \bbl@xin@{,#2,}{,\BabelModifiers,}%
9249 \ifin@
9250 \AfterBabelLanguage{#1}{\languageattribute{#1}{#2}}%
9251 \fi
9252 \bbl@add@list\bbl@attributes{#1-#2}%
9253 \expandafter\def\csname#1@attr@#2\endcsname{#3}}
9254 % \end{macrocode}
9255 %
9256 % \macro{\bbl@ifattributeset}
9257 %
9258 % This internal macro has 4 arguments. It can be used to interpret
9259 % \TeX\ code based on whether a certain attribute was set. This command
9260 % should appear inside the argument to |\AtBeginDocument| because the
9261 % attributes are set in the document preamble, \emph{after} \babel\ is
9262 % loaded.
9263 %
9264 % The first argument is the language, the second argument the attribute
9265 % being checked, and the third and fourth arguments are the true and
9266 % false clauses.
9267 %
9268 % \begin{macrocode}
9269 \def\bbl@ifattributeset#1#2#3#4{%
9270 \ifx\bbl@known@attribs\@undefined
9271 \in@false
9272 \else
9273 \bbl@xin@{,#1-#2,}{,\bbl@known@attribs,}%
9274 \fi
9275 \ifin@
9276 \bbl@afterelse#3%
9277 \else
9278 \bbl@afterfi#4%
9279 \fi}
9280 % \end{macrocode}
9281 %
9282 % \macro{\bbl@ifknown@ttrib}
9283 % An internal macro to check whether a given language/attribute is
9284 % known. The macro takes 4 arguments, the language/attribute, the
9285 % attribute list, the \TeX-code to be executed when the attribute is
9286 % known and the \TeX-code to be executed otherwise.
9287 %
9288 % We first assume the attribute is unknown. Then we loop over the list
9289 % of known attributes, trying to find a match.
9290 %
9291 % \begin{macrocode}
9292 \def\bbl@ifknown@ttrib#1#2{%
9293 \let\bbl@tempa\@secondoftwo
9294 \bbl@loopx\bbl@tempb{#2}{%
9295 \expandafter\in@\expandafter{\expandafter,\bbl@tempb,}{,#1,}%
9296 \ifin@
9297 \let\bbl@tempa\@firstoftwo
9298 \else
9299 \fi}%
9300 \bbl@tempa}
9301 % \end{macrocode}
9302 %
9303 % \macro{\bbl@clear@ttribs}
9304 % This macro removes all the attribute code from \LaTeX’s memory at
9305 % |\begin{document}| time (if any is present).
9306 %
9307 % \begin{macrocode}
9308 \def\bbl@clear@ttribs{%
9309 \ifx\bbl@attributes\@undefined\else
9310 \bbl@loopx\bbl@tempa{\bbl@attributes}{%
9311 \expandafter\bbl@clear@ttrib\bbl@tempa.}%
9312 \let\bbl@attributes\@undefined
9313 \fi}
9314 \def\bbl@clear@ttrib#1-#2.{%
9315 \expandafter\let\csname#1@attr@#2\endcsname\@undefined}
9316 \AtBeginDocument{\bbl@clear@ttribs}
9317 % \end{macrocode}
9318 %
9319 % \subsection{Support for saving and redefining macros}
9320 %
9321 % To save the meaning of control sequences using |\babel@save|, we use
9322 % temporary control sequences. To save hash table entries for these
9323 % control sequences, we don't use the name of the control sequence to
9324 % be saved to construct the temporary name. Instead we simply use the
9325 % value of a counter, which is reset to zero each time we begin to save
9326 % new values. This works well because we release the saved meanings
9327 % before we begin to save a new set of control sequence meanings (see
9328 % |\selectlanguage| and |\originalTeX|). Note undefined macros are not
9329 % undefined any more when saved -- they are |\relax|'ed.
9330 %
9331 % \macro{\babel@savecnt}
9332 % \macro{\babel@beginsave}
9333 % The initialization of a new save cycle: reset the counter to zero.
9334 %
9335 % \begin{macrocode}
9336 \bbl@trace{Macros for saving definitions}
9337 \def\babel@beginsave{\babel@savecnt\z@}
9338 % \end{macrocode}
9339 %
9340 % Before it’s forgotten, allocate the counter and initialize all.
9341 %
9342 % \begin{macrocode}
9343 \newcount\babel@savecnt
9344 \babel@beginsave
9345 % \end{macrocode}
9346 %
9347 % \macro{\babel@save}
9348 % \macro{\babel@savevariable}
9349 %
9350 % The macro |\babel@save|\meta{csname} saves the current meaning of the
9351 % control sequence \meta{csname} to |\originalTeX| (which has to be
9352 % expandable, i.e., you shouldn't let it to \cs{relax}). To do this,
9353 % we let the current meaning to a temporary control sequence, the
9354 % restore commands are appended to |\originalTeX| and the counter is
9355 % incremented. The macro |\babel@savevariable|\meta{variable} saves the
9356 % value of the variable. \meta{variable} can be anything allowed after
9357 % the |\the| primitive. To avoid messing saved definitions up, they are
9358 % saved only the very first time.
9359 %
9360 % \begin{macrocode}
9361 \def\babel@save#1{%
9362 \def\bbl@tempa{{,#1,}}% Clumsy, for Plain
9363 \expandafter\bbl@add\expandafter\bbl@tempa\expandafter{%
9364 \expandafter{\expandafter,\bbl@savedextras,}}%
9365 \expandafter\in@\bbl@tempa
9366 \ifin@\else
9367 \bbl@add\bbl@savedextras{,#1,}%
9368 \bbl@carg\let{babel@\number\babel@savecnt}#1\relax
9369 \toks@\expandafter{\originalTeX\let#1=}%
9370 \bbl@exp{%
9371 \def\\\originalTeX{\the\toks@\<babel@\number\babel@savecnt>\relax}}%
9372 \advance\babel@savecnt\@ne
9373 \fi}
9374 \def\babel@savevariable#1{%
9375 \toks@\expandafter{\originalTeX #1=}%
9376 \bbl@exp{\def\\\originalTeX{\the\toks@\the#1\relax}}}
9377 % \end{macrocode}
9378 %
9379 % \macro{\bbl@redefine}
9380 %
9381 % To redefine a command, we save the old meaning of the macro. Then
9382 % we redefine it to call the original macro with the `sanitized'
9383 % argument. The reason why we do it this way is that we don't want
9384 % to redefine the \LaTeX\ macros completely in case their
9385 % definitions change (they have changed in the past). A macro named
9386 % |\macro| will be saved new control sequences named |\org@macro|.
9387 %
9388 % \begin{macrocode}
9389 \def\bbl@redefine#1{%
9390 \edef\bbl@tempa{\bbl@stripslash#1}%
9391 \expandafter\let\csname org@\bbl@tempa\endcsname#1%
9392 \expandafter\def\csname\bbl@tempa\endcsname}
9393 \@onlypreamble\bbl@redefine
9394 % \end{macrocode}
9395 %
9396 % \macro{\bbl@redefine@long}
9397 % This version of |\babel@redefine| can be used to redefine |\long|
9398 % commands such as |\ifthenelse|.
9399 %
9400 % \begin{macrocode}
9401 \def\bbl@redefine@long#1{%
9402 \edef\bbl@tempa{\bbl@stripslash#1}%
9403 \expandafter\let\csname org@\bbl@tempa\endcsname#1%
9404 \long\expandafter\def\csname\bbl@tempa\endcsname}
9405 \@onlypreamble\bbl@redefine@long
9406 % \end{macrocode}
9407 %
9408 % \macro{\bbl@redefinerobust}
9409 % For commands that are redefined, but which \textit{might} be
9410 % robust we need a slightly more intelligent macro. A robust
9411 % command |foo| is defined to expand to |\protect|\verb*|\foo |. So
9412 % it is necessary to check whether \verb*|\foo | exists. The result
9413 % is that the command that is being redefined is always robust
9414 % afterwards. Therefore all we need to do now is define \verb*|\foo |.
9415 %
9416 % \begin{macrocode}
9417 \def\bbl@redefinerobust#1{%
9418 \edef\bbl@tempa{\bbl@stripslash#1}%
9419 \bbl@ifunset{\bbl@tempa\space}%
9420 {\expandafter\let\csname org@\bbl@tempa\endcsname#1%
9421 \bbl@exp{\def\\#1{\\\protect\<\bbl@tempa\space>}}}%
9422 {\bbl@exp{\let\<org@\bbl@tempa>\<\bbl@tempa\space>}}%
9423 \@namedef{\bbl@tempa\space}}
9424 \@onlypreamble\bbl@redefinerobust
9425 % \end{macrocode}
9426 %
9427 % \subsection{French spacing}
9428 %
9429 % \macro{\bbl@frenchspacing}
9430 % \macro{\bbl@nonfrenchspacing}
9431 % Some languages need to have |\frenchspacing| in effect. Others
9432 % don't want that. The command |\bbl@frenchspacing| switches it on
9433 % when it isn't already in effect and |\bbl@nonfrenchspacing|
9434 % switches it off if necessary.
9435 %
9436 % \begin{macrocode}
9437 \def\bbl@frenchspacing{%
9438 \ifnum\the\sfcode`\.=\@m
9439 \let\bbl@nonfrenchspacing\relax
9440 \else
9441 \frenchspacing
9442 \let\bbl@nonfrenchspacing\nonfrenchspacing
9443 \fi}
9444 \let\bbl@nonfrenchspacing\nonfrenchspacing
9445 % \end{macrocode}
9446 %
9447 % A more refined way to switch the catcodes is done with |ini| files.
9448 % Here an auxiliary macro is defined, but the main part is in
9449 % |\babelprovide|. This new method should be ideally the default one.
9450 %
9451 % \begin{macrocode}
9452 \let\bbl@elt\relax
9453 \edef\bbl@fs@chars{%
9454 \bbl@elt{\string.}\@m{3000}\bbl@elt{\string?}\@m{3000}%
9455 \bbl@elt{\string!}\@m{3000}\bbl@elt{\string:}\@m{2000}%
9456 \bbl@elt{\string;}\@m{1500}\bbl@elt{\string,}\@m{1250}}
9457 \def\bbl@pre@fs{%
9458 \def\bbl@elt##1##2##3{\sfcode`##1=\the\sfcode`##1\relax}%
9459 \edef\bbl@save@sfcodes{\bbl@fs@chars}}%
9460 \def\bbl@post@fs{%
9461 \bbl@save@sfcodes
9462 \edef\bbl@tempa{\bbl@cl{frspc}}%
9463 \edef\bbl@tempa{\expandafter\@car\bbl@tempa\@nil}%
9464 \if u\bbl@tempa % do nothing
9465 \else\if n\bbl@tempa % non french
9466 \def\bbl@elt##1##2##3{%
9467 \ifnum\sfcode`##1=##2\relax
9468 \babel@savevariable{\sfcode`##1}%
9469 \sfcode`##1=##3\relax
9470 \fi}%
9471 \bbl@fs@chars
9472 \else\if y\bbl@tempa % french
9473 \def\bbl@elt##1##2##3{%
9474 \ifnum\sfcode`##1=##3\relax
9475 \babel@savevariable{\sfcode`##1}%
9476 \sfcode`##1=##2\relax
9477 \fi}%
9478 \bbl@fs@chars
9479 \fi\fi\fi}
9480 % \end{macrocode}
9481 %
9482 % \subsection{Hyphens}
9483 %
9484 % \macro{\babelhyphenation}
9485 %
9486 % This macro saves hyphenation exceptions. Two macros are used to
9487 % store them: |\bbl@hyphenation@| for the global ones and
9488 % |\bbl@hyphenation@<language>| for language ones. See |\bbl@patterns|
9489 % above for further details. We make sure there is a space between
9490 % words when multiple commands are used.
9491 %
9492 % \begin{macrocode}
9493 \bbl@trace{Hyphens}
9494 \@onlypreamble\babelhyphenation
9495 \AtEndOfPackage{%
9496 \newcommand\babelhyphenation[2][\@empty]{%
9497 \ifx\bbl@hyphenation@\relax
9498 \let\bbl@hyphenation@\@empty
9499 \fi
9500 \ifx\bbl@hyphlist\@empty\else
9501 \bbl@warning{%
9502 You must not intermingle \string\selectlanguage\space and\\%
9503 \string\babelhyphenation\space or some exceptions will not\\%
9504 be taken into account. Reported}%
9505 \fi
9506 \ifx\@empty#1%
9507 \protected@edef\bbl@hyphenation@{\bbl@hyphenation@\space#2}%
9508 \else
9509 \bbl@vforeach{#1}{%
9510 \def\bbl@tempa{##1}%
9511 \bbl@fixname\bbl@tempa
9512 \bbl@iflanguage\bbl@tempa{%
9513 \bbl@csarg\protected@edef{hyphenation@\bbl@tempa}{%
9514 \bbl@ifunset{bbl@hyphenation@\bbl@tempa}%
9515 {}%
9516 {\csname bbl@hyphenation@\bbl@tempa\endcsname\space}%
9517 #2}}}%
9518 \fi}}
9519 % \end{macrocode}
9520 %
9521 % \macro{\babelhyphenmins}
9522 %
9523 % Only \LaTeX{} (basically because it’s defined with a \LaTeX{} tool).
9524 %
9525 % \begin{macrocode}
9526 \ifx\NewDocumentCommand\@undefined\else
9527 \NewDocumentCommand\babelhyphenmins{sommo}{%
9528 \IfNoValueTF{#2}%
9529 {\protected@edef\bbl@hyphenmins@{\set@hyphenmins{#3}{#4}}%
9530 \IfValueT{#5}{%
9531 \protected@edef\bbl@hyphenatmin@{\hyphenationmin=#5\relax}}%
9532 \IfBooleanT{#1}{%
9533 \lefthyphenmin=#3\relax
9534 \righthyphenmin=#4\relax
9535 \IfValueT{#5}{\hyphenationmin=#5\relax}}}%
9536 {\edef\bbl@tempb{\zap@space#2 \@empty}%
9537 \bbl@for\bbl@tempa\bbl@tempb{%
9538 \@namedef{bbl@hyphenmins@\bbl@tempa}{\set@hyphenmins{#3}{#4}}%
9539 \IfValueT{#5}{%
9540 \@namedef{bbl@hyphenatmin@\bbl@tempa}{\hyphenationmin=#5\relax}}}%
9541 \IfBooleanT{#1}{\bbl@error{hyphenmins-args}{}{}{}}}}
9542 \fi
9543 % \end{macrocode}
9544 %
9545 % \macro{\bbl@allowhyphens}
9546 %
9547 % This macro makes hyphenation possible. Basically its definition is
9548 % nothing more than |\nobreak| |\hskip| \texttt{0pt plus 0pt}. \TeX\
9549 % begins and ends a word for hyphenation at a glue node. The penalty
9550 % prevents a linebreak at this glue node.
9551 %
9552 % \begin{macrocode}
9553 \def\bbl@allowhyphens{\ifvmode\else\nobreak\hskip\z@skip\fi}
9554 \def\bbl@t@one{T1}
9555 \def\allowhyphens{\ifx\cf@encoding\bbl@t@one\else\bbl@allowhyphens\fi}
9556 % \end{macrocode}
9557 %
9558 % \macro{\babelhyphen}
9559 %
9560 % Macros to insert common hyphens. Note the space before |@| in
9561 % |\babelhyphen|. Instead of protecting it with
9562 % |\DeclareRobustCommand|, which could insert a |\relax|, we use
9563 % the same procedure as shorthands, with |\active@prefix|.
9564 %
9565 % \begin{macrocode}
9566 \newcommand\babelnullhyphen{\char\hyphenchar\font}
9567 \def\babelhyphen{\active@prefix\babelhyphen\bbl@hyphen}
9568 \def\bbl@hyphen{%
9569 \@ifstar{\bbl@hyphen@i @}{\bbl@hyphen@i\@empty}}
9570 \def\bbl@hyphen@i#1#2{%
9571 \lowercase{\bbl@ifunset{bbl@hy@#1#2\@empty}}%
9572 {\csname bbl@#1usehyphen\endcsname{\discretionary{#2}{}{#2}}}%
9573 {\lowercase{\csname bbl@hy@#1#2\@empty\endcsname}}}
9574 % \end{macrocode}
9575 %
9576 % The following two commands are used to wrap the “hyphen” and
9577 % set the behavior of the rest of the word -- the version with a
9578 % single |@| is used when further hyphenation is allowed, while
9579 % that with |@@| if no more hyphens are allowed. In both cases, if
9580 % the hyphen is preceded by a positive space, breaking after the
9581 % hyphen is disallowed.
9582 %
9583 % There should not be a discretionary after a hyphen at the
9584 % beginning of a word, so it is prevented if preceded by a
9585 % skip. Unfortunately, this does handle cases like “(-suffix)”.
9586 % |\nobreak| is always preceded by |\leavevmode|, in case the
9587 % shorthand starts a paragraph.
9588 %
9589 % \begin{macrocode}
9590 \def\bbl@usehyphen#1{%
9591 \leavevmode
9592 \ifdim\lastskip>\z@\mbox{#1}\else\nobreak#1\fi
9593 \nobreak\hskip\z@skip}
9594 \def\bbl@@usehyphen#1{%
9595 \leavevmode\ifdim\lastskip>\z@\mbox{#1}\else#1\fi}
9596 % \end{macrocode}
9597 %
9598 % The following macro inserts the hyphen char.
9599 %
9600 % \begin{macrocode}
9601 \def\bbl@hyphenchar{%
9602 \ifnum\hyphenchar\font=\m@ne
9603 \babelnullhyphen
9604 \else
9605 \char\hyphenchar\font
9606 \fi}
9607 % \end{macrocode}
9608 %
9609 % Finally, we define the hyphen “types”. Their names will not change,
9610 % so you may use them in |ldf|’s. After a space, the |\mbox| in
9611 % |\bbl@hy@nobreak| is redundant.
9612 %
9613 % \begin{macrocode}
9614 \def\bbl@hy@soft{\bbl@usehyphen{\discretionary{\bbl@hyphenchar}{}{}}}
9615 \def\bbl@hy@@soft{\bbl@@usehyphen{\discretionary{\bbl@hyphenchar}{}{}}}
9616 \def\bbl@hy@hard{\bbl@usehyphen\bbl@hyphenchar}
9617 \def\bbl@hy@@hard{\bbl@@usehyphen\bbl@hyphenchar}
9618 \def\bbl@hy@nobreak{\bbl@usehyphen{\mbox{\bbl@hyphenchar}}}
9619 \def\bbl@hy@@nobreak{\mbox{\bbl@hyphenchar}}
9620 \def\bbl@hy@repeat{%
9621 \bbl@usehyphen{%
9622 \discretionary{\bbl@hyphenchar}{\bbl@hyphenchar}{\bbl@hyphenchar}}}
9623 \def\bbl@hy@@repeat{%
9624 \bbl@@usehyphen{%
9625 \discretionary{\bbl@hyphenchar}{\bbl@hyphenchar}{\bbl@hyphenchar}}}
9626 \def\bbl@hy@empty{\hskip\z@skip}
9627 \def\bbl@hy@@empty{\discretionary{}{}{}}
9628 % \end{macrocode}
9629 %
9630 % \macro{\bbl@disc}
9631 % For some languages the macro |\bbl@disc| is used to ease the
9632 % insertion of discretionaries for letters that behave `abnormally' at
9633 % a breakpoint.
9634 %
9635 % \begin{macrocode}
9636 \def\bbl@disc#1#2{\nobreak\discretionary{#2-}{}{#1}\bbl@allowhyphens}
9637 % \end{macrocode}
9638 %
9639 % \subsection{Multiencoding strings}
9640 %
9641 % The aim following commands is to provide a common interface for
9642 % strings in several encodings. They also contains several hooks which
9643 % can be used by \luatex{} and \xetex. The code is organized here with
9644 % pseudo-guards, so we start with the basic commands.
9645 %
9646 % \paragraph{Tools}
9647 %
9648 % But first, a tool. It makes global a local variable. This is not the
9649 % best solution, but it works.
9650 %
9651 % \begin{macrocode}
9652 \bbl@trace{Multiencoding strings}
9653 \def\bbl@toglobal#1{\global\let#1#1}
9654 % \end{macrocode}
9655 %
9656 % The following option is currently no-op. It was meant for the
9657 % deprecated |\SetCase|.
9658 %
9659 % \begin{macrocode}
9660 %<<*More package options>>
9661 \DeclareOption{nocase}{}
9662 %<</More package options>>
9663 % \end{macrocode}
9664 %
9665 % The following package options control the behavior of |\SetString|.
9666 %
9667 % \begin{macrocode}
9668 %<<*More package options>>
9669 \let\bbl@opt@strings\@nnil % accept strings=value
9670 \DeclareOption{strings}{\def\bbl@opt@strings{\BabelStringsDefault}}
9671 \DeclareOption{strings=encoded}{\let\bbl@opt@strings\relax}
9672 \def\BabelStringsDefault{generic}
9673 %<</More package options>>
9674 % \end{macrocode}
9675 %
9676 % \paragraph{Main command} This is the main command. With the first
9677 % use it is redefined to omit the basic setup in subsequent blocks.
9678 % We make sure strings contain actual letters in the range 128-255,
9679 % not active characters.
9680 %
9681 % \begin{macrocode}
9682 \@onlypreamble\StartBabelCommands
9683 \def\StartBabelCommands{%
9684 \begingroup
9685 \@tempcnta="7F
9686 \def\bbl@tempa{%
9687 \ifnum\@tempcnta>"FF\else
9688 \catcode\@tempcnta=11
9689 \advance\@tempcnta\@ne
9690 \expandafter\bbl@tempa
9691 \fi}%
9692 \bbl@tempa
9693 <@Macros local to BabelCommands@>
9694 \def\bbl@provstring##1##2{%
9695 \providecommand##1{##2}%
9696 \bbl@toglobal##1}%
9697 \global\let\bbl@scafter\@empty
9698 \let\StartBabelCommands\bbl@startcmds
9699 \ifx\BabelLanguages\relax
9700 \let\BabelLanguages\CurrentOption
9701 \fi
9702 \begingroup
9703 \let\bbl@screset\@nnil % local flag - disable 1st stopcommands
9704 \StartBabelCommands}
9705 \def\bbl@startcmds{%
9706 \ifx\bbl@screset\@nnil\else
9707 \bbl@usehooks{stopcommands}{}%
9708 \fi
9709 \endgroup
9710 \begingroup
9711 \@ifstar
9712 {\ifx\bbl@opt@strings\@nnil
9713 \let\bbl@opt@strings\BabelStringsDefault
9714 \fi
9715 \bbl@startcmds@i}%
9716 \bbl@startcmds@i}
9717 \def\bbl@startcmds@i#1#2{%
9718 \edef\bbl@L{\zap@space#1 \@empty}%
9719 \edef\bbl@G{\zap@space#2 \@empty}%
9720 \bbl@startcmds@ii}
9721 \let\bbl@startcommands\StartBabelCommands
9722 % \end{macrocode}
9723 %
9724 % Parse the encoding info to get the label, input, and font parts.
9725 %
9726 % Select the behavior of |\SetString|. There are two main cases,
9727 % depending of if there is an optional argument: without it and
9728 % |strings=encoded|, strings are defined
9729 % always; otherwise, they are set only if they are still undefined
9730 % (i.e., fallback values). With labelled blocks and
9731 % |strings=encoded|, define the strings, but with another value,
9732 % define strings only if the current label or font encoding is the
9733 % value of |strings|; otherwise (i.e., no |strings| or a block whose
9734 % label is not in |strings=|) do nothing.
9735 %
9736 % We presume the current block is not loaded, and therefore set
9737 % (above) a couple of default values to gobble the arguments. Then,
9738 % these macros are redefined if necessary according to several
9739 % parameters.
9740 %
9741 % \begin{macrocode}
9742 \newcommand\bbl@startcmds@ii[1][\@empty]{%
9743 \let\SetString\@gobbletwo
9744 \let\bbl@stringdef\@gobbletwo
9745 \let\AfterBabelCommands\@gobble
9746 \ifx\@empty#1%
9747 \def\bbl@sc@label{generic}%
9748 \def\bbl@encstring##1##2{%
9749 \ProvideTextCommandDefault##1{##2}%
9750 \bbl@toglobal##1%
9751 \expandafter\bbl@toglobal\csname\string?\string##1\endcsname}%
9752 \let\bbl@sctest\in@true
9753 \else
9754 \let\bbl@sc@charset\space % <- zapped below
9755 \let\bbl@sc@fontenc\space % <- " "
9756 \def\bbl@tempa##1=##2\@nil{%
9757 \bbl@csarg\edef{sc@\zap@space##1 \@empty}{##2 }}%
9758 \bbl@vforeach{label=#1}{\bbl@tempa##1\@nil}%
9759 \def\bbl@tempa##1 ##2{% space -> comma
9760 ##1%
9761 \ifx\@empty##2\else\ifx,##1,\else,\fi\bbl@afterfi\bbl@tempa##2\fi}%
9762 \edef\bbl@sc@fontenc{\expandafter\bbl@tempa\bbl@sc@fontenc\@empty}%
9763 \edef\bbl@sc@label{\expandafter\zap@space\bbl@sc@label\@empty}%
9764 \edef\bbl@sc@charset{\expandafter\zap@space\bbl@sc@charset\@empty}%
9765 \def\bbl@encstring##1##2{%
9766 \bbl@foreach\bbl@sc@fontenc{%
9767 \bbl@ifunset{T@####1}%
9768 {}%
9769 {\ProvideTextCommand##1{####1}{##2}%
9770 \bbl@toglobal##1%
9771 \expandafter
9772 \bbl@toglobal\csname####1\string##1\endcsname}}}%
9773 \def\bbl@sctest{%
9774 \bbl@xin@{,\bbl@opt@strings,}{,\bbl@sc@label,\bbl@sc@fontenc,}}%
9775 \fi
9776 \ifx\bbl@opt@strings\@nnil % i.e., no strings key -> defaults
9777 \else\ifx\bbl@opt@strings\relax % i.e., strings=encoded
9778 \let\AfterBabelCommands\bbl@aftercmds
9779 \let\SetString\bbl@setstring
9780 \let\bbl@stringdef\bbl@encstring
9781 \else % i.e., strings=value
9782 \bbl@sctest
9783 \ifin@
9784 \let\AfterBabelCommands\bbl@aftercmds
9785 \let\SetString\bbl@setstring
9786 \let\bbl@stringdef\bbl@provstring
9787 \fi\fi\fi
9788 \bbl@scswitch
9789 \ifx\bbl@G\@empty
9790 \def\SetString##1##2{%
9791 \bbl@error{missing-group}{##1}{}{}}%
9792 \fi
9793 \ifx\@empty#1%
9794 \bbl@usehooks{defaultcommands}{}%
9795 \else
9796 \@expandtwoargs
9797 \bbl@usehooks{encodedcommands}{{\bbl@sc@charset}{\bbl@sc@fontenc}}%
9798 \fi}
9799 % \end{macrocode}
9800 %
9801 % There are two versions of |\bbl@scswitch|. The first version is used
9802 % when |ldf|s are read, and it makes sure |\<group><language>| is
9803 % reset, but only once (|\bbl@screset| is used to keep track of this).
9804 % The second version is used in the preamble and packages loaded after
9805 % \babel{} and does nothing.
9806 %
9807 % The macro |\bbl@forlang| loops |\bbl@L| but its body is executed only
9808 % if the value is in |\BabelLanguages| (inside \babel) or
9809 % |\date<language>| is defined (after \babel{} has been loaded).
9810 % There are also two version of |\bbl@forlang|. The first one skips the
9811 % current iteration if the language is not in |\BabelLanguages| (used
9812 % in |ldf|s), and the second one skips undefined languages (after
9813 % \babel{} has been loaded) .
9814 %
9815 % \begin{macrocode}
9816 \def\bbl@forlang#1#2{%
9817 \bbl@for#1\bbl@L{%
9818 \bbl@xin@{,#1,}{,\BabelLanguages,}%
9819 \ifin@#2\relax\fi}}
9820 \def\bbl@scswitch{%
9821 \bbl@forlang\bbl@tempa{%
9822 \ifx\bbl@G\@empty\else
9823 \ifx\SetString\@gobbletwo\else
9824 \edef\bbl@GL{\bbl@G\bbl@tempa}%
9825 \bbl@xin@{,\bbl@GL,}{,\bbl@screset,}%
9826 \ifin@\else
9827 \global\expandafter\let\csname\bbl@GL\endcsname\@undefined
9828 \xdef\bbl@screset{\bbl@screset,\bbl@GL}%
9829 \fi
9830 \fi
9831 \fi}}
9832 \AtEndOfPackage{%
9833 \def\bbl@forlang#1#2{\bbl@for#1\bbl@L{\bbl@ifunset{date#1}{}{#2}}}%
9834 \let\bbl@scswitch\relax}
9835 \@onlypreamble\EndBabelCommands
9836 \def\EndBabelCommands{%
9837 \bbl@usehooks{stopcommands}{}%
9838 \endgroup
9839 \endgroup
9840 \bbl@scafter}
9841 \let\bbl@endcommands\EndBabelCommands
9842 % \end{macrocode}
9843 %
9844 % Now we define commands to be used inside |\StartBabelCommands|.
9845 %
9846 % \paragraph{Strings} The following macro is the actual definition
9847 % of |\SetString| when it is “active”
9848 %
9849 % First save the “switcher”. Create it if undefined. Strings are
9850 % defined only if undefined (i.e., like |\providescommand|). With
9851 % the event |stringprocess| you can preprocess the string by
9852 % manipulating the value of |\BabelString|. If there are several
9853 % hooks assigned to this event, preprocessing is done in the same
9854 % order as defined. Finally, the string is set.
9855 %
9856 % \begin{macrocode}
9857 \def\bbl@setstring#1#2{% e.g., \prefacename{<string>}
9858 \bbl@forlang\bbl@tempa{%
9859 \edef\bbl@LC{\bbl@tempa\bbl@stripslash#1}%
9860 \bbl@ifunset{\bbl@LC}% e.g., \germanchaptername
9861 {\bbl@exp{%
9862 \global\\\bbl@add\<\bbl@G\bbl@tempa>{\\\bbl@scset\\#1\<\bbl@LC>}}}%
9863 {}%
9864 \def\BabelString{#2}%
9865 \bbl@usehooks{stringprocess}{}%
9866 \expandafter\bbl@stringdef
9867 \csname\bbl@LC\expandafter\endcsname\expandafter{\BabelString}}}
9868 % \end{macrocode}
9869 %
9870 % A little auxiliary command sets the string. Formerly used with
9871 % casing. Very likely no longer necessary, although it’s used in
9872 % |\setlocalecaption|.
9873 %
9874 % \begin{macrocode}
9875 \def\bbl@scset#1#2{\def#1{#2}}
9876 % \end{macrocode}
9877 %
9878 % Define |\SetStringLoop|, which is actually set inside
9879 % |\StartBabelCommands|. The current definition is somewhat complicated
9880 % because we need a count, but |\count@| is not under our control
9881 % (remember |\SetString| may call hooks). Instead of defining a
9882 % dedicated count, we just “pre-expand” its value.
9883 %
9884 % \begin{macrocode}
9885 %<<*Macros local to BabelCommands>>
9886 \def\SetStringLoop##1##2{%
9887 \def\bbl@templ####1{\expandafter\noexpand\csname##1\endcsname}%
9888 \count@\z@
9889 \bbl@loop\bbl@tempa{##2}{% empty items and spaces are ok
9890 \advance\count@\@ne
9891 \toks@\expandafter{\bbl@tempa}%
9892 \bbl@exp{%
9893 \\\SetString\bbl@templ{\romannumeral\count@}{\the\toks@}%
9894 \count@=\the\count@\relax}}}%
9895 %<</Macros local to BabelCommands>>
9896 % \end{macrocode}
9897 %
9898 % \paragraph{Delaying code} Now the definition of |\AfterBabelCommands|
9899 % when it is activated.
9900 %
9901 % \begin{macrocode}
9902 \def\bbl@aftercmds#1{%
9903 \toks@\expandafter{\bbl@scafter#1}%
9904 \xdef\bbl@scafter{\the\toks@}}
9905 % \end{macrocode}
9906 %
9907 % \paragraph{Case mapping}
9908 %
9909 % The command |\SetCase| is deprecated. Currently it consists in a
9910 % definition with a hack just for backward compatibility in the macro
9911 % mapping.
9912 %
9913 % \begin{macrocode}
9914 %<<*Macros local to BabelCommands>>
9915 \newcommand\SetCase[3][]{%
9916 \def\bbl@tempa####1####2{%
9917 \ifx####1\@empty\else
9918 \bbl@carg\bbl@add{extras\CurrentOption}{%
9919 \bbl@carg\babel@save{c__text_uppercase_\string####1_tl}%
9920 \bbl@carg\def{c__text_uppercase_\string####1_tl}{####2}%
9921 \bbl@carg\babel@save{c__text_lowercase_\string####2_tl}%
9922 \bbl@carg\def{c__text_lowercase_\string####2_tl}{####1}}%
9923 \expandafter\bbl@tempa
9924 \fi}%
9925 \bbl@tempa##1\@empty\@empty
9926 \bbl@carg\bbl@toglobal{extras\CurrentOption}}%
9927 %<</Macros local to BabelCommands>>
9928 % \end{macrocode}
9929 %
9930 % Macros to deal with case mapping for hyphenation. To decide if the
9931 % document is monolingual or multilingual, we make a rough guess --
9932 % just see if there is a comma in the languages list, built in the
9933 % first pass of the package options.
9934 %
9935 % \begin{macrocode}
9936 %<<*Macros local to BabelCommands>>
9937 \newcommand\SetHyphenMap[1]{%
9938 \bbl@forlang\bbl@tempa{%
9939 \expandafter\bbl@stringdef
9940 \csname\bbl@tempa @bbl@hyphenmap\endcsname{##1}}}%
9941 %<</Macros local to BabelCommands>>
9942 % \end{macrocode}
9943 %
9944 % There are 3 helper macros which do most of the work for you.
9945 %
9946 % \begin{macrocode}
9947 \newcommand\BabelLower[2]{% one to one.
9948 \ifnum\lccode#1=#2\else
9949 \babel@savevariable{\lccode#1}%
9950 \lccode#1=#2\relax
9951 \fi}
9952 \newcommand\BabelLowerMM[4]{% many-to-many
9953 \@tempcnta=#1\relax
9954 \@tempcntb=#4\relax
9955 \def\bbl@tempa{%
9956 \ifnum\@tempcnta>#2\else
9957 \@expandtwoargs\BabelLower{\the\@tempcnta}{\the\@tempcntb}%
9958 \advance\@tempcnta#3\relax
9959 \advance\@tempcntb#3\relax
9960 \expandafter\bbl@tempa
9961 \fi}%
9962 \bbl@tempa}
9963 \newcommand\BabelLowerMO[4]{% many-to-one
9964 \@tempcnta=#1\relax
9965 \def\bbl@tempa{%
9966 \ifnum\@tempcnta>#2\else
9967 \@expandtwoargs\BabelLower{\the\@tempcnta}{#4}%
9968 \advance\@tempcnta#3
9969 \expandafter\bbl@tempa
9970 \fi}%
9971 \bbl@tempa}
9972 % \end{macrocode}
9973 %
9974 % The following package options control the behavior of
9975 % hyphenation mapping.
9976 %
9977 % \begin{macrocode}
9978 %<<*More package options>>
9979 \DeclareOption{hyphenmap=off}{\chardef\bbl@opt@hyphenmap\z@}
9980 \DeclareOption{hyphenmap=first}{\chardef\bbl@opt@hyphenmap\@ne}
9981 \DeclareOption{hyphenmap=select}{\chardef\bbl@opt@hyphenmap\tw@}
9982 \DeclareOption{hyphenmap=other}{\chardef\bbl@opt@hyphenmap\thr@@}
9983 \DeclareOption{hyphenmap=other*}{\chardef\bbl@opt@hyphenmap4\relax}
9984 %<</More package options>>
9985 % \end{macrocode}
9986 %
9987 % Initial setup to provide a default behavior if |hyphenmap| is not
9988 % set.
9989 %
9990 % \begin{macrocode}
9991 \AtEndOfPackage{%
9992 \ifx\bbl@opt@hyphenmap\@undefined
9993 \bbl@xin@{,}{\bbl@language@opts}%
9994 \chardef\bbl@opt@hyphenmap\ifin@4\else\@ne\fi
9995 \fi}
9996 % \end{macrocode}
9997 %
9998 % \subsection{Tailor captions}
9999 %
10000 % A general tool for resetting the caption
10001 % names with a unique interface. With the old way, which mixes the
10002 % switcher and the string, we convert it to the new one, which
10003 % separates these two steps.
10004 %
10005 % \begin{macrocode}
10006 \newcommand\setlocalecaption{%
10007 \@ifstar\bbl@setcaption@s\bbl@setcaption@x}
10008 \def\bbl@setcaption@x#1#2#3{% language caption-name string
10009 \bbl@trim@def\bbl@tempa{#2}%
10010 \bbl@xin@{.template}{\bbl@tempa}%
10011 \ifin@
10012 \bbl@ini@captions@template{#3}{#1}%
10013 \else
10014 \edef\bbl@tempd{%
10015 \expandafter\expandafter\expandafter
10016 \strip@prefix\expandafter\meaning\csname captions#1\endcsname}%
10017 \bbl@xin@
10018 {\expandafter\string\csname #2name\endcsname}%
10019 {\bbl@tempd}%
10020 \ifin@ % Renew caption
10021 \bbl@xin@{\string\bbl@scset}{\bbl@tempd}%
10022 \ifin@
10023 \bbl@exp{%
10024 \\\bbl@ifsamestring{\bbl@tempa}{\languagename}%
10025 {\\\bbl@scset\<#2name>\<#1#2name>}%
10026 {}}%
10027 \else % Old way converts to new way
10028 \bbl@ifunset{#1#2name}%
10029 {\bbl@exp{%
10030 \\\bbl@add\<captions#1>{\def\<#2name>{\<#1#2name>}}%
10031 \\\bbl@ifsamestring{\bbl@tempa}{\languagename}%
10032 {\def\<#2name>{\<#1#2name>}}%
10033 {}}}%
10034 {}%
10035 \fi
10036 \else
10037 \bbl@xin@{\string\bbl@scset}{\bbl@tempd}% New
10038 \ifin@ % New way
10039 \bbl@exp{%
10040 \\\bbl@add\<captions#1>{\\\bbl@scset\<#2name>\<#1#2name>}%
10041 \\\bbl@ifsamestring{\bbl@tempa}{\languagename}%
10042 {\\\bbl@scset\<#2name>\<#1#2name>}%
10043 {}}%
10044 \else % Old way, but defined in the new way
10045 \bbl@exp{%
10046 \\\bbl@add\<captions#1>{\def\<#2name>{\<#1#2name>}}%
10047 \\\bbl@ifsamestring{\bbl@tempa}{\languagename}%
10048 {\def\<#2name>{\<#1#2name>}}%
10049 {}}%
10050 \fi%
10051 \fi
10052 \@namedef{#1#2name}{#3}%
10053 \toks@\expandafter{\bbl@captionslist}%
10054 \bbl@exp{\\\in@{\<#2name>}{\the\toks@}}%
10055 \ifin@\else
10056 \bbl@exp{\\\bbl@add\\\bbl@captionslist{\<#2name>}}%
10057 \bbl@toglobal\bbl@captionslist
10058 \fi
10059 \fi}
10060 % \end{macrocode}
10061 %
10062 % \subsection{Making glyphs available}
10063 %
10064 % This section makes a number of glyphs available that either do not
10065 % exist in the \texttt{OT1} encoding and have to be `faked', or
10066 % that are not accessible through \file{T1enc.def}.
10067 %
10068 % \macro{\set@low@box}
10069 %
10070 % The following macro is used to lower quotes to the same level as
10071 % the comma. It prepares its argument in box register~0.
10072 %
10073 % \begin{macrocode}
10074 \bbl@trace{Macros related to glyphs}
10075 \def\set@low@box#1{\setbox\tw@\hbox{,}\setbox\z@\hbox{#1}%
10076 \dimen\z@\ht\z@ \advance\dimen\z@ -\ht\tw@%
10077 \setbox\z@\hbox{\lower\dimen\z@ \box\z@}\ht\z@\ht\tw@ \dp\z@\dp\tw@}
10078 % \end{macrocode}
10079 %
10080 % \macro{\save@sf@q}
10081 % The macro |\save@sf@q| is used to save and reset the current space
10082 % factor.
10083 %
10084 % \begin{macrocode}
10085 \def\save@sf@q#1{\leavevmode
10086 \begingroup
10087 \edef\@SF{\spacefactor\the\spacefactor}#1\@SF
10088 \endgroup}
10089 % \end{macrocode}
10090 %
10091 % \subsubsection{Quotation marks}
10092 %
10093 % \macro{\quotedblbase}
10094 % In the \texttt{T1} encoding the opening double quote at the
10095 % baseline is available as a separate character, accessible via
10096 % |\quotedblbase|. In the \texttt{OT1} encoding it is not
10097 % available, therefore we make it available by lowering the normal
10098 % open quote character to the baseline.
10099 %
10100 % \begin{macrocode}
10101 \ProvideTextCommand{\quotedblbase}{OT1}{%
10102 \save@sf@q{\set@low@box{\textquotedblright\/}%
10103 \box\z@\kern-.04em\bbl@allowhyphens}}
10104 % \end{macrocode}
10105 %
10106 % Make sure that when an encoding other than \texttt{OT1} or
10107 % \texttt{T1} is used this glyph can still be typeset.
10108 %
10109 % \begin{macrocode}
10110 \ProvideTextCommandDefault{\quotedblbase}{%
10111 \UseTextSymbol{OT1}{\quotedblbase}}
10112 % \end{macrocode}
10113 %
10114 % \macro{\quotesinglbase}
10115 % We also need the single quote character at the baseline.
10116 %
10117 % \begin{macrocode}
10118 \ProvideTextCommand{\quotesinglbase}{OT1}{%
10119 \save@sf@q{\set@low@box{\textquoteright\/}%
10120 \box\z@\kern-.04em\bbl@allowhyphens}}
10121 % \end{macrocode}
10122 %
10123 % Make sure that when an encoding other than \texttt{OT1} or
10124 % \texttt{T1} is used this glyph can still be typeset.
10125 %
10126 % \begin{macrocode}
10127 \ProvideTextCommandDefault{\quotesinglbase}{%
10128 \UseTextSymbol{OT1}{\quotesinglbase}}
10129 % \end{macrocode}
10130 %
10131 % \macro{\guillemetleft}
10132 % \macro{\guillemetright}
10133 % The guillemet characters are not available in \texttt{OT1}
10134 % encoding. They are faked. (Wrong names with o preserved for
10135 % compatibility.)
10136 %
10137 % \begin{macrocode}
10138 \ProvideTextCommand{\guillemetleft}{OT1}{%
10139 \ifmmode
10140 \ll
10141 \else
10142 \save@sf@q{\nobreak
10143 \raise.2ex\hbox{$\scriptscriptstyle\ll$}\bbl@allowhyphens}%
10144 \fi}
10145 \ProvideTextCommand{\guillemetright}{OT1}{%
10146 \ifmmode
10147 \gg
10148 \else
10149 \save@sf@q{\nobreak
10150 \raise.2ex\hbox{$\scriptscriptstyle\gg$}\bbl@allowhyphens}%
10151 \fi}
10152 \ProvideTextCommand{\guillemotleft}{OT1}{%
10153 \ifmmode
10154 \ll
10155 \else
10156 \save@sf@q{\nobreak
10157 \raise.2ex\hbox{$\scriptscriptstyle\ll$}\bbl@allowhyphens}%
10158 \fi}
10159 \ProvideTextCommand{\guillemotright}{OT1}{%
10160 \ifmmode
10161 \gg
10162 \else
10163 \save@sf@q{\nobreak
10164 \raise.2ex\hbox{$\scriptscriptstyle\gg$}\bbl@allowhyphens}%
10165 \fi}
10166 % \end{macrocode}
10167 %
10168 % Make sure that when an encoding other than \texttt{OT1} or
10169 % \texttt{T1} is used these glyphs can still be typeset.
10170 %
10171 % \begin{macrocode}
10172 \ProvideTextCommandDefault{\guillemetleft}{%
10173 \UseTextSymbol{OT1}{\guillemetleft}}
10174 \ProvideTextCommandDefault{\guillemetright}{%
10175 \UseTextSymbol{OT1}{\guillemetright}}
10176 \ProvideTextCommandDefault{\guillemotleft}{%
10177 \UseTextSymbol{OT1}{\guillemotleft}}
10178 \ProvideTextCommandDefault{\guillemotright}{%
10179 \UseTextSymbol{OT1}{\guillemotright}}
10180 % \end{macrocode}
10181 %
10182 % \macro{\guilsinglleft}
10183 % \macro{\guilsinglright}
10184 % The single guillemets are not available in \texttt{OT1} encoding.
10185 % They are faked.
10186 %
10187 % \begin{macrocode}
10188 \ProvideTextCommand{\guilsinglleft}{OT1}{%
10189 \ifmmode
10190 <%
10191 \else
10192 \save@sf@q{\nobreak
10193 \raise.2ex\hbox{$\scriptscriptstyle<$}\bbl@allowhyphens}%
10194 \fi}
10195 \ProvideTextCommand{\guilsinglright}{OT1}{%
10196 \ifmmode
10197 >%
10198 \else
10199 \save@sf@q{\nobreak
10200 \raise.2ex\hbox{$\scriptscriptstyle>$}\bbl@allowhyphens}%
10201 \fi}
10202 % \end{macrocode}
10203 %
10204 % Make sure that when an encoding other than \texttt{OT1} or
10205 % \texttt{T1} is used these glyphs can still be typeset.
10206 %
10207 % \begin{macrocode}
10208 \ProvideTextCommandDefault{\guilsinglleft}{%
10209 \UseTextSymbol{OT1}{\guilsinglleft}}
10210 \ProvideTextCommandDefault{\guilsinglright}{%
10211 \UseTextSymbol{OT1}{\guilsinglright}}
10212 % \end{macrocode}
10213 %
10214 % \subsubsection{Letters}
10215 %
10216 % \macro{\ij}
10217 % \macro{\IJ}
10218 % The dutch language uses the letter `ij'. It is available in
10219 % \texttt{T1} encoded fonts, but not in the \texttt{OT1} encoded
10220 % fonts. Therefore we fake it for the \texttt{OT1} encoding.
10221 %
10222 % \begin{macrocode}
10223 \DeclareTextCommand{\ij}{OT1}{%
10224 i\kern-0.02em\bbl@allowhyphens j}
10225 \DeclareTextCommand{\IJ}{OT1}{%
10226 I\kern-0.02em\bbl@allowhyphens J}
10227 \DeclareTextCommand{\ij}{T1}{\char188}
10228 \DeclareTextCommand{\IJ}{T1}{\char156}
10229 % \end{macrocode}
10230 %
10231 % Make sure that when an encoding other than \texttt{OT1} or
10232 % \texttt{T1} is used these glyphs can still be typeset.
10233 %
10234 % \begin{macrocode}
10235 \ProvideTextCommandDefault{\ij}{%
10236 \UseTextSymbol{OT1}{\ij}}
10237 \ProvideTextCommandDefault{\IJ}{%
10238 \UseTextSymbol{OT1}{\IJ}}
10239 % \end{macrocode}
10240 %
10241 % \macro{\dj}
10242 % \macro{\DJ}
10243 % The croatian language needs the letters |\dj| and |\DJ|; they are
10244 % available in the \texttt{T1} encoding, but not in the
10245 % \texttt{OT1} encoding by default.
10246 %
10247 % Some code to construct these glyphs for the \texttt{OT1} encoding
10248 % was made available to me by Stipčević Mario,
10249 % (\texttt{[email protected]}).
10250 %
10251 % \begin{macrocode}
10252 \def\crrtic@{\hrule height0.1ex width0.3em}
10253 \def\crttic@{\hrule height0.1ex width0.33em}
10254 \def\ddj@{%
10255 \setbox0\hbox{d}\dimen@=\ht0
10256 \advance\dimen@1ex
10257 \[email protected]\dimen@
10258 \dimen@ii\expandafter\rem@pt\the\fontdimen\@ne\font\dimen@
10259 \advance\[email protected]
10260 \leavevmode\rlap{\raise\dimen@\hbox{\kern\dimen@ii\vbox{\crrtic@}}}}
10261 \def\DDJ@{%
10262 \setbox0\hbox{D}\dimen@=.55\ht0
10263 \dimen@ii\expandafter\rem@pt\the\fontdimen\@ne\font\dimen@
10264 \advance\[email protected] % correction for the dash position
10265 \advance\[email protected]\fontdimen7\font % correction for cmtt font
10266 \dimen\thr@@\expandafter\rem@pt\the\fontdimen7\font\dimen@
10267 \leavevmode\rlap{\raise\dimen@\hbox{\kern\dimen@ii\vbox{\crttic@}}}}
10268 %
10269 \DeclareTextCommand{\dj}{OT1}{\ddj@ d}
10270 \DeclareTextCommand{\DJ}{OT1}{\DDJ@ D}
10271 % \end{macrocode}
10272 %
10273 % Make sure that when an encoding other than \texttt{OT1} or
10274 % \texttt{T1} is used these glyphs can still be typeset.
10275 %
10276 % \begin{macrocode}
10277 \ProvideTextCommandDefault{\dj}{%
10278 \UseTextSymbol{OT1}{\dj}}
10279 \ProvideTextCommandDefault{\DJ}{%
10280 \UseTextSymbol{OT1}{\DJ}}
10281 % \end{macrocode}
10282 %
10283 % \macro{\SS}
10284 % For the \texttt{T1} encoding |\SS| is defined and selects a specific
10285 % glyph from the font, but for other encodings it is not available.
10286 % Therefore we make it available here.
10287 %
10288 % \begin{macrocode}
10289 \DeclareTextCommand{\SS}{OT1}{SS}
10290 \ProvideTextCommandDefault{\SS}{\UseTextSymbol{OT1}{\SS}}
10291 % \end{macrocode}
10292 %
10293 % \subsubsection{Shorthands for quotation marks}
10294 %
10295 % Shorthands are provided for a number of different quotation marks,
10296 % which make them usable both outside and inside mathmode. They are
10297 % defined with |\ProvideTextCommandDefault|, but this is very likely
10298 % not required because their definitions are based on
10299 % encoding-dependent macros.
10300 %
10301 % \macro{\glq}
10302 % \macro{\grq}
10303 %
10304 % The `german' single quotes.
10305 %
10306 % \begin{macrocode}
10307 \ProvideTextCommandDefault{\glq}{%
10308 \textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
10309 % \end{macrocode}
10310 %
10311 % The definition of |\grq| depends on the fontencoding. With
10312 % \texttt{T1} encoding no extra kerning is needed.
10313 %
10314 % \begin{macrocode}
10315 \ProvideTextCommand{\grq}{T1}{%
10316 \textormath{\kern\z@\textquoteleft}{\mbox{\textquoteleft}}}
10317 \ProvideTextCommand{\grq}{TU}{%
10318 \textormath{\textquoteleft}{\mbox{\textquoteleft}}}
10319 \ProvideTextCommand{\grq}{OT1}{%
10320 \save@sf@q{\kern-.0125em
10321 \textormath{\textquoteleft}{\mbox{\textquoteleft}}%
10322 \kern.07em\relax}}
10323 \ProvideTextCommandDefault{\grq}{\UseTextSymbol{OT1}\grq}
10324 % \end{macrocode}
10325 %
10326 % \macro{\glqq}
10327 % \macro{\grqq}
10328 %
10329 % The `german' double quotes.
10330 %
10331 % \begin{macrocode}
10332 \ProvideTextCommandDefault{\glqq}{%
10333 \textormath{\quotedblbase}{\mbox{\quotedblbase}}}
10334 % \end{macrocode}
10335 %
10336 % The definition of |\grqq| depends on the fontencoding. With
10337 % \texttt{T1} encoding no extra kerning is needed.
10338 %
10339 % \begin{macrocode}
10340 \ProvideTextCommand{\grqq}{T1}{%
10341 \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
10342 \ProvideTextCommand{\grqq}{TU}{%
10343 \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
10344 \ProvideTextCommand{\grqq}{OT1}{%
10345 \save@sf@q{\kern-.07em
10346 \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}%
10347 \kern.07em\relax}}
10348 \ProvideTextCommandDefault{\grqq}{\UseTextSymbol{OT1}\grqq}
10349 % \end{macrocode}
10350 %
10351 % \macro{\flq}
10352 % \macro{\frq}
10353 %
10354 % The `french' single guillemets.
10355 %
10356 % \begin{macrocode}
10357 \ProvideTextCommandDefault{\flq}{%
10358 \textormath{\guilsinglleft}{\mbox{\guilsinglleft}}}
10359 \ProvideTextCommandDefault{\frq}{%
10360 \textormath{\guilsinglright}{\mbox{\guilsinglright}}}
10361 % \end{macrocode}
10362 %
10363 % \macro{\flqq}
10364 % \macro{\frqq}
10365 %
10366 % The `french' double guillemets.
10367 %
10368 % \begin{macrocode}
10369 \ProvideTextCommandDefault{\flqq}{%
10370 \textormath{\guillemetleft}{\mbox{\guillemetleft}}}
10371 \ProvideTextCommandDefault{\frqq}{%
10372 \textormath{\guillemetright}{\mbox{\guillemetright}}}
10373 % \end{macrocode}
10374 %
10375 % \subsubsection{Umlauts and tremas}
10376 %
10377 % The command |\"| needs to have a different effect for different
10378 % languages. For German for instance, the `umlaut' should be positioned
10379 % lower than the default position for placing it over the letters a, o,
10380 % u, A, O and U. When placed over an e, i, E or I it can retain its
10381 % normal position. For Dutch the same glyph is always placed in the
10382 % lower position.
10383 %
10384 % \macro{\umlauthigh}
10385 %
10386 % \macro{\umlautlow}
10387 % To be able to provide both positions of |\"| we provide two commands
10388 % to switch the positioning, the default will be |\umlauthigh| (the
10389 % normal positioning).
10390 %
10391 % \begin{macrocode}
10392 \def\umlauthigh{%
10393 \def\bbl@umlauta##1{\leavevmode\bgroup%
10394 \accent\csname\f@encoding dqpos\endcsname
10395 ##1\bbl@allowhyphens\egroup}%
10396 \let\bbl@umlaute\bbl@umlauta}
10397 \def\umlautlow{%
10398 \def\bbl@umlauta{\protect\lower@umlaut}}
10399 \def\umlautelow{%
10400 \def\bbl@umlaute{\protect\lower@umlaut}}
10401 \umlauthigh
10402 % \end{macrocode}
10403 %
10404 % \macro{\lower@umlaut}
10405 % Used to position the |\"| closer to
10406 % the letter. We want the umlaut character lowered, nearer to the
10407 % letter. To do this we need an extra \meta{dimen} register.
10408 %
10409 % \begin{macrocode}
10410 \expandafter\ifx\csname U@D\endcsname\relax
10411 \csname newdimen\endcsname\U@D
10412 \fi
10413 % \end{macrocode}
10414 %
10415 % The following code fools \TeX’s \texttt{make\_accent} procedure about
10416 % the current x-height of the font to force another placement of the
10417 % umlaut character. First we have to save the current x-height of the
10418 % font, because we'll change this font dimension and this is always
10419 % done globally.
10420 %
10421 % Then we compute the new x-height in such a way that the umlaut
10422 % character is lowered to the base character. The value of
10423 % \texttt{.45ex} depends on the \MF\ parameters with which the fonts
10424 % were built. (Just try out, which value will look best.) If the new
10425 % x-height is too low, it is not changed. Finally we call the |\accent|
10426 % primitive, reset the old x-height and insert the base character in
10427 % the argument.
10428 %
10429 % \begin{macrocode}
10430 \def\lower@umlaut#1{%
10431 \leavevmode\bgroup
10432 \U@D 1ex%
10433 {\setbox\z@\hbox{%
10434 \char\csname\f@encoding dqpos\endcsname}%
10435 \dimen@ -.45ex\advance\dimen@\ht\z@
10436 \ifdim 1ex<\dimen@ \fontdimen5\font\dimen@ \fi}%
10437 \accent\csname\f@encoding dqpos\endcsname
10438 \fontdimen5\font\U@D #1%
10439 \egroup}
10440 % \end{macrocode}
10441 %
10442 % For all vowels we declare |\"| to be a composite command which
10443 % uses |\bbl@umlauta| or |\bbl@umlaute| to position the umlaut
10444 % character. We need to be sure that these definitions override the
10445 % ones that are provided when the package \pkg{fontenc} with
10446 % option \Lopt{OT1} is used. Therefore these declarations are
10447 % postponed until the beginning of the document. Note these
10448 % definitions only apply to some languages, but
10449 % \babel{} sets them for \textit{all} languages -- you may want to
10450 % redefine |\bbl@umlauta| and/or |\bbl@umlaute| for a language
10451 % in the corresponding |ldf| (using the \babel{} switching mechanism,
10452 % of course).
10453 %
10454 % \begin{macrocode}
10455 \AtBeginDocument{%
10456 \DeclareTextCompositeCommand{\"}{OT1}{a}{\bbl@umlauta{a}}%
10457 \DeclareTextCompositeCommand{\"}{OT1}{e}{\bbl@umlaute{e}}%
10458 \DeclareTextCompositeCommand{\"}{OT1}{i}{\bbl@umlaute{\i}}%
10459 \DeclareTextCompositeCommand{\"}{OT1}{\i}{\bbl@umlaute{\i}}%
10460 \DeclareTextCompositeCommand{\"}{OT1}{o}{\bbl@umlauta{o}}%
10461 \DeclareTextCompositeCommand{\"}{OT1}{u}{\bbl@umlauta{u}}%
10462 \DeclareTextCompositeCommand{\"}{OT1}{A}{\bbl@umlauta{A}}%
10463 \DeclareTextCompositeCommand{\"}{OT1}{E}{\bbl@umlaute{E}}%
10464 \DeclareTextCompositeCommand{\"}{OT1}{I}{\bbl@umlaute{I}}%
10465 \DeclareTextCompositeCommand{\"}{OT1}{O}{\bbl@umlauta{O}}%
10466 \DeclareTextCompositeCommand{\"}{OT1}{U}{\bbl@umlauta{U}}}
10467 % \end{macrocode}
10468 %
10469 % Finally, make sure the default hyphenrules are defined (even if
10470 % empty). For internal use, another empty |\language| is defined.
10471 % Currently used in Amharic.
10472 %
10473 % \begin{macrocode}
10474 \ifx\l@english\@undefined
10475 \chardef\l@english\z@
10476 \fi
10477 % The following is used to cancel rules in ini files (see Amharic).
10478 \ifx\l@unhyphenated\@undefined
10479 \newlanguage\l@unhyphenated
10480 \fi
10481 % \end{macrocode}
10482 %
10483 % \subsection{Layout}
10484 %
10485 % Layout is mainly intended to set bidi documents, but there is at
10486 % least a tool useful in general.
10487 %
10488 % \begin{macrocode}
10489 \bbl@trace{Bidi layout}
10490 \providecommand\IfBabelLayout[3]{#3}%
10491 % \end{macrocode}
10492 %
10493 % \subsection{Load engine specific macros}
10494 %
10495 % Some macros are not defined in all engines, so, after loading the
10496 % files define them if necessary to raise an error.
10497 %
10498 % \begin{macrocode}
10499 \bbl@trace{Input engine specific macros}
10500 \ifcase\bbl@engine
10501 \input txtbabel.def
10502 \or
10503 \input luababel.def
10504 \or
10505 \input xebabel.def
10506 \fi
10507 \providecommand\babelfont{\bbl@error{only-lua-xe}{}{}{}}
10508 \providecommand\babelprehyphenation{\bbl@error{only-lua}{}{}{}}
10509 \ifx\babelposthyphenation\@undefined
10510 \let\babelposthyphenation\babelprehyphenation
10511 \let\babelpatterns\babelprehyphenation
10512 \let\babelcharproperty\babelprehyphenation
10513 \fi
10514 %</package|core>
10515 % \end{macrocode}
10516 %
10517 % \subsection{Creating and modifying languages}
10518 %
10519 % Continue with \LaTeX{} only.
10520 %
10521 % |\babelprovide| is a general purpose tool for creating and modifying
10522 % languages. It creates the language infrastructure, and loads, if
10523 % requested, an |ini| file. It may be used in conjunction to previously
10524 % loaded |ldf| files.
10525 %
10526 % \begin{macrocode}
10527 %<*package>
10528 \bbl@trace{Creating languages and reading ini files}
10529 \let\bbl@extend@ini\@gobble
10530 \newcommand\babelprovide[2][]{%
10531 \let\bbl@savelangname\languagename
10532 \edef\bbl@savelocaleid{\the\localeid}%
10533 \global\let\bbl@afterload\@empty
10534 % Set name and locale id
10535 \edef\languagename{#2}%
10536 \bbl@id@assign
10537 % Initialize keys
10538 \bbl@vforeach{captions,date,import,main,script,language,%
10539 hyphenrules,linebreaking,justification,mapfont,maparabic,%
10540 mapdigits,intraspace,intrapenalty,onchar,transforms,alph,%
10541 Alph,labels,labels*,mapdot,calendar,date,casing,interchar,%
10542 @import}%
10543 {\bbl@csarg\let{KVP@##1}\@nnil}%
10544 \global\let\bbl@release@transforms\@empty
10545 \global\let\bbl@release@casing\@empty
10546 \let\bbl@calendars\@empty
10547 \global\let\bbl@inidata\@empty
10548 \global\let\bbl@extend@ini\@gobble
10549 \global\let\bbl@included@inis\@empty
10550 \gdef\bbl@key@list{;}%
10551 \bbl@ifunset{bbl@passto@#2}%
10552 {\def\bbl@tempa{#1}}%
10553 {\bbl@exp{\def\\\bbl@tempa{\[bbl@passto@#2],\unexpanded{#1}}}}%
10554 \expandafter\bbl@forkv\expandafter{\bbl@tempa}{%
10555 \in@{/}{##1}% With /, (re)sets a value in the ini
10556 \ifin@
10557 \bbl@renewinikey##1\@@{##2}%
10558 \else
10559 \bbl@csarg\ifx{KVP@##1}\@nnil\else
10560 \bbl@error{unknown-provide-key}{##1}{}{}%
10561 \fi
10562 \bbl@csarg\def{KVP@##1}{##2}%
10563 \fi}%
10564 \chardef\bbl@howloaded=% 0:none; 1:ldf without ini; 2:ini
10565 \bbl@ifunset{date#2}\z@{\bbl@ifunset{bbl@llevel@#2}\@ne\tw@}%
10566 % == init ==
10567 \ifx\bbl@screset\@undefined
10568 \bbl@ldfinit
10569 \fi
10570 % ==
10571 % If there is no import (last wins), use @import (internal, there
10572 % must be just one). To consider any order (because
10573 % \PassOptionsToLocale).
10574 \ifx\bbl@KVP@import\@nnil
10575 \let\bbl@KVP@import\bbl@KVP@@import
10576 \fi
10577 % == date (as option) ==
10578 % \ifx\bbl@KVP@date\@nnil\else
10579 % \fi
10580 % ==
10581 \let\bbl@lbkflag\relax % \@empty = do setup linebreak, only in 3 cases:
10582 \ifcase\bbl@howloaded
10583 \let\bbl@lbkflag\@empty % new
10584 \else
10585 \ifx\bbl@KVP@hyphenrules\@nnil\else
10586 \let\bbl@lbkflag\@empty
10587 \fi
10588 \ifx\bbl@KVP@import\@nnil\else
10589 \let\bbl@lbkflag\@empty
10590 \fi
10591 \fi
10592 % == import, captions ==
10593 \ifx\bbl@KVP@import\@nnil\else
10594 \bbl@exp{\\\bbl@ifblank{\bbl@KVP@import}}%
10595 {\ifx\bbl@initoload\relax
10596 \begingroup
10597 \def\BabelBeforeIni##1##2{\gdef\bbl@KVP@import{##1}\endinput}%
10598 \bbl@input@texini{#2}%
10599 \endgroup
10600 \else
10601 \xdef\bbl@KVP@import{\bbl@initoload}%
10602 \fi}%
10603 {}%
10604 \let\bbl@KVP@date\@empty
10605 \fi
10606 \let\bbl@KVP@captions@@\bbl@KVP@captions
10607 \ifx\bbl@KVP@captions\@nnil
10608 \let\bbl@KVP@captions\bbl@KVP@import
10609 \fi
10610 % ==
10611 \ifx\bbl@KVP@transforms\@nnil\else
10612 \bbl@replace\bbl@KVP@transforms{ }{,}%
10613 \fi
10614 % ==
10615 \ifx\bbl@KVP@mapdot\@nnil\else
10616 \def\bbl@tempa{\@empty}%
10617 \ifx\bbl@KVP@mapdot\bbl@tempa\else
10618 \bbl@exp{\gdef\<bbl@map@@.@@\languagename>{\[bbl@KVP@mapdot]}}%
10619 \fi
10620 \fi
10621 % Load ini
10622 % --------
10623 \ifcase\bbl@howloaded
10624 \bbl@provide@new{#2}%
10625 \else
10626 \bbl@ifblank{#1}%
10627 {}% With \bbl@load@basic below
10628 {\bbl@provide@renew{#2}}%
10629 \fi
10630 % Post tasks
10631 % ----------
10632 % == subsequent calls after the first provide for a locale ==
10633 \ifx\bbl@inidata\@empty\else
10634 \bbl@extend@ini{#2}%
10635 \fi
10636 % == ensure captions ==
10637 \ifx\bbl@KVP@captions\@nnil\else
10638 \bbl@ifunset{bbl@extracaps@#2}%
10639 {\bbl@exp{\\\babelensure[exclude=\\\today]{#2}}}%
10640 {\bbl@exp{\\\babelensure[exclude=\\\today,
10641 include=\[bbl@extracaps@#2]}]{#2}}%
10642 \let\bbl@tempc\languagename
10643 \bbl@replace\bbl@tempc{-}{@@}%
10644 \bbl@ifunset{bbl@ensure@\bbl@tempc}%
10645 {\bbl@exp{%
10646 \\\DeclareRobustCommand\<bbl@ensure@\bbl@tempc>[1]{%
10647 \\\foreignlanguage{\languagename}%
10648 {####1}}}}%
10649 {}%
10650 \bbl@exp{%
10651 \\\bbl@toglobal\<bbl@ensure@\bbl@tempc>%
10652 \\\bbl@toglobal\<bbl@ensure@\bbl@tempc\space>}%
10653 \fi
10654 % \end{macrocode}
10655 %
10656 % At this point all parameters are defined if 'import'. Now we
10657 % execute some code depending on them. But what about if nothing was
10658 % imported? We just set the basic parameters, but still loading the
10659 % whole ini file.
10660 %
10661 % \begin{macrocode}
10662 \bbl@load@basic{#2}%
10663 % == script, language ==
10664 % Override the values from ini or defines them
10665 \ifx\bbl@KVP@script\@nnil\else
10666 \bbl@csarg\edef{sname@#2}{\bbl@KVP@script}%
10667 \fi
10668 \ifx\bbl@KVP@language\@nnil\else
10669 \bbl@csarg\edef{lname@#2}{\bbl@KVP@language}%
10670 \fi
10671 \ifcase\bbl@engine\or
10672 \bbl@ifunset{bbl@chrng@\languagename}{}%
10673 {\directlua{
10674 Babel.set_chranges_b('\bbl@cl{sbcp}', '\bbl@cl{chrng}') }}%
10675 \fi
10676 % == Line breaking: intraspace, intrapenalty ==
10677 % For CJK, East Asian, Southeast Asian, if interspace in ini
10678 \ifx\bbl@KVP@intraspace\@nnil\else % We can override the ini or set
10679 \bbl@csarg\edef{intsp@#2}{\bbl@KVP@intraspace}%
10680 \fi
10681 \bbl@provide@intraspace
10682 % == Line breaking: justification ==
10683 \ifx\bbl@KVP@justification\@nnil\else
10684 \let\bbl@KVP@linebreaking\bbl@KVP@justification
10685 \fi
10686 \ifx\bbl@KVP@linebreaking\@nnil\else
10687 \bbl@xin@{,\bbl@KVP@linebreaking,}%
10688 {,elongated,kashida,cjk,padding,unhyphenated,}%
10689 \ifin@
10690 \bbl@csarg\xdef
10691 {lnbrk@\languagename}{\expandafter\@car\bbl@KVP@linebreaking\@nil}%
10692 \fi
10693 \fi
10694 \bbl@xin@{/e}{/\bbl@cl{lnbrk}}%
10695 \ifin@\else\bbl@xin@{/k}{/\bbl@cl{lnbrk}}\fi
10696 \ifin@\bbl@arabicjust\fi
10697 \bbl@xin@{/p}{/\bbl@cl{lnbrk}}%
10698 \ifin@\AtBeginDocument{\@nameuse{bbl@tibetanjust}}\fi
10699 % == Line breaking: hyphenate.other.(locale|script) ==
10700 \ifx\bbl@lbkflag\@empty
10701 \bbl@ifunset{bbl@hyotl@\languagename}{}%
10702 {\bbl@csarg\bbl@replace{hyotl@\languagename}{ }{,}%
10703 \bbl@startcommands*{\languagename}{}%
10704 \bbl@csarg\bbl@foreach{hyotl@\languagename}{%
10705 \ifcase\bbl@engine
10706 \ifnum##1<257
10707 \SetHyphenMap{\BabelLower{##1}{##1}}%
10708 \fi
10709 \else
10710 \SetHyphenMap{\BabelLower{##1}{##1}}%
10711 \fi}%
10712 \bbl@endcommands}%
10713 \bbl@ifunset{bbl@hyots@\languagename}{}%
10714 {\bbl@csarg\bbl@replace{hyots@\languagename}{ }{,}%
10715 \bbl@csarg\bbl@foreach{hyots@\languagename}{%
10716 \ifcase\bbl@engine
10717 \ifnum##1<257
10718 \global\lccode##1=##1\relax
10719 \fi
10720 \else
10721 \global\lccode##1=##1\relax
10722 \fi}}%
10723 \fi
10724 % == Counters: maparabic ==
10725 % Native digits, if provided in ini (TeX level, xe and lua)
10726 \ifcase\bbl@engine\else
10727 \bbl@ifunset{bbl@dgnat@\languagename}{}%
10728 {\expandafter\ifx\csname bbl@dgnat@\languagename\endcsname\@empty\else
10729 \expandafter\expandafter\expandafter
10730 \bbl@setdigits\csname bbl@dgnat@\languagename\endcsname
10731 \ifx\bbl@KVP@maparabic\@nnil\else
10732 \ifx\bbl@latinarabic\@undefined
10733 \expandafter\let\expandafter\@arabic
10734 \csname bbl@counter@\languagename\endcsname
10735 \else % i.e., if layout=counters, which redefines \@arabic
10736 \expandafter\let\expandafter\bbl@latinarabic
10737 \csname bbl@counter@\languagename\endcsname
10738 \fi
10739 \fi
10740 \fi}%
10741 \fi
10742 % == Counters: mapdigits ==
10743 % > luababel.def
10744 % == Counters: alph, Alph ==
10745 \ifx\bbl@KVP@alph\@nnil\else
10746 \bbl@exp{%
10747 \\\bbl@add\<bbl@preextras@\languagename>{%
10748 \\\babel@save\\\@alph
10749 \let\\\@alph\<bbl@cntr@\bbl@KVP@alph @\languagename>}}%
10750 \fi
10751 \ifx\bbl@KVP@Alph\@nnil\else
10752 \bbl@exp{%
10753 \\\bbl@add\<bbl@preextras@\languagename>{%
10754 \\\babel@save\\\@Alph
10755 \let\\\@Alph\<bbl@cntr@\bbl@KVP@Alph @\languagename>}}%
10756 \fi
10757 % == Counters: mapdot ==
10758 \ifx\bbl@KVP@mapdot\@nnil\else
10759 \bbl@foreach\bbl@list@the{%
10760 \bbl@ifunset{the##1}{}%
10761 {{\bbl@ncarg\let\bbl@tempd{the##1}%
10762 \bbl@carg\bbl@sreplace{the##1}{.}{\bbl@map@lbl{.}}%
10763 \expandafter\ifx\csname the##1\endcsname\bbl@tempd\else
10764 \bbl@exp{\gdef\<the##1>{{\[the##1]}}}%
10765 \fi}}}%
10766 \edef\bbl@tempb{enumi,enumii,enumiii,enumiv}%
10767 \bbl@foreach\bbl@tempb{%
10768 \bbl@ifunset{label##1}{}%
10769 {{\bbl@ncarg\let\bbl@tempd{label##1}%
10770 \bbl@carg\bbl@sreplace{label##1}{.}{\bbl@map@lbl{.}}%
10771 \expandafter\ifx\csname label##1\endcsname\bbl@tempd\else
10772 \bbl@exp{\gdef\<label##1>{{\[label##1]}}}%
10773 \fi}}}%
10774 \fi
10775 % == Casing ==
10776 \bbl@release@casing
10777 \ifx\bbl@KVP@casing\@nnil\else
10778 \bbl@csarg\xdef{casing@\languagename}%
10779 {\@nameuse{bbl@casing@\languagename}\bbl@maybextx\bbl@KVP@casing}%
10780 \fi
10781 % == Calendars ==
10782 \ifx\bbl@KVP@calendar\@nnil
10783 \edef\bbl@KVP@calendar{\bbl@cl{calpr}}%
10784 \fi
10785 \def\bbl@tempe##1 ##2\@@{% Get first calendar
10786 \def\bbl@tempa{##1}}%
10787 \bbl@exp{\\\bbl@tempe\bbl@KVP@calendar\space\\\@@}%
10788 \def\bbl@tempe##1.##2.##3\@@{%
10789 \def\bbl@tempc{##1}%
10790 \def\bbl@tempb{##2}}%
10791 \expandafter\bbl@tempe\bbl@tempa..\@@
10792 \bbl@csarg\edef{calpr@\languagename}{%
10793 \ifx\bbl@tempc\@empty\else
10794 calendar=\bbl@tempc
10795 \fi
10796 \ifx\bbl@tempb\@empty\else
10797 ,variant=\bbl@tempb
10798 \fi}%
10799 % == engine specific extensions ==
10800 % Defined in XXXbabel.def
10801 \bbl@provide@extra{#2}%
10802 % == require.babel in ini ==
10803 % To load or reaload the babel-*.tex, if require.babel in ini
10804 \ifx\bbl@beforestart\relax\else % But not in doc aux or body
10805 \bbl@ifunset{bbl@rqtex@\languagename}{}%
10806 {\expandafter\ifx\csname bbl@rqtex@\languagename\endcsname\@empty\else
10807 \let\BabelBeforeIni\@gobbletwo
10808 \chardef\atcatcode=\catcode`\@
10809 \catcode`\@=11\relax
10810 \def\CurrentOption{#2}%
10811 \bbl@input@texini{\bbl@cs{rqtex@\languagename}}%
10812 \catcode`\@=\atcatcode
10813 \let\atcatcode\relax
10814 \global\bbl@csarg\let{rqtex@\languagename}\relax
10815 \fi}%
10816 \bbl@foreach\bbl@calendars{%
10817 \bbl@ifunset{bbl@ca@##1}{%
10818 \chardef\atcatcode=\catcode`\@
10819 \catcode`\@=11\relax
10820 \InputIfFileExists{babel-ca-##1.tex}{}{}%
10821 \catcode`\@=\atcatcode
10822 \let\atcatcode\relax}%
10823 {}}%
10824 \fi
10825 % == frenchspacing ==
10826 \ifcase\bbl@howloaded\in@true\else\in@false\fi
10827 \ifin@\else\bbl@xin@{typography/frenchspacing}{\bbl@key@list}\fi
10828 \ifin@
10829 \bbl@extras@wrap{\\\bbl@pre@fs}%
10830 {\bbl@pre@fs}%
10831 {\bbl@post@fs}%
10832 \fi
10833 % == transforms ==
10834 % > luababel.def
10835 \def\CurrentOption{#2}%
10836 \@nameuse{bbl@icsave@#2}%
10837 % == main ==
10838 \ifx\bbl@KVP@main\@nnil % Restore only if not 'main'
10839 \let\languagename\bbl@savelangname
10840 \chardef\localeid\bbl@savelocaleid\relax
10841 \fi
10842 % == ==
10843 \ifx\ldf@finish\@onlypreamble\else
10844 \bbl@afterload
10845 \fi
10846 % == hyphenrules (apply if current) ==
10847 \ifx\bbl@KVP@hyphenrules\@nnil\else
10848 \ifnum\bbl@savelocaleid=\localeid
10849 \language\@nameuse{l@\languagename}%
10850 \fi
10851 \fi}
10852 % \end{macrocode}
10853 %
10854 % Depending on whether or not the language exists (based on
10855 % |\date<language>|), we define two macros. Remember
10856 % |\bbl@startcommands| opens a group.
10857 %
10858 % \begin{macrocode}
10859 \def\bbl@provide@new#1{%
10860 \@namedef{date#1}{}% marks lang exists - required by \StartBabelCommands
10861 \@namedef{extras#1}{}%
10862 \@namedef{noextras#1}{}%
10863 \bbl@startcommands*{#1}{captions}%
10864 \ifx\bbl@KVP@captions\@nnil % and also if import, implicit
10865 \def\bbl@tempb##1{% elt for \bbl@captionslist
10866 \ifx##1\@nnil\else
10867 \bbl@exp{%
10868 \\\SetString\\##1{%
10869 \\\bbl@nocaption{\bbl@stripslash##1}{#1\bbl@stripslash##1}}}%
10870 \expandafter\bbl@tempb
10871 \fi}%
10872 \expandafter\bbl@tempb\bbl@captionslist\@nnil
10873 \else
10874 \ifx\bbl@initoload\relax
10875 \bbl@read@ini{\bbl@KVP@captions}2% % Here letters cat = 11
10876 \else
10877 \bbl@read@ini{\bbl@initoload}2% % Same
10878 \fi
10879 \fi
10880 \StartBabelCommands*{#1}{date}%
10881 \ifx\bbl@KVP@date\@nnil
10882 \bbl@exp{%
10883 \\\SetString\\\today{\\\bbl@nocaption{today}{#1today}}}%
10884 \else
10885 \bbl@savetoday
10886 \bbl@savedate
10887 \fi
10888 \bbl@endcommands
10889 \bbl@load@basic{#1}%
10890 % == hyphenmins == (only if new)
10891 \bbl@exp{%
10892 \gdef\<#1hyphenmins>{%
10893 {\bbl@ifunset{bbl@lfthm@#1}{2}{\bbl@cs{lfthm@#1}}}%
10894 {\bbl@ifunset{bbl@rgthm@#1}{3}{\bbl@cs{rgthm@#1}}}}}%
10895 % == hyphenrules (also in renew) ==
10896 \bbl@provide@hyphens{#1}%
10897 % == main ==
10898 \ifx\bbl@KVP@main\@nnil\else
10899 \expandafter\main@language\expandafter{#1}%
10900 \fi}
10901 %
10902 \def\bbl@provide@renew#1{%
10903 \ifx\bbl@KVP@captions\@nnil\else
10904 \StartBabelCommands*{#1}{captions}%
10905 \bbl@read@ini{\bbl@KVP@captions}2% % Here all letters cat = 11
10906 \EndBabelCommands
10907 \fi
10908 \ifx\bbl@KVP@date\@nnil\else
10909 \StartBabelCommands*{#1}{date}%
10910 \bbl@savetoday
10911 \bbl@savedate
10912 \EndBabelCommands
10913 \fi
10914 % == hyphenrules (also in new) ==
10915 \ifx\bbl@lbkflag\@empty
10916 \bbl@provide@hyphens{#1}%
10917 \fi
10918 % == main ==
10919 \ifx\bbl@KVP@main\@nnil\else
10920 \expandafter\main@language\expandafter{#1}%
10921 \fi}
10922 % \end{macrocode}
10923 %
10924 % Load the basic parameters (ids, typography, counters, and a few
10925 % more), while captions and dates are left out. But it may happen some
10926 % data has been loaded before automatically, so we first discard the
10927 % saved values.
10928 %
10929 % \begin{macrocode}
10930 \def\bbl@load@basic#1{%
10931 \ifcase\bbl@howloaded\or\or
10932 \ifcase\csname bbl@llevel@\languagename\endcsname
10933 \bbl@csarg\let{lname@\languagename}\relax
10934 \fi
10935 \fi
10936 \bbl@ifunset{bbl@lname@#1}%
10937 {\def\BabelBeforeIni##1##2{%
10938 \begingroup
10939 \let\bbl@ini@captions@aux\@gobbletwo
10940 \def\bbl@inidate ####1.####2.####3.####4\relax ####5####6{}%
10941 \bbl@read@ini{##1}1%
10942 \ifx\bbl@initoload\relax\endinput\fi
10943 \endgroup}%
10944 \begingroup % boxed, to avoid extra spaces:
10945 \ifx\bbl@initoload\relax
10946 \bbl@input@texini{#1}%
10947 \else
10948 \setbox\z@\hbox{\BabelBeforeIni{\bbl@initoload}{}}%
10949 \fi
10950 \endgroup}%
10951 {}}
10952 % \end{macrocode}
10953 %
10954 % The following |ini| reader ignores everything but the
10955 % |identification| section. It is called when a font is defined (i.e.,
10956 % when the language is first selected) to know which script/language
10957 % must be enabled. This means we must make sure a few characters are
10958 % not active. The |ini| is not read directly, but with a proxy |tex|
10959 % file named as the language (which means any code in it must be
10960 % skipped, too).
10961 %
10962 % \begin{macrocode}
10963 \def\bbl@load@info#1{%
10964 \def\BabelBeforeIni##1##2{%
10965 \begingroup
10966 \bbl@read@ini{##1}0%
10967 \endinput % babel- .tex may contain onlypreamble's
10968 \endgroup}% boxed, to avoid extra spaces:
10969 {\bbl@input@texini{#1}}}
10970 % \end{macrocode}
10971 %
10972 % The |hyphenrules| option is handled with an auxiliary macro. This
10973 % macro is called in three cases: when a language is first declared
10974 % with |\babelprovide|, with |hyphenrules| and with |import|.
10975 %
10976 % \begin{macrocode}
10977 \def\bbl@provide@hyphens#1{%
10978 \@tempcnta\m@ne % a flag
10979 \ifx\bbl@KVP@hyphenrules\@nnil\else
10980 \bbl@replace\bbl@KVP@hyphenrules{ }{,}%
10981 \bbl@foreach\bbl@KVP@hyphenrules{%
10982 \ifnum\@tempcnta=\m@ne % if not yet found
10983 \bbl@ifsamestring{##1}{+}%
10984 {\bbl@carg\addlanguage{l@##1}}%
10985 {}%
10986 \bbl@ifunset{l@##1}% After a possible +
10987 {}%
10988 {\@tempcnta\@nameuse{l@##1}}%
10989 \fi}%
10990 \ifnum\@tempcnta=\m@ne
10991 \bbl@warning{%
10992 Requested 'hyphenrules' for '\languagename' not found:\\%
10993 \bbl@KVP@hyphenrules.\\%
10994 Using the default value. Reported}%
10995 \fi
10996 \fi
10997 \ifnum\@tempcnta=\m@ne % if no opt or no language in opt found
10998 \ifx\bbl@KVP@captions@@\@nnil
10999 \bbl@ifunset{bbl@hyphr@#1}{}% use value in ini, if exists
11000 {\bbl@exp{\\\bbl@ifblank{\bbl@cs{hyphr@#1}}}%
11001 {}%
11002 {\bbl@ifunset{l@\bbl@cl{hyphr}}%
11003 {}% if hyphenrules found:
11004 {\@tempcnta\@nameuse{l@\bbl@cl{hyphr}}}}}%
11005 \fi
11006 \fi
11007 \bbl@ifunset{l@#1}%
11008 {\ifnum\@tempcnta=\m@ne
11009 \bbl@carg\adddialect{l@#1}\language
11010 \else
11011 \bbl@carg\adddialect{l@#1}\@tempcnta
11012 \fi}%
11013 {\ifnum\@tempcnta=\m@ne\else
11014 \global\bbl@carg\chardef{l@#1}\@tempcnta
11015 \fi}}
11016 % \end{macrocode}
11017 %
11018 % The reader of |babel-...tex| files. We reset temporarily some
11019 % catcodes (and make sure no space is accidentally inserted).
11020 %
11021 % \begin{macrocode}
11022 \def\bbl@input@texini#1{%
11023 \bbl@bsphack
11024 \bbl@exp{%
11025 \catcode`\\\%=14 \catcode`\\\\=0
11026 \catcode`\\\{=1 \catcode`\\\}=2
11027 \lowercase{\\\InputIfFileExists{babel-#1.tex}{}{}}%
11028 \catcode`\\\%=\the\catcode`\%\relax
11029 \catcode`\\\\=\the\catcode`\\\relax
11030 \catcode`\\\{=\the\catcode`\{\relax
11031 \catcode`\\\}=\the\catcode`\}\relax}%
11032 \bbl@esphack}
11033 % \end{macrocode}
11034 %
11035 % The following macros read and store |ini| files (but don't process
11036 % them). For each line, there are 3 possible actions: ignore if starts
11037 % with |;|, switch section if starts with |[|, and store otherwise.
11038 % There are used in the first step of |\bbl@read@ini|.
11039 %
11040 % \begin{macrocode}
11041 \def\bbl@iniline#1\bbl@iniline{%
11042 \@ifnextchar[\bbl@inisect{\@ifnextchar;\bbl@iniskip\bbl@inistore}#1\@@}% ]
11043 \def\bbl@inisect[#1]#2\@@{\def\bbl@section{#1}}
11044 \def\bbl@iniskip#1\@@{}% if starts with ;
11045 \def\bbl@inistore#1=#2\@@{% full (default)
11046 \bbl@trim@def\bbl@tempa{#1}%
11047 \bbl@trim\toks@{#2}%
11048 \bbl@ifsamestring{\bbl@tempa}{@include}%
11049 {\bbl@read@subini{\the\toks@}}%
11050 {\bbl@xin@{;\bbl@section/\bbl@tempa;}{\bbl@key@list}%
11051 \ifin@\else
11052 \bbl@xin@{,identification/include.}%
11053 {,\bbl@section/\bbl@tempa}%
11054 \ifin@\xdef\bbl@included@inis{\the\toks@}\fi
11055 \bbl@exp{%
11056 \\\g@addto@macro\\\bbl@inidata{%
11057 \\\bbl@elt{\bbl@section}{\bbl@tempa}{\the\toks@}}}%
11058 \fi}}
11059 \def\bbl@inistore@min#1=#2\@@{% minimal (maybe set in \bbl@read@ini)
11060 \bbl@trim@def\bbl@tempa{#1}%
11061 \bbl@trim\toks@{#2}%
11062 \bbl@xin@{.identification.}{.\bbl@section.}%
11063 \ifin@
11064 \bbl@exp{\\\g@addto@macro\\\bbl@inidata{%
11065 \\\bbl@elt{identification}{\bbl@tempa}{\the\toks@}}}%
11066 \fi}
11067 % \end{macrocode}
11068 %
11069 % \subsection{Main loop in ‘provide’}
11070 %
11071 % Now, the ‘main loop’, |\bbl@read@ini|, which \textbf{**must be
11072 % executed inside a group**}. At this point, |\bbl@inidata| may contain
11073 % data declared in |\babelprovide|, with ‘slashed’ keys. There are 3
11074 % steps: first read the ini file and store it; then traverse the stored
11075 % values, and process some groups if required (date, captions, labels,
11076 % counters); finally, ‘export’ some values by defining global macros
11077 % (identification, typography, characters, numbers). The second
11078 % argument is 0 when called to read the minimal data for fonts; with
11079 % |\babelprovide| it's either 1 (without \texttt{import}) or 2 (which
11080 % |import|). The value $-$1 is used with |\DocumentMetadata|.
11081 %
11082 % |\bbl@loop@ini| is the reader, line by line (1: stream), and calls
11083 % |\bbl@iniline| to save the key/value pairs. If |\bbl@inistore| finds
11084 % the |@include| directive, the input stream is switched temporarily and
11085 % |\bbl@read@subini| is called.
11086 %
11087 % When the language is being set based on the document metadata (\#2 in
11088 % |\bbl@read@ini| is $-$1), there is an interlude to get the name,
11089 % after the data have been collected, and before it’s processed.
11090 %
11091 % \begin{macrocode}
11092 \def\bbl@loop@ini#1{%
11093 \loop
11094 \if T\ifeof#1 F\fi T\relax % Trick, because inside \loop
11095 \endlinechar\m@ne
11096 \read#1 to \bbl@line
11097 \endlinechar`\^^M
11098 \ifx\bbl@line\@empty\else
11099 \expandafter\bbl@iniline\bbl@line\bbl@iniline
11100 \fi
11101 \repeat}
11102 %
11103 \def\bbl@read@subini#1{%
11104 \ifx\bbl@readsubstream\@undefined
11105 \csname newread\endcsname\bbl@readsubstream
11106 \fi
11107 \openin\bbl@readsubstream=babel-#1.ini
11108 \ifeof\bbl@readsubstream
11109 \bbl@error{no-ini-file}{#1}{}{}%
11110 \else
11111 {\bbl@loop@ini\bbl@readsubstream}%
11112 \fi
11113 \closein\bbl@readsubstream}
11114 %
11115 \ifx\bbl@readstream\@undefined
11116 \csname newread\endcsname\bbl@readstream
11117 \fi
11118 \def\bbl@read@ini#1#2{%
11119 \global\let\bbl@extend@ini\@gobble
11120 \openin\bbl@readstream=babel-#1.ini
11121 \ifeof\bbl@readstream
11122 \bbl@error{no-ini-file}{#1}{}{}%
11123 \else
11124 % == Store ini data in \bbl@inidata ==
11125 \catcode`\ =10 \catcode`\"=12
11126 \catcode`\[=12 \catcode`\]=12 \catcode`\==12 \catcode`\&=12
11127 \catcode`\;=12 \catcode`\|=12 \catcode`\%=14 \catcode`\-=12
11128 \ifnum#2=\m@ne % Just for the info
11129 \edef\languagename{tag \bbl@metalang}%
11130 \fi
11131 \bbl@info{\ifnum#2=\m@ne Fetching locale name for tag \bbl@metalang
11132 \else Importing
11133 \ifcase#2font and identification \or basic \fi
11134 data for \languagename
11135 \fi\\%
11136 from babel-#1.ini. Reported}%
11137 \ifnum#2<\@ne
11138 \global\let\bbl@inidata\@empty
11139 \let\bbl@inistore\bbl@inistore@min % Remember it's local
11140 \fi
11141 \def\bbl@section{identification}%
11142 \bbl@exp{%
11143 \\\bbl@inistore tag.ini=#1\\\@@
11144 \\\bbl@inistore load.level=\ifnum#2<\@ne 0\else #2\fi\\\@@}%
11145 \bbl@loop@ini\bbl@readstream
11146 % == Process stored data ==
11147 \ifnum#2=\m@ne
11148 \def\bbl@tempa##1 ##2\@@{##1}% Get first name
11149 \def\bbl@elt##1##2##3{%
11150 \bbl@ifsamestring{identification/name.babel}{##1/##2}%
11151 {\edef\languagename{\bbl@tempa##3 \@@}%
11152 \let\localename\languagename
11153 \bbl@id@assign
11154 \def\bbl@elt####1####2####3{}}%
11155 {}}%
11156 \bbl@inidata
11157 \fi
11158 \bbl@csarg\xdef{lini@\languagename}{#1}%
11159 \bbl@read@ini@aux
11160 % == 'Export' data ==
11161 \bbl@ini@exports{#2}%
11162 \global\bbl@csarg\let{inidata@\languagename}\bbl@inidata
11163 \global\let\bbl@inidata\@empty
11164 \bbl@exp{\\\bbl@add@list\\\bbl@ini@loaded{\languagename}}%
11165 \bbl@toglobal\bbl@ini@loaded
11166 \@ifpackagewith{babel}{licr=unextended}{}%
11167 {\ifcase\bbl@engine\else % Find a better place
11168 \bbl@xin@{,\bbl@cl{sbcp},}{,Cyrl,}%
11169 \ifin@
11170 \bbl@once{licr-cryl}{\g@addto@macro\bbl@afterload{\input{cyrl2uni.def}}}%
11171 \fi
11172 \fi}%
11173 \fi
11174 \closein\bbl@readstream}
11175 \def\bbl@read@ini@aux{%
11176 \let\bbl@savestrings\@empty
11177 \let\bbl@savetoday\@empty
11178 \let\bbl@savedate\@empty
11179 \def\bbl@elt##1##2##3{%
11180 \def\bbl@section{##1}%
11181 \in@{=date.}{=##1}% Find a better place
11182 \ifin@
11183 \bbl@ifunset{bbl@inikv@##1}%
11184 {\bbl@ini@calendar{##1}}%
11185 {}%
11186 \fi
11187 \bbl@ifunset{bbl@inikv@##1}{}%
11188 {\csname bbl@inikv@##1\endcsname{##2}{##3}}}%
11189 \bbl@inidata}
11190 % \end{macrocode}
11191 %
11192 % A variant to be used when the ini file has been already loaded,
11193 % because it's not the first |\babelprovide| for this language.
11194 %
11195 % \begin{macrocode}
11196 \def\bbl@extend@ini@aux#1{%
11197 \bbl@startcommands*{#1}{captions}%
11198 % Activate captions/... and modify exports
11199 \bbl@csarg\def{[email protected]}##1##2{%
11200 \setlocalecaption{#1}{##1}{##2}}%
11201 \def\bbl@inikv@captions##1##2{%
11202 \bbl@ini@captions@aux{##1}{##2}}%
11203 \def\bbl@stringdef##1##2{\gdef##1{##2}}%
11204 \def\bbl@exportkey##1##2##3{%
11205 \bbl@ifunset{bbl@@kv@##2}{}%
11206 {\expandafter\ifx\csname bbl@@kv@##2\endcsname\@empty\else
11207 \bbl@exp{\global\let\<bbl@##1@\languagename>\<bbl@@kv@##2>}%
11208 \fi}}%
11209 % As with \bbl@read@ini, but with some changes
11210 \bbl@read@ini@aux
11211 \bbl@ini@exports\tw@
11212 % Update inidata@lang by pretending the ini is read.
11213 \def\bbl@elt##1##2##3{%
11214 \def\bbl@section{##1}%
11215 \bbl@iniline##2=##3\bbl@iniline}%
11216 \csname bbl@inidata@#1\endcsname
11217 \global\bbl@csarg\let{inidata@#1}\bbl@inidata
11218 \StartBabelCommands*{#1}{date}% And from the import stuff
11219 \def\bbl@stringdef##1##2{\gdef##1{##2}}%
11220 \bbl@savetoday
11221 \bbl@savedate
11222 \bbl@endcommands}
11223 % \end{macrocode}
11224 %
11225 % A somewhat hackish tool to handle calendar sections.
11226 %
11227 % \begin{macrocode}
11228 \def\bbl@ini@calendar#1{%
11229 \lowercase{\def\bbl@tempa{=#1=}}%
11230 \bbl@replace\bbl@tempa{=date.gregorian}{}%
11231 \bbl@replace\bbl@tempa{=date.}{}%
11232 \in@{.licr=}{#1=}%
11233 \ifin@
11234 \ifcase\bbl@engine
11235 \bbl@replace\bbl@tempa{.licr=}{}%
11236 \else
11237 \let\bbl@tempa\relax
11238 \fi
11239 \fi
11240 \ifx\bbl@tempa\relax\else
11241 \bbl@replace\bbl@tempa{=}{}%
11242 \ifx\bbl@tempa\@empty\else
11243 \xdef\bbl@calendars{\bbl@calendars,\bbl@tempa}%
11244 \fi
11245 \bbl@exp{%
11246 \def\<bbl@inikv@#1>####1####2{%
11247 \\\bbl@inidate####1...\relax{####2}{\bbl@tempa}}}%
11248 \fi}
11249 % \end{macrocode}
11250 %
11251 % A key with a slash in |\babelprovide| replaces the value in the |ini|
11252 % file (which is ignored altogether). The mechanism is simple (but
11253 % suboptimal): add the data to the |ini| one (at this point the |ini|
11254 % file has not yet been read), and define a dummy macro. When the |ini|
11255 % file is read, just skip the corresponding key and reset the macro (in
11256 % |\bbl@inistore| above).
11257 %
11258 % \begin{macrocode}
11259 \def\bbl@renewinikey#1/#2\@@#3{%
11260 \global\let\bbl@extend@ini\bbl@extend@ini@aux
11261 \edef\bbl@tempa{\zap@space #1 \@empty}% section
11262 \edef\bbl@tempb{\zap@space #2 \@empty}% key
11263 \bbl@trim\toks@{#3}% value
11264 \bbl@exp{%
11265 \edef\\\bbl@key@list{\bbl@key@list \bbl@tempa/\bbl@tempb;}%
11266 \\\g@addto@macro\\\bbl@inidata{%
11267 \\\bbl@elt{\bbl@tempa}{\bbl@tempb}{\the\toks@}}}}%
11268 % \end{macrocode}
11269 %
11270 % The previous assignments are local, so we need to export them. If
11271 % the value is empty, we can provide a default value.
11272 %
11273 % \begin{macrocode}
11274 \def\bbl@exportkey#1#2#3{%
11275 \bbl@ifunset{bbl@@kv@#2}%
11276 {\bbl@csarg\gdef{#1@\languagename}{#3}}%
11277 {\expandafter\ifx\csname bbl@@kv@#2\endcsname\@empty
11278 \bbl@csarg\gdef{#1@\languagename}{#3}%
11279 \else
11280 \bbl@exp{\global\let\<bbl@#1@\languagename>\<bbl@@kv@#2>}%
11281 \fi}}
11282 % \end{macrocode}
11283 %
11284 % Key-value pairs are treated differently depending on the section in
11285 % the |ini| file. The following macros are the readers for
11286 % |identification| and |typography|. Note |\bbl@ini@exports|
11287 % is called always (via |\bbl@inisec|), while |\bbl@after@ini| must be
11288 % called explicitly after |\bbl@read@ini| if necessary.
11289 %
11290 % Although BCP 47 doesn’t treat ‘-x-’ as an extension, the CLDR and
11291 % many other sources do (as a \textit{private use extension}). For
11292 % consistency with other single-letter subtags or ‘singletons’, here
11293 % is considered an extension, too.
11294 %
11295 % The identification section is used internally by \babel\ in the
11296 % following places [to be completed]: BCP 47 script tag in the Unicode
11297 % ranges, which is in turn used by |onchar|; the language system is set
11298 % with the names, and then \textsf{fontspec} maps them to the opentype
11299 % tags, but if the latter package doesn’t define them, then \babel\
11300 % does it; |encodings| are used in \pdftex{} to select a font encoding
11301 % valid (and preloaded) for a language loaded on the fly.
11302 %
11303 % \begin{macrocode}
11304 \def\bbl@iniwarning#1{%
11305 \bbl@ifunset{bbl@@[email protected]#1}{}%
11306 {\bbl@warning{%
11307 From babel-\bbl@cs{lini@\languagename}.ini:\\%
11308 \bbl@cs{@[email protected]#1}\\%
11309 Reported}}}
11310 %
11311 \let\bbl@release@transforms\@empty
11312 \let\bbl@release@casing\@empty
11313 % \end{macrocode}
11314 %
11315 % Relevant keys are ‘exported’, i.e., global macros with short names
11316 % are created with values taken from the corresponding keys. The
11317 % number of exported keys depends on the loading level (\#1): $-$1 and
11318 % 0 only info (the identificacion section), 1 also basic (like
11319 % linebreaking or character ranges), 2 also (re)new (with date and
11320 % captions).
11321 %
11322 % \begin{macrocode}
11323 \def\bbl@ini@exports#1{%
11324 % Identification always exported
11325 \bbl@iniwarning{}%
11326 \ifcase\bbl@engine
11327 \bbl@iniwarning{.pdflatex}%
11328 \or
11329 \bbl@iniwarning{.lualatex}%
11330 \or
11331 \bbl@iniwarning{.xelatex}%
11332 \fi%
11333 \bbl@exportkey{llevel}{identification.load.level}{}%
11334 \bbl@exportkey{elname}{identification.name.english}{}%
11335 \bbl@exp{\\\bbl@exportkey{lname}{identification.name.opentype}%
11336 {\csname bbl@elname@\languagename\endcsname}}%
11337 \bbl@exportkey{tbcp}{identification.tag.bcp47}{}%
11338 \bbl@exportkey{casing}{identification.tag.bcp47}{}%
11339 \bbl@exportkey{lbcp}{identification.language.tag.bcp47}{}%
11340 \bbl@exportkey{lotf}{identification.tag.opentype}{dflt}%
11341 \bbl@exportkey{esname}{identification.script.name}{}%
11342 \bbl@exp{\\\bbl@exportkey{sname}{identification.script.name.opentype}%
11343 {\csname bbl@esname@\languagename\endcsname}}%
11344 \bbl@exportkey{sbcp}{identification.script.tag.bcp47}{}%
11345 \bbl@exportkey{sotf}{identification.script.tag.opentype}{DFLT}%
11346 \bbl@exportkey{rbcp}{identification.region.tag.bcp47}{}%
11347 \bbl@exportkey{vbcp}{identification.variant.tag.bcp47}{}%
11348 \bbl@exportkey{extt}{identification.extension.t.tag.bcp47}{}%
11349 \bbl@exportkey{extu}{identification.extension.u.tag.bcp47}{}%
11350 \bbl@exportkey{extx}{identification.extension.x.tag.bcp47}{}%
11351 % Also maps bcp47 -> languagename
11352 \bbl@csarg\xdef{bcp@map@\bbl@cl{tbcp}}{\languagename}%
11353 \ifcase\bbl@engine\or
11354 \directlua{%
11355 Babel.locale_props[\the\bbl@cs{id@@\languagename}].script
11356 = '\bbl@cl{sbcp}'}%
11357 \fi
11358 % Conditional
11359 \ifnum#1>\z@ % -1 or 0 = only info, 1 = basic, 2 = (re)new
11360 \bbl@exportkey{calpr}{date.calendar.preferred}{}%
11361 \bbl@exportkey{lnbrk}{typography.linebreaking}{h}%
11362 \bbl@exportkey{hyphr}{typography.hyphenrules}{}%
11363 \bbl@exportkey{lfthm}{typography.lefthyphenmin}{2}%
11364 \bbl@exportkey{rgthm}{typography.righthyphenmin}{3}%
11365 \bbl@exportkey{prehc}{typography.prehyphenchar}{}%
11366 \bbl@exportkey{hyotl}{typography.hyphenate.other.locale}{}%
11367 \bbl@exportkey{hyots}{typography.hyphenate.other.script}{}%
11368 \bbl@exportkey{intsp}{typography.intraspace}{}%
11369 \bbl@exportkey{frspc}{typography.frenchspacing}{u}%
11370 \bbl@exportkey{chrng}{characters.ranges}{}%
11371 \bbl@exportkey{quote}{characters.delimiters.quotes}{}%
11372 \bbl@exportkey{dgnat}{numbers.digits.native}{}%
11373 \ifnum#1=\tw@ % only (re)new
11374 \bbl@exportkey{rqtex}{identification.require.babel}{}%
11375 \bbl@toglobal\bbl@savetoday
11376 \bbl@toglobal\bbl@savedate
11377 \bbl@savestrings
11378 \fi
11379 \fi}
11380 % \end{macrocode}
11381 %
11382 % \subsection{Processing keys in \texttt{ini}}
11383 %
11384 % A shared handler for key=val lines to be stored in
11385 % |\bbl@@kv@<section>.<key>|.
11386 %
11387 % \begin{macrocode}
11388 \def\bbl@inikv#1#2{% key=value
11389 \toks@{#2}% This hides #'s from ini values
11390 \bbl@csarg\edef{@kv@\bbl@section.#1}{\the\toks@}}
11391 % \end{macrocode}
11392 %
11393 % By default, the following sections are just read. Actions are taken
11394 % later.
11395 %
11396 % \begin{macrocode}
11397 \let\bbl@inikv@identification\bbl@inikv
11398 \let\bbl@inikv@date\bbl@inikv
11399 \let\bbl@inikv@typography\bbl@inikv
11400 \let\bbl@inikv@numbers\bbl@inikv
11401 % \end{macrocode}
11402 %
11403 % The |characters| section also stores the values, but |casing| is
11404 % treated in a different fashion. Much like transforms, a set of
11405 % commands calling the parser are stored in |\bbl@release@casing|,
11406 % which is executed in |\babelprovide|.
11407 %
11408 % \begin{macrocode}
11409 \def\bbl@maybextx{-\bbl@csarg\ifx{extx@\languagename}\@empty x-\fi}
11410 \def\bbl@inikv@characters#1#2{%
11411 \bbl@ifsamestring{#1}{casing}% e.g., casing = uV
11412 {\bbl@exp{%
11413 \\\g@addto@macro\\\bbl@release@casing{%
11414 \\\bbl@casemapping{}{\languagename}{\unexpanded{#2}}}}}%
11415 {\in@{$casing.}{$#1}% e.g., casing.Uv = uV
11416 \ifin@
11417 \lowercase{\def\bbl@tempb{#1}}%
11418 \bbl@replace\bbl@tempb{casing.}{}%
11419 \bbl@exp{\\\g@addto@macro\\\bbl@release@casing{%
11420 \\\bbl@casemapping
11421 {\\\bbl@maybextx\bbl@tempb}{\languagename}{\unexpanded{#2}}}}%
11422 \else
11423 \bbl@inikv{#1}{#2}%
11424 \fi}}
11425 % \end{macrocode}
11426 %
11427 % Additive numerals require an additional definition. When |.1| is
11428 % found, two macros are defined -- the basic one, without |.1| called
11429 % by |\localenumeral|, and another one preserving the trailing |.1| for
11430 % the ‘units’.
11431 %
11432 % \begin{macrocode}
11433 \def\bbl@inikv@counters#1#2{%
11434 \bbl@ifsamestring{#1}{digits}%
11435 {\bbl@error{digits-is-reserved}{}{}{}}%
11436 {}%
11437 \def\bbl@tempc{#1}%
11438 \bbl@trim@def{\bbl@tempb*}{#2}%
11439 \in@{.1$}{#1$}%
11440 \ifin@
11441 \bbl@replace\bbl@tempc{.1}{}%
11442 \bbl@csarg\protected@xdef{cntr@\bbl@tempc @\languagename}{%
11443 \noexpand\bbl@alphnumeral{\bbl@tempc}}%
11444 \fi
11445 \in@{.F.}{#1}%
11446 \ifin@\else\in@{.S.}{#1}\fi
11447 \ifin@
11448 \bbl@csarg\protected@xdef{cntr@#1@\languagename}{\bbl@tempb*}%
11449 \else
11450 \toks@{}% Required by \bbl@buildifcase, which returns \bbl@tempa
11451 \expandafter\bbl@buildifcase\bbl@tempb* \\ % Space after \\
11452 \bbl@csarg{\global\expandafter\let}{cntr@#1@\languagename}\bbl@tempa
11453 \fi}
11454 % \end{macrocode}
11455 %
11456 % Now |captions| and |captions.licr|, depending on the engine. And
11457 % below also for dates. They rely on a few auxiliary macros. It is
11458 % expected the ini file provides the complete set in Unicode and LICR,
11459 % in that order.
11460 %
11461 % \begin{macrocode}
11462 \ifcase\bbl@engine
11463 \bbl@csarg\def{[email protected]}#1#2{%
11464 \bbl@ini@captions@aux{#1}{#2}}
11465 \else
11466 \def\bbl@inikv@captions#1#2{%
11467 \bbl@ini@captions@aux{#1}{#2}}
11468 \fi
11469 % \end{macrocode}
11470 %
11471 % The auxiliary macro for captions define |\<caption>name|.
11472 %
11473 % \begin{macrocode}
11474 \def\bbl@ini@captions@template#1#2{% string language tempa=capt-name
11475 \bbl@replace\bbl@tempa{.template}{}%
11476 \def\bbl@toreplace{#1{}}%
11477 \bbl@replace\bbl@toreplace{[ ]}{\nobreakspace{}}%
11478 \bbl@replace\bbl@toreplace{[[}{\csname}%
11479 \bbl@replace\bbl@toreplace{[}{\csname the}%
11480 \bbl@replace\bbl@toreplace{]]}{name\endcsname{}}%
11481 \bbl@replace\bbl@toreplace{]}{\endcsname{}}%
11482 \bbl@xin@{,\bbl@tempa,}{,chapter,appendix,part,}%
11483 \ifin@
11484 \@nameuse{bbl@patch\bbl@tempa}%
11485 \global\bbl@csarg\let{\bbl@tempa fmt@#2}\bbl@toreplace
11486 \fi
11487 \bbl@xin@{,\bbl@tempa,}{,figure,table,}%
11488 \ifin@
11489 \global\bbl@csarg\let{\bbl@tempa fmt@#2}\bbl@toreplace
11490 \bbl@exp{\gdef\<fnum@\bbl@tempa>{%
11491 \\\bbl@ifunset{bbl@\bbl@tempa fmt@\\\languagename}%
11492 {\[fnum@\bbl@tempa]}%
11493 {\\\@nameuse{bbl@\bbl@tempa fmt@\\\languagename}}}}%
11494 \fi}
11495 %
11496 \def\bbl@ini@captions@aux#1#2{%
11497 \bbl@trim@def\bbl@tempa{#1}%
11498 \bbl@xin@{.template}{\bbl@tempa}%
11499 \ifin@
11500 \bbl@ini@captions@template{#2}\languagename
11501 \else
11502 \bbl@ifblank{#2}%
11503 {\bbl@exp{%
11504 \toks@{\\\bbl@nocaption{\bbl@tempa name}{\languagename\bbl@tempa name}}}}%
11505 {\bbl@trim\toks@{#2}}%
11506 \bbl@exp{%
11507 \\\bbl@add\\\bbl@savestrings{%
11508 \\\SetString\<\bbl@tempa name>{\the\toks@}}}%
11509 \toks@\expandafter{\bbl@captionslist}%
11510 \bbl@exp{\\\in@{\<\bbl@tempa name>}{\the\toks@}}%
11511 \ifin@\else
11512 \bbl@exp{%
11513 \\\bbl@add\<bbl@extracaps@\languagename>{\<\bbl@tempa name>}%
11514 \\\bbl@toglobal\<bbl@extracaps@\languagename>}%
11515 \fi
11516 \fi}
11517 % \end{macrocode}
11518 %
11519 % \textbf{Labels.} Captions must contain just strings, no
11520 % format at all, so there is new group in ini files.
11521 %
11522 % \begin{macrocode}
11523 \def\bbl@list@the{%
11524 part,chapter,section,subsection,subsubsection,paragraph,%
11525 subparagraph,enumi,enumii,enumiii,enumiv,equation,figure,%
11526 table,page,footnote,mpfootnote,mpfn}
11527 %
11528 \def\bbl@map@cnt#1{% #1:roman,etc, // #2:enumi,etc
11529 \bbl@ifunset{bbl@map@#1@\languagename}%
11530 {\@nameuse{#1}}%
11531 {\@nameuse{bbl@map@#1@\languagename}}}
11532 %
11533 \def\bbl@map@lbl#1{% #1:a sign, eg, .
11534 \ifincsname#1\else
11535 \bbl@ifunset{bbl@map@@#1@@\languagename}%
11536 {#1}%
11537 {\@nameuse{bbl@map@@#1@@\languagename}}%
11538 \fi}
11539 %
11540 \def\bbl@inikv@labels#1#2{%
11541 \in@{.map}{#1}%
11542 \ifin@
11543 \in@{,dot.map,}{,#1,}%
11544 \ifin@
11545 \global\@namedef{bbl@map@@.@@\languagename}{#2}%
11546 \fi
11547 \ifx\bbl@KVP@labels\@nnil\else
11548 \bbl@xin@{ map }{ \bbl@KVP@labels\space}%
11549 \ifin@
11550 \def\bbl@tempc{#1}%
11551 \bbl@replace\bbl@tempc{.map}{}%
11552 \in@{,#2,}{,arabic,roman,Roman,alph,Alph,fnsymbol,}%
11553 \bbl@exp{%
11554 \gdef\<bbl@map@\bbl@tempc @\languagename>%
11555 {\ifin@\<#2>\else\\\localecounter{#2}\fi}}%
11556 \bbl@foreach\bbl@list@the{%
11557 \bbl@ifunset{the##1}{}%
11558 {\bbl@ncarg\let\bbl@tempd{the##1}%
11559 \bbl@exp{%
11560 \\\bbl@sreplace\<the##1>%
11561 {\<\bbl@tempc>{##1}}%
11562 {\\\bbl@map@cnt{\bbl@tempc}{##1}}%
11563 \\\bbl@sreplace\<the##1>%
11564 {\<\@empty @\bbl@tempc>\<c@##1>}%
11565 {\\\bbl@map@cnt{\bbl@tempc}{##1}}%
11566 \\\bbl@sreplace\<the##1>%
11567 {\\\csname @\bbl@tempc\\\endcsname\<c@##1>}%
11568 {{\\\bbl@map@cnt{\bbl@tempc}{##1}}}}%
11569 \expandafter\ifx\csname the##1\endcsname\bbl@tempd\else
11570 \bbl@exp{\gdef\<the##1>{{\[the##1]}}}%
11571 \fi}}%
11572 \fi
11573 \fi
11574 %
11575 \else
11576 % The following code is still under study. You can test it and make
11577 % suggestions. E.g., enumerate.2 = ([enumi]).([enumii]). It's
11578 % language dependent.
11579 \in@{enumerate.}{#1}%
11580 \ifin@
11581 \def\bbl@tempa{#1}%
11582 \bbl@replace\bbl@tempa{enumerate.}{}%
11583 \def\bbl@toreplace{#2}%
11584 \bbl@replace\bbl@toreplace{[ ]}{\nobreakspace{}}%
11585 \bbl@replace\bbl@toreplace{[}{\csname the}%
11586 \bbl@replace\bbl@toreplace{]}{\endcsname{}}%
11587 \toks@\expandafter{\bbl@toreplace}%
11588 \bbl@exp{%
11589 \\\bbl@add\<extras\languagename>{%
11590 \\\babel@save\<labelenum\romannumeral\bbl@tempa>%
11591 \def\<labelenum\romannumeral\bbl@tempa>{\the\toks@}}%
11592 \\\bbl@toglobal\<extras\languagename>}%
11593 \fi
11594 \fi}
11595 % \end{macrocode}
11596 %
11597 % To show correctly some captions in a few languages, we need to patch
11598 % some internal macros, because the order is hardcoded. For example, in
11599 % Japanese the chapter number is surrounded by two string, while in
11600 % Hungarian is placed after. These replacement works in many classes,
11601 % but not all. Actually, the following lines are somewhat tentative.
11602 %
11603 % \begin{macrocode}
11604 \def\bbl@chaptype{chapter}
11605 \ifx\@makechapterhead\@undefined
11606 \let\bbl@patchchapter\relax
11607 \else\ifx\thechapter\@undefined
11608 \let\bbl@patchchapter\relax
11609 \else\ifx\ps@headings\@undefined
11610 \let\bbl@patchchapter\relax
11611 \else
11612 \def\bbl@patchchapter{%
11613 \global\let\bbl@patchchapter\relax
11614 \gdef\bbl@chfmt{%
11615 \bbl@ifunset{bbl@\bbl@chaptype fmt@\languagename}%
11616 {\@chapapp\space\thechapter}%
11617 {\@nameuse{bbl@\bbl@chaptype fmt@\languagename}}}%
11618 \bbl@add\appendix{\def\bbl@chaptype{appendix}}% Not harmful, I hope
11619 \bbl@sreplace\ps@headings{\@chapapp\ \thechapter}{\bbl@chfmt}%
11620 \bbl@sreplace\chaptermark{\@chapapp\ \thechapter}{\bbl@chfmt}%
11621 \bbl@sreplace\@makechapterhead{\@chapapp\space\thechapter}{\bbl@chfmt}%
11622 \bbl@toglobal\appendix
11623 \bbl@toglobal\ps@headings
11624 \bbl@toglobal\chaptermark
11625 \bbl@toglobal\@makechapterhead}
11626 \let\bbl@patchappendix\bbl@patchchapter
11627 \fi\fi\fi
11628 \ifx\@part\@undefined
11629 \let\bbl@patchpart\relax
11630 \else
11631 \def\bbl@patchpart{%
11632 \global\let\bbl@patchpart\relax
11633 \gdef\bbl@partformat{%
11634 \bbl@ifunset{bbl@partfmt@\languagename}%
11635 {\partname\nobreakspace\thepart}%
11636 {\@nameuse{bbl@partfmt@\languagename}}}%
11637 \bbl@sreplace\@part{\partname\nobreakspace\thepart}{\bbl@partformat}%
11638 \bbl@toglobal\@part}
11639 \fi
11640 % \end{macrocode}
11641 %
11642 % \textbf{Date.} Arguments (year, month, day) are \textit{not}
11643 % protected, on purpose. In |\today|, arguments are always gregorian,
11644 % and therefore always converted with other calendars.
11645 %
11646 % \begin{macrocode}
11647 \let\bbl@calendar\@empty
11648 \DeclareRobustCommand\localedate[1][]{\bbl@localedate{#1}}
11649 \def\bbl@localedate#1#2#3#4{%
11650 \begingroup
11651 \edef\bbl@they{#2}%
11652 \edef\bbl@them{#3}%
11653 \edef\bbl@thed{#4}%
11654 \edef\bbl@tempe{%
11655 \bbl@ifunset{bbl@calpr@\languagename}{}{\bbl@cl{calpr}},%
11656 #1}%
11657 \bbl@exp{\lowercase{\edef\\\bbl@tempe{\bbl@tempe}}}%
11658 \bbl@replace\bbl@tempe{ }{}%
11659 \bbl@replace\bbl@tempe{convert}{convert=}%
11660 \let\bbl@ld@calendar\@empty
11661 \let\bbl@ld@variant\@empty
11662 \let\bbl@ld@convert\relax
11663 \def\bbl@tempb##1=##2\@@{\@namedef{bbl@ld@##1}{##2}}%
11664 \bbl@foreach\bbl@tempe{\bbl@tempb##1\@@}%
11665 \bbl@replace\bbl@ld@calendar{gregorian}{}%
11666 \ifx\bbl@ld@calendar\@empty\else
11667 \ifx\bbl@ld@convert\relax\else
11668 \babelcalendar[\bbl@they-\bbl@them-\bbl@thed]%
11669 {\bbl@ld@calendar}\bbl@they\bbl@them\bbl@thed
11670 \fi
11671 \fi
11672 \@nameuse{bbl@precalendar}% Remove, e.g., +, -civil (-ca-islamic)
11673 \edef\bbl@calendar{% Used in \month..., too
11674 \bbl@ld@calendar
11675 \ifx\bbl@ld@variant\@empty\else
11676 .\bbl@ld@variant
11677 \fi}%
11678 \bbl@cased
11679 {\@nameuse{bbl@date@\languagename @\bbl@calendar}%
11680 \bbl@they\bbl@them\bbl@thed}%
11681 \endgroup}
11682 %
11683 \def\bbl@printdate#1{%
11684 \@ifnextchar[{\bbl@printdate@i{#1}}{\bbl@printdate@i{#1}[]}}
11685 \def\bbl@printdate@i#1[#2]#3#4#5{%
11686 \bbl@usedategrouptrue
11687 \def\bbl@tempc{#1}%
11688 \bbl@replace\bbl@tempc{-}{@@}%
11689 \@nameuse{bbl@ensure@\bbl@tempc}{\localedate[#2]{#3}{#4}{#5}}}
11690 %
11691 % e.g.: 1=months, 2=wide, 3=1, 4=dummy, 5=value, 6=calendar
11692 \def\bbl@inidate#1.#2.#3.#4\relax#5#6{%
11693 \bbl@trim@def\bbl@tempa{#1.#2}%
11694 \bbl@ifsamestring{\bbl@tempa}{months.wide}% to savedate
11695 {\bbl@trim@def\bbl@tempa{#3}%
11696 \bbl@trim\toks@{#5}%
11697 \@temptokena\expandafter{\bbl@savedate}%
11698 \bbl@exp{% Reverse order - in ini last wins
11699 \def\\\bbl@savedate{%
11700 \\\SetString\<month\romannumeral\bbl@tempa#6name>{\the\toks@}%
11701 \the\@temptokena}}}%
11702 {\bbl@ifsamestring{\bbl@tempa}{date.long}% defined now
11703 {\lowercase{\def\bbl@tempb{#6}}%
11704 \bbl@trim@def\bbl@toreplace{#5}%
11705 \bbl@TG@@date
11706 \global\bbl@csarg\let{date@\languagename @\bbl@tempb}\bbl@toreplace
11707 \ifx\bbl@savetoday\@empty
11708 \bbl@exp{%
11709 \\\AfterBabelCommands{%
11710 \gdef\<\languagename date>{\\\protect\<\languagename date >}%
11711 \gdef\<\languagename date >{\\\bbl@printdate{\languagename}}}%
11712 \def\\\bbl@savetoday{%
11713 \\\SetString\\\today{%
11714 \<\languagename date>[convert]%
11715 {\\\the\year}{\\\the\month}{\\\the\day}}}}%
11716 \fi}%
11717 {}}}
11718 % \end{macrocode}
11719 %
11720 % \textbf{Dates} will require some macros for the basic formatting.
11721 % They may be redefined by language, so “semi-public” names (camel
11722 % case) are used. Oddly enough, the CLDR places particles like “de”
11723 % inconsistently in either in the date or in the month name. Note after
11724 % |\bbl@replace| |\toks@| contains the resulting string, which is used
11725 % by |\bbl@replace@finish@iii| (this implicit behavior doesn't seem a
11726 % good idea, but it’s efficient).
11727 %
11728 % \begin{macrocode}
11729 \let\bbl@calendar\@empty
11730 \newcommand\babelcalendar[2][\the\year-\the\month-\the\day]{%
11731 \@nameuse{bbl@ca@#2}#1\@@}
11732 \newcommand\BabelDateSpace{\nobreakspace}
11733 \newcommand\BabelDateDot{.\@}
11734 \newcommand\BabelDated[1]{{\number#1}}
11735 \newcommand\BabelDatedd[1]{{\ifnum#1<10 0\fi\number#1}}
11736 \newcommand\BabelDateM[1]{{\number#1}}
11737 \newcommand\BabelDateMM[1]{{\ifnum#1<10 0\fi\number#1}}
11738 \newcommand\BabelDateMMMM[1]{{%
11739 \csname month\romannumeral#1\bbl@calendar name\endcsname}}%
11740 \newcommand\BabelDatey[1]{{\number#1}}%
11741 \newcommand\BabelDateyy[1]{{%
11742 \ifnum#1<10 0\number#1 %
11743 \else\ifnum#1<100 \number#1 %
11744 \else\ifnum#1<1000 \expandafter\@gobble\number#1 %
11745 \else\ifnum#1<10000 \expandafter\@gobbletwo\number#1 %
11746 \else
11747 \bbl@error{limit-two-digits}{}{}{}%
11748 \fi\fi\fi\fi}}
11749 \newcommand\BabelDateyyyy[1]{{\number#1}}
11750 \newcommand\BabelDateU[1]{{\number#1}}%
11751 \def\bbl@replace@finish@iii#1{%
11752 \bbl@exp{\def\\#1####1####2####3{\the\toks@}}}
11753 \def\bbl@TG@@date{%
11754 \bbl@replace\bbl@toreplace{[ ]}{\BabelDateSpace{}}%
11755 \bbl@replace\bbl@toreplace{[.]}{\BabelDateDot{}}%
11756 \bbl@replace\bbl@toreplace{[y]}{\BabelDatey{####1}}%
11757 \bbl@replace\bbl@toreplace{[y|}{\bbl@datecntr[####1|}%
11758 \bbl@replace\bbl@toreplace{[yy]}{\BabelDateyy{####1}}%
11759 \bbl@replace\bbl@toreplace{[yyyy]}{\BabelDateyyyy{####1}}%
11760 \bbl@replace\bbl@toreplace{[M]}{\BabelDateM{####2}}%
11761 \bbl@replace\bbl@toreplace{[M|}{\bbl@datecntr[####2|}%
11762 \bbl@replace\bbl@toreplace{[MM]}{\BabelDateMM{####2}}%
11763 \bbl@replace\bbl@toreplace{[MMMM]}{\BabelDateMMMM{####2}}%
11764 \bbl@replace\bbl@toreplace{[d]}{\BabelDated{####3}}%
11765 \bbl@replace\bbl@toreplace{[d|}{\bbl@datecntr[####3|}%
11766 \bbl@replace\bbl@toreplace{[dd]}{\BabelDatedd{####3}}%
11767 \bbl@replace\bbl@toreplace{[U]}{\BabelDateU{####1}}%
11768 \bbl@replace\bbl@toreplace{[U|}{\bbl@datecntr[####1|}%
11769 \bbl@replace@finish@iii\bbl@toreplace}
11770 \def\bbl@datecntr{\expandafter\bbl@xdatecntr\expandafter}
11771 \def\bbl@xdatecntr[#1|#2]{\localenumeral{#2}{#1}}
11772 % \end{macrocode}
11773 %
11774 % \subsection{French spacing (again)}
11775 %
11776 % For the following declarations, see issue \#240. |\nonfrenchspacing|
11777 % is set by |document| too early, so it’s a hack.
11778 %
11779 % \begin{macrocode}
11780 \AddToHook{begindocument/before}{%
11781 \let\bbl@normalsf\normalsfcodes
11782 \let\normalsfcodes\relax}
11783 \AtBeginDocument{%
11784 \ifx\bbl@normalsf\@empty
11785 \ifnum\sfcode`\.=\@m
11786 \let\normalsfcodes\frenchspacing
11787 \else
11788 \let\normalsfcodes\nonfrenchspacing
11789 \fi
11790 \else
11791 \let\normalsfcodes\bbl@normalsf
11792 \fi}
11793 % \end{macrocode}
11794 %
11795 % \textbf{Transforms.}
11796 %
11797 % Process the transforms read from |ini| files, converts them to a form
11798 % close to the user interface (with |\babelprehyphenation| and
11799 % |\babelprehyphenation|), wrapped with |\bbl@transforms@aux| \ldots
11800 % |\relax|, and stores them in |\bbl@release@transforms|. However,
11801 % since building a list enclosed in braces isn’t trivial, the
11802 % replacements are added after a comma, and then |\bbl@transforms@aux|
11803 % adds the braces.
11804 %
11805 % \begin{macrocode}
11806 \bbl@csarg\let{[email protected]}\bbl@inikv
11807 \bbl@csarg\let{[email protected]}\bbl@inikv
11808 \def\bbl@transforms@aux#1#2#3#4,#5\relax{%
11809 #1[#2]{#3}{#4}{#5}}
11810 \begingroup
11811 \catcode`\%=12
11812 \catcode`\&=14
11813 \gdef\bbl@transforms#1#2#3{&%
11814 \directlua{
11815 local str = [==[#2]==]
11816 str = str:gsub('%.%d+%.%d+$', '')
11817 token.set_macro('babeltempa', str)
11818 }&%
11819 \def\babeltempc{}&%
11820 \bbl@xin@{,\babeltempa,}{,\bbl@KVP@transforms,}&%
11821 \ifin@\else
11822 \bbl@xin@{:\babeltempa,}{,\bbl@KVP@transforms,}&%
11823 \fi
11824 \ifin@
11825 \bbl@foreach\bbl@KVP@transforms{&%
11826 \bbl@xin@{:\babeltempa,}{,##1,}&%
11827 \ifin@ &% font:font:transform syntax
11828 \directlua{
11829 local t = {}
11830 for m in string.gmatch('##1'..':', '(.-):') do
11831 table.insert(t, m)
11832 end
11833 table.remove(t)
11834 token.set_macro('babeltempc', ',fonts=' .. table.concat(t, ' '))
11835 }&%
11836 \fi}&%
11837 \in@{.0$}{#2$}&%
11838 \ifin@
11839 \directlua{&% (\attribute) syntax
11840 local str = string.match([[\bbl@KVP@transforms]],
11841 '%(([^%(]-)%)[^%)]-\babeltempa')
11842 if str == nil then
11843 token.set_macro('babeltempb', '')
11844 else
11845 token.set_macro('babeltempb', ',attribute=' .. str)
11846 end
11847 }&%
11848 \toks@{#3}&%
11849 \bbl@exp{&%
11850 \\\g@addto@macro\\\bbl@release@transforms{&%
11851 \relax &% Closes previous \bbl@transforms@aux
11852 \\\bbl@transforms@aux
11853 \\#1{label=\babeltempa\babeltempb\babeltempc}&%
11854 {\languagename}{\the\toks@}}}&%
11855 \else
11856 \g@addto@macro\bbl@release@transforms{, {#3}}&%
11857 \fi
11858 \fi}
11859 \endgroup
11860 % \end{macrocode}
11861 %
11862 % \subsection{Handle language system}
11863 %
11864 % The language system (i.e., |Language| and |Script|) to be used when
11865 % defining a font or setting the direction are set with the following
11866 % macros. It also deals with unhyphenated line breaking in \xetex\
11867 % (e.g., Thai and traditional Sanskrit), which is done with a hack at
11868 % the font level because this engine doesn’t support it.
11869 %
11870 % \begin{macrocode}
11871 \def\bbl@provide@lsys#1{%
11872 \bbl@ifunset{bbl@lname@#1}%
11873 {\bbl@load@info{#1}}%
11874 {}%
11875 \bbl@csarg\let{lsys@#1}\@empty
11876 \bbl@ifunset{bbl@sname@#1}{\bbl@csarg\gdef{sname@#1}{Default}}{}%
11877 \bbl@ifunset{bbl@sotf@#1}{\bbl@csarg\gdef{sotf@#1}{DFLT}}{}%
11878 \bbl@csarg\bbl@add@list{lsys@#1}{Script=\bbl@cs{sname@#1}}%
11879 \bbl@ifunset{bbl@lname@#1}{}%
11880 {\bbl@csarg\bbl@add@list{lsys@#1}{Language=\bbl@cs{lname@#1}}}%
11881 \ifcase\bbl@engine\or\or
11882 \bbl@ifunset{bbl@prehc@#1}{}%
11883 {\bbl@exp{\\\bbl@ifblank{\bbl@cs{prehc@#1}}}%
11884 {}%
11885 {\ifx\bbl@xenohyph\@undefined
11886 \global\let\bbl@xenohyph\bbl@xenohyph@d
11887 \ifx\AtBeginDocument\@notprerr
11888 \expandafter\@secondoftwo % to execute right now
11889 \fi
11890 \AtBeginDocument{%
11891 \bbl@patchfont{\bbl@xenohyph}%
11892 {\expandafter\select@language\expandafter{\languagename}}}%
11893 \fi}}%
11894 \fi
11895 \bbl@csarg\bbl@toglobal{lsys@#1}}
11896 % \end{macrocode}
11897 %
11898 % \subsection{Numerals}
11899 %
11900 % A tool to define the macros for native digits from the list provided
11901 % in the |ini| file. Somewhat convoluted because there are 10 digits,
11902 % but only 9 arguments in \TeX. Non-digits characters are kept. The
11903 % first macro is the generic “localized” command.
11904 %
11905 % \begin{macrocode}
11906 \def\bbl@setdigits#1#2#3#4#5{%
11907 \bbl@exp{%
11908 \def\<\languagename digits>####1{% i.e., \langdigits
11909 \<bbl@digits@\languagename>####1\\\@nil}%
11910 \let\<bbl@cntr@digits@\languagename>\<\languagename digits>%
11911 \def\<\languagename counter>####1{% i.e., \langcounter
11912 \\\expandafter\<bbl@counter@\languagename>%
11913 \\\csname c@####1\endcsname}%
11914 \def\<bbl@counter@\languagename>####1{% i.e., \bbl@counter@lang
11915 \\\expandafter\<bbl@digits@\languagename>%
11916 \\\number####1\\\@nil}}%
11917 \def\bbl@tempa##1##2##3##4##5{%
11918 \bbl@exp{% Wow, quite a lot of hashes! :-(
11919 \def\<bbl@digits@\languagename>########1{%
11920 \\\ifx########1\\\@nil % i.e., \bbl@digits@lang
11921 \\\else
11922 \\\ifx0########1#1%
11923 \\\else\\\ifx1########1#2%
11924 \\\else\\\ifx2########1#3%
11925 \\\else\\\ifx3########1#4%
11926 \\\else\\\ifx4########1#5%
11927 \\\else\\\ifx5########1##1%
11928 \\\else\\\ifx6########1##2%
11929 \\\else\\\ifx7########1##3%
11930 \\\else\\\ifx8########1##4%
11931 \\\else\\\ifx9########1##5%
11932 \\\else########1%
11933 \\\fi\\\fi\\\fi\\\fi\\\fi\\\fi\\\fi\\\fi\\\fi\\\fi
11934 \\\expandafter\<bbl@digits@\languagename>%
11935 \\\fi}}}%
11936 \bbl@tempa}
11937 % \end{macrocode}
11938 %
11939 % Alphabetic counters must be converted from a space separated list to
11940 % an |\ifcase| structure.
11941 %
11942 % \begin{macrocode}
11943 \def\bbl@buildifcase#1 {% Returns \bbl@tempa, requires \toks@={}
11944 \ifx\\#1% % \\ before, in case #1 is multiletter
11945 \bbl@exp{%
11946 \def\\\bbl@tempa####1{%
11947 \<ifcase>####1\space\the\toks@\<else>\\\@ctrerr\<fi>}}%
11948 \else
11949 \toks@\expandafter{\the\toks@\or #1}%
11950 \expandafter\bbl@buildifcase
11951 \fi}
11952 % \end{macrocode}
11953 %
11954 % The code for additive counters is somewhat tricky and it's based on
11955 % the fact the arguments just before |\@@| collects digits which have
11956 % been left ‘unused’ in previous arguments, the first of them being the
11957 % number of digits in the number to be converted. This explains the
11958 % reverse set |76543210|. Digits above 10000 are not handled yet. When
11959 % the key contains the subkey |.F.|, the number after is treated as an
11960 % special case, for a fixed form (see |babel-he.ini|, for example).
11961 %
11962 % \begin{macrocode}
11963 \newcommand\localenumeral[2]{%
11964 \bbl@ifunset{bbl@cntr@#1@\languagename}%
11965 {#2}%
11966 {\bbl@cs{cntr@#1@\languagename}{#2}}}
11967 \def\bbl@localecntr#1#2{\localenumeral{#2}{#1}}
11968 \newcommand\localecounter[2]{%
11969 \expandafter\bbl@localecntr
11970 \expandafter{\number\csname c@#2\endcsname}{#1}}
11971 \def\bbl@alphnumeral#1#2{%
11972 \expandafter\bbl@alphnumeral@i\number#2 76543210\@@{#1}}
11973 \def\bbl@alphnumeral@i#1#2#3#4#5#6#7#8\@@#9{%
11974 \ifcase\@car#8\@nil\or % Currently <10000, but prepared for bigger
11975 \bbl@alphnumeral@ii{#9}000000#1\or
11976 \bbl@alphnumeral@ii{#9}00000#1#2\or
11977 \bbl@alphnumeral@ii{#9}0000#1#2#3\or
11978 \bbl@alphnumeral@ii{#9}000#1#2#3#4\else
11979 \bbl@alphnum@invalid{>9999}%
11980 \fi}
11981 \def\bbl@alphnumeral@ii#1#2#3#4#5#6#7#8{%
11982 \bbl@ifunset{bbl@cntr@#1.F.\number#5#6#7#8@\languagename}%
11983 {\bbl@cs{cntr@#1.4@\languagename}#5%
11984 \bbl@cs{cntr@#1.3@\languagename}#6%
11985 \bbl@cs{cntr@#1.2@\languagename}#7%
11986 \bbl@cs{cntr@#1.1@\languagename}#8%
11987 \ifnum#6#7#8>\z@
11988 \bbl@ifunset{bbl@cntr@#1.S.321@\languagename}{}%
11989 {\bbl@cs{cntr@#1.S.321@\languagename}}%
11990 \fi}%
11991 {\bbl@cs{cntr@#1.F.\number#5#6#7#8@\languagename}}}
11992 \def\bbl@alphnum@invalid#1{%
11993 \bbl@error{alphabetic-too-large}{#1}{}{}}
11994 % \end{macrocode}
11995 %
11996 % \subsection{Casing}
11997 %
11998 % \begin{macrocode}
11999 \newcommand\BabelUppercaseMapping[3]{%
12000 \DeclareUppercaseMapping[\@nameuse{bbl@casing@#1}]{#2}{#3}}
12001 \newcommand\BabelTitlecaseMapping[3]{%
12002 \DeclareTitlecaseMapping[\@nameuse{bbl@casing@#1}]{#2}{#3}}
12003 \newcommand\BabelLowercaseMapping[3]{%
12004 \DeclareLowercaseMapping[\@nameuse{bbl@casing@#1}]{#2}{#3}}
12005 % \end{macrocode}
12006 %
12007 % The parser for |casing| and |casing.|\meta{variant}.
12008 %
12009 % \begin{macrocode}
12010 \ifcase\bbl@engine % Converts utf8 to its code (expandable)
12011 \def\bbl@utftocode#1{\the\numexpr\decode@UTFviii#1\relax}
12012 \else
12013 \def\bbl@utftocode#1{\expandafter`\string#1}
12014 \fi
12015 \def\bbl@casemapping#1#2#3{% 1:variant
12016 \def\bbl@tempa##1 ##2{% Loop
12017 \bbl@casemapping@i{##1}%
12018 \ifx\@empty##2\else\bbl@afterfi\bbl@tempa##2\fi}%
12019 \edef\bbl@templ{\@nameuse{bbl@casing@#2}#1}% Language code
12020 \def\bbl@tempe{0}% Mode (upper/lower...)
12021 \def\bbl@tempc{#3 }% Casing list
12022 \expandafter\bbl@tempa\bbl@tempc\@empty}
12023 \def\bbl@casemapping@i#1{%
12024 \def\bbl@tempb{#1}%
12025 \ifcase\bbl@engine % Handle utf8 in pdftex, by surrounding chars with {}
12026 \@nameuse{regex_replace_all:nnN}%
12027 {[\x{c0}-\x{ff}][\x{80}-\x{bf}]*}{{\0}}\bbl@tempb
12028 \else
12029 \@nameuse{regex_replace_all:nnN}{.}{{\0}}\bbl@tempb
12030 \fi
12031 \expandafter\bbl@casemapping@ii\bbl@tempb\@@}
12032 \def\bbl@casemapping@ii#1#2#3\@@{%
12033 \in@{#1#3}{<>}% i.e., if <u>, <l>, <t>
12034 \ifin@
12035 \edef\bbl@tempe{%
12036 \if#2u1 \else\if#2l2 \else\if#2t3 \fi\fi\fi}%
12037 \else
12038 \ifcase\bbl@tempe\relax
12039 \DeclareUppercaseMapping[\bbl@templ]{\bbl@utftocode{#1}}{#2}%
12040 \DeclareLowercaseMapping[\bbl@templ]{\bbl@utftocode{#2}}{#1}%
12041 \or
12042 \DeclareUppercaseMapping[\bbl@templ]{\bbl@utftocode{#1}}{#2}%
12043 \or
12044 \DeclareLowercaseMapping[\bbl@templ]{\bbl@utftocode{#1}}{#2}%
12045 \or
12046 \DeclareTitlecaseMapping[\bbl@templ]{\bbl@utftocode{#1}}{#2}%
12047 \fi
12048 \fi}
12049 % \end{macrocode}
12050 %
12051 % \subsection{Getting info}
12052 %
12053 % The information in the identification section can be useful, so the
12054 % following macro just exposes it with a user command.
12055 %
12056 % \begin{macrocode}
12057 \def\bbl@localeinfo#1#2{%
12058 \bbl@ifunset{bbl@info@#2}{#1}%
12059 {\bbl@ifunset{bbl@\csname bbl@info@#2\endcsname @\languagename}{#1}%
12060 {\bbl@cs{\csname bbl@info@#2\endcsname @\languagename}}}}
12061 \newcommand\localeinfo[1]{%
12062 \ifx*#1\@empty
12063 \bbl@afterelse\bbl@localeinfo{}%
12064 \else
12065 \bbl@localeinfo
12066 {\bbl@error{no-ini-info}{}{}{}}%
12067 {#1}%
12068 \fi}
12069 % \@namedef{bbl@[email protected]}{lcname}
12070 \@namedef{bbl@[email protected]}{lini}
12071 \@namedef{bbl@[email protected]}{elname}
12072 \@namedef{bbl@[email protected]}{lname}
12073 \@namedef{bbl@[email protected]}{tbcp}
12074 \@namedef{bbl@[email protected]}{lbcp}
12075 \@namedef{bbl@[email protected]}{lotf}
12076 \@namedef{bbl@[email protected]}{esname}
12077 \@namedef{bbl@[email protected]}{sname}
12078 \@namedef{bbl@[email protected]}{sbcp}
12079 \@namedef{bbl@[email protected]}{sotf}
12080 \@namedef{bbl@[email protected]}{rbcp}
12081 \@namedef{bbl@[email protected]}{vbcp}
12082 \@namedef{bbl@[email protected]}{extt}
12083 \@namedef{bbl@[email protected]}{extu}
12084 \@namedef{bbl@[email protected]}{extx}
12085 % \end{macrocode}
12086 %
12087 % With version 3.75 |\BabelEnsureInfo| is executed always, but there is
12088 % an option to disable it. Since the info in |ini| files are always
12089 % loaded, it has be made no-op in version 25.8.
12090 %
12091 % \begin{macrocode}
12092 %<<*More package options>>
12093 \DeclareOption{ensureinfo=off}{}
12094 %<</More package options>>
12095 \let\BabelEnsureInfo\relax
12096 % \end{macrocode}
12097 %
12098 % More general, but non-expandable, is |\getlocaleproperty|.
12099 %
12100 % \begin{macrocode}
12101 \newcommand\getlocaleproperty{%
12102 \@ifstar\bbl@getproperty@s\bbl@getproperty@x}
12103 \def\bbl@getproperty@s#1#2#3{%
12104 \let#1\relax
12105 \def\bbl@elt##1##2##3{%
12106 \bbl@ifsamestring{##1/##2}{#3}%
12107 {\providecommand#1{##3}%
12108 \def\bbl@elt####1####2####3{}}%
12109 {}}%
12110 \bbl@cs{inidata@#2}}%
12111 \def\bbl@getproperty@x#1#2#3{%
12112 \bbl@getproperty@s{#1}{#2}{#3}%
12113 \ifx#1\relax
12114 \bbl@error{unknown-locale-key}{#1}{#2}{#3}%
12115 \fi}
12116 % \end{macrocode}
12117 %
12118 % To inspect every possible loaded |ini|, we define |\LocaleForEach|,
12119 % where |\bbl@ini@loaded| is a comma-separated list of locales, built
12120 % by |\bbl@read@ini|.
12121 %
12122 % \begin{macrocode}
12123 \let\bbl@ini@loaded\@empty
12124 \newcommand\LocaleForEach{\bbl@foreach\bbl@ini@loaded}
12125 \def\ShowLocaleProperties#1{%
12126 \typeout{}%
12127 \typeout{*** Properties for language '#1' ***}%
12128 \def\bbl@elt##1##2##3{\typeout{##1/##2 = \unexpanded{##3}}}%
12129 \@nameuse{bbl@inidata@#1}%
12130 \typeout{*******}}
12131 % \end{macrocode}
12132 %
12133 % \subsection{BCP 47 related commands}
12134 %
12135 % This macro is called by language selectors when the language isn’t
12136 % recognized. So, it’s the core for (1) mapping from a BCP 27 tag to
12137 % the actual language, if |bcp47.toname| is enabled (i.e., if
12138 % |bbl@bcptoname| is true), and (2) lazy loading. With |autoload.bcp47|
12139 % enabled \textit{and} lazy loading, we must first build a name for the
12140 % language, with the help of |autoload.bcp47.prefix|. Then we use
12141 % |\provideprovide| passing the options set with
12142 % |autoload.bcp47.options| (by default |import|). Finally, and if the
12143 % locale has not been loaded before, we use |\provideprovide| with the
12144 % language name as passed to the selector.
12145 %
12146 % \begin{macrocode}
12147 \newif\ifbbl@bcpallowed
12148 \bbl@bcpallowedfalse
12149 \def\bbl@autoload@options{@import}
12150 \def\bbl@provide@locale{%
12151 \ifx\babelprovide\@undefined
12152 \bbl@error{base-on-the-fly}{}{}{}%
12153 \fi
12154 \let\bbl@auxname\languagename
12155 \ifbbl@bcptoname
12156 \bbl@ifunset{bbl@bcp@map@\languagename}{}% Move uplevel??
12157 {\edef\languagename{\@nameuse{bbl@bcp@map@\languagename}}%
12158 \let\localename\languagename}%
12159 \fi
12160 \ifbbl@bcpallowed
12161 \expandafter\ifx\csname date\languagename\endcsname\relax
12162 \expandafter
12163 \bbl@bcplookup\languagename-\@empty-\@empty-\@empty\@@
12164 \ifx\bbl@bcp\relax\else % Returned by \bbl@bcplookup
12165 \edef\languagename{\bbl@bcp@prefix\bbl@bcp}%
12166 \let\localename\languagename
12167 \expandafter\ifx\csname date\languagename\endcsname\relax
12168 \let\bbl@initoload\bbl@bcp
12169 \bbl@exp{\\\babelprovide[\bbl@autoload@bcpoptions]{\languagename}}%
12170 \let\bbl@initoload\relax
12171 \fi
12172 \bbl@csarg\xdef{bcp@map@\bbl@bcp}{\localename}%
12173 \fi
12174 \fi
12175 \fi
12176 \expandafter\ifx\csname date\languagename\endcsname\relax
12177 \IfFileExists{babel-\languagename.tex}%
12178 {\bbl@exp{\\\babelprovide[\bbl@autoload@options]{\languagename}}}%
12179 {}%
12180 \fi}
12181 % \end{macrocode}
12182 %
12183 % \LaTeX{} needs to know the BCP 47 codes for some features. For that,
12184 % it expects |\BCPdata| to be defined. While |language|, |region|,
12185 % |script|, and |variant| are recognized, |extension.<s>| for
12186 % singletons may change.
12187 %
12188 % Still somewhat hackish. Note |\str_if_eq:nnTF| is fully
12189 % expandable (|\bbl@ifsamestring| isn’t). The argument is the prefix to
12190 % tag.bcp47.
12191 %
12192 % \begin{macrocode}
12193 \providecommand\BCPdata{}
12194 \ifx\renewcommand\@undefined\else
12195 \renewcommand\BCPdata[1]{\bbl@bcpdata@i#1\@empty\@empty\@empty}
12196 \def\bbl@bcpdata@i#1#2#3#4#5#6\@empty{%
12197 \@nameuse{str_if_eq:nnTF}{#1#2#3#4#5}{main.}%
12198 {\bbl@bcpdata@ii{#6}\bbl@main@language}%
12199 {\bbl@bcpdata@ii{#1#2#3#4#5#6}\languagename}}%
12200 \def\bbl@bcpdata@ii#1#2{%
12201 \bbl@ifunset{bbl@info@#1.tag.bcp47}%
12202 {\bbl@error{unknown-ini-field}{#1}{}{}}%
12203 {\bbl@ifunset{bbl@\csname bbl@info@#1.tag.bcp47\endcsname @#2}{}%
12204 {\bbl@cs{\csname bbl@info@#1.tag.bcp47\endcsname @#2}}}}
12205 \fi
12206 \@namedef{bbl@[email protected]}{casing}
12207 \@namedef{bbl@[email protected]}{tbcp} % For \BCPdata
12208 % \end{macrocode}
12209 %
12210 % \section{Adjusting the Babel behavior}
12211 %
12212 % A generic high level interface is provided to adjust some global
12213 % and general settings.
12214 %
12215 % \begin{macrocode}
12216 \newcommand\babeladjust[1]{%
12217 \bbl@forkv{#1}{%
12218 \bbl@ifunset{bbl@ADJ@##1@##2}%
12219 {\bbl@cs{ADJ@##1}{##2}}%
12220 {\bbl@cs{ADJ@##1@##2}}}}
12221 %
12222 \def\bbl@adjust@lua#1#2{%
12223 \ifvmode
12224 \ifnum\currentgrouplevel=\z@
12225 \directlua{ Babel.#2 }%
12226 \expandafter\expandafter\expandafter\@gobble
12227 \fi
12228 \fi
12229 {\bbl@error{adjust-only-vertical}{#1}{}{}}}% Gobbled if everything went ok.
12230 \@namedef{bbl@[email protected]@on}{%
12231 \bbl@adjust@lua{bidi}{mirroring_enabled=true}}
12232 \@namedef{bbl@[email protected]@off}{%
12233 \bbl@adjust@lua{bidi}{mirroring_enabled=false}}
12234 \@namedef{bbl@[email protected]@on}{%
12235 \bbl@adjust@lua{bidi}{bidi_enabled=true}}
12236 \@namedef{bbl@[email protected]@off}{%
12237 \bbl@adjust@lua{bidi}{bidi_enabled=false}}
12238 \@namedef{bbl@[email protected]@on}{%
12239 \let\bbl@noamsmath\@empty}
12240 \@namedef{bbl@[email protected]@off}{%
12241 \let\bbl@noamsmath\relax}
12242 %
12243 \@namedef{bbl@[email protected]@on}{%
12244 \bbl@adjust@lua{bidi}{digits_mapped=true}}
12245 \@namedef{bbl@[email protected]@off}{%
12246 \bbl@adjust@lua{bidi}{digits_mapped=false}}
12247 %
12248 \@namedef{bbl@[email protected]@on}{%
12249 \bbl@adjust@lua{linebreak}{sea_enabled=true}}
12250 \@namedef{bbl@[email protected]@off}{%
12251 \bbl@adjust@lua{linebreak}{sea_enabled=false}}
12252 \@namedef{bbl@[email protected]@on}{%
12253 \bbl@adjust@lua{linebreak}{cjk_enabled=true}}
12254 \@namedef{bbl@[email protected]@off}{%
12255 \bbl@adjust@lua{linebreak}{cjk_enabled=false}}
12256 \@namedef{bbl@[email protected]@on}{%
12257 \bbl@adjust@lua{linebreak}{arabic.justify_enabled=true}}
12258 \@namedef{bbl@[email protected]@off}{%
12259 \bbl@adjust@lua{linebreak}{arabic.justify_enabled=false}}
12260 %
12261 \def\bbl@adjust@layout#1{%
12262 \ifvmode
12263 #1%
12264 \expandafter\@gobble
12265 \fi
12266 {\bbl@error{layout-only-vertical}{}{}{}}}% Gobbled if everything went ok.
12267 \@namedef{bbl@[email protected]@on}{%
12268 \ifnum\bbl@tabular@mode=\tw@
12269 \bbl@adjust@layout{\let\@tabular\bbl@NL@@tabular}%
12270 \else
12271 \chardef\bbl@tabular@mode\@ne
12272 \fi}
12273 \@namedef{bbl@[email protected]@off}{%
12274 \ifnum\bbl@tabular@mode=\tw@
12275 \bbl@adjust@layout{\let\@tabular\bbl@OL@@tabular}%
12276 \else
12277 \chardef\bbl@tabular@mode\z@
12278 \fi}
12279 \@namedef{bbl@[email protected]@on}{%
12280 \bbl@adjust@layout{\let\list\bbl@NL@list}}
12281 \@namedef{bbl@[email protected]@off}{%
12282 \bbl@adjust@layout{\let\list\bbl@OL@list}}
12283 %
12284 \@namedef{bbl@[email protected]@on}{%
12285 \bbl@bcpallowedtrue}
12286 \@namedef{bbl@[email protected]@off}{%
12287 \bbl@bcpallowedfalse}
12288 \@namedef{bbl@[email protected]}#1{%
12289 \def\bbl@bcp@prefix{#1}}
12290 \def\bbl@bcp@prefix{bcp47-}
12291 \@namedef{bbl@[email protected]}#1{%
12292 \def\bbl@autoload@options{#1}}
12293 \def\bbl@autoload@bcpoptions{import}
12294 \@namedef{bbl@[email protected]}#1{%
12295 \def\bbl@autoload@bcpoptions{#1}}
12296 \newif\ifbbl@bcptoname
12297 %
12298 \@namedef{bbl@[email protected]@on}{%
12299 \bbl@bcptonametrue}
12300 \@namedef{bbl@[email protected]@off}{%
12301 \bbl@bcptonamefalse}
12302 %
12303 \@namedef{bbl@[email protected]@nohyphenation}{%
12304 \directlua{ Babel.ignore_pre_char = function(node)
12305 return (node.lang == \the\csname l@nohyphenation\endcsname)
12306 end }}
12307 \@namedef{bbl@[email protected]@off}{%
12308 \directlua{ Babel.ignore_pre_char = function(node)
12309 return false
12310 end }}
12311 %
12312 \@namedef{bbl@[email protected]@nohyphenation}{%
12313 \def\bbl@ignoreinterchar{%
12314 \ifnum\language=\l@nohyphenation
12315 \expandafter\@gobble
12316 \else
12317 \expandafter\@firstofone
12318 \fi}}
12319 \@namedef{bbl@[email protected]@off}{%
12320 \let\bbl@ignoreinterchar\@firstofone}
12321 %
12322 \@namedef{bbl@[email protected]@shift}{%
12323 \let\bbl@restorelastskip\relax
12324 \def\bbl@savelastskip{%
12325 \let\bbl@restorelastskip\relax
12326 \ifvmode
12327 \ifdim\lastskip=\z@
12328 \let\bbl@restorelastskip\nobreak
12329 \else
12330 \bbl@exp{%
12331 \def\\\bbl@restorelastskip{%
12332 \skip@=\the\lastskip
12333 \\\nobreak \vskip-\skip@ \vskip\skip@}}%
12334 \fi
12335 \fi}}
12336 \@namedef{bbl@[email protected]@keep}{%
12337 \let\bbl@restorelastskip\relax
12338 \let\bbl@savelastskip\relax}
12339 \@namedef{bbl@[email protected]@omit}{%
12340 \AddBabelHook{babel-select}{beforestart}{%
12341 \expandafter\babel@aux\expandafter{\bbl@main@language}{}}%
12342 \let\bbl@restorelastskip\relax
12343 \def\bbl@savelastskip##1\bbl@restorelastskip{}}
12344 \@namedef{bbl@[email protected]@off}{%
12345 \let\bbl@encoding@select@off\@empty}
12346 % \end{macrocode}
12347 %
12348 % \subsection{Cross referencing macros}
12349 %
12350 % The \LaTeX\ book states:
12351 % \begin{quote}
12352 % The \emph{key} argument is any sequence of letters, digits, and
12353 % punctuation symbols; upper- and lowercase letters are regarded as
12354 % different.
12355 % \end{quote}
12356 % When the above quote should still be true when a document is
12357 % typeset in a language that has active characters, special care
12358 % has to be taken of the category codes of these characters when
12359 % they appear in an argument of the cross referencing macros.
12360 %
12361 % When a cross referencing command processes its argument, all
12362 % tokens in this argument should be character tokens with category
12363 % `letter' or `other'.
12364 %
12365 % The following package options control which macros are to be
12366 % redefined.
12367 %
12368 % \begin{macrocode}
12369 %<<*More package options>>
12370 \DeclareOption{safe=none}{\let\bbl@opt@safe\@empty}
12371 \DeclareOption{safe=bib}{\def\bbl@opt@safe{B}}
12372 \DeclareOption{safe=ref}{\def\bbl@opt@safe{R}}
12373 \DeclareOption{safe=refbib}{\def\bbl@opt@safe{BR}}
12374 \DeclareOption{safe=bibref}{\def\bbl@opt@safe{BR}}
12375 %<</More package options>>
12376 % \end{macrocode}
12377 %
12378 % \macro{\@newl@bel}
12379 %
12380 % First we open a new group to keep the changed setting of
12381 % |\protect| local and then we set the |@safe@actives| switch to
12382 % true to make sure that any shorthand that appears in any of the
12383 % arguments immediately expands to its non-active self.
12384 %
12385 % \begin{macrocode}
12386 \bbl@trace{Cross referencing macros}
12387 \ifx\bbl@opt@safe\@empty\else % i.e., if 'ref' and/or 'bib'
12388 \def\@newl@bel#1#2#3{%
12389 {\@safe@activestrue
12390 \bbl@ifunset{#1@#2}%
12391 \relax
12392 {\gdef\@multiplelabels{%
12393 \@latex@warning@no@line{There were multiply-defined labels}}%
12394 \@latex@warning@no@line{Label `#2' multiply defined}}%
12395 \global\@namedef{#1@#2}{#3}}}
12396 % \end{macrocode}
12397 %
12398 % \macro{\@testdef}
12399 %
12400 % An internal \LaTeX\ macro used to test if the labels that have
12401 % been written on the |aux| file have changed. It is called by
12402 % the |\enddocument| macro.
12403 %
12404 % \begin{macrocode}
12405 \CheckCommand*\@testdef[3]{%
12406 \def\reserved@a{#3}%
12407 \expandafter\ifx\csname#1@#2\endcsname\reserved@a
12408 \else
12409 \@tempswatrue
12410 \fi}
12411 % \end{macrocode}
12412 %
12413 % Now that we made sure that |\@testdef| still has the same definition
12414 % we can rewrite it. First we make the shorthands `safe'. Then we use
12415 % |\bbl@tempa| as an `alias' for the macro that contains the label
12416 % which is being checked. Then we define |\bbl@tempb| just as
12417 % |\@newl@bel| does it. When the label is defined we replace the
12418 % definition of |\bbl@tempa| by its meaning. If the label didn't
12419 % change, |\bbl@tempa| and |\bbl@tempb| should be identical macros.
12420 %
12421 % \begin{macrocode}
12422 \def\@testdef#1#2#3{%
12423 \@safe@activestrue
12424 \expandafter\let\expandafter\bbl@tempa\csname #1@#2\endcsname
12425 \def\bbl@tempb{#3}%
12426 \@safe@activesfalse
12427 \ifx\bbl@tempa\relax
12428 \else
12429 \edef\bbl@tempa{\expandafter\strip@prefix\meaning\bbl@tempa}%
12430 \fi
12431 \edef\bbl@tempb{\expandafter\strip@prefix\meaning\bbl@tempb}%
12432 \ifx\bbl@tempa\bbl@tempb
12433 \else
12434 \@tempswatrue
12435 \fi}
12436 \fi
12437 % \end{macrocode}
12438 %
12439 % \macro{\ref}
12440 % \macro{\pageref}
12441 %
12442 % The same holds for the macro |\ref| that references a label and
12443 % |\pageref| to reference a page. We make them robust as well (if
12444 % they weren't already) to prevent problems if they should become
12445 % expanded at the wrong moment.
12446 %
12447 % \begin{macrocode}
12448 \bbl@xin@{R}\bbl@opt@safe
12449 \ifin@
12450 \edef\bbl@tempc{\expandafter\string\csname ref code\endcsname}%
12451 \bbl@xin@{\expandafter\strip@prefix\meaning\bbl@tempc}%
12452 {\expandafter\strip@prefix\meaning\ref}%
12453 \ifin@
12454 \bbl@redefine\@kernel@ref#1{%
12455 \@safe@activestrue\org@@kernel@ref{#1}\@safe@activesfalse}
12456 \bbl@redefine\@kernel@pageref#1{%
12457 \@safe@activestrue\org@@kernel@pageref{#1}\@safe@activesfalse}
12458 \bbl@redefine\@kernel@sref#1{%
12459 \@safe@activestrue\org@@kernel@sref{#1}\@safe@activesfalse}
12460 \bbl@redefine\@kernel@spageref#1{%
12461 \@safe@activestrue\org@@kernel@spageref{#1}\@safe@activesfalse}
12462 \else
12463 \bbl@redefinerobust\ref#1{%
12464 \@safe@activestrue\org@ref{#1}\@safe@activesfalse}
12465 \bbl@redefinerobust\pageref#1{%
12466 \@safe@activestrue\org@pageref{#1}\@safe@activesfalse}
12467 \fi
12468 \else
12469 \let\org@ref\ref
12470 \let\org@pageref\pageref
12471 \fi
12472 % \end{macrocode}
12473 %
12474 % \macro{\@citex}
12475 %
12476 % The macro used to cite from a bibliography, |\cite|, uses an
12477 % internal macro, |\@citex|.
12478 % It is this internal macro that picks up the argument(s),
12479 % so we redefine this internal macro and leave |\cite| alone. The
12480 % first argument is used for typesetting, so the shorthands need
12481 % only be deactivated in the second argument.
12482 %
12483 % \begin{macrocode}
12484 \bbl@xin@{B}\bbl@opt@safe
12485 \ifin@
12486 \bbl@redefine\@citex[#1]#2{%
12487 \@safe@activestrue\edef\bbl@tempa{#2}\@safe@activesfalse
12488 \org@@citex[#1]{\bbl@tempa}}
12489 % \end{macrocode}
12490 %
12491 % Unfortunately, the packages \pkg{natbib} and \pkg{cite} need a
12492 % different definition of |\@citex|...
12493 % To begin with, \pkg{natbib} has a definition for |\@citex| with
12494 % \emph{three} arguments... We only know that a package is loaded
12495 % when |\begin{document}| is executed, so we need to postpone the
12496 % different redefinition.
12497 %
12498 % Notice that we use |\def| here instead of |\bbl@redefine| because
12499 % |\org@@citex| is already defined and we don't want to overwrite
12500 % that definition (it would result in parameter stack overflow
12501 % because of a circular definition).
12502 %
12503 % (Recent versions of \pkg{natbib} change dynamically |\@citex|, so PR4087
12504 % doesn't seem fixable in a simple way. Just load \pkg{natbib} before.)
12505 %
12506 % \begin{macrocode}
12507 \AtBeginDocument{%
12508 \@ifpackageloaded{natbib}{%
12509 \def\@citex[#1][#2]#3{%
12510 \@safe@activestrue\edef\bbl@tempa{#3}\@safe@activesfalse
12511 \org@@citex[#1][#2]{\bbl@tempa}}%
12512 }{}}
12513 % \end{macrocode}
12514 %
12515 % The package \pkg{cite} has a definition of |\@citex| where the
12516 % shorthands need to be turned off in both arguments.
12517 %
12518 % \begin{macrocode}
12519 \AtBeginDocument{%
12520 \@ifpackageloaded{cite}{%
12521 \def\@citex[#1]#2{%
12522 \@safe@activestrue\org@@citex[#1]{#2}\@safe@activesfalse}%
12523 }{}}
12524 % \end{macrocode}
12525 %
12526 % \macro{\nocite}
12527 %
12528 % The macro |\nocite| which is used to instruct BiB\TeX\ to
12529 % extract uncited references from the database.
12530 %
12531 % \begin{macrocode}
12532 \bbl@redefine\nocite#1{%
12533 \@safe@activestrue\org@nocite{#1}\@safe@activesfalse}
12534 % \end{macrocode}
12535 %
12536 % \macro{\bibcite}
12537 %
12538 % The macro that is used in the |aux| file to
12539 % define citation labels. When packages such as \pkg{natbib} or
12540 % \pkg{cite} are not loaded its second argument is used to typeset the
12541 % citation label. In that case, this second argument can contain
12542 % active characters but is used in an environment where
12543 % |\@safe@activestrue| is in effect. This switch needs to be reset
12544 % inside the |\hbox| which contains the citation label. In order to
12545 % determine during \file{aux} file processing which definition of
12546 % |\bibcite| is needed we define |\bibcite| in such a way that it
12547 % redefines itself with the proper definition. We call
12548 % |\bbl@cite@choice| to select the proper definition for |\bibcite|.
12549 % This new definition is then activated.
12550 %
12551 % \begin{macrocode}
12552 \bbl@redefine\bibcite{%
12553 \bbl@cite@choice
12554 \bibcite}
12555 % \end{macrocode}
12556 %
12557 % \macro{\bbl@bibcite}
12558 %
12559 % The macro |\bbl@bibcite| holds the definition of |\bibcite|
12560 % needed when neither \pkg{natbib} nor \pkg{cite} is loaded.
12561 %
12562 % \begin{macrocode}
12563 \def\bbl@bibcite#1#2{%
12564 \org@bibcite{#1}{\@safe@activesfalse#2}}
12565 % \end{macrocode}
12566 %
12567 % \macro{\bbl@cite@choice}
12568 %
12569 % The macro |\bbl@cite@choice| determines which definition of
12570 % |\bibcite| is needed. First we give |\bibcite| its default
12571 % definition.
12572 %
12573 % \begin{macrocode}
12574 \def\bbl@cite@choice{%
12575 \global\let\bibcite\bbl@bibcite
12576 \@ifpackageloaded{natbib}{\global\let\bibcite\org@bibcite}{}%
12577 \@ifpackageloaded{cite}{\global\let\bibcite\org@bibcite}{}%
12578 \global\let\bbl@cite@choice\relax}
12579 % \end{macrocode}
12580 %
12581 % When a document is run for the first time, no \file{aux} file is
12582 % available, and |\bibcite| will not yet be properly defined. In
12583 % this case, this has to happen before the document starts.
12584 %
12585 % \begin{macrocode}
12586 \AtBeginDocument{\bbl@cite@choice}
12587 % \end{macrocode}
12588 %
12589 % \macro{\@bibitem}
12590 %
12591 % One of the two internal \LaTeX\ macros called by |\bibitem|
12592 % that write the citation label on the |aux| file.
12593 %
12594 % \begin{macrocode}
12595 \bbl@redefine\@bibitem#1{%
12596 \@safe@activestrue\org@@bibitem{#1}\@safe@activesfalse}
12597 \else
12598 \let\org@nocite\nocite
12599 \let\org@@citex\@citex
12600 \let\org@bibcite\bibcite
12601 \let\org@@bibitem\@bibitem
12602 \fi
12603 % \end{macrocode}
12604 %
12605 % \subsection{Layout}
12606 %
12607 % \begin{macrocode}
12608 \newcommand\BabelPatchSection[1]{%
12609 \@ifundefined{#1}{}{%
12610 \bbl@exp{\let\<bbl@ss@#1>\<#1>}%
12611 \@namedef{#1}{%
12612 \@ifstar{\bbl@presec@s{#1}}%
12613 {\@dblarg{\bbl@presec@x{#1}}}}}}
12614 \def\bbl@presec@x#1[#2]#3{%
12615 \bbl@exp{%
12616 \\\select@language@x{\bbl@main@language}%
12617 \\\bbl@cs{sspre@#1}%
12618 \\\bbl@cs{ss@#1}%
12619 [\\\foreignlanguage{\languagename}{\unexpanded{#2}}]%
12620 {\\\foreignlanguage{\languagename}{\unexpanded{#3}}}%
12621 \\\select@language@x{\languagename}}}
12622 \def\bbl@presec@s#1#2{%
12623 \bbl@exp{%
12624 \\\select@language@x{\bbl@main@language}%
12625 \\\bbl@cs{sspre@#1}%
12626 \\\bbl@cs{ss@#1}*%
12627 {\\\foreignlanguage{\languagename}{\unexpanded{#2}}}%
12628 \\\select@language@x{\languagename}}}
12629 %
12630 \IfBabelLayout{sectioning}%
12631 {\BabelPatchSection{part}%
12632 \BabelPatchSection{chapter}%
12633 \BabelPatchSection{section}%
12634 \BabelPatchSection{subsection}%
12635 \BabelPatchSection{subsubsection}%
12636 \BabelPatchSection{paragraph}%
12637 \BabelPatchSection{subparagraph}%
12638 \def\babel@toc#1{%
12639 \select@language@x{\bbl@main@language}}}{}
12640 \IfBabelLayout{captions}%
12641 {\BabelPatchSection{caption}}{}
12642 % \end{macrocode}
12643 %
12644 % \macro{\BabelFootnote}
12645 %
12646 % Footnotes.
12647 %
12648 % \begin{macrocode}
12649 \bbl@trace{Footnotes}
12650 \def\bbl@footnote#1#2#3{%
12651 \@ifnextchar[%
12652 {\bbl@footnote@o{#1}{#2}{#3}}%
12653 {\bbl@footnote@x{#1}{#2}{#3}}}
12654 \long\def\bbl@footnote@x#1#2#3#4{%
12655 \bgroup
12656 \select@language@x{\bbl@main@language}%
12657 \bbl@fn@footnote{#2#1{\ignorespaces#4}#3}%
12658 \egroup}
12659 \long\def\bbl@footnote@o#1#2#3[#4]#5{%
12660 \bgroup
12661 \select@language@x{\bbl@main@language}%
12662 \bbl@fn@footnote[#4]{#2#1{\ignorespaces#5}#3}%
12663 \egroup}
12664 \def\bbl@footnotetext#1#2#3{%
12665 \@ifnextchar[%
12666 {\bbl@footnotetext@o{#1}{#2}{#3}}%
12667 {\bbl@footnotetext@x{#1}{#2}{#3}}}
12668 \long\def\bbl@footnotetext@x#1#2#3#4{%
12669 \bgroup
12670 \select@language@x{\bbl@main@language}%
12671 \bbl@fn@footnotetext{#2#1{\ignorespaces#4}#3}%
12672 \egroup}
12673 \long\def\bbl@footnotetext@o#1#2#3[#4]#5{%
12674 \bgroup
12675 \select@language@x{\bbl@main@language}%
12676 \bbl@fn@footnotetext[#4]{#2#1{\ignorespaces#5}#3}%
12677 \egroup}
12678 \def\BabelFootnote#1#2#3#4{%
12679 \ifx\bbl@fn@footnote\@undefined
12680 \let\bbl@fn@footnote\footnote
12681 \fi
12682 \ifx\bbl@fn@footnotetext\@undefined
12683 \let\bbl@fn@footnotetext\footnotetext
12684 \fi
12685 \bbl@ifblank{#2}%
12686 {\def#1{\bbl@footnote{\@firstofone}{#3}{#4}}
12687 \@namedef{\bbl@stripslash#1text}%
12688 {\bbl@footnotetext{\@firstofone}{#3}{#4}}}%
12689 {\def#1{\bbl@exp{\\\bbl@footnote{\\\foreignlanguage{#2}}}{#3}{#4}}%
12690 \@namedef{\bbl@stripslash#1text}%
12691 {\bbl@exp{\\\bbl@footnotetext{\\\foreignlanguage{#2}}}{#3}{#4}}}}
12692 \IfBabelLayout{footnotes}%
12693 {\let\bbl@OL@footnote\footnote
12694 \BabelFootnote\footnote\languagename{}{}%
12695 \BabelFootnote\localfootnote\languagename{}{}%
12696 \BabelFootnote\mainfootnote{}{}{}}
12697 {}
12698 % \end{macrocode}
12699 %
12700 % \subsection{Marks}
12701 %
12702 % \macro{\markright}
12703 % Because the output routine is asynchronous, we must pass the
12704 % current language attribute to the head lines. To achieve this we
12705 % need to adapt the definition of |\markright| and |\markboth|
12706 % somewhat. However, headlines and footlines can contain text
12707 % outside marks; for that we must take some actions in the output
12708 % routine if the 'headfoot' options is used.
12709 %
12710 % We need to make some redefinitions to the output routine
12711 % to avoid an endless loop and to correctly handle the page number
12712 % in bidi documents.
12713 %
12714 % \begin{macrocode}
12715 \bbl@trace{Marks}
12716 \IfBabelLayout{sectioning}
12717 {\ifx\bbl@opt@headfoot\@nnil
12718 \g@addto@macro\@resetactivechars{%
12719 \set@typeset@protect
12720 \expandafter\select@language@x\expandafter{\bbl@main@language}%
12721 \let\protect\noexpand
12722 \ifcase\bbl@bidimode\else % Only with bidi. See also above
12723 \edef\thepage{%
12724 \noexpand\babelsublr{\unexpanded\expandafter{\thepage}}}%
12725 \fi}%
12726 \fi}
12727 {\ifbbl@single\else
12728 \bbl@ifunset{markright }\bbl@redefine\bbl@redefinerobust
12729 \markright#1{%
12730 \bbl@ifblank{#1}%
12731 {\org@markright{}}%
12732 {\toks@{#1}%
12733 \bbl@exp{%
12734 \\\org@markright{\\\protect\\\foreignlanguage{\languagename}%
12735 {\\\protect\\\bbl@restore@actives\the\toks@}}}}}%
12736 % \end{macrocode}
12737 %
12738 % \macro{\markboth}
12739 % \macro{\@mkboth}
12740 % The definition of |\markboth| is equivalent to that of |\markright|,
12741 % except that we need two token registers. The documentclasses
12742 % \cls{report} and \cls{book} define and set the headings for the page.
12743 % While doing so they also store a copy of |\markboth| in |\@mkboth|.
12744 % Therefore we need to check whether |\@mkboth| has already been set.
12745 % If so we need to do that again with the new definition of
12746 % |\markboth|. (As of Oct 2019, \LaTeX{} stores the definition in an
12747 % intermediate macro, so it's not necessary anymore, but it's preserved
12748 % for older versions.)
12749 %
12750 % \begin{macrocode}
12751 \ifx\@mkboth\markboth
12752 \def\bbl@tempc{\let\@mkboth\markboth}%
12753 \else
12754 \def\bbl@tempc{}%
12755 \fi
12756 \bbl@ifunset{markboth }\bbl@redefine\bbl@redefinerobust
12757 \markboth#1#2{%
12758 \protected@edef\bbl@tempb##1{%
12759 \protect\foreignlanguage
12760 {\languagename}{\protect\bbl@restore@actives##1}}%
12761 \bbl@ifblank{#1}%
12762 {\toks@{}}%
12763 {\toks@\expandafter{\bbl@tempb{#1}}}%
12764 \bbl@ifblank{#2}%
12765 {\@temptokena{}}%
12766 {\@temptokena\expandafter{\bbl@tempb{#2}}}%
12767 \bbl@exp{\\\org@markboth{\the\toks@}{\the\@temptokena}}}%
12768 \bbl@tempc
12769 \fi} % end ifbbl@single, end \IfBabelLayout
12770 % \end{macrocode}
12771 %
12772 % \subsection{Other packages}
12773 %
12774 % \subsubsection{\pkg{ifthen}}
12775 %
12776 % \macro{\ifthenelse}
12777 %
12778 % Sometimes a document writer wants to create a special effect
12779 % depending on the page a certain fragment of text appears on. This
12780 % can be achieved by the following piece of code:
12781 %\begin{verbatim}
12782 % \ifthenelse{\isodd{\pageref{some-label}}}
12783 % {code for odd pages}
12784 % {code for even pages}
12785 %\end{verbatim}
12786 % In order for this to work the argument of |\isodd| needs to be
12787 % fully expandable. With the above redefinition of |\pageref| it is
12788 % not in the case of this example. To overcome that, we add some
12789 % code to the definition of |\ifthenelse| to make things work.
12790 %
12791 % We want to revert the definition of |\pageref| and |\ref| to
12792 % their original definition for the first argument of |\ifthenelse|,
12793 % so we first need to store their current meanings.
12794 %
12795 % Then we can set the |\@safe@actives| switch and call the original
12796 % |\ifthenelse|. In order to be able to use shorthands in the
12797 % second and third arguments of |\ifthenelse| the resetting of the
12798 % switch \emph{and} the definition of |\pageref| happens inside
12799 % those arguments.
12800 %
12801 % \begin{macrocode}
12802 \bbl@trace{Preventing clashes with other packages}
12803 \ifx\org@ref\@undefined\else
12804 \bbl@xin@{R}\bbl@opt@safe
12805 \ifin@
12806 \AtBeginDocument{%
12807 \@ifpackageloaded{ifthen}{%
12808 \bbl@redefine@long\ifthenelse#1#2#3{%
12809 \let\bbl@temp@pref\pageref
12810 \let\pageref\org@pageref
12811 \let\bbl@temp@ref\ref
12812 \let\ref\org@ref
12813 \@safe@activestrue
12814 \org@ifthenelse{#1}%
12815 {\let\pageref\bbl@temp@pref
12816 \let\ref\bbl@temp@ref
12817 \@safe@activesfalse
12818 #2}%
12819 {\let\pageref\bbl@temp@pref
12820 \let\ref\bbl@temp@ref
12821 \@safe@activesfalse
12822 #3}%
12823 }%
12824 }{}%
12825 }
12826 \fi
12827 % \end{macrocode}
12828 %
12829 % \subsubsection{\pkg{varioref}}
12830 %
12831 % \macro{\@@vpageref}
12832 % \macro{\vrefpagenum}
12833 % \macro{\Ref}
12834 %
12835 % When the package \pkg{varioref} is in use we need to modify its
12836 % internal command |\@@vpageref| in order to prevent problems when
12837 % an active character ends up in the argument of |\vref|. The same
12838 % needs to happen for |\vrefpagenum|.
12839 %
12840 % \begin{macrocode}
12841 \AtBeginDocument{%
12842 \@ifpackageloaded{varioref}{%
12843 \bbl@redefine\@@vpageref#1[#2]#3{%
12844 \@safe@activestrue
12845 \org@@@vpageref{#1}[#2]{#3}%
12846 \@safe@activesfalse}%
12847 \bbl@redefine\vrefpagenum#1#2{%
12848 \@safe@activestrue
12849 \org@vrefpagenum{#1}{#2}%
12850 \@safe@activesfalse}%
12851 % \end{macrocode}
12852 %
12853 % The package \pkg{varioref} defines |\Ref| to be a robust command
12854 % which uppercases the first character of the reference text. In
12855 % order to be able to do that it needs to access the expandable form
12856 % of |\ref|. So we employ a little trick here. We redefine the
12857 % (internal) command \verb*|\Ref | to call |\org@ref| instead of
12858 % |\ref|. The disadvantage of this solution is that whenever the
12859 % definition of |\Ref| changes, this definition needs to be updated
12860 % as well.
12861 %
12862 % \begin{macrocode}
12863 \expandafter\def\csname Ref \endcsname#1{%
12864 \protected@edef\@tempa{\org@ref{#1}}\expandafter\MakeUppercase\@tempa}
12865 }{}%
12866 }
12867 \fi
12868 % \end{macrocode}
12869 %
12870 % \subsubsection{\pkg{hhline}}
12871 %
12872 % \macro{\hhline}
12873 %
12874 % Delaying the activation of the shorthand characters has introduced
12875 % a problem with the \pkg{hhline} package. The reason is that it
12876 % uses the `:' character which is made active by the french support
12877 % in \babel. Therefore we need to \emph{reload} the package when
12878 % the `:' is an active character. Note that this happens
12879 % \emph{after} the category code of the @-sign has been changed to
12880 % other, so we need to temporarily change it to letter again.
12881 %
12882 % \begin{macrocode}
12883 \AtEndOfPackage{%
12884 \AtBeginDocument{%
12885 \@ifpackageloaded{hhline}%
12886 {\expandafter\ifx\csname normal@char\string:\endcsname\relax
12887 \else
12888 \makeatletter
12889 \def\@currname{hhline}\input{hhline.sty}\makeatother
12890 \fi}%
12891 {}}}
12892 % \end{macrocode}
12893 %
12894 % \macro{\substitutefontfamily}
12895 %
12896 % \textit{Deprecated.} It creates an \file{fd} file on the fly. The
12897 % first argument is an encoding mnemonic, the second and third
12898 % arguments are font family names. Use the tools provided by \LaTeX\
12899 % (|\DeclareFontFamilySubstitution|).
12900 %
12901 % \begin{macrocode}
12902 \def\substitutefontfamily#1#2#3{%
12903 \lowercase{\immediate\openout15=#1#2.fd\relax}%
12904 \immediate\write15{%
12905 \string\ProvidesFile{#1#2.fd}%
12906 [\the\year/\two@digits{\the\month}/\two@digits{\the\day}
12907 \space generated font description file]^^J
12908 \string\DeclareFontFamily{#1}{#2}{}^^J
12909 \string\DeclareFontShape{#1}{#2}{m}{n}{<->ssub * #3/m/n}{}^^J
12910 \string\DeclareFontShape{#1}{#2}{m}{it}{<->ssub * #3/m/it}{}^^J
12911 \string\DeclareFontShape{#1}{#2}{m}{sl}{<->ssub * #3/m/sl}{}^^J
12912 \string\DeclareFontShape{#1}{#2}{m}{sc}{<->ssub * #3/m/sc}{}^^J
12913 \string\DeclareFontShape{#1}{#2}{b}{n}{<->ssub * #3/bx/n}{}^^J
12914 \string\DeclareFontShape{#1}{#2}{b}{it}{<->ssub * #3/bx/it}{}^^J
12915 \string\DeclareFontShape{#1}{#2}{b}{sl}{<->ssub * #3/bx/sl}{}^^J
12916 \string\DeclareFontShape{#1}{#2}{b}{sc}{<->ssub * #3/bx/sc}{}^^J
12917 }%
12918 \closeout15
12919 }
12920 \@onlypreamble\substitutefontfamily
12921 % \end{macrocode}
12922 %
12923 % \subsection{Encoding and fonts}
12924 %
12925 % Because documents may use non-ASCII font encodings, we make sure
12926 % that the logos of \TeX\ and \LaTeX\ always come out in the right
12927 % encoding. There is a list of non-ASCII encodings. Requested
12928 % encodings are currently stored in |\@fontenc@load@list|. If a
12929 % non-ASCII has been loaded, we define versions of |\TeX| and |\LaTeX|
12930 % for them using |\ensureascii|. The default ASCII encoding is set,
12931 % too (in reverse order): the “main” encoding (when the document
12932 % begins), the last loaded, or |OT1|.
12933 %
12934 % \macro{\ensureascii}
12935 %
12936 % \begin{macrocode}
12937 \bbl@trace{Encoding and fonts}
12938 \newcommand\BabelNonASCII{LGR,LGI,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU}
12939 \newcommand\BabelNonText{TS1,T3,TS3}
12940 \let\org@TeX\TeX
12941 \let\org@LaTeX\LaTeX
12942 \let\ensureascii\@firstofone
12943 \let\asciiencoding\@empty
12944 \AtBeginDocument{%
12945 \def\@elt#1{,#1,}%
12946 \edef\bbl@tempa{\expandafter\@gobbletwo\@fontenc@load@list}%
12947 \let\@elt\relax
12948 \let\bbl@tempb\@empty
12949 \def\bbl@tempc{OT1}%
12950 \bbl@foreach\BabelNonASCII{% LGR loaded in a non-standard way
12951 \bbl@ifunset{T@#1}{}{\def\bbl@tempb{#1}}}%
12952 \bbl@foreach\bbl@tempa{%
12953 \bbl@xin@{,#1,}{,\BabelNonASCII,}%
12954 \ifin@
12955 \def\bbl@tempb{#1}% Store last non-ascii
12956 \else\bbl@xin@{,#1,}{,\BabelNonText,}% Pass
12957 \ifin@\else
12958 \def\bbl@tempc{#1}% Store last ascii
12959 \fi
12960 \fi}%
12961 \ifx\bbl@tempb\@empty\else
12962 \bbl@xin@{,\cf@encoding,}{,\BabelNonASCII,\BabelNonText,}%
12963 \ifin@\else
12964 \edef\bbl@tempc{\cf@encoding}% The default if ascii wins
12965 \fi
12966 \let\asciiencoding\bbl@tempc
12967 \renewcommand\ensureascii[1]{%
12968 {\fontencoding{\asciiencoding}\selectfont#1}}%
12969 \DeclareTextCommandDefault{\TeX}{\ensureascii{\org@TeX}}%
12970 \DeclareTextCommandDefault{\LaTeX}{\ensureascii{\org@LaTeX}}%
12971 \fi}
12972 % \end{macrocode}
12973 %
12974 % Now comes the old deprecated stuff (with a little change in 3.9l, for
12975 % \textsf{fontspec}). The first thing we need to do is to determine, at
12976 % |\begin{document}|, which latin fontencoding to use.
12977 %
12978 % \macro{\latinencoding}
12979 % When text is being typeset in an encoding other than `latin'
12980 % (\texttt{OT1} or \texttt{T1}), it would be nice to still have Roman
12981 % numerals come out in the Latin encoding. So we first assume that the
12982 % current encoding at the end of processing the package is the Latin
12983 % encoding.
12984 %
12985 % \begin{macrocode}
12986 \AtEndOfPackage{\edef\latinencoding{\cf@encoding}}
12987 % \end{macrocode}
12988 %
12989 % But this might be overruled with a later loading of the package
12990 % \pkg{fontenc}. Therefore we check at the execution of
12991 % |\begin{document}| whether it was loaded with the \Lopt{T1} option.
12992 % The normal way to do this (using |\@ifpackageloaded|) is disabled for
12993 % this package. Now we have to revert to parsing the internal macro
12994 % |\@filelist| which contains all the filenames loaded.
12995 %
12996 % \begin{macrocode}
12997 \AtBeginDocument{%
12998 \@ifpackageloaded{fontspec}%
12999 {\xdef\latinencoding{%
13000 \ifx\UTFencname\@undefined
13001 EU\ifcase\bbl@engine\or2\or1\fi
13002 \else
13003 \UTFencname
13004 \fi}}%
13005 {\gdef\latinencoding{OT1}%
13006 \ifx\cf@encoding\bbl@t@one
13007 \xdef\latinencoding{\bbl@t@one}%
13008 \else
13009 \def\@elt#1{,#1,}%
13010 \edef\bbl@tempa{\expandafter\@gobbletwo\@fontenc@load@list}%
13011 \let\@elt\relax
13012 \bbl@xin@{,T1,}\bbl@tempa
13013 \ifin@
13014 \xdef\latinencoding{\bbl@t@one}%
13015 \fi
13016 \fi}}
13017 % \end{macrocode}
13018 %
13019 % \macro{\latintext}
13020 % Then we can define the command |\latintext| which is a declarative
13021 % switch to a latin font-encoding. Usage of this macro is deprecated.
13022 %
13023 % \begin{macrocode}
13024 \DeclareRobustCommand{\latintext}{%
13025 \fontencoding{\latinencoding}\selectfont
13026 \def\encodingdefault{\latinencoding}}
13027 % \end{macrocode}
13028 %
13029 % \macro{\textlatin}
13030 % This command takes an argument which is then typeset using the
13031 % requested font encoding. In order to avoid many encoding switches it
13032 % operates in a local scope.
13033 %
13034 % \begin{macrocode}
13035 \ifx\@undefined\DeclareTextFontCommand
13036 \DeclareRobustCommand{\textlatin}[1]{\leavevmode{\latintext #1}}
13037 \else
13038 \DeclareTextFontCommand{\textlatin}{\latintext}
13039 \fi
13040 % \end{macrocode}
13041 %
13042 % For several functions, we need to execute some code with
13043 % |\selectfont|. With \LaTeX\ 2021-06-01, there is a hook for this
13044 % purpose.
13045 %
13046 % \begin{macrocode}
13047 \def\bbl@patchfont#1{\AddToHook{selectfont}{#1}}
13048 % \end{macrocode}
13049 %
13050 % \subsection{Basic bidi support}
13051 %
13052 % This code is currently placed here for
13053 % practical reasons. It will be moved to the correct place soon, I
13054 % hope.
13055 %
13056 % It is loosely based on |rlbabel.def|, but most of it has been
13057 % developed from scratch. This \babel{} module (by Johannes Braams and
13058 % Boris Lavva) has served the purpose of typesetting R documents for
13059 % two decades, and despite its flaws I think it is still a good starting
13060 % point (some parts have been copied here almost verbatim), partly
13061 % thanks to its simplicity. I've also looked at \textsc{arabi} (by
13062 % Youssef Jabri), which is compatible with \babel{}.
13063 %
13064 % There are two ways of modifying macros to make them “bidi”, namely,
13065 % by patching the internal low-level macros (which is what I have done
13066 % with lists, columns, counters, tocs, much like |rlbabel| did), and
13067 % by introducing a “middle layer” just below the user interface
13068 % (sectioning, footnotes).
13069 %
13070 % \begin{itemize}
13071 % \item pdftex provides a minimal support for bidi text, and it
13072 % must be done by hand. Vertical typesetting is not possible.
13073 % \item \xetex{} is somewhat better, thanks to its font engine
13074 % (even if not always reliable) and a few additional tools. However,
13075 % very little is done at the paragraph level. Another challenging
13076 % problem is text direction does not honour \TeX{} grouping.
13077 % \item \luatex{} can provide the most complete solution, as we can
13078 % manipulate almost freely the node list, the generated lines,
13079 % and so on, but bidi text does not work out of the box and some
13080 % development is necessary. It also provides tools to properly
13081 % set left-to-right and right-to-left page layouts. As Lua\TeX-ja
13082 % shows, vertical typesetting is possible, too.
13083 % \end{itemize}
13084 %
13085 % \begin{macrocode}
13086 \bbl@trace{Loading basic (internal) bidi support}
13087 \ifodd\bbl@engine
13088 \else % Any xe+lua bidi
13089 \ifnum\bbl@bidimode>100 \ifnum\bbl@bidimode<200
13090 \bbl@error{bidi-only-lua}{}{}{}%
13091 \let\bbl@beforeforeign\leavevmode
13092 \AtEndOfPackage{%
13093 \EnableBabelHook{babel-bidi}%
13094 \bbl@xebidipar}
13095 \fi\fi
13096 \def\bbl@loadxebidi#1{%
13097 \ifx\RTLfootnotetext\@undefined
13098 \AtEndOfPackage{%
13099 \EnableBabelHook{babel-bidi}%
13100 \ifx\fontspec\@undefined
13101 \usepackage{fontspec}% bidi needs fontspec
13102 \fi
13103 \usepackage#1{bidi}%
13104 \let\bbl@digitsdotdash\DigitsDotDashInterCharToks
13105 \def\DigitsDotDashInterCharToks{% See the 'bidi' package
13106 \ifnum\@nameuse{bbl@wdir@\languagename}=\tw@ % 'AL' bidi
13107 \bbl@digitsdotdash % So ignore in 'R' bidi
13108 \fi}}%
13109 \fi}
13110 \ifnum\bbl@bidimode>200 % Any xe bidi=
13111 \ifcase\expandafter\@gobbletwo\the\bbl@bidimode\or
13112 \bbl@tentative{bidi=bidi}
13113 \bbl@loadxebidi{}
13114 \or
13115 \bbl@loadxebidi{[rldocument]}
13116 \or
13117 \bbl@loadxebidi{}
13118 \fi
13119 \fi
13120 \fi
13121 \ifnum\bbl@bidimode=\@ne % bidi=default
13122 \let\bbl@beforeforeign\leavevmode
13123 \ifodd\bbl@engine % lua
13124 \newattribute\bbl@attr@dir
13125 \directlua{ Babel.attr_dir = luatexbase.registernumber'bbl@attr@dir' }
13126 \bbl@exp{\output{\bodydir\pagedir\the\output}}
13127 \fi
13128 \AtEndOfPackage{%
13129 \EnableBabelHook{babel-bidi}% pdf/lua/xe
13130 \ifodd\bbl@engine\else % pdf/xe
13131 \bbl@xebidipar
13132 \fi}
13133 \fi
13134 % \end{macrocode}
13135 %
13136 % Now come the macros used to set the direction when a language is
13137 % switched. Testing are based on script names, because it’s the user
13138 % interface (including |language| and |script| in |\babelprovide|.
13139 % First the (mostly) common macros.
13140 %
13141 % \begin{macrocode}
13142 \bbl@trace{Macros to switch the text direction}
13143 \def\bbl@alscripts{%
13144 ,Arabic,Syriac,Thaana,Hanifi Rohingya,Hanifi,Sogdian,}
13145 \def\bbl@rscripts{%
13146 Adlam,Avestan,Chorasmian,Cypriot,Elymaic,Garay,%
13147 Hatran,Hebrew,Imperial Aramaic,Inscriptional Pahlavi,%
13148 Inscriptional Parthian,Kharoshthi,Lydian,Mandaic,Manichaean,%
13149 Mende Kikakui,Meroitic Cursive,Meroitic Hieroglyphs,Nabataean,%
13150 Nko,Old Hungarian,Old North Arabian,Old Sogdian,%
13151 Old South Arabian,Old Turkic,Old Uyghur,Palmyrene,Phoenician,%
13152 Psalter Pahlavi,Samaritan,Yezidi,Mandaean,%
13153 Meroitic,N'Ko,Orkhon,Todhri}
13154 %
13155 \def\bbl@provide@dirs#1{%
13156 \bbl@xin@{\csname bbl@sname@#1\endcsname}{\bbl@alscripts\bbl@rscripts}%
13157 \ifin@
13158 \global\bbl@csarg\chardef{wdir@#1}\@ne
13159 \bbl@xin@{\csname bbl@sname@#1\endcsname}{\bbl@alscripts}%
13160 \ifin@
13161 \global\bbl@csarg\chardef{wdir@#1}\tw@
13162 \fi
13163 \else
13164 \global\bbl@csarg\chardef{wdir@#1}\z@
13165 \fi
13166 \ifodd\bbl@engine
13167 \bbl@csarg\ifcase{wdir@#1}%
13168 \directlua{ Babel.locale_props[\the\localeid].textdir = 'l' }%
13169 \or
13170 \directlua{ Babel.locale_props[\the\localeid].textdir = 'r' }%
13171 \or
13172 \directlua{ Babel.locale_props[\the\localeid].textdir = 'al' }%
13173 \fi
13174 \fi}
13175 %
13176 \def\bbl@switchdir{%
13177 \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}%
13178 \bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}%
13179 \bbl@exp{\\\bbl@setdirs\bbl@cl{wdir}}}
13180 \def\bbl@setdirs#1{%
13181 \ifcase\bbl@select@type
13182 \bbl@bodydir{#1}%
13183 \bbl@pardir{#1}% <- Must precede \bbl@textdir
13184 \fi
13185 \bbl@textdir{#1}}
13186 \ifnum\bbl@bidimode>\z@
13187 \AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir}
13188 \DisableBabelHook{babel-bidi}
13189 \fi
13190 % \end{macrocode}
13191 %
13192 % Now the engine-dependent macros.
13193 %
13194 % \begin{macrocode}
13195 \ifodd\bbl@engine % luatex=1
13196 \else % pdftex=0, xetex=2
13197 \newcount\bbl@dirlevel
13198 \chardef\bbl@thetextdir\z@
13199 \chardef\bbl@thepardir\z@
13200 \def\bbl@textdir#1{%
13201 \ifcase#1\relax
13202 \chardef\bbl@thetextdir\z@
13203 \@nameuse{setlatin}%
13204 \bbl@textdir@i\beginL\endL
13205 \else
13206 \chardef\bbl@thetextdir\@ne
13207 \@nameuse{setnonlatin}%
13208 \bbl@textdir@i\beginR\endR
13209 \fi}
13210 \def\bbl@textdir@i#1#2{%
13211 \ifhmode
13212 \ifnum\currentgrouplevel>\z@
13213 \ifnum\currentgrouplevel=\bbl@dirlevel
13214 \bbl@error{multiple-bidi}{}{}{}%
13215 \bgroup\aftergroup#2\aftergroup\egroup
13216 \else
13217 \ifcase\currentgrouptype\or % 0 bottom
13218 \aftergroup#2% 1 simple {}
13219 \or
13220 \bgroup\aftergroup#2\aftergroup\egroup % 2 hbox
13221 \or
13222 \bgroup\aftergroup#2\aftergroup\egroup % 3 adj hbox
13223 \or\or\or % vbox vtop align
13224 \or
13225 \bgroup\aftergroup#2\aftergroup\egroup % 7 noalign
13226 \or\or\or\or\or\or % output math disc insert vcent mathchoice
13227 \or
13228 \aftergroup#2% 14 \begingroup
13229 \else
13230 \bgroup\aftergroup#2\aftergroup\egroup % 15 adj
13231 \fi
13232 \fi
13233 \bbl@dirlevel\currentgrouplevel
13234 \fi
13235 #1%
13236 \fi}
13237 \def\bbl@pardir#1{\chardef\bbl@thepardir#1\relax}
13238 \let\bbl@bodydir\@gobble
13239 \def\bbl@dirparastext{\chardef\bbl@thepardir\bbl@thetextdir}
13240 % \end{macrocode}
13241 %
13242 % The following command is executed only if there is a right-to-left
13243 % script (once). It activates the |\everypar| hack for \xetex, to
13244 % properly handle the par direction. Note text and par dirs are
13245 % decoupled to some extent (although not completely).
13246 %
13247 % \begin{macrocode}
13248 \def\bbl@xebidipar{%
13249 \let\bbl@xebidipar\relax
13250 \TeXXeTstate\@ne
13251 \def\bbl@xeeverypar{%
13252 \ifcase\bbl@thepardir
13253 \ifcase\bbl@thetextdir\else\beginR\fi
13254 \else
13255 {\setbox\z@\lastbox\beginR\box\z@}%
13256 \fi}%
13257 \AddToHook{para/begin}{\bbl@xeeverypar}}
13258 \ifnum\bbl@bidimode>200 % Any xe bidi=
13259 \let\bbl@textdir@i\@gobbletwo
13260 \let\bbl@xebidipar\@empty
13261 \AddBabelHook{bidi}{foreign}{%
13262 \ifcase\bbl@thetextdir
13263 \BabelWrapText{\LR{##1}}%
13264 \else
13265 \BabelWrapText{\RL{##1}}%
13266 \fi}
13267 \def\bbl@pardir#1{\ifcase#1\relax\setLR\else\setRL\fi}
13268 \fi
13269 \fi
13270 % \end{macrocode}
13271 %
13272 % A tool for weak L (mainly digits). We also disable warnings with
13273 % \textsf{hyperref}.
13274 %
13275 % \begin{macrocode}
13276 \DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl@textdir\z@#1}}
13277 \AtBeginDocument{%
13278 \ifx\pdfstringdefDisableCommands\@undefined\else
13279 \ifx\pdfstringdefDisableCommands\relax\else
13280 \pdfstringdefDisableCommands{\let\babelsublr\@firstofone}%
13281 \fi
13282 \fi}
13283 % \end{macrocode}
13284 %
13285 % \subsection{Local Language Configuration}
13286 %
13287 % \macro{\loadlocalcfg}
13288 %
13289 % At some sites it may be necessary to add site-specific actions to
13290 % a language definition file. This can be done by creating a file
13291 % with the same name as the language definition file, but with the
13292 % extension \file{.cfg}. For instance the file \file{norsk.cfg}
13293 % will be loaded when the language definition file \file{norsk.ldf}
13294 % is loaded.
13295 %
13296 % For plain-based formats we don't want to override the definition
13297 % of |\loadlocalcfg| from \file{plain.def}.
13298 %
13299 % \begin{macrocode}
13300 \bbl@trace{Local Language Configuration}
13301 \ifx\loadlocalcfg\@undefined
13302 \@ifpackagewith{babel}{noconfigs}%
13303 {\let\loadlocalcfg\@gobble}%
13304 {\def\loadlocalcfg#1{%
13305 \InputIfFileExists{#1.cfg}%
13306 {\typeout{*************************************^^J%
13307 * Local config file #1.cfg used^^J%
13308 *}}%
13309 \@empty}}
13310 \fi
13311 % \end{macrocode}
13312 %
13313 % \subsection{Language options}
13314 %
13315 % Languages are loaded when processing the corresponding option
13316 % \textit{except} if a |main| language has been set. In such a
13317 % case, it is not loaded until all options has been processed.
13318 % The following macro inputs the ldf file and does some additional
13319 % checks (|\input| works, too, but possible errors are not caught).
13320 %
13321 % \begin{macrocode}
13322 \bbl@trace{Language options}
13323 \def\BabelDefinitionFile#1#2#3{}
13324 \let\bbl@afterlang\relax
13325 \let\BabelModifiers\relax
13326 \let\bbl@loaded\@empty
13327 \def\bbl@load@language#1{%
13328 \InputIfFileExists{#1.ldf}%
13329 {\edef\bbl@loaded{\CurrentOption
13330 \ifx\bbl@loaded\@empty\else,\bbl@loaded\fi}%
13331 \expandafter\let\expandafter\bbl@afterlang
13332 \csname\CurrentOption.ldf-h@@k\endcsname
13333 \expandafter\let\expandafter\BabelModifiers
13334 \csname bbl@mod@\CurrentOption\endcsname
13335 \bbl@exp{\\\AtBeginDocument{%
13336 \\\bbl@usehooks@lang{\CurrentOption}{begindocument}{{\CurrentOption}}}}}%
13337 {\bbl@error{unknown-package-option}{}{}{}}}
13338 % \end{macrocode}
13339 %
13340 % Another way to extend the list of `known' options for \babel\ was
13341 % to create the file \file{bblopts.cfg} in which one can add option
13342 % declarations. However, this mechanism is deprecated -- if you
13343 % want an alternative name for a language, just create a new |ldf|
13344 % file loading the actual one. You can also set the name
13345 % of the file with the package option |config=<name>|, which will
13346 % load |<name>.cfg| instead.
13347 %
13348 % If the language as been set as metadata, read the info from the
13349 % corresponding \texttt{ini} file and extract the \babel\ name. Then
13350 % added it as a package option at the end, so that it becomes the main
13351 % language. The behavior of a metatag with a global language option is
13352 % not well defined, so if there is not a |main| option we set here
13353 % explicitly.
13354 %
13355 % Tagging PDF Span elements requires horizontal mode. With
13356 % |DocumentMetada| we also force it with |\foreignlanguage| (this is
13357 % also done in bidi texts).
13358 %
13359 % \begin{macrocode}
13360 \ifx\GetDocumentProperties\@undefined\else
13361 \let\bbl@beforeforeign\leavevmode
13362 \edef\bbl@metalang{\GetDocumentProperties{document/lang}}%
13363 \ifx\bbl@metalang\@empty\else
13364 \begingroup
13365 \expandafter
13366 \bbl@bcplookup\bbl@metalang-\@empty-\@empty-\@empty\@@
13367 \ifx\bbl@bcp\relax
13368 \ifx\bbl@opt@main\@nnil
13369 \bbl@error{no-locale-for-meta}{\bbl@metalang}{}{}%
13370 \fi
13371 \else
13372 \bbl@read@ini{\bbl@bcp}\m@ne
13373 \xdef\bbl@language@opts{\bbl@language@opts,\languagename}%
13374 \ifx\bbl@opt@main\@nnil
13375 \global\let\bbl@opt@main\languagename
13376 \fi
13377 \bbl@info{Passing \languagename\space to babel.\\%
13378 This will be the main language except if\\%
13379 explictly overriden with 'main='.\\%
13380 Reported}%
13381 \fi
13382 \endgroup
13383 \fi
13384 \fi
13385 \ifx\bbl@opt@config\@nnil
13386 \@ifpackagewith{babel}{noconfigs}{}%
13387 {\InputIfFileExists{bblopts.cfg}%
13388 {\bbl@info{Configuration files are deprecated, as\\%
13389 they can break document portability.\\%
13390 Reported}%
13391 \typeout{*************************************^^J%
13392 * Local config file bblopts.cfg used^^J%
13393 *}}%
13394 {}}%
13395 \else
13396 \InputIfFileExists{\bbl@[email protected]}%
13397 {\bbl@info{Configuration files are deprecated, as\\%
13398 they can break document portability.\\%
13399 Reported}%
13400 \typeout{*************************************^^J%
13401 * Local config file \bbl@[email protected] used^^J%
13402 *}}%
13403 {\bbl@error{config-not-found}{}{}{}}%
13404 \fi
13405 % \end{macrocode}
13406 %
13407 % Recognizing global options in packages not having a closed set of
13408 % them is not trivial, as for them to be processed they must be defined
13409 % explicitly. So, package options not yet taken into account and stored
13410 % in |bbl@language@opts| are assumed to be languages. If not declared
13411 % above, the names of the option and the file are the same. We first
13412 % pre-process the class and package options to determine the available
13413 % locales, and which version (\texttt{ldf} or \texttt{ini} will be
13414 % loaded. This is done by first loading the corresponding
13415 % \texttt{babel-}\m{name}\texttt{.tex} file.
13416 %
13417 % The second argument of |\BabelBeforeIni| may content a
13418 % |\BabelDefinitionFile| which defines |\bbl@tempa| and |\bbl@tempb|
13419 % and saves the third argument for the moment of the actual loading. If
13420 % there is no |\BabelDefinitionFile| the last element is usually empty,
13421 % and the \texttt{ini} file is loaded. The values are used to build a
13422 % list in the form ‘main-or-not’ |/| ‘ldf-or-ldfìni-flag’ |//|
13423 % ‘option-name’ |//| ‘bcp-tag’ |/| ‘ldf-name-or-none’. The
13424 % ‘main-or-not’ element is \verb|0| by default and set to \verb|10|
13425 % later if necessary (by prepending \verb|1|). The ‘bcp-tag’ is stored
13426 % here so that the corresponding \textsf{ini} file can be be loaded
13427 % directly (with |@import|).
13428 %
13429 % \begin{macrocode}
13430 \def\BabelBeforeIni#1#2{%
13431 \def\bbl@tempa{\@m}% <- Default if no \BDefFile
13432 \let\bbl@tempb\@empty
13433 #2%
13434 \edef\bbl@toload{%
13435 \ifx\bbl@toload\@empty\else\bbl@toload,\fi
13436 \bbl@toload@last}%
13437 \edef\bbl@toload@last{0/\bbl@tempa//\CurrentOption//#1/\bbl@tempb}}
13438 \def\BabelDefinitionFile#1#2#3{%
13439 \def\bbl@tempa{#1}\def\bbl@tempb{#2}%
13440 \@namedef{bbl@preldf@\CurrentOption}{#3}%
13441 \endinput}%
13442 % \end{macrocode}
13443 %
13444 % For efficiency, first preprocess the class options to remove those
13445 % with |=|, which are becoming increasingly frequent (no language
13446 % should contain this character). Here we use the more robust macro to
13447 % traverse a clist from the \LaTeX3 layer.
13448 %
13449 % \begin{macrocode}
13450 \def\bbl@tempf{,}
13451 \@nameuse{clist_map_inline:Nn}\@raw@classoptionslist{%
13452 \in@{=}{#1}%
13453 \ifin@\else
13454 \edef\bbl@tempf{\bbl@tempf\zap@space#1 \@empty,}%
13455 \fi}
13456 % \end{macrocode}
13457 %
13458 % Store the class/package options in a list. If there is an explicit
13459 % \texttt{main}, it’s placed as the last option. Then loop it to read
13460 % the \texttt{tex} files, which can have a |\BabelDefinitionFile|. If
13461 % there is no \texttt{tex} file, we attempt loading the \textsf{ldf}
13462 % for the option name; if it fails, an error is raised. Note the option
13463 % name is surrounded by |//...//|. Class and package options are
13464 % separated with \texttt{@@}, because errors and info are dealt with in
13465 % different ways. Consecutive identical languages count as one.
13466 %
13467 % \begin{macrocode}
13468 \let\bbl@toload\@empty
13469 \let\bbl@toload@last\@empty
13470 \let\bbl@unkopt\@gobble %% <- Ugly
13471 \edef\bbl@tempc{%
13472 \bbl@tempf,@@,\bbl@language@opts
13473 \ifx\bbl@opt@main\@nnil\else,\bbl@opt@main\fi}
13474 \let\BabelLocalesTentative\bbl@tempc
13475 %
13476 \bbl@foreach\bbl@tempc{%
13477 \in@{@@}{#1}% <- Ugly
13478 \ifin@
13479 \def\bbl@unkopt##1{%
13480 \DeclareOption{##1}{\bbl@error{unknown-package-option}{}{}{}}}%
13481 \else
13482 \def\CurrentOption{#1}%
13483 \bbl@xin@{//#1//}{\bbl@toload@last}% Collapse consecutive
13484 \ifin@\else
13485 \lowercase{\InputIfFileExists{babel-#1.tex}}{}{%
13486 \IfFileExists{#1.ldf}%
13487 {\edef\bbl@toload{%
13488 \ifx\bbl@toload\@empty\else\bbl@toload,\fi
13489 \bbl@toload@last}%
13490 \edef\bbl@toload@last{0/0//\CurrentOption//und/#1}}%
13491 {\bbl@unkopt{#1}}}%
13492 \fi
13493 \fi}
13494 % \end{macrocode}
13495 %
13496 % We have to determine (1) if no language has be loaded (in which case
13497 % we fallback to ‘nil’, with a special tag), and (2) the main language.
13498 % With an explicit ‘main’ language, remove repeated elements.
13499 % The number \texttt{1} flags it as the main language (relevant in
13500 % \textit{ini} locales), because with \texttt{0} becomes \texttt{10}.
13501 %
13502 % \begin{macrocode}
13503 \ifx\bbl@opt@main\@nnil
13504 \ifx\bbl@toload@last\@empty
13505 \def\bbl@toload@last{0/0//nil//und-x-nil/nil}
13506 \bbl@info{%
13507 You haven't specified a language as a class or package\\%
13508 option. I'll load 'nil'. Reported}
13509 \fi
13510 \else
13511 \let\bbl@tempc\@empty
13512 \bbl@foreach\bbl@toload{%
13513 \bbl@xin@{//\bbl@opt@main//}{#1}%
13514 \ifin@\else
13515 \bbl@add@list\bbl@tempc{#1}%
13516 \fi}
13517 \let\bbl@toload\bbl@tempc
13518 \fi
13519 \edef\bbl@toload{\bbl@toload,1\bbl@toload@last}
13520 % \end{macrocode}
13521 %
13522 % Finally, load the `ini` file or the pair `ini`/`ldf` file. \Babel{}
13523 % resorts to its own mechanism, not the default one based on
13524 % |\ProcessOptions| (which is still present to make some internal
13525 % clean-up). First, handle |provide=!| and friends (with a recursive
13526 % call if they are present), and then |provide=*| and friend. |\count@|
13527 % is used as flag: 0 if ‘ini’, 1 if ‘ldf’.
13528
13529 % \begin{macrocode}
13530 \def\AfterBabelLanguage#1{%
13531 \bbl@ifsamestring\CurrentOption{#1}{\global\bbl@add\bbl@afterlang}{}}
13532 \NewHook{babel/presets}
13533 \UseHook{babel/presets}
13534 %
13535 \let\bbl@tempb\@empty
13536 \def\bbl@tempc#1/#2//#3//#4/#5\@@{%
13537 \count@\z@
13538 \ifnum#2=\@m % if no \BabelDefinitionFile
13539 \ifnum#1=\z@ % not main. -- % if provide+=!, provide*=!
13540 \ifnum\bbl@ldfflag>\@ne\bbl@tempc 0/0//#3//#4/#3\@@
13541 \else\bbl@tempd{#1}{#2}{#3}{#4}{#5}%
13542 \fi
13543 \else % 10 = main -- % if provide=!, provide*=!
13544 \ifodd\bbl@ldfflag\bbl@tempc 10/0//#3//#4/#3\@@
13545 \else\bbl@tempd{#1}{#2}{#3}{#4}{#5}%
13546 \fi
13547 \fi
13548 \else
13549 \ifnum#1=\z@ % not main
13550 \ifnum\bbl@iniflag>\@ne\else % if ø, provide
13551 \ifcase#2\count@\@ne\else\ifcase\bbl@engine\count@\@ne\fi\fi
13552 \fi
13553 \else % 10 = main
13554 \ifodd\bbl@iniflag\else % if provide+, provide*
13555 \ifcase#2\count@\@ne\else\ifcase\bbl@engine\count@\@ne\fi\fi
13556 \fi
13557 \fi
13558 \bbl@tempd{#1}{#2}{#3}{#4}{#5}%
13559 \fi}
13560 % \end{macrocode}
13561 %
13562 % Based on the value of |\count@|, do the actual loading. If ‘ldf’,
13563 % we load the basic info from the ‘ini’ file before.
13564 %
13565 % \begin{macrocode}
13566 \def\bbl@tempd#1#2#3#4#5{%
13567 \DeclareOption{#3}{}%
13568 \ifcase\count@
13569 \bbl@exp{\\\bbl@add\\\bbl@tempb{%
13570 \global\let\\\bbl@afterload\\\@empty
13571 \\\@nameuse{bbl@preini@#3}%
13572 \\\bbl@ldfinit
13573 \def\\\CurrentOption{#3}%
13574 \\\babelprovide[@import=#4,\ifnum#1=\z@\else\bbl@opt@provide,main\fi]{#3}%
13575 \\\bbl@afterldf
13576 \\\bbl@afterload}}%
13577 \else
13578 \bbl@add\bbl@tempb{%
13579 \global\let\bbl@afterload\@empty
13580 \def\CurrentOption{#3}%
13581 \let\localename\CurrentOption
13582 \let\languagename\localename
13583 \def\BabelIniTag{#4}%
13584 \@nameuse{bbl@preldf@#3}%
13585 \begingroup
13586 \bbl@id@assign
13587 \bbl@read@ini{\BabelIniTag}0%
13588 \endgroup
13589 \bbl@load@language{#5}%
13590 \bbl@afterload}%
13591 \fi}
13592 %
13593 \bbl@foreach\bbl@toload{\bbl@tempc#1\@@}
13594 \bbl@tempb
13595 \DeclareOption*{}
13596 \ProcessOptions
13597 %
13598 \bbl@exp{%
13599 \\\AtBeginDocument{\\\bbl@usehooks@lang{/}{begindocument}{{}}}}%
13600 \def\AfterBabelLanguage{\bbl@error{late-after-babel}{}{}{}}
13601 %</package>
13602 % \end{macrocode}
13603 %
13604 % \section{The kernel of Babel}
13605 %
13606 % The kernel of the \babel\ system is currently stored in
13607 % \file{babel.def}. The file \file{babel.def} contains most of the
13608 % code. The file \file{hyphen.cfg} is a file that can be loaded into
13609 % the format, which is necessary when you want to be able to switch
13610 % hyphenation patterns.
13611 %
13612 % Because plain \TeX\ users might want to use some of the features of
13613 % the \babel{} system too, care has to be taken that plain \TeX\ can
13614 % process the files. For this reason the current format will have to
13615 % be checked in a number of places. Some of the code below is common
13616 % to plain \TeX\ and \LaTeX, some of it is for the \LaTeX\ case only.
13617 %
13618 % Plain formats based on etex (etex, xetex, luatex) don't load
13619 % |hyphen.cfg| but |etex.src|, which follows a different naming
13620 % convention, so we need to define the \babel{} names. It presumes
13621 % |language.def| exists and it is the same file used when formats were
13622 % created.
13623 %
13624 % A proxy file for switch.def
13625 %
13626 % \begin{macrocode}
13627 %<*kernel>
13628 \let\bbl@onlyswitch\@empty
13629 \input babel.def
13630 \let\bbl@onlyswitch\@undefined
13631 %</kernel>
13632 % \end{macrocode}
13633 %
13634 % \section{Error messages}
13635 %
13636 % They are loaded when |\bll@error| is first called. To save space, the
13637 % main code just identifies them with a tag, and messages are stored in
13638 % a separate file. Since it can be loaded anywhere, you make sure some
13639 % catcodes have the right value, although those for |\|, |`|, |^^M|,
13640 % |%| and |=| are reset before loading the file.
13641 %
13642 % \begin{macrocode}
13643 %<*errors>
13644 \catcode`\{=1 \catcode`\}=2 \catcode`\#=6
13645 \catcode`\:=12 \catcode`\,=12 \catcode`\.=12 \catcode`\-=12
13646 \catcode`\'=12 \catcode`\(=12 \catcode`\)=12
13647 \catcode`\@=11 \catcode`\^=7
13648 %
13649 \ifx\MessageBreak\@undefined
13650 \gdef\bbl@error@i#1#2{%
13651 \begingroup
13652 \newlinechar=`\^^J
13653 \def\\{^^J(babel) }%
13654 \errhelp{#2}\errmessage{\\#1}%
13655 \endgroup}
13656 \else
13657 \gdef\bbl@error@i#1#2{%
13658 \begingroup
13659 \def\\{\MessageBreak}%
13660 \PackageError{babel}{#1}{#2}%
13661 \endgroup}
13662 \fi
13663 \def\bbl@errmessage#1#2#3{%
13664 \expandafter\gdef\csname bbl@err@#1\endcsname##1##2##3{%
13665 \bbl@error@i{#2}{#3}}}
13666 % Implicit #2#3#4:
13667 \gdef\bbl@error#1{\csname bbl@err@#1\endcsname}
13668 %
13669 \bbl@errmessage{not-yet-available}
13670 {Not yet available}%
13671 {Find an armchair, sit down and wait}
13672 \bbl@errmessage{bad-package-option}%
13673 {Bad option '#1=#2'. Either you have misspelled the\\%
13674 key or there is a previous setting of '#1'. Valid\\%
13675 keys are, among others, 'shorthands', 'main', 'bidi',\\%
13676 'strings', 'config', 'headfoot', 'safe', 'math'.}%
13677 {See the manual for further details.}
13678 \bbl@errmessage{base-on-the-fly}
13679 {For a language to be defined on the fly 'base'\\%
13680 is not enough, and the whole package must be\\%
13681 loaded. Either delete the 'base' option or\\%
13682 request the languages explicitly}%
13683 {See the manual for further details.}
13684 \bbl@errmessage{undefined-language}
13685 {You haven't defined the language '#1' yet.\\%
13686 Perhaps you misspelled it or your installation\\%
13687 is not complete}%
13688 {Your command will be ignored, type <return> to proceed}
13689 \bbl@errmessage{invalid-ini-name}
13690 {'#1' not valid with the 'ini' mechanism.\\%
13691 I think you want '#2' instead. You may continue,\\%
13692 but you should fix the name. See the babel manual\\%
13693 for the available locales with 'provide'}%
13694 {See the manual for further details.}
13695 \bbl@errmessage{shorthand-is-off}
13696 {I can't declare a shorthand turned off (\string#2)}
13697 {Sorry, but you can't use shorthands which have been\\%
13698 turned off in the package options}
13699 \bbl@errmessage{not-a-shorthand}
13700 {The character '\string #1' should be made a shorthand character;\\%
13701 add the command \string\useshorthands\string{#1\string} to
13702 the preamble.\\%
13703 I will ignore your instruction}%
13704 {You may proceed, but expect unexpected results}
13705 \bbl@errmessage{not-a-shorthand-b}
13706 {I can't switch '\string#2' on or off--not a shorthand\\%
13707 This character is not a shorthand. Maybe you made\\%
13708 a typing mistake?}%
13709 {I will ignore your instruction.}
13710 \bbl@errmessage{unknown-attribute}
13711 {The attribute #2 is unknown for language #1.}%
13712 {Your command will be ignored, type <return> to proceed}
13713 \bbl@errmessage{missing-group}
13714 {Missing group for string \string#1}%
13715 {You must assign strings to some category, typically\\%
13716 captions or extras, but you set none}
13717 \bbl@errmessage{only-lua-xe}
13718 {This macro is available only in LuaLaTeX and XeLaTeX.}%
13719 {Consider switching to these engines.}
13720 \bbl@errmessage{only-lua}
13721 {This macro is available only in LuaLaTeX}%
13722 {Consider switching to that engine.}
13723 \bbl@errmessage{unknown-provide-key}
13724 {Unknown key '#1' in \string\babelprovide}%
13725 {See the manual for valid keys}%
13726 \bbl@errmessage{unknown-mapfont}
13727 {Option '\bbl@KVP@mapfont' unknown for\\%
13728 mapfont. Use 'direction'}%
13729 {See the manual for details.}
13730 \bbl@errmessage{no-ini-file}
13731 {There is no ini file for the requested language\\%
13732 (#1: \languagename). Perhaps you misspelled it or your\\%
13733 installation is not complete}%
13734 {Fix the name or reinstall babel.}
13735 \bbl@errmessage{digits-is-reserved}
13736 {The counter name 'digits' is reserved for mapping\\%
13737 decimal digits}%
13738 {Use another name.}
13739 \bbl@errmessage{limit-two-digits}
13740 {Currently two-digit years are restricted to the\\
13741 range 0-9999}%
13742 {There is little you can do. Sorry.}
13743 \bbl@errmessage{alphabetic-too-large}
13744 {Alphabetic numeral too large (#1)}%
13745 {Currently this is the limit.}
13746 \bbl@errmessage{no-ini-info}
13747 {I've found no info for the current locale.\\%
13748 The corresponding ini file has not been loaded\\%
13749 Perhaps it doesn't exist}%
13750 {See the manual for details.}
13751 \bbl@errmessage{unknown-ini-field}
13752 {Unknown field '#1' in \string\BCPdata.\\%
13753 Perhaps you misspelled it}%
13754 {See the manual for details.}
13755 \bbl@errmessage{unknown-locale-key}
13756 {Unknown key for locale '#2':\\%
13757 #3\\%
13758 \string#1 will be set to \string\relax}%
13759 {Perhaps you misspelled it.}%
13760 \bbl@errmessage{adjust-only-vertical}
13761 {Currently, #1 related features can be adjusted only\\%
13762 in the main vertical list}%
13763 {Maybe things change in the future, but this is what it is.}
13764 \bbl@errmessage{layout-only-vertical}
13765 {Currently, layout related features can be adjusted only\\%
13766 in vertical mode}%
13767 {Maybe things change in the future, but this is what it is.}
13768 \bbl@errmessage{bidi-only-lua}
13769 {The bidi method 'basic' is available only in\\%
13770 luatex. I'll continue with 'bidi=default', so\\%
13771 expect wrong results.\\%
13772 Suggested actions:\\%
13773 * If possible, switch to luatex, as xetex is not\\%
13774 recommend anymore.\\
13775 * If you can’t, try 'bidi=bidi' with xetex.\\%
13776 * With pdftex, only 'bidi=default' is available.}%
13777 {See the manual for further details.}
13778 \bbl@errmessage{multiple-bidi}
13779 {Multiple bidi settings inside a group\\%
13780 I'll insert a new group, but expect wrong results.\\%
13781 Suggested action:\\%
13782 * Add a new group where appropriate.}
13783 {See the manual for further details.}
13784 \bbl@errmessage{unknown-package-option}
13785 {Unknown option '\CurrentOption'.\\%
13786 Suggested actions:\\%
13787 * Make sure you haven’t misspelled it\\%
13788 * Check in the babel manual that it's supported\\%
13789 * If supported and it's a language, you may\\%
13790 \space\space need in some distributions a separate\\%
13791 \space\space installation\\%
13792 * If installed, check there isn’t an old\\%
13793 \space\space version of the required files in your system\\%
13794 * If it's an unsupported language, create it with\\%
13795 \string\babelprovide (see the manual)}
13796 {Valid options are, among others: shorthands=, KeepShorthandsActive,\\%
13797 activeacute, activegrave, noconfigs, safe=, main=, math=\\%
13798 headfoot=, strings=, config=, hyphenmap=, or a language name.}
13799 \bbl@errmessage{config-not-found}
13800 {Local config file '\bbl@[email protected]' not found.\\%
13801 Suggested actions:\\%
13802 * Make sure you haven’t misspelled it in config=\\%
13803 * Check it exists and it’s in the correct path}%
13804 {Perhaps you misspelled it.}
13805 \bbl@errmessage{late-after-babel}
13806 {Too late for \string\AfterBabelLanguage}%
13807 {Languages have been loaded, so I can do nothing}
13808 \bbl@errmessage{double-hyphens-class}
13809 {Double hyphens aren't allowed in \string\babelcharclass\\%
13810 because it's potentially ambiguous}%
13811 {See the manual for further info}
13812 \bbl@errmessage{unknown-interchar}
13813 {'#1' for '\languagename' cannot be enabled.\\%
13814 Maybe there is a typo}%
13815 {See the manual for further details.}
13816 \bbl@errmessage{unknown-interchar-b}
13817 {'#1' for '\languagename' cannot be disabled.\\%
13818 Maybe there is a typo}%
13819 {See the manual for further details.}
13820 \bbl@errmessage{charproperty-only-vertical}
13821 {\string\babelcharproperty\space can be used only in\\%
13822 vertical mode (preamble or between paragraphs)}%
13823 {See the manual for further info}
13824 \bbl@errmessage{unknown-char-property}
13825 {No property named '#2'. Allowed values are\\%
13826 direction (bc), mirror (bmg), and linebreak (lb)}%
13827 {See the manual for further info}
13828 \bbl@errmessage{bad-transform-option}
13829 {Bad option '#1' in a transform.\\%
13830 I’ll ignore it but expect more errors}%
13831 {See the manual for further info.}
13832 \bbl@errmessage{font-conflict-transforms}
13833 {Transforms cannot be re-assigned to different\\%
13834 fonts. The conflict is in '\bbl@kv@label'.\\%
13835 Apply the same fonts or use a different label}%
13836 {See the manual for further details.}
13837 \bbl@errmessage{transform-not-available}
13838 {'#1' for '\languagename' cannot be enabled.\\%
13839 Maybe there is a typo or it’s a font-dependent transform}%
13840 {See the manual for further details.}
13841 \bbl@errmessage{transform-not-available-b}
13842 {'#1' for '\languagename' cannot be disabled.\\%
13843 Maybe there is a typo or it’s a font-dependent transform}%
13844 {See the manual for further details.}
13845 \bbl@errmessage{year-out-range}
13846 {Year out of range.\\%
13847 The allowed range is #1}%
13848 {See the manual for further details.}
13849 \bbl@errmessage{only-pdftex-lang}
13850 {The '#1' ldf style doesn't work with #2,\\%
13851 but you can use the ini locale instead.\\%
13852 Try adding 'provide=*' to the option list. You may\\%
13853 also want to set 'bidi=' to some value}%
13854 {See the manual for further details.}
13855 \bbl@errmessage{hyphenmins-args}
13856 {\string\babelhyphenmins\ accepts either the optional\\%
13857 argument or the star, but not both at the same time}%
13858 {See the manual for further details.}
13859 \bbl@errmessage{no-locale-for-meta}
13860 {There isn't currently a locale for the 'lang' requested\\%
13861 in the PDF metadata ('#1'). To fix it, you can\\%
13862 set explicitly a similar language (using the same\\%
13863 script) with the key main= when loading babel. If you\\%
13864 continue, I'll fallback to the 'nil' language, with\\%
13865 tag 'und' and script 'Latn', but expect a bad font\\%
13866 rendering with other scripts. You may also need set\\%
13867 explicitly captions and date, too}%
13868 {See the manual for further details.}
13869 %</errors>
13870 %<*patterns>
13871 % \end{macrocode}
13872 %
13873 % \section{Loading hyphenation patterns}
13874 %
13875 % The following code is meant to be read by ini\TeX\ because it
13876 % should instruct \TeX\ to read hyphenation patterns. To this end the
13877 % \texttt{docstrip} option \texttt{patterns} is used to include
13878 % this code in the file \file{hyphen.cfg}. Code is written with lower
13879 % level macros.
13880 %
13881 % \begin{macrocode}
13882 <@Make sure ProvidesFile is defined@>
13883 \ProvidesFile{hyphen.cfg}[<@date@> v<@version@> Babel hyphens]
13884 \xdef\bbl@format{\jobname}
13885 \def\bbl@version{<@version@>}
13886 \def\bbl@date{<@date@>}
13887 \ifx\AtBeginDocument\@undefined
13888 \def\@empty{}
13889 \fi
13890 <@Define core switching macros@>
13891 % \end{macrocode}
13892 %
13893 % \macro{\process@line}
13894 % Each line in the file \file{language.dat} is processed by
13895 % |\process@line| after it is read. The first thing this macro does is
13896 % to check whether the line starts with \texttt{=}. When the first
13897 % token of a line is an \texttt{=}, the macro |\process@synonym| is
13898 % called; otherwise the macro |\process@language| will continue.
13899 %
13900 % \begin{macrocode}
13901 \def\process@line#1#2 #3 #4 {%
13902 \ifx=#1%
13903 \process@synonym{#2}%
13904 \else
13905 \process@language{#1#2}{#3}{#4}%
13906 \fi
13907 \ignorespaces}
13908 % \end{macrocode}
13909 %
13910 % \macro{\process@synonym}
13911 %
13912 % This macro takes care of the lines which start with an
13913 % \texttt{=}. It needs an empty token register to begin with.
13914 % |\bbl@languages| is also set to empty.
13915 %
13916 % \begin{macrocode}
13917 \toks@{}
13918 \def\bbl@languages{}
13919 % \end{macrocode}
13920 %
13921 % When no languages have been loaded yet, the name following the
13922 % \texttt{=} will be a synonym for hyphenation register 0. So, it is
13923 % stored in a token register and executed when the first pattern file
13924 % has been processed. (The |\relax| just helps to the |\if| below
13925 % catching synonyms without a language.)
13926 %
13927 % Otherwise the name will be a synonym for the language loaded last.
13928 %
13929 % We also need to copy the hyphenmin parameters for the synonym.
13930 %
13931 % \begin{macrocode}
13932 \def\process@synonym#1{%
13933 \ifnum\last@language=\m@ne
13934 \toks@\expandafter{\the\toks@\relax\process@synonym{#1}}%
13935 \else
13936 \expandafter\chardef\csname l@#1\endcsname\last@language
13937 \wlog{\string\l@#1=\string\language\the\last@language}%
13938 \expandafter\let\csname #1hyphenmins\expandafter\endcsname
13939 \csname\languagename hyphenmins\endcsname
13940 \let\bbl@elt\relax
13941 \edef\bbl@languages{\bbl@languages\bbl@elt{#1}{\the\last@language}{}{}}%
13942 \fi}
13943 % \end{macrocode}
13944 %
13945 % \macro{\process@language}
13946 %
13947 % The macro |\process@language| is used to process a non-empty line
13948 % from the `configuration file'. It has three arguments, each
13949 % delimited by white space. The first argument is the `name' of a
13950 % language; the second is the name of the file that contains the
13951 % patterns. The optional third argument is the name of a file
13952 % containing hyphenation exceptions.
13953 %
13954 % The first thing to do is call |\addlanguage| to allocate a pattern
13955 % register and to make that register `active'. Then the pattern file
13956 % is read.
13957 %
13958 % For some hyphenation patterns it is needed to load them with a
13959 % specific font encoding selected. This can be specified in the
13960 % file \file{language.dat} by adding for instance `\texttt{:T1}' to
13961 % the name of the language. The macro |\bbl@get@enc| extracts the
13962 % font encoding from the language name and stores it in
13963 % |\bbl@hyph@enc|. The latter can be used in hyphenation files if
13964 % you need to set a behavior depending on the given encoding (it
13965 % is set to empty if no encoding is given).
13966 %
13967 % Pattern files may contain assignments to |\lefthyphenmin| and
13968 % |\righthyphenmin|. \TeX\ does not keep track of these
13969 % assignments. Therefore we try to detect such assignments and
13970 % store them in the |\|\langvar|hyphenmins| macro. When no
13971 % assignments were made we provide a default setting.
13972 %
13973 % Some pattern files contain changes to the |\lccode| en |\uccode|
13974 % arrays. Such changes should remain local to the language;
13975 % therefore we process the pattern file in a group; the |\patterns|
13976 % command acts globally so its effect will be remembered.
13977 %
13978 % Then we globally store the settings of |\lefthyphenmin| and
13979 % |\righthyphenmin| and close the group.
13980 %
13981 % When the hyphenation patterns have been processed we need to see
13982 % if a file with hyphenation exceptions needs to be read. This is
13983 % the case when the third argument is not empty and when it does
13984 % not contain a space token. (Note however there is no need to save
13985 % hyphenation exceptions into the format.)
13986 %
13987 % \cs{bbl@languages} saves a snapshot of the loaded languages in the
13988 % form \cs{bbl@elt}\marg{language-name}\marg{number}%
13989 % \marg{patterns-file}\marg{exceptions-file}. Note the last 2
13990 % arguments are empty in `dialects' defined in |language.dat| with
13991 % |=|. Note also the language name can have encoding info.
13992 %
13993 % Finally, if the counter |\language| is equal to zero we execute the
13994 % synonyms stored.
13995 %
13996 % \begin{macrocode}
13997 \def\process@language#1#2#3{%
13998 \expandafter\addlanguage\csname l@#1\endcsname
13999 \expandafter\language\csname l@#1\endcsname
14000 \edef\languagename{#1}%
14001 \bbl@hook@everylanguage{#1}%
14002 % > luatex
14003 \bbl@get@enc#1::\@@@
14004 \begingroup
14005 \lefthyphenmin\m@ne
14006 \bbl@hook@loadpatterns{#2}%
14007 % > luatex
14008 \ifnum\lefthyphenmin=\m@ne
14009 \else
14010 \expandafter\xdef\csname #1hyphenmins\endcsname{%
14011 \the\lefthyphenmin\the\righthyphenmin}%
14012 \fi
14013 \endgroup
14014 \def\bbl@tempa{#3}%
14015 \ifx\bbl@tempa\@empty\else
14016 \bbl@hook@loadexceptions{#3}%
14017 % > luatex
14018 \fi
14019 \let\bbl@elt\relax
14020 \edef\bbl@languages{%
14021 \bbl@languages\bbl@elt{#1}{\the\language}{#2}{\bbl@tempa}}%
14022 \ifnum\the\language=\z@
14023 \expandafter\ifx\csname #1hyphenmins\endcsname\relax
14024 \set@hyphenmins\tw@\thr@@\relax
14025 \else
14026 \expandafter\expandafter\expandafter\set@hyphenmins
14027 \csname #1hyphenmins\endcsname
14028 \fi
14029 \the\toks@
14030 \toks@{}%
14031 \fi}
14032 % \end{macrocode}
14033 %
14034 % \macro{\bbl@get@enc}
14035 %
14036 % \macro{\bbl@hyph@enc}
14037 % The macro |\bbl@get@enc| extracts the font encoding from the
14038 % language name and stores it in |\bbl@hyph@enc|. It uses delimited
14039 % arguments to achieve this.
14040 %
14041 % \begin{macrocode}
14042 \def\bbl@get@enc#1:#2:#3\@@@{\def\bbl@hyph@enc{#2}}
14043 % \end{macrocode}
14044 %
14045 % Now, hooks are defined. For efficiency reasons, they are dealt
14046 % here in a special way. Besides \luatex, format-specific
14047 % configuration files are taken into account. |loadkernel| currently
14048 % loads nothing, but define some basic macros instead.
14049 %
14050 % \begin{macrocode}
14051 \def\bbl@hook@everylanguage#1{}
14052 \def\bbl@hook@loadpatterns#1{\input #1\relax}
14053 \let\bbl@hook@loadexceptions\bbl@hook@loadpatterns
14054 \def\bbl@hook@loadkernel#1{%
14055 \def\addlanguage{\csname newlanguage\endcsname}%
14056 \def\adddialect##1##2{%
14057 \global\chardef##1##2\relax
14058 \wlog{\string##1 = a dialect from \string\language##2}}%
14059 \def\iflanguage##1{%
14060 \expandafter\ifx\csname l@##1\endcsname\relax
14061 \@nolanerr{##1}%
14062 \else
14063 \ifnum\csname l@##1\endcsname=\language
14064 \expandafter\expandafter\expandafter\@firstoftwo
14065 \else
14066 \expandafter\expandafter\expandafter\@secondoftwo
14067 \fi
14068 \fi}%
14069 \def\providehyphenmins##1##2{%
14070 \expandafter\ifx\csname ##1hyphenmins\endcsname\relax
14071 \@namedef{##1hyphenmins}{##2}%
14072 \fi}%
14073 \def\set@hyphenmins##1##2{%
14074 \lefthyphenmin##1\relax
14075 \righthyphenmin##2\relax}%
14076 \def\selectlanguage{%
14077 \errhelp{Selecting a language requires a package supporting it}%
14078 \errmessage{No multilingual package has been loaded}}%
14079 \let\foreignlanguage\selectlanguage
14080 \let\otherlanguage\selectlanguage
14081 \expandafter\let\csname otherlanguage*\endcsname\selectlanguage
14082 \def\bbl@usehooks##1##2{}%
14083 \def\setlocale{%
14084 \errhelp{Find an armchair, sit down and wait}%
14085 \errmessage{(babel) Not yet available}}%
14086 \let\uselocale\setlocale
14087 \let\locale\setlocale
14088 \let\selectlocale\setlocale
14089 \let\localename\setlocale
14090 \let\textlocale\setlocale
14091 \let\textlanguage\setlocale
14092 \let\languagetext\setlocale}
14093 \begingroup
14094 \def\AddBabelHook#1#2{%
14095 \expandafter\ifx\csname bbl@hook@#2\endcsname\relax
14096 \def\next{\toks1}%
14097 \else
14098 \def\next{\expandafter\gdef\csname bbl@hook@#2\endcsname####1}%
14099 \fi
14100 \next}
14101 \ifx\directlua\@undefined
14102 \ifx\XeTeXinputencoding\@undefined\else
14103 \input xebabel.def
14104 \fi
14105 \else
14106 \input luababel.def
14107 \fi
14108 \openin1 = babel-\[email protected]
14109 \ifeof1
14110 \else
14111 \input babel-\[email protected]\relax
14112 \fi
14113 \closein1
14114 \endgroup
14115 \bbl@hook@loadkernel{switch.def}
14116 % \end{macrocode}
14117 %
14118 % \macro{\readconfigfile}
14119 % The configuration file can now be opened for reading.
14120 %
14121 % \begin{macrocode}
14122 \openin1 = language.dat
14123 % \end{macrocode}
14124 %
14125 % See if the file exists, if not, use the default hyphenation file
14126 % \file{hyphen.tex}. The user will be informed about this.
14127 %
14128 % \begin{macrocode}
14129 \def\languagename{english}%
14130 \ifeof1
14131 \message{I couldn't find the file language.dat,\space
14132 I will try the file hyphen.tex}
14133 \input hyphen.tex\relax
14134 \chardef\l@english\z@
14135 \else
14136 % \end{macrocode}
14137 %
14138 % Pattern registers are allocated using count register
14139 % |\last@language|. Its initial value is~0. The definition of the
14140 % macro |\newlanguage| is such that it first increments the count
14141 % register and then defines the language. In order to have the
14142 % first patterns loaded in pattern register number~0 we initialize
14143 % |\last@language| with the value~$-1$.
14144 %
14145 % \begin{macrocode}
14146 \last@language\m@ne
14147 % \end{macrocode}
14148 %
14149 % We now read lines from the file until the end is found. While
14150 % reading from the input, it is useful to switch off recognition of
14151 % the end-of-line character. This saves us stripping off spaces from
14152 % the contents of the control sequence.
14153 %
14154 % \begin{macrocode}
14155 \loop
14156 \endlinechar\m@ne
14157 \read1 to \bbl@line
14158 \endlinechar`\^^M
14159 % \end{macrocode}
14160 %
14161 % If the file has reached its end, exit from the loop here. If not,
14162 % empty lines are skipped. Add 3 space characters to the end of
14163 % |\bbl@line|. This is needed to be able to recognize the arguments of
14164 % |\process@line| later on. The default language should be the very
14165 % first one.
14166 %
14167 % \begin{macrocode}
14168 \if T\ifeof1F\fi T\relax
14169 \ifx\bbl@line\@empty\else
14170 \edef\bbl@line{\bbl@line\space\space\space}%
14171 \expandafter\process@line\bbl@line\relax
14172 \fi
14173 \repeat
14174 % \end{macrocode}
14175 %
14176 % Check for the end of the file. We must reverse the test for
14177 % |\ifeof| without |\else|. Then reactivate the default patterns,
14178 % and close the configuration file.
14179 %
14180 % \begin{macrocode}
14181 \begingroup
14182 \def\bbl@elt#1#2#3#4{%
14183 \global\language=#2\relax
14184 \gdef\languagename{#1}%
14185 \def\bbl@elt##1##2##3##4{}}%
14186 \bbl@languages
14187 \endgroup
14188 \fi
14189 \closein1
14190 % \end{macrocode}
14191 %
14192 % We add a message about the fact that \babel{} is loaded in the
14193 % format and with which language patterns to the \cs{everyjob}
14194 % register.
14195 %
14196 % \begin{macrocode}
14197 \if/\the\toks@/\else
14198 \errhelp{language.dat loads no language, only synonyms}
14199 \errmessage{Orphan language synonym}
14200 \fi
14201 % \end{macrocode}
14202 %
14203 % Also remove some macros from memory and raise an error if |\toks@| is
14204 % not empty. Finally load \file{switch.def}, but the latter is not
14205 % required and the line inputting it may be commented out.
14206 %
14207 % \begin{macrocode}
14208 \let\bbl@line\@undefined
14209 \let\process@line\@undefined
14210 \let\process@synonym\@undefined
14211 \let\process@language\@undefined
14212 \let\bbl@get@enc\@undefined
14213 \let\bbl@hyph@enc\@undefined
14214 \let\bbl@tempa\@undefined
14215 \let\bbl@hook@loadkernel\@undefined
14216 \let\bbl@hook@everylanguage\@undefined
14217 \let\bbl@hook@loadpatterns\@undefined
14218 \let\bbl@hook@loadexceptions\@undefined
14219 %</patterns>
14220 % \end{macrocode}
14221 %
14222 % Here the code for ini\TeX\ ends.
14223 %
14224 % \section{\luatex{} + \xetex{}: common stuff}
14225 %
14226 % Add the bidi handler just before luaotfload, which is loaded by default
14227 % by LaTeX. Just in case, consider the possibility it has not been
14228 % loaded. First, a couple of definitions related to bidi (although
14229 % |default| also applies to \pdftex).
14230 %
14231 % \begin{macrocode}
14232 %<<*More package options>>
14233 \chardef\bbl@bidimode\z@
14234 \DeclareOption{bidi=default}{\chardef\bbl@bidimode=\@ne}
14235 \DeclareOption{bidi=basic}{\chardef\bbl@bidimode=101 }
14236 \DeclareOption{bidi=basic-r}{\chardef\bbl@bidimode=102 }
14237 \DeclareOption{bidi=bidi}{\chardef\bbl@bidimode=201 }
14238 \DeclareOption{bidi=bidi-r}{\chardef\bbl@bidimode=202 }
14239 \DeclareOption{bidi=bidi-l}{\chardef\bbl@bidimode=203 }
14240 %<</More package options>>
14241 % \end{macrocode}
14242 %
14243 % \macro{\babelfont}
14244 %
14245 % With explicit languages, we could define the font at once, but we
14246 % don't. Just wait and see if the language is actually activated.
14247 % |bbl@font| replaces hardcoded font names inside |\..family| by the
14248 % corresponding macro |\..default|.
14249 %
14250 % \begin{macrocode}
14251 %<<*Font selection>>
14252 \bbl@trace{Font handling with fontspec}
14253 \AddBabelHook{babel-fontspec}{afterextras}{\bbl@switchfont}
14254 \AddBabelHook{babel-fontspec}{beforestart}{\bbl@ckeckstdfonts}
14255 \DisableBabelHook{babel-fontspec}
14256 \@onlypreamble\babelfont
14257 \ifx\NewDocumentCommand\@undefined\else % Not plain
14258 \NewDocumentCommand\babelfont{O{}mO{}mO{}}{%
14259 \bbl@bblfont@o[#1]{#2}[#3,#5]{#4}}
14260 \fi
14261 \newcommand\bbl@bblfont@o[2][]{% 1=langs/scripts 2=fam
14262 \ifx\fontspec\@undefined
14263 \usepackage{fontspec}%
14264 \fi
14265 \EnableBabelHook{babel-fontspec}%
14266 \edef\bbl@tempa{#1}%
14267 \def\bbl@tempb{#2}% Used by \bbl@bblfont
14268 \bbl@bblfont}
14269 \newcommand\bbl@bblfont[2][]{% 1=features 2=fontname, @font=rm|sf|tt
14270 \bbl@ifunset{\bbl@tempb family}%
14271 {\bbl@providefam{\bbl@tempb}}%
14272 {}%
14273 % For the default font, just in case:
14274 \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}%
14275 \expandafter\bbl@ifblank\expandafter{\bbl@tempa}%
14276 {\bbl@csarg\edef{\bbl@tempb dflt@}{<>{#1}{#2}}% save bbl@rmdflt@
14277 \bbl@exp{%
14278 \let\<bbl@\bbl@tempb dflt@\languagename>\<bbl@\bbl@tempb dflt@>%
14279 \\\bbl@font@set\<bbl@\bbl@tempb dflt@\languagename>%
14280 \<\bbl@tempb default>\<\bbl@tempb family>}}%
14281 {\bbl@foreach\bbl@tempa{% i.e., bbl@rmdflt@lang / *scrt
14282 \bbl@csarg\def{\bbl@tempb dflt@##1}{<>{#1}{#2}}}}}%
14283 % \end{macrocode}
14284 %
14285 % If the family in the previous command does not exist, it must be
14286 % defined. Here is how:
14287 %
14288 % \begin{macrocode}
14289 \def\bbl@providefam#1{%
14290 \bbl@exp{%
14291 \\\newcommand\<#1default>{}% Just define it
14292 \\\bbl@add@list\\\bbl@font@fams{#1}%
14293 \\\NewHook{#1family}%
14294 \\\DeclareRobustCommand\<#1family>{%
14295 \\\not@math@alphabet\<#1family>\relax
14296 % \\\prepare@family@series@update{#1}\<#1default>% TODO. Fails
14297 \\\fontfamily\<#1default>%
14298 \\\UseHook{#1family}%
14299 \\\selectfont}%
14300 \\\DeclareTextFontCommand{\<text#1>}{\<#1family>}}}
14301 % \end{macrocode}
14302 %
14303 % The following macro is activated when the hook |babel-fontspec| is
14304 % enabled. But before, we define a macro for a warning, which sets a
14305 % flag to avoid duplicate them.
14306 %
14307 % \begin{macrocode}
14308 \def\bbl@nostdfont#1{%
14309 \bbl@once{nostdfam-\f@family}%
14310 {\bbl@infowarn{The current font is not a babel standard family:\\%
14311 #1%
14312 \fontname\font\\%
14313 There is nothing intrinsically wrong, and you can\\%,
14314 ignore this message altogether if you do not need\\%
14315 this font. If they are used in the document, be aware\\%
14316 'babel' will not set Script and Language for it, so\\%
14317 you may consider defining a new family with \string\babelfont.\\%
14318 See the manual for further details about \string\babelfont.
14319 Reported}}%
14320 {}}%
14321 \gdef\bbl@switchfont{%
14322 \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}%
14323 \bbl@exp{% e.g., Arabic -> arabic
14324 \lowercase{\edef\\\bbl@tempa{\bbl@cl{sname}}}}%
14325 \bbl@foreach\bbl@font@fams{%
14326 \bbl@ifunset{bbl@##1dflt@\languagename}% (1) language?
14327 {\bbl@ifunset{bbl@##1dflt@*\bbl@tempa}% (2) from script?
14328 {\bbl@ifunset{bbl@##1dflt@}% 2=F - (3) from generic?
14329 {}% 123=F - nothing!
14330 {\bbl@exp{% 3=T - from generic
14331 \global\let\<bbl@##1dflt@\languagename>%
14332 \<bbl@##1dflt@>}}}%
14333 {\bbl@exp{% 2=T - from script
14334 \global\let\<bbl@##1dflt@\languagename>%
14335 \<bbl@##1dflt@*\bbl@tempa>}}}%
14336 {}}% 1=T - language, already defined
14337 \def\bbl@tempa{\bbl@nostdfont{}}%
14338 \bbl@foreach\bbl@font@fams{% don't gather with prev for
14339 \bbl@ifunset{bbl@##1dflt@\languagename}%
14340 {\bbl@cs{famrst@##1}%
14341 \global\bbl@csarg\let{famrst@##1}\relax}%
14342 {\bbl@exp{% order is relevant.
14343 \\\bbl@add\\\originalTeX{%
14344 \\\bbl@font@rst{\bbl@cl{##1dflt}}%
14345 \<##1default>\<##1family>{##1}}%
14346 \\\bbl@font@set\<bbl@##1dflt@\languagename>% the main part!
14347 \<##1default>\<##1family>}}}%
14348 \bbl@ifrestoring{}{\bbl@tempa}}%
14349 % \end{macrocode}
14350 %
14351 % The following is executed at the beginning of the aux file or the
14352 % document to warn about fonts not defined with |\babelfont|.
14353 %
14354 % \begin{macrocode}
14355 \ifx\f@family\@undefined\else % if latex
14356 \ifcase\bbl@engine % if pdftex
14357 \let\bbl@ckeckstdfonts\relax
14358 \else
14359 \def\bbl@ckeckstdfonts{%
14360 \begingroup
14361 \global\let\bbl@ckeckstdfonts\relax
14362 \let\bbl@tempa\@empty
14363 \bbl@foreach\bbl@font@fams{%
14364 \bbl@ifunset{bbl@##1dflt@}%
14365 {\@nameuse{##1family}%
14366 \bbl@csarg\gdef{WFF@\f@family}{}% Flag
14367 \bbl@exp{\\\bbl@add\\\bbl@tempa{* \<##1family>= \f@family\\\\%
14368 \space\space\fontname\font\\\\}}%
14369 \bbl@csarg\xdef{##1dflt@}{\f@family}%
14370 \expandafter\xdef\csname ##1default\endcsname{\f@family}}%
14371 {}}%
14372 \ifx\bbl@tempa\@empty\else
14373 \bbl@infowarn{The following font families will use the default\\%
14374 settings for all or some languages:\\%
14375 \bbl@tempa
14376 There is nothing intrinsically wrong with it, but\\%
14377 'babel' will no set Script and Language, which could\\%
14378 be relevant in some languages. If your document uses\\%
14379 these families, consider redefining them with \string\babelfont.\\%
14380 Reported}%
14381 \fi
14382 \endgroup}
14383 \fi
14384 \fi
14385 % \end{macrocode}
14386 %
14387 % Now the macros defining the font with \textsf{fontspec}.
14388 %
14389 % When there are repeated keys in \textsf{fontspec}, the last value
14390 % wins. So, we just place the ini settings at the beginning, and user
14391 % settings will take precedence. We must deactivate temporarily
14392 % |\bbl@mapselect| because |\selectfont| is called internally when a
14393 % font is defined.
14394 %
14395 % For historical reasons, \LaTeX{} can select two different series
14396 % (|bx| and |b|), for what is conceptually a single one. This can
14397 % lead to problems when a single family requires several fonts,
14398 % depending on the language, mainly because ‘substitutions’ with some
14399 % combinations are not done consistently -- sometimes |bx/sc| is the
14400 % correct font, but sometimes points to |b/n|, even if |b/sc| exists.
14401 % So, some substitutions are redefined (in a somewhat hackish way, by
14402 % inspecting if the variant declaration contains |>ssub*|).
14403 %
14404 % \begin{macrocode}
14405 \def\bbl@font@set#1#2#3{% e.g., \bbl@rmdflt@lang \rmdefault \rmfamily
14406 \bbl@xin@{<>}{#1}%
14407 \ifin@
14408 \bbl@exp{\\\bbl@fontspec@set\\#1\expandafter\@gobbletwo#1\\#3}%
14409 \fi
14410 \bbl@exp{% 'Unprotected' macros return prev values
14411 \def\\#2{#1}% e.g., \rmdefault{\bbl@rmdflt@lang}
14412 \\\bbl@ifsamestring{#2}{\f@family}%
14413 {\\#3%
14414 \\\bbl@ifsamestring{\f@series}{\bfdefault}{\\\bfseries}{}%
14415 \let\\\bbl@tempa\relax}%
14416 {}}}
14417 % \end{macrocode}
14418 %
14419 % Loaded locally, which does its job, but very must be global. The
14420 % problem is how. This actually defines a font predeclared with
14421 % |\babelfont|, making sure |Script| and |Language| names are defined.
14422 % If they are not, the corresponding data in the ini file is used. The
14423 % font is actually set temporarily to get the family name
14424 % (|\f@family|). There is also a hack because by default some
14425 % replacements related to the bold series are sometimes assigned to the
14426 % wrong font (see issue \#92).
14427 %
14428 % \begin{macrocode}
14429 \def\bbl@fontspec@set#1#2#3#4{% eg \bbl@rmdflt@lang fnt-opt fnt-nme \xxfamily
14430 \let\bbl@tempe\bbl@mapselect
14431 \edef\bbl@tempb{\bbl@stripslash#4/}% Catcodes hack (better pass it).
14432 \bbl@exp{\\\bbl@replace\\\bbl@tempb{\bbl@stripslash\family/}{}}%
14433 \let\bbl@mapselect\relax
14434 \let\bbl@temp@fam#4% e.g., '\rmfamily', to be restored below
14435 \let#4\@empty % Make sure \renewfontfamily is valid
14436 \bbl@set@renderer
14437 \bbl@exp{%
14438 \let\\\bbl@temp@pfam\<\bbl@stripslash#4\space>% e.g., '\rmfamily '
14439 \<keys_if_exist:nnF>{fontspec-opentype}{Script/\bbl@cl{sname}}%
14440 {\\\newfontscript{\bbl@cl{sname}}{\bbl@cl{sotf}}}%
14441 \<keys_if_exist:nnF>{fontspec-opentype}{Language/\bbl@cl{lname}}%
14442 {\\\newfontlanguage{\bbl@cl{lname}}{\bbl@cl{lotf}}}%
14443 \\\renewfontfamily\\#4%
14444 [\bbl@cl{lsys},% xetex removes unknown features :-(
14445 \ifcase\bbl@engine\or RawFeature={family=\bbl@tempb},\fi
14446 #2]}{#3}% i.e., \bbl@exp{..}{#3}
14447 \bbl@unset@renderer
14448 \begingroup
14449 #4%
14450 \xdef#1{\f@family}% e.g., \bbl@rmdflt@lang{FreeSerif(0)}
14451 \endgroup
14452 \bbl@xin@{\string>\string s\string s\string u\string b\string*}%
14453 {\expandafter\meaning\csname TU/#1/bx/sc\endcsname}%
14454 \ifin@
14455 \global\bbl@ccarg\let{TU/#1/bx/sc}{TU/#1/b/sc}%
14456 \fi
14457 \bbl@xin@{\string>\string s\string s\string u\string b\string*}%
14458 {\expandafter\meaning\csname TU/#1/bx/scit\endcsname}%
14459 \ifin@
14460 \global\bbl@ccarg\let{TU/#1/bx/scit}{TU/#1/b/scit}%
14461 \fi
14462 \let#4\bbl@temp@fam
14463 \bbl@exp{\let\<\bbl@stripslash#4\space>}\bbl@temp@pfam
14464 \let\bbl@mapselect\bbl@tempe}%
14465 % \end{macrocode}
14466 %
14467 % |font@rst| and |famrst| are only used when there is no global
14468 % settings, to save and restore de previous families. Not really
14469 % necessary, but done for optimization.
14470 %
14471 % \begin{macrocode}
14472 \def\bbl@font@rst#1#2#3#4{%
14473 \bbl@csarg\def{famrst@#4}{\bbl@font@set{#1}#2#3}}
14474 % \end{macrocode}
14475 %
14476 % The default font families. They are eurocentric, but the list can be
14477 % expanded easily with |\babelfont|.
14478 %
14479 % \begin{macrocode}
14480 \def\bbl@font@fams{rm,sf,tt}
14481 %<</Font selection>>
14482 % \end{macrocode}
14483 %
14484 % \section{Hooks for XeTeX and LuaTeX}
14485 %
14486 % \subsection{XeTeX}
14487 %
14488 % Unfortunately, the current encoding cannot be retrieved and
14489 % therefore it is reset always to |utf8|, which seems a sensible
14490 % default.
14491 %
14492 % Now, the code.
14493 %
14494 % \begin{macrocode}
14495 %<*xetex>
14496 \def\BabelStringsDefault{unicode}
14497 \let\xebbl@stop\relax
14498 \AddBabelHook{xetex}{encodedcommands}{%
14499 \def\bbl@tempa{#1}%
14500 \ifx\bbl@tempa\@empty
14501 \XeTeXinputencoding"bytes"%
14502 \else
14503 \XeTeXinputencoding"#1"%
14504 \fi
14505 \def\xebbl@stop{\XeTeXinputencoding"utf8"}}
14506 \AddBabelHook{xetex}{stopcommands}{%
14507 \xebbl@stop
14508 \let\xebbl@stop\relax}
14509 \def\bbl@input@classes{% Used in CJK intraspaces
14510 \input{load-unicode-xetex-classes.tex}%
14511 \let\bbl@input@classes\relax}
14512 \def\bbl@intraspace#1 #2 #3\@@{%
14513 \bbl@csarg\gdef{xeisp@\languagename}%
14514 {\XeTeXlinebreakskip #1em plus #2em minus #3em\relax}}
14515 \def\bbl@intrapenalty#1\@@{%
14516 \bbl@csarg\gdef{xeipn@\languagename}%
14517 {\XeTeXlinebreakpenalty #1\relax}}
14518 \def\bbl@provide@intraspace{%
14519 \bbl@xin@{/s}{/\bbl@cl{lnbrk}}%
14520 \ifin@\else\bbl@xin@{/c}{/\bbl@cl{lnbrk}}\fi
14521 \ifin@
14522 \bbl@ifunset{bbl@intsp@\languagename}{}%
14523 {\expandafter\ifx\csname bbl@intsp@\languagename\endcsname\@empty\else
14524 \ifx\bbl@KVP@intraspace\@nnil
14525 \bbl@exp{%
14526 \\\bbl@intraspace\bbl@cl{intsp}\\\@@}%
14527 \fi
14528 \ifx\bbl@KVP@intrapenalty\@nnil
14529 \bbl@intrapenalty0\@@
14530 \fi
14531 \fi
14532 \ifx\bbl@KVP@intraspace\@nnil\else % We may override the ini
14533 \expandafter\bbl@intraspace\bbl@KVP@intraspace\@@
14534 \fi
14535 \ifx\bbl@KVP@intrapenalty\@nnil\else
14536 \expandafter\bbl@intrapenalty\bbl@KVP@intrapenalty\@@
14537 \fi
14538 \bbl@exp{%
14539 \\\bbl@add\<extras\languagename>{%
14540 \XeTeXlinebreaklocale "\bbl@cl{tbcp}"%
14541 \<bbl@xeisp@\languagename>%
14542 \<bbl@xeipn@\languagename>}%
14543 \\\bbl@toglobal\<extras\languagename>%
14544 \\\bbl@add\<noextras\languagename>{%
14545 \XeTeXlinebreaklocale ""}%
14546 \\\bbl@toglobal\<noextras\languagename>}%
14547 \ifx\bbl@ispacesize\@undefined
14548 \gdef\bbl@ispacesize{\bbl@cl{xeisp}}%
14549 \ifx\AtBeginDocument\@notprerr
14550 \expandafter\@secondoftwo % to execute right now
14551 \fi
14552 \AtBeginDocument{\bbl@patchfont{\bbl@ispacesize}}%
14553 \fi}%
14554 \fi}
14555 \ifx\DisableBabelHook\@undefined\endinput\fi
14556 \let\bbl@set@renderer\relax
14557 \let\bbl@unset@renderer\relax
14558 <@Font selection@>
14559 \def\bbl@provide@extra#1{}
14560 % \end{macrocode}
14561 %
14562 % Hack for unhyphenated line breaking. See |\bbl@provide@lsys| in the
14563 % common code.
14564 %
14565 % \begin{macrocode}
14566 \def\bbl@xenohyph@d{%
14567 \bbl@ifset{bbl@prehc@\languagename}%
14568 {\ifnum\hyphenchar\font=\defaulthyphenchar
14569 \iffontchar\font\bbl@cl{prehc}\relax
14570 \hyphenchar\font\bbl@cl{prehc}\relax
14571 \else\iffontchar\font"200B
14572 \hyphenchar\font"200B
14573 \else
14574 \bbl@warning
14575 {Neither 0 nor ZERO WIDTH SPACE are available\\%
14576 in the current font, and therefore the hyphen\\%
14577 will be printed. Try changing the fontspec's\\%
14578 'HyphenChar' to another value, but be aware\\%
14579 this setting is not safe (see the manual).\\%
14580 Reported}%
14581 \hyphenchar\font\defaulthyphenchar
14582 \fi\fi
14583 \fi}%
14584 {\hyphenchar\font\defaulthyphenchar}}
14585 % \end{macrocode}
14586 %
14587 % \subsection{Support for interchar}
14588 %
14589 % \xetex{} reserves some values for CJK (although they are not set in
14590 % \textsc{xelatex}), so we make sure they are skipped. Define some user
14591 % names for the global classes, too.
14592 %
14593 % \begin{macrocode}
14594 \ifnum\xe@alloc@intercharclass<\thr@@
14595 \xe@alloc@intercharclass\thr@@
14596 \fi
14597 \chardef\bbl@xeclass@default@=\z@
14598 \chardef\bbl@xeclass@cjkideogram@=\@ne
14599 \chardef\bbl@xeclass@cjkleftpunctuation@=\tw@
14600 \chardef\bbl@xeclass@cjkrightpunctuation@=\thr@@
14601 \chardef\bbl@xeclass@boundary@=4095
14602 \chardef\bbl@xeclass@ignore@=4096
14603 % \end{macrocode}
14604 %
14605 % The machinery is activated with a hook (enabled only if actually
14606 % used). Here |\bbl@tempc| is pre-set with |\bbl@usingxeclass|, defined
14607 % below. The standard mechanism based on |\originalTeX| to save, set
14608 % and restore values is used. |\count@| stores the previous char to be
14609 % set, except at the beginning (0) and after |\bbl@upto|, which is the
14610 % previous char negated, as a flag to mark a range.
14611 %
14612 % \begin{macrocode}
14613 \AddBabelHook{babel-interchar}{beforeextras}{%
14614 \@nameuse{bbl@xechars@\languagename}}
14615 \DisableBabelHook{babel-interchar}
14616 \protected\def\bbl@charclass#1{%
14617 \ifnum\count@<\z@
14618 \count@-\count@
14619 \loop
14620 \bbl@exp{%
14621 \\\babel@savevariable{\XeTeXcharclass`\Uchar\count@}}%
14622 \XeTeXcharclass\count@ \bbl@tempc
14623 \ifnum\count@<`#1\relax
14624 \advance\count@\@ne
14625 \repeat
14626 \else
14627 \babel@savevariable{\XeTeXcharclass`#1}%
14628 \XeTeXcharclass`#1 \bbl@tempc
14629 \fi
14630 \count@`#1\relax}
14631 % \end{macrocode}
14632 %
14633 % Now the two user macros. Char classes are declared implicitly, and
14634 % then the macro to be executed at the |babel-interchar| hook is
14635 % created. The list of chars to be handled by the hook defined above
14636 % has internally the form
14637 % |\bbl@usingxeclass\bbl@xeclass@punct@english||\bbl@charclass{.}|%
14638 % |\bbl@charclass{,}| (etc.), where |\bbl@usingxeclass| stores the class to be
14639 % applied to the subsequent characters. The \cs{ifcat} part deals with
14640 % the alternative way to enter characters as macros (e.g., |\}|). As a
14641 % special case, hyphens are stored as |\bbl@upto|, to deal with ranges.
14642 %
14643 % \begin{macrocode}
14644 \newcommand\bbl@ifinterchar[1]{%
14645 \let\bbl@tempa\@gobble % Assume to ignore
14646 \edef\bbl@tempb{\zap@space#1 \@empty}%
14647 \ifx\bbl@KVP@interchar\@nnil\else
14648 \bbl@replace\bbl@KVP@interchar{ }{,}%
14649 \bbl@foreach\bbl@tempb{%
14650 \bbl@xin@{,##1,}{,\bbl@KVP@interchar,}%
14651 \ifin@
14652 \let\bbl@tempa\@firstofone
14653 \fi}%
14654 \fi
14655 \bbl@tempa}
14656 \newcommand\IfBabelIntercharT[2]{%
14657 \bbl@carg\bbl@add{bbl@icsave@\CurrentOption}{\bbl@ifinterchar{#1}{#2}}}%
14658 \newcommand\babelcharclass[3]{%
14659 \EnableBabelHook{babel-interchar}%
14660 \bbl@csarg\newXeTeXintercharclass{xeclass@#2@#1}%
14661 \def\bbl@tempb##1{%
14662 \ifx##1\@empty\else
14663 \ifx##1-%
14664 \bbl@upto
14665 \else
14666 \bbl@charclass{%
14667 \ifcat\noexpand##1\relax\bbl@stripslash##1\else\string##1\fi}%
14668 \fi
14669 \expandafter\bbl@tempb
14670 \fi}%
14671 \bbl@ifunset{bbl@xechars@#1}%
14672 {\toks@{%
14673 \babel@savevariable\XeTeXinterchartokenstate
14674 \XeTeXinterchartokenstate\@ne
14675 }}%
14676 {\toks@\expandafter\expandafter\expandafter{%
14677 \csname bbl@xechars@#1\endcsname}}%
14678 \bbl@csarg\edef{xechars@#1}{%
14679 \the\toks@
14680 \bbl@usingxeclass\csname bbl@xeclass@#2@#1\endcsname
14681 \bbl@tempb#3\@empty}}
14682 \protected\def\bbl@usingxeclass#1{\count@\z@ \let\bbl@tempc#1}
14683 \protected\def\bbl@upto{%
14684 \ifnum\count@>\z@
14685 \advance\count@\@ne
14686 \count@-\count@
14687 \else\ifnum\count@=\z@
14688 \bbl@charclass{-}%
14689 \else
14690 \bbl@error{double-hyphens-class}{}{}{}%
14691 \fi\fi}
14692 % \end{macrocode}
14693 %
14694 % And finally, the command with the code to be inserted. If the language
14695 % doesn’t define a class, then use the global one, as defined above.
14696 % For the definition there is a intermediate macro, which can be
14697 % ‘disabled’ with |\bbl@ic@<label>@<language>|.
14698 %
14699 % \begin{macrocode}
14700 \def\bbl@ignoreinterchar{%
14701 \ifnum\language=\l@nohyphenation
14702 \expandafter\@gobble
14703 \else
14704 \expandafter\@firstofone
14705 \fi}
14706 \newcommand\babelinterchar[5][]{%
14707 \let\bbl@kv@label\@empty
14708 \bbl@forkv{#1}{\bbl@csarg\edef{kv@##1}{##2}}%
14709 \@namedef{\zap@space bbl@xeinter@\bbl@kv@label @#3@#4@#2 \@empty}%
14710 {\bbl@ignoreinterchar{#5}}%
14711 \bbl@csarg\let{ic@\bbl@kv@label @#2}\@firstofone
14712 \bbl@exp{\\\bbl@for\\\bbl@tempa{\zap@space#3 \@empty}}{%
14713 \bbl@exp{\\\bbl@for\\\bbl@tempb{\zap@space#4 \@empty}}{%
14714 \XeTeXinterchartoks
14715 \@nameuse{bbl@xeclass@\bbl@tempa @%
14716 \bbl@ifunset{bbl@xeclass@\bbl@tempa @#2}{}{#2}} %
14717 \@nameuse{bbl@xeclass@\bbl@tempb @%
14718 \bbl@ifunset{bbl@xeclass@\bbl@tempb @#2}{}{#2}} %
14719 = \expandafter{%
14720 \csname bbl@ic@\bbl@kv@label @#2\expandafter\endcsname
14721 \csname\zap@space bbl@xeinter@\bbl@kv@label
14722 @#3@#4@#2 \@empty\endcsname}}}}
14723 \DeclareRobustCommand\enablelocaleinterchar[1]{%
14724 \bbl@ifunset{bbl@ic@#1@\languagename}%
14725 {\bbl@error{unknown-interchar}{#1}{}{}}%
14726 {\bbl@csarg\let{ic@#1@\languagename}\@firstofone}}
14727 \DeclareRobustCommand\disablelocaleinterchar[1]{%
14728 \bbl@ifunset{bbl@ic@#1@\languagename}%
14729 {\bbl@error{unknown-interchar-b}{#1}{}{}}%
14730 {\bbl@csarg\let{ic@#1@\languagename}\@gobble}}
14731 %</xetex>
14732 % \end{macrocode}
14733 %
14734 % \subsection{Layout}
14735 %
14736 % Note elements like headlines and margins can be modified easily with
14737 % packages like \textsf{fancyhdr}, \textsf{typearea} or
14738 % \textsf{titleps}, and \textsf{geometry}.
14739 %
14740 % |\bbl@startskip| and |\bbl@endskip| are available to package
14741 % authors. Thanks to the \TeX{} expansion mechanism the following
14742 % constructs are valid: |\adim\bbl@startskip|,
14743 % |\advance\bbl@startskip\adim|, |\bbl@startskip\adim|.
14744 %
14745 % Consider |txtbabel| as a shorthand for \textit{tex--xet babel},
14746 % which is the bidi model in both \pdftex{} and \xetex{}.
14747 %
14748 % \begin{macrocode}
14749 %<*xetex|texxet>
14750 \providecommand\bbl@provide@intraspace{}
14751 \bbl@trace{Redefinitions for bidi layout}
14752 % \end{macrocode}
14753 %
14754 % Finish here if there in no |layout|.
14755 %
14756 % \begin{macrocode}
14757 \ifx\bbl@opt@layout\@nnil\else % if layout=..
14758 \IfBabelLayout{nopars}
14759 {}
14760 {\edef\bbl@opt@layout{\bbl@[email protected].}}%
14761 \def\bbl@startskip{\ifcase\bbl@thepardir\leftskip\else\rightskip\fi}
14762 \def\bbl@endskip{\ifcase\bbl@thepardir\rightskip\else\leftskip\fi}
14763 \ifnum\bbl@bidimode>\z@
14764 \IfBabelLayout{pars}
14765 {\def\@hangfrom#1{%
14766 \setbox\@tempboxa\hbox{{#1}}%
14767 \hangindent\ifcase\bbl@thepardir\wd\@tempboxa\else-\wd\@tempboxa\fi
14768 \noindent\box\@tempboxa}
14769 \def\raggedright{%
14770 \let\\\@centercr
14771 \bbl@startskip\z@skip
14772 \@rightskip\@flushglue
14773 \bbl@endskip\@rightskip
14774 \parindent\z@
14775 \parfillskip\bbl@startskip}
14776 \def\raggedleft{%
14777 \let\\\@centercr
14778 \bbl@startskip\@flushglue
14779 \bbl@endskip\z@skip
14780 \parindent\z@
14781 \parfillskip\bbl@endskip}}
14782 {}
14783 \fi
14784 \IfBabelLayout{lists}
14785 {\bbl@sreplace\list
14786 {\@totalleftmargin\leftmargin}{\@totalleftmargin\bbl@listleftmargin}%
14787 \def\bbl@listleftmargin{%
14788 \ifcase\bbl@thepardir\leftmargin\else\rightmargin\fi}%
14789 \ifcase\bbl@engine
14790 \def\labelenumii{)\theenumii(}% pdftex doesn't reverse ()
14791 \def\p@enumiii{\p@enumii)\theenumii(}%
14792 \fi
14793 \bbl@sreplace\@verbatim
14794 {\leftskip\@totalleftmargin}%
14795 {\bbl@startskip\textwidth
14796 \advance\bbl@startskip-\linewidth}%
14797 \bbl@sreplace\@verbatim
14798 {\rightskip\z@skip}%
14799 {\bbl@endskip\z@skip}}%
14800 {}
14801 \IfBabelLayout{contents}
14802 {\bbl@sreplace\@dottedtocline{\leftskip}{\bbl@startskip}%
14803 \bbl@sreplace\@dottedtocline{\rightskip}{\bbl@endskip}}
14804 {}
14805 \IfBabelLayout{columns}
14806 {\bbl@sreplace\@outputdblcol{\hb@xt@\textwidth}{\bbl@outputhbox}%
14807 \def\bbl@outputhbox#1{%
14808 \hb@xt@\textwidth{%
14809 \hskip\columnwidth
14810 \hfil
14811 {\normalcolor\vrule \@width\columnseprule}%
14812 \hfil
14813 \hb@xt@\columnwidth{\box\@leftcolumn \hss}%
14814 \hskip-\textwidth
14815 \hb@xt@\columnwidth{\box\@outputbox \hss}%
14816 \hskip\columnsep
14817 \hskip\columnwidth}}}%
14818 {}
14819 % \end{macrocode}
14820 %
14821 % Implicitly reverses sectioning labels in |bidi=basic|, because the
14822 % full stop is not in contact with L numbers any more. I think there
14823 % must be a better way.
14824 %
14825 % \begin{macrocode}
14826 \IfBabelLayout{counters*}%
14827 {\bbl@add\bbl@opt@layout{.counters.}%
14828 \AddToHook{shipout/before}{%
14829 \let\bbl@tempa\babelsublr
14830 \let\babelsublr\@firstofone
14831 \let\bbl@save@thepage\thepage
14832 \protected@edef\thepage{\thepage}%
14833 \let\babelsublr\bbl@tempa}%
14834 \AddToHook{shipout/after}{%
14835 \let\thepage\bbl@save@thepage}}{}
14836 \IfBabelLayout{counters}%
14837 {\let\bbl@latinarabic=\@arabic
14838 \def\@arabic#1{\babelsublr{\bbl@latinarabic#1}}%
14839 \let\bbl@asciiroman=\@roman
14840 \def\@roman#1{\babelsublr{\ensureascii{\bbl@asciiroman#1}}}%
14841 \let\bbl@asciiRoman=\@Roman
14842 \def\@Roman#1{\babelsublr{\ensureascii{\bbl@asciiRoman#1}}}}{}
14843 \fi % end if layout
14844 %</xetex|texxet>
14845 % \end{macrocode}
14846 %
14847 % \subsection{8-bit TeX}
14848 %
14849 % Which start just above, because some code is shared with \xetex. Now,
14850 % 8-bit specific stuff. If just one encoding has been declared, then
14851 % assume no switching is necessary (1).
14852 %
14853 % \begin{macrocode}
14854 %<*texxet>
14855 \def\bbl@provide@extra#1{%
14856 % == auto-select encoding ==
14857 \ifx\bbl@encoding@select@off\@empty\else
14858 \bbl@ifunset{bbl@encoding@#1}%
14859 {\def\@elt##1{,##1,}%
14860 \edef\bbl@tempe{\expandafter\@gobbletwo\@fontenc@load@list}%
14861 \count@\z@
14862 \bbl@foreach\bbl@tempe{%
14863 \def\bbl@tempd{##1}% Save last declared
14864 \advance\count@\@ne}%
14865 \ifnum\count@>\@ne % (1)
14866 \getlocaleproperty*\bbl@tempa{#1}{identification/encodings}%
14867 \ifx\bbl@tempa\relax \let\bbl@tempa\@empty \fi
14868 \bbl@replace\bbl@tempa{ }{,}%
14869 \global\bbl@csarg\let{encoding@#1}\@empty
14870 \bbl@xin@{,\bbl@tempd,}{,\bbl@tempa,}%
14871 \ifin@\else % if main encoding included in ini, do nothing
14872 \let\bbl@tempb\relax
14873 \bbl@foreach\bbl@tempa{%
14874 \ifx\bbl@tempb\relax
14875 \bbl@xin@{,##1,}{,\bbl@tempe,}%
14876 \ifin@\def\bbl@tempb{##1}\fi
14877 \fi}%
14878 \ifx\bbl@tempb\relax\else
14879 \bbl@exp{%
14880 \global\<bbl@add>\<bbl@preextras@#1>{\<bbl@encoding@#1>}%
14881 \gdef\<bbl@encoding@#1>{%
14882 \\\babel@save\\\f@encoding
14883 \\\bbl@add\\\originalTeX{\\\selectfont}%
14884 \\\fontencoding{\bbl@tempb}%
14885 \\\selectfont}}%
14886 \fi
14887 \fi
14888 \fi}%
14889 {}%
14890 \fi}
14891 %</texxet>
14892 % \end{macrocode}
14893 %
14894 % \subsection{LuaTeX}
14895 %
14896 % The loader for \luatex{} is based solely on |language.dat|, which
14897 % is read on the fly. The code shouldn't be executed when the format
14898 % is build, so we check if |\AddBabelHook| is defined. Then comes a
14899 % modified version of the loader in |hyphen.cfg| (without the
14900 % hyphenmins stuff, which is under the direct control of \babel).
14901 %
14902 % The names |\l@<language>| are defined and take some value from the
14903 % beginning because all \texttt{ldf} files assume this for the
14904 % corresponding language to be considered valid, but patterns are not
14905 % loaded (except the first one). This is done later, when the language
14906 % is first selected (which usually means when the \texttt{ldf}
14907 % finishes). If a language has been loaded, |\bbl@hyphendata@<num>|
14908 % exists (with the names of the files read).
14909 %
14910 % The default setup preloads the first language into the format. This
14911 % is intended mainly for `english', so that it's available without
14912 % further intervention from the user. To avoid duplicating it, the
14913 % following rule applies: if the “0th” language and the first
14914 % language in |language.dat| have the same name then just ignore the
14915 % latter. If there are new synonymous, the are added, but note if the
14916 % language patterns have not been preloaded they won't at run time.
14917 %
14918 % Other preloaded languages could be read twice, if they have been
14919 % preloaded into the format. This is not optimal, but it shouldn't
14920 % happen very often -- with \luatex{} patterns are best loaded when
14921 % the document is typeset, and the “0th” language is preloaded just
14922 % for backwards compatibility.
14923 %
14924 % As of 1.1b, lua(e)tex is taken into account. Formerly, loading of
14925 % patterns on the fly didn't work in this format, but with the new
14926 % loader it does. Unfortunately, the format is not based on \babel,
14927 % and data could be duplicated, because languages are reassigned above
14928 % those in the format (nothing serious, anyway). Note even with this
14929 % format |language.dat| is used (under the principle of a single
14930 % source), instead of |language.def|.
14931 %
14932 % Of course, there is room for improvements, like tools to read and
14933 % reassign languages, which would require modifying the language list,
14934 % and better error handling.
14935 %
14936 % We need catcode tables, but no format (targeted by \babel) provide a
14937 % command to allocate them (although there are packages like
14938 % \textsf{ctablestack}). FIX - This isn't true anymore. For the moment,
14939 % a dangerous approach is used - just allocate a high random number and
14940 % cross the fingers. To complicate things, \textsf{etex.sty} changes
14941 % the way languages are allocated.
14942 %
14943 % This files is read at three places: (1) when |plain.def|, |babel.sty|
14944 % starts, to read the list of available languages from |language.dat|
14945 % (for the |base| option); (2) at hyphen.cfg, to modify some macros;
14946 % (3) in the middle of |plain.def| and |babel.sty|, by |babel.def|,
14947 % with the commands and other definitions for |luatex| (e.g.,
14948 % |\babelpatterns|).
14949 %
14950 % \begin{macrocode}
14951 %<*luatex>
14952 \directlua{ Babel = Babel or {} } % DL2
14953 \ifx\AddBabelHook\@undefined % When plain.def, babel.sty starts
14954 \bbl@trace{Read language.dat}
14955 \ifx\bbl@readstream\@undefined
14956 \csname newread\endcsname\bbl@readstream
14957 \fi
14958 \begingroup
14959 \toks@{}
14960 \count@\z@ % 0=start, 1=0th, 2=normal
14961 \def\bbl@process@line#1#2 #3 #4 {%
14962 \ifx=#1%
14963 \bbl@process@synonym{#2}%
14964 \else
14965 \bbl@process@language{#1#2}{#3}{#4}%
14966 \fi
14967 \ignorespaces}
14968 \def\bbl@manylang{%
14969 \ifnum\bbl@last>\@ne
14970 \bbl@info{Non-standard hyphenation setup}%
14971 \fi
14972 \let\bbl@manylang\relax}
14973 \def\bbl@process@language#1#2#3{%
14974 \ifcase\count@
14975 \@ifundefined{zth@#1}{\count@\tw@}{\count@\@ne}%
14976 \or
14977 \count@\tw@
14978 \fi
14979 \ifnum\count@=\tw@
14980 \expandafter\addlanguage\csname l@#1\endcsname
14981 \language\allocationnumber
14982 \chardef\bbl@last\allocationnumber
14983 \bbl@manylang
14984 \let\bbl@elt\relax
14985 \xdef\bbl@languages{%
14986 \bbl@languages\bbl@elt{#1}{\the\language}{#2}{#3}}%
14987 \fi
14988 \the\toks@
14989 \toks@{}}
14990 \def\bbl@process@synonym@aux#1#2{%
14991 \global\expandafter\chardef\csname l@#1\endcsname#2\relax
14992 \let\bbl@elt\relax
14993 \xdef\bbl@languages{%
14994 \bbl@languages\bbl@elt{#1}{#2}{}{}}}%
14995 \def\bbl@process@synonym#1{%
14996 \ifcase\count@
14997 \toks@\expandafter{\the\toks@\relax\bbl@process@synonym{#1}}%
14998 \or
14999 \@ifundefined{zth@#1}{\bbl@process@synonym@aux{#1}{0}}{}%
15000 \else
15001 \bbl@process@synonym@aux{#1}{\the\bbl@last}%
15002 \fi}
15003 \ifx\bbl@languages\@undefined % Just a (sensible?) guess
15004 \chardef\l@english\z@
15005 \chardef\l@USenglish\z@
15006 \chardef\bbl@last\z@
15007 \global\@namedef{bbl@hyphendata@0}{{hyphen.tex}{}}
15008 \gdef\bbl@languages{%
15009 \bbl@elt{english}{0}{hyphen.tex}{}%
15010 \bbl@elt{USenglish}{0}{}{}}
15011 \else
15012 \global\let\bbl@languages@format\bbl@languages
15013 \def\bbl@elt#1#2#3#4{% Remove all except language 0
15014 \ifnum#2>\z@\else
15015 \noexpand\bbl@elt{#1}{#2}{#3}{#4}%
15016 \fi}%
15017 \xdef\bbl@languages{\bbl@languages}%
15018 \fi
15019 \def\bbl@elt#1#2#3#4{\@namedef{zth@#1}{}} % Define flags
15020 \bbl@languages
15021 \openin\bbl@readstream=language.dat
15022 \ifeof\bbl@readstream
15023 \bbl@warning{I couldn't find language.dat. No additional\\%
15024 patterns loaded. Reported}%
15025 \else
15026 \loop
15027 \endlinechar\m@ne
15028 \read\bbl@readstream to \bbl@line
15029 \endlinechar`\^^M
15030 \if T\ifeof\bbl@readstream F\fi T\relax
15031 \ifx\bbl@line\@empty\else
15032 \edef\bbl@line{\bbl@line\space\space\space}%
15033 \expandafter\bbl@process@line\bbl@line\relax
15034 \fi
15035 \repeat
15036 \fi
15037 \closein\bbl@readstream
15038 \endgroup
15039 \bbl@trace{Macros for reading patterns files}
15040 \def\bbl@get@enc#1:#2:#3\@@@{\def\bbl@hyph@enc{#2}}
15041 \ifx\babelcatcodetablenum\@undefined
15042 \ifx\newcatcodetable\@undefined
15043 \def\babelcatcodetablenum{5211}
15044 \def\bbl@pattcodes{\numexpr\babelcatcodetablenum+1\relax}
15045 \else
15046 \newcatcodetable\babelcatcodetablenum
15047 \newcatcodetable\bbl@pattcodes
15048 \fi
15049 \else
15050 \def\bbl@pattcodes{\numexpr\babelcatcodetablenum+1\relax}
15051 \fi
15052 \def\bbl@luapatterns#1#2{%
15053 \bbl@get@enc#1::\@@@
15054 \setbox\z@\hbox\bgroup
15055 \begingroup
15056 \savecatcodetable\babelcatcodetablenum\relax
15057 \initcatcodetable\bbl@pattcodes\relax
15058 \catcodetable\bbl@pattcodes\relax
15059 \catcode`\#=6 \catcode`\$=3 \catcode`\&=4 \catcode`\^=7
15060 \catcode`\_=8 \catcode`\{=1 \catcode`\}=2 \catcode`\~=13
15061 \catcode`\@=11 \catcode`\^^I=10 \catcode`\^^J=12
15062 \catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\.=12
15063 \catcode`\-=12 \catcode`\/=12 \catcode`\[=12 \catcode`\]=12
15064 \catcode`\`=12 \catcode`\'=12 \catcode`\"=12
15065 \input #1\relax
15066 \catcodetable\babelcatcodetablenum\relax
15067 \endgroup
15068 \def\bbl@tempa{#2}%
15069 \ifx\bbl@tempa\@empty\else
15070 \input #2\relax
15071 \fi
15072 \egroup}%
15073 \def\bbl@patterns@lua#1{%
15074 \language=\expandafter\ifx\csname l@#1:\f@encoding\endcsname\relax
15075 \csname l@#1\endcsname
15076 \edef\bbl@tempa{#1}%
15077 \else
15078 \csname l@#1:\f@encoding\endcsname
15079 \edef\bbl@tempa{#1:\f@encoding}%
15080 \fi\relax
15081 \@namedef{lu@texhyphen@loaded@\the\language}{}% Temp
15082 \@ifundefined{bbl@hyphendata@\the\language}%
15083 {\def\bbl@elt##1##2##3##4{%
15084 \ifnum##2=\csname l@\bbl@tempa\endcsname % #2=spanish, dutch:OT1...
15085 \def\bbl@tempb{##3}%
15086 \ifx\bbl@tempb\@empty\else % if not a synonymous
15087 \def\bbl@tempc{{##3}{##4}}%
15088 \fi
15089 \bbl@csarg\xdef{hyphendata@##2}{\bbl@tempc}%
15090 \fi}%
15091 \bbl@languages
15092 \@ifundefined{bbl@hyphendata@\the\language}%
15093 {\bbl@info{No hyphenation patterns were set for\\%
15094 language '\bbl@tempa'. Reported}}%
15095 {\expandafter\expandafter\expandafter\bbl@luapatterns
15096 \csname bbl@hyphendata@\the\language\endcsname}}{}}
15097 \endinput\fi
15098 % \end{macrocode}
15099 %
15100 % Here ends |\ifx\AddBabelHook\@undefined|. A few lines are only read
15101 % by \textsc{hyphen.cfg}.
15102 %
15103 % \begin{macrocode}
15104 \ifx\DisableBabelHook\@undefined
15105 \AddBabelHook{luatex}{everylanguage}{%
15106 \def\process@language##1##2##3{%
15107 \def\process@line####1####2 ####3 ####4 {}}}
15108 \AddBabelHook{luatex}{loadpatterns}{%
15109 \input #1\relax
15110 \expandafter\gdef\csname bbl@hyphendata@\the\language\endcsname
15111 {{#1}{}}}
15112 \AddBabelHook{luatex}{loadexceptions}{%
15113 \input #1\relax
15114 \def\bbl@tempb##1##2{{##1}{#1}}%
15115 \expandafter\xdef\csname bbl@hyphendata@\the\language\endcsname
15116 {\expandafter\expandafter\expandafter\bbl@tempb
15117 \csname bbl@hyphendata@\the\language\endcsname}}
15118 \endinput\fi
15119 % \end{macrocode}
15120 %
15121 % Here stops reading code for \textsc{hyphen.cfg}. The following is
15122 % read the 2nd time it's loaded. First, global declarations for lua.
15123 %
15124 % \begin{macrocode}
15125 \begingroup
15126 \catcode`\%=12
15127 \catcode`\'=12
15128 \catcode`\"=12
15129 \catcode`\:=12
15130 \directlua{
15131 Babel.locale_props = Babel.locale_props or {}
15132 function Babel.lua_error(e, a)
15133 tex.print([[\noexpand\csname bbl@error\endcsname{]] ..
15134 e .. '}{' .. (a or '') .. '}{}{}')
15135 end
15136
15137 function Babel.bytes(line)
15138 return line:gsub("(.)",
15139 function (chr) return unicode.utf8.char(string.byte(chr)) end)
15140 end
15141
15142 function Babel.priority_in_callback(name,description)
15143 for i,v in ipairs(luatexbase.callback_descriptions(name)) do
15144 if v == description then return i end
15145 end
15146 return false
15147 end
15148
15149 function Babel.begin_process_input()
15150 if luatexbase and luatexbase.add_to_callback then
15151 luatexbase.add_to_callback('process_input_buffer',
15152 Babel.bytes,'Babel.bytes')
15153 else
15154 Babel.callback = callback.find('process_input_buffer')
15155 callback.register('process_input_buffer',Babel.bytes)
15156 end
15157 end
15158 function Babel.end_process_input ()
15159 if luatexbase and luatexbase.remove_from_callback then
15160 luatexbase.remove_from_callback('process_input_buffer','Babel.bytes')
15161 else
15162 callback.register('process_input_buffer',Babel.callback)
15163 end
15164 end
15165
15166 function Babel.str_to_nodes(fn, matches, base)
15167 local n, head, last
15168 if fn == nil then return nil end
15169 for s in string.utfvalues(fn(matches)) do
15170 if base.id == 7 then
15171 base = base.replace
15172 end
15173 n = node.copy(base)
15174 n.char = s
15175 if not head then
15176 head = n
15177 else
15178 last.next = n
15179 end
15180 last = n
15181 end
15182 return head
15183 end
15184
15185 Babel.linebreaking = Babel.linebreaking or {}
15186 Babel.linebreaking.before = {}
15187 Babel.linebreaking.after = {}
15188 Babel.locale = {}
15189 function Babel.linebreaking.add_before(func, pos)
15190 tex.print([[\noexpand\csname bbl@luahyphenate\endcsname]])
15191 if pos == nil then
15192 table.insert(Babel.linebreaking.before, func)
15193 else
15194 table.insert(Babel.linebreaking.before, pos, func)
15195 end
15196 end
15197 function Babel.linebreaking.add_after(func)
15198 tex.print([[\noexpand\csname bbl@luahyphenate\endcsname]])
15199 table.insert(Babel.linebreaking.after, func)
15200 end
15201
15202 function Babel.addpatterns(pp, lg)
15203 local lg = lang.new(lg)
15204 local pats = lang.patterns(lg) or ''
15205 lang.clear_patterns(lg)
15206 for p in pp:gmatch('[^%s]+') do
15207 ss = ''
15208 for i in string.utfcharacters(p:gsub('%d', '')) do
15209 ss = ss .. '%d?' .. i
15210 end
15211 ss = ss:gsub('^%%d%?%.', '%%.') .. '%d?'
15212 ss = ss:gsub('%.%%d%?$', '%%.')
15213 pats, n = pats:gsub('%s' .. ss .. '%s', ' ' .. p .. ' ')
15214 if n == 0 then
15215 tex.sprint(
15216 [[\string\csname\space bbl@info\endcsname{New pattern: ]]
15217 .. p .. [[}]])
15218 pats = pats .. ' ' .. p
15219 else
15220 tex.sprint(
15221 [[\string\csname\space bbl@info\endcsname{Renew pattern: ]]
15222 .. p .. [[}]])
15223 end
15224 end
15225 lang.patterns(lg, pats)
15226 end
15227
15228 Babel.characters = Babel.characters or {}
15229 Babel.ranges = Babel.ranges or {}
15230 function Babel.hlist_has_bidi(head)
15231 local has_bidi = false
15232 local ranges = Babel.ranges
15233 for item in node.traverse(head) do
15234 if item.id == node.id'glyph' then
15235 local itemchar = item.char
15236 local chardata = Babel.characters[itemchar]
15237 local dir = chardata and chardata.d or nil
15238 if not dir then
15239 for nn, et in ipairs(ranges) do
15240 if itemchar < et[1] then
15241 break
15242 elseif itemchar <= et[2] then
15243 dir = et[3]
15244 break
15245 end
15246 end
15247 end
15248 if dir and (dir == 'al' or dir == 'r') then
15249 has_bidi = true
15250 end
15251 end
15252 end
15253 return has_bidi
15254 end
15255 function Babel.set_chranges_b (script, chrng)
15256 if chrng == '' then return end
15257 texio.write('Replacing ' .. script .. ' script ranges')
15258 Babel.script_blocks[script] = {}
15259 for s, e in string.gmatch(chrng..' ', '(.-)%.%.(.-)%s') do
15260 table.insert(
15261 Babel.script_blocks[script], {tonumber(s,16), tonumber(e,16)})
15262 end
15263 end
15264
15265 function Babel.discard_sublr(str)
15266 if str:find( [[\string\indexentry]] ) and
15267 str:find( [[\string\babelsublr]] ) then
15268 str = str:gsub( [[\string\babelsublr%s*(%b{})]],
15269 function(m) return m:sub(2,-2) end )
15270 end
15271 return str
15272 end
15273 }
15274 \endgroup
15275 \ifx\newattribute\@undefined\else % Test for plain
15276 \newattribute\bbl@attr@locale % DL4
15277 \directlua{ Babel.attr_locale = luatexbase.registernumber'bbl@attr@locale' }
15278 \AddBabelHook{luatex}{beforeextras}{%
15279 \setattribute\bbl@attr@locale\localeid}
15280 \fi
15281 %
15282 \def\BabelStringsDefault{unicode}
15283 \let\luabbl@stop\relax
15284 \AddBabelHook{luatex}{encodedcommands}{%
15285 \def\bbl@tempa{utf8}\def\bbl@tempb{#1}%
15286 \ifx\bbl@tempa\bbl@tempb\else
15287 \directlua{Babel.begin_process_input()}%
15288 \def\luabbl@stop{%
15289 \directlua{Babel.end_process_input()}}%
15290 \fi}%
15291 \AddBabelHook{luatex}{stopcommands}{%
15292 \luabbl@stop
15293 \let\luabbl@stop\relax}
15294 %
15295 \AddBabelHook{luatex}{patterns}{%
15296 \@ifundefined{bbl@hyphendata@\the\language}%
15297 {\def\bbl@elt##1##2##3##4{%
15298 \ifnum##2=\csname l@#2\endcsname % #2=spanish, dutch:OT1...
15299 \def\bbl@tempb{##3}%
15300 \ifx\bbl@tempb\@empty\else % if not a synonymous
15301 \def\bbl@tempc{{##3}{##4}}%
15302 \fi
15303 \bbl@csarg\xdef{hyphendata@##2}{\bbl@tempc}%
15304 \fi}%
15305 \bbl@languages
15306 \@ifundefined{bbl@hyphendata@\the\language}%
15307 {\bbl@info{No hyphenation patterns were set for\\%
15308 language '#2'. Reported}}%
15309 {\expandafter\expandafter\expandafter\bbl@luapatterns
15310 \csname bbl@hyphendata@\the\language\endcsname}}{}%
15311 \@ifundefined{bbl@patterns@}{}{%
15312 \begingroup
15313 \bbl@xin@{,\number\language,}{,\bbl@pttnlist}%
15314 \ifin@\else
15315 \ifx\bbl@patterns@\@empty\else
15316 \directlua{ Babel.addpatterns(
15317 [[\bbl@patterns@]], \number\language) }%
15318 \fi
15319 \@ifundefined{bbl@patterns@#1}%
15320 \@empty
15321 {\directlua{ Babel.addpatterns(
15322 [[\space\csname bbl@patterns@#1\endcsname]],
15323 \number\language) }}%
15324 \xdef\bbl@pttnlist{\bbl@pttnlist\number\language,}%
15325 \fi
15326 \endgroup}%
15327 \bbl@exp{%
15328 \bbl@ifunset{bbl@prehc@\languagename}{}%
15329 {\\\bbl@ifblank{\bbl@cs{prehc@\languagename}}{}%
15330 {\prehyphenchar=\bbl@cl{prehc}\relax}}}}
15331 % \end{macrocode}
15332 %
15333 % \macro{\babelpatterns}
15334 %
15335 % This macro adds patterns. Two macros are used to store them:
15336 % |\bbl@patterns@| for the global ones and |\bbl@patterns@<language>| for
15337 % language ones. We make sure there is a space between words when
15338 % multiple commands are used.
15339 %
15340 % \begin{macrocode}
15341 \@onlypreamble\babelpatterns
15342 \AtEndOfPackage{%
15343 \newcommand\babelpatterns[2][\@empty]{%
15344 \ifx\bbl@patterns@\relax
15345 \let\bbl@patterns@\@empty
15346 \fi
15347 \ifx\bbl@pttnlist\@empty\else
15348 \bbl@warning{%
15349 You must not intermingle \string\selectlanguage\space and\\%
15350 \string\babelpatterns\space or some patterns will not\\%
15351 be taken into account. Reported}%
15352 \fi
15353 \ifx\@empty#1%
15354 \protected@edef\bbl@patterns@{\bbl@patterns@\space#2}%
15355 \else
15356 \edef\bbl@tempb{\zap@space#1 \@empty}%
15357 \bbl@for\bbl@tempa\bbl@tempb{%
15358 \bbl@fixname\bbl@tempa
15359 \bbl@iflanguage\bbl@tempa{%
15360 \bbl@csarg\protected@edef{patterns@\bbl@tempa}{%
15361 \@ifundefined{bbl@patterns@\bbl@tempa}%
15362 \@empty
15363 {\csname bbl@patterns@\bbl@tempa\endcsname\space}%
15364 #2}}}%
15365 \fi}}
15366 % \end{macrocode}
15367 %
15368 % \subsection{Southeast Asian scripts}
15369 %
15370 % First, some general code for line breaking, used by
15371 % |\babelposthyphenation|.
15372 %
15373 % Replace regular (i.e., implicit) discretionaries by spaceskips, based
15374 % on the previous glyph (which I think makes sense, because the hyphen
15375 % and the previous char go always together). Other discretionaries are
15376 % not touched. See Unicode UAX 14.
15377 %
15378 % \begin{macrocode}
15379 \def\bbl@intraspace#1 #2 #3\@@{%
15380 \directlua{
15381 Babel.intraspaces = Babel.intraspaces or {}
15382 Babel.intraspaces['\csname bbl@sbcp@\languagename\endcsname'] = %
15383 {b = #1, p = #2, m = #3}
15384 Babel.locale_props[\the\localeid].intraspace = %
15385 {b = #1, p = #2, m = #3}
15386 }}
15387 \def\bbl@intrapenalty#1\@@{%
15388 \directlua{
15389 Babel.intrapenalties = Babel.intrapenalties or {}
15390 Babel.intrapenalties['\csname bbl@sbcp@\languagename\endcsname'] = #1
15391 Babel.locale_props[\the\localeid].intrapenalty = #1
15392 }}
15393 \begingroup
15394 \catcode`\%=12
15395 \catcode`\&=14
15396 \catcode`\'=12
15397 \catcode`\~=12
15398 \gdef\bbl@seaintraspace{&
15399 \let\bbl@seaintraspace\relax
15400 \directlua{
15401 Babel.sea_enabled = true
15402 Babel.sea_ranges = Babel.sea_ranges or {}
15403 function Babel.set_chranges (script, chrng)
15404 local c = 0
15405 for s, e in string.gmatch(chrng..' ', '(.-)%.%.(.-)%s') do
15406 Babel.sea_ranges[script..c]={tonumber(s,16), tonumber(e,16)}
15407 c = c + 1
15408 end
15409 end
15410 function Babel.sea_disc_to_space (head)
15411 local sea_ranges = Babel.sea_ranges
15412 local last_char = nil
15413 local quad = 655360 &% 10 pt = 655360 = 10 * 65536
15414 for item in node.traverse(head) do
15415 local i = item.id
15416 if i == node.id'glyph' then
15417 last_char = item
15418 elseif i == 7 and item.subtype == 3 and last_char
15419 and last_char.char > 0x0C99 then
15420 quad = font.getfont(last_char.font).size
15421 for lg, rg in pairs(sea_ranges) do
15422 if last_char.char > rg[1] and last_char.char < rg[2] then
15423 lg = lg:sub(1, 4) &% Remove trailing number of, e.g., Cyrl1
15424 local intraspace = Babel.intraspaces[lg]
15425 local intrapenalty = Babel.intrapenalties[lg]
15426 local n
15427 if intrapenalty ~= 0 then
15428 n = node.new(14, 0) &% penalty
15429 n.penalty = intrapenalty
15430 node.insert_before(head, item, n)
15431 end
15432 n = node.new(12, 13) &% (glue, spaceskip)
15433 node.setglue(n, intraspace.b * quad,
15434 intraspace.p * quad,
15435 intraspace.m * quad)
15436 node.insert_before(head, item, n)
15437 node.remove(head, item)
15438 end
15439 end
15440 end
15441 end
15442 end
15443 }&
15444 \bbl@luahyphenate}
15445 % \end{macrocode}
15446 %
15447 % \subsection{CJK line breaking}
15448 %
15449 % Minimal line breaking for CJK scripts, mainly intended for simple
15450 % documents and short texts as a secondary language. Only line
15451 % breaking, with a little stretching for justification, without any
15452 % attempt to adjust the spacing. It is based on (but does not strictly
15453 % follow) the Unicode algorithm.
15454 %
15455 % We first need a little table with the corresponding line breaking
15456 % properties. A few characters have an additional key for the width
15457 % (fullwidth \textit{vs.} halfwidth), not yet used. There is a separate
15458 % file, defined below.
15459 %
15460 % \begin{macrocode}
15461 \catcode`\%=14
15462 \gdef\bbl@cjkintraspace{%
15463 \let\bbl@cjkintraspace\relax
15464 \directlua{
15465 require('babel-data-cjk.lua')
15466 Babel.cjk_enabled = true
15467 function Babel.cjk_linebreak(head)
15468 local GLYPH = node.id'glyph'
15469 local last_char = nil
15470 local quad = 655360 % 10 pt = 655360 = 10 * 65536
15471 local last_class = nil
15472 local last_lang = nil
15473 for item in node.traverse(head) do
15474 if item.id == GLYPH then
15475 local lang = item.lang
15476 local LOCALE = node.get_attribute(item,
15477 Babel.attr_locale)
15478 local props = Babel.locale_props[LOCALE] or {}
15479 local class = Babel.cjk_class[item.char].c
15480 if props.cjk_quotes and props.cjk_quotes[item.char] then
15481 class = props.cjk_quotes[item.char]
15482 end
15483 if class == 'cp' then class = 'cl' % )] as CL
15484 elseif class == 'id' then class = 'I'
15485 elseif class == 'cj' then class = 'I' % loose
15486 end
15487 local br = 0
15488 if class and last_class and Babel.cjk_breaks[last_class][class] then
15489 br = Babel.cjk_breaks[last_class][class]
15490 end
15491 if br == 1 and props.linebreak == 'c' and
15492 lang ~= \the\l@nohyphenation\space and
15493 last_lang ~= \the\l@nohyphenation then
15494 local intrapenalty = props.intrapenalty
15495 if intrapenalty ~= 0 then
15496 local n = node.new(14, 0) % penalty
15497 n.penalty = intrapenalty
15498 node.insert_before(head, item, n)
15499 end
15500 local intraspace = props.intraspace
15501 local n = node.new(12, 13) % (glue, spaceskip)
15502 node.setglue(n, intraspace.b * quad,
15503 intraspace.p * quad,
15504 intraspace.m * quad)
15505 node.insert_before(head, item, n)
15506 end
15507 if font.getfont(item.font) then
15508 quad = font.getfont(item.font).size
15509 end
15510 last_class = class
15511 last_lang = lang
15512 else % if penalty, glue or anything else
15513 last_class = nil
15514 end
15515 end
15516 lang.hyphenate(head)
15517 end
15518 }%
15519 \bbl@luahyphenate}
15520 \gdef\bbl@luahyphenate{%
15521 \let\bbl@luahyphenate\relax
15522 \directlua{
15523 luatexbase.add_to_callback('hyphenate',
15524 function (head, tail)
15525 if Babel.linebreaking.before then
15526 for k, func in ipairs(Babel.linebreaking.before) do
15527 func(head)
15528 end
15529 end
15530 lang.hyphenate(head)
15531 if Babel.cjk_enabled then
15532 Babel.cjk_linebreak(head)
15533 end
15534 if Babel.linebreaking.after then
15535 for k, func in ipairs(Babel.linebreaking.after) do
15536 func(head)
15537 end
15538 end
15539 if Babel.set_hboxed then
15540 Babel.set_hboxed(head)
15541 end
15542 if Babel.sea_enabled then
15543 Babel.sea_disc_to_space(head)
15544 end
15545 end,
15546 'Babel.hyphenate')
15547 }}
15548 \endgroup
15549 %
15550 \def\bbl@provide@intraspace{%
15551 \bbl@ifunset{bbl@intsp@\languagename}{}%
15552 {\expandafter\ifx\csname bbl@intsp@\languagename\endcsname\@empty\else
15553 \bbl@xin@{/c}{/\bbl@cl{lnbrk}}%
15554 \ifin@ % cjk
15555 \bbl@cjkintraspace
15556 \directlua{
15557 Babel.locale_props = Babel.locale_props or {}
15558 Babel.locale_props[\the\localeid].linebreak = 'c'
15559 }%
15560 \bbl@exp{\\\bbl@intraspace\bbl@cl{intsp}\\\@@}%
15561 \ifx\bbl@KVP@intrapenalty\@nnil
15562 \bbl@intrapenalty0\@@
15563 \fi
15564 \else % sea
15565 \bbl@seaintraspace
15566 \bbl@exp{\\\bbl@intraspace\bbl@cl{intsp}\\\@@}%
15567 \directlua{
15568 Babel.sea_ranges = Babel.sea_ranges or {}
15569 Babel.set_chranges('\bbl@cl{sbcp}',
15570 '\bbl@cl{chrng}')
15571 }%
15572 \ifx\bbl@KVP@intrapenalty\@nnil
15573 \bbl@intrapenalty0\@@
15574 \fi
15575 \fi
15576 \fi
15577 \ifx\bbl@KVP@intrapenalty\@nnil\else
15578 \expandafter\bbl@intrapenalty\bbl@KVP@intrapenalty\@@
15579 \fi}}
15580 % \end{macrocode}
15581 %
15582 % \subsection{Arabic justification}
15583 %
15584 % WIP. |\bbl@arabicjust| is executed with both elongated an kashida.
15585 % This must be fine tuned. The attribute kashida is set by transforms
15586 % with |kashida|.
15587 %
15588 % \begin{macrocode}
15589 \ifnum\bbl@bidimode>100 \ifnum\bbl@bidimode<200
15590 \def\bblar@chars{%
15591 0628,0629,062A,062B,062C,062D,062E,062F,0630,0631,0632,0633,%
15592 0634,0635,0636,0637,0638,0639,063A,063B,063C,063D,063E,063F,%
15593 0640,0641,0642,0643,0644,0645,0646,0647,0649}
15594 \def\bblar@elongated{%
15595 0626,0628,062A,062B,0633,0634,0635,0636,063B,%
15596 063C,063D,063E,063F,0641,0642,0643,0644,0646,%
15597 0649,064A}
15598 \begingroup
15599 \catcode`_=11 \catcode`:=11
15600 \gdef\bblar@nofswarn{\gdef\msg_warning:nnx##1##2##3{}}
15601 \endgroup
15602 \gdef\bbl@arabicjust{%
15603 \let\bbl@arabicjust\relax
15604 \newattribute\bblar@kashida
15605 \directlua{ Babel.attr_kashida = luatexbase.registernumber'bblar@kashida' }%
15606 \bblar@kashida=\z@
15607 \bbl@patchfont{{\bbl@parsejalt}}%
15608 \directlua{
15609 Babel.arabic.elong_map = Babel.arabic.elong_map or {}
15610 Babel.arabic.elong_map[\the\localeid] = {}
15611 luatexbase.add_to_callback('post_linebreak_filter',
15612 Babel.arabic.justify, 'Babel.arabic.justify')
15613 luatexbase.add_to_callback('hpack_filter',
15614 Babel.arabic.justify_hbox, 'Babel.arabic.justify_hbox')
15615 }}%
15616 % \end{macrocode}
15617 %
15618 % Save both node lists to make replacement.
15619 %
15620 % \begin{macrocode}
15621 \def\bblar@fetchjalt#1#2#3#4{%
15622 \bbl@exp{\\\bbl@foreach{#1}}{%
15623 \bbl@ifunset{bblar@JE@##1}%
15624 {\setbox\z@\hbox{\textdir TRT ^^^^200d\char"##1#2}}%
15625 {\setbox\z@\hbox{\textdir TRT ^^^^200d\char"\@nameuse{bblar@JE@##1}#2}}%
15626 \directlua{%
15627 local last = nil
15628 for item in node.traverse(tex.box[0].head) do
15629 if item.id == node.id'glyph' and item.char > 0x600 and
15630 not (item.char == 0x200D) then
15631 last = item
15632 end
15633 end
15634 Babel.arabic.#3['##1#4'] = last.char
15635 }}}
15636 % \end{macrocode}
15637 %
15638 % Elongated forms. Brute force. No rules at all, yet. The ideal: look
15639 % at jalt table. And perhaps other tables (falt?, cswh?). What about
15640 % kaf? And diacritic positioning?
15641 %
15642 % \begin{macrocode}
15643 \gdef\bbl@parsejalt{%
15644 \ifx\addfontfeature\@undefined\else
15645 \bbl@xin@{/e}{/\bbl@cl{lnbrk}}%
15646 \ifin@
15647 \directlua{%
15648 if Babel.arabic.elong_map[\the\localeid][\fontid\font] == nil then
15649 Babel.arabic.elong_map[\the\localeid][\fontid\font] = {}
15650 tex.print([[\string\csname\space bbl@parsejalti\endcsname]])
15651 end
15652 }%
15653 \fi
15654 \fi}
15655 \gdef\bbl@parsejalti{%
15656 \begingroup
15657 \let\bbl@parsejalt\relax % To avoid infinite loop
15658 \edef\bbl@tempb{\fontid\font}%
15659 \bblar@nofswarn
15660 \@nameuse{tracinglostchars}\z@
15661 \bblar@fetchjalt\bblar@elongated{}{from}{}%
15662 \bblar@fetchjalt\bblar@chars{^^^^064a}{from}{a}% Alef maksura
15663 \bblar@fetchjalt\bblar@chars{^^^^0649}{from}{y}% Yeh
15664 \addfontfeature{RawFeature=+jalt}%
15665 % \@namedef{bblar@JE@0643}{06AA}% todo: catch medial kaf
15666 \bblar@fetchjalt\bblar@elongated{}{dest}{}%
15667 \bblar@fetchjalt\bblar@chars{^^^^064a}{dest}{a}%
15668 \bblar@fetchjalt\bblar@chars{^^^^0649}{dest}{y}%
15669 \directlua{%
15670 for k, v in pairs(Babel.arabic.from) do
15671 if Babel.arabic.dest[k] and
15672 not (Babel.arabic.from[k] == Babel.arabic.dest[k]) then
15673 Babel.arabic.elong_map[\the\localeid][\bbl@tempb]
15674 [Babel.arabic.from[k]] = Babel.arabic.dest[k]
15675 end
15676 end
15677 }%
15678 \endgroup}
15679 % \end{macrocode}
15680 %
15681 % The actual justification (inspired by \textsc{chickenize}).
15682 %
15683 % \begin{macrocode}
15684 \begingroup
15685 \catcode`#=11
15686 \catcode`~=11
15687 \directlua{
15688
15689 Babel.arabic = Babel.arabic or {}
15690 Babel.arabic.from = {}
15691 Babel.arabic.dest = {}
15692 Babel.arabic.justify_factor = 0.95
15693 Babel.arabic.justify_enabled = true
15694 Babel.arabic.kashida_limit = -1
15695
15696 function Babel.arabic.justify(head)
15697 if not Babel.arabic.justify_enabled then return head end
15698 for line in node.traverse_id(node.id'hlist', head) do
15699 Babel.arabic.justify_hlist(head, line)
15700 end
15701 % In case the very first item is a line (eg, in \vbox):
15702 while head.prev do head = head.prev end
15703 return head
15704 end
15705
15706 function Babel.arabic.justify_hbox(head, gc, size, pack)
15707 local has_inf = false
15708 if Babel.arabic.justify_enabled and pack == 'exactly' then
15709 for n in node.traverse_id(12, head) do
15710 if n.stretch_order > 0 then has_inf = true end
15711 end
15712 if not has_inf then
15713 Babel.arabic.justify_hlist(head, nil, gc, size, pack)
15714 end
15715 end
15716 return head
15717 end
15718
15719 function Babel.arabic.justify_hlist(head, line, gc, size, pack)
15720 local d, new
15721 local k_list, k_item, pos_inline
15722 local width, width_new, full, k_curr, wt_pos, goal, shift
15723 local subst_done = false
15724 local elong_map = Babel.arabic.elong_map
15725 local cnt
15726 local last_line
15727 local GLYPH = node.id'glyph'
15728 local KASHIDA = Babel.attr_kashida
15729 local LOCALE = Babel.attr_locale
15730
15731 if line == nil then
15732 line = {}
15733 line.glue_sign = 1
15734 line.glue_order = 0
15735 line.head = head
15736 line.shift = 0
15737 line.width = size
15738 end
15739
15740 % Exclude last line.
15741 if ((line.next ~= nil or line.glue_sign == 1) and line.glue_order == 0) then
15742 elongs = {} % Stores elongated candidates of each line
15743 k_list = {} % And all letters with kashida
15744 pos_inline = 0 % Not yet used
15745
15746 for n in node.traverse_id(GLYPH, line.head) do
15747 pos_inline = pos_inline + 1 % To find where it is. Not used.
15748
15749 % Elongated glyphs
15750 if elong_map then
15751 local locale = node.get_attribute(n, LOCALE)
15752 if elong_map[locale] and elong_map[locale][n.font] and
15753 elong_map[locale][n.font][n.char] then
15754 table.insert(elongs, {node = n, locale = locale} )
15755 node.set_attribute(n.prev, KASHIDA, 0)
15756 end
15757 end
15758
15759 % Tatwil. First create a list of nodes marked with kashida. The
15760 % rest of nodes can be ignored. The list of used weigths is build
15761 % when transforms with the key kashida= are declared.
15762 if Babel.kashida_wts then
15763 local k_wt = node.get_attribute(n, KASHIDA)
15764 if k_wt > 0 then % todo. parameter for multi inserts
15765 table.insert(k_list, {node = n, weight = k_wt, pos = pos_inline})
15766 end
15767 end
15768
15769 end % of node.traverse_id
15770
15771 if #elongs == 0 and #k_list == 0 then goto next_line end
15772 full = line.width
15773 shift = line.shift
15774 goal = full * Babel.arabic.justify_factor % A bit crude
15775 width = node.dimensions(line.head) % The 'natural' width
15776
15777 % == Elongated ==
15778 % Original idea taken from 'chikenize'
15779 while (#elongs > 0 and width < goal) do
15780 subst_done = true
15781 local x = #elongs
15782 local curr = elongs[x].node
15783 local oldchar = curr.char
15784 curr.char = elong_map[elongs[x].locale][curr.font][curr.char]
15785 width = node.dimensions(line.head) % Check if the line is too wide
15786 % Substitute back if the line would be too wide and break:
15787 if width > goal then
15788 curr.char = oldchar
15789 break
15790 end
15791 % If continue, pop the just substituted node from the list:
15792 table.remove(elongs, x)
15793 end
15794
15795 % == Tatwil ==
15796 % Traverse the kashida node list so many times as required, until
15797 % the line if filled. The first pass adds a tatweel after each
15798 % node with kashida in the line, the second pass adds another one,
15799 % and so on. In each pass, add first the kashida with the highest
15800 % weight, then with lower weight and so on.
15801 if #k_list == 0 then goto next_line end
15802
15803 width = node.dimensions(line.head) % The 'natural' width
15804 k_curr = #k_list % Traverse backwards, from the end
15805 wt_pos = 1
15806
15807 while width < goal do
15808 subst_done = true
15809 k_item = k_list[k_curr].node
15810 if k_list[k_curr].weight == Babel.kashida_wts[wt_pos] then
15811 d = node.copy(k_item)
15812 d.char = 0x0640
15813 d.yoffset = 0 % TODO. From the prev char. But 0 seems safe.
15814 d.xoffset = 0
15815 line.head, new = node.insert_after(line.head, k_item, d)
15816 width_new = node.dimensions(line.head)
15817 if width > goal or width == width_new then
15818 node.remove(line.head, new) % Better compute before
15819 break
15820 end
15821 if Babel.fix_diacr then
15822 Babel.fix_diacr(k_item.next)
15823 end
15824 width = width_new
15825 end
15826 if k_curr == 1 then
15827 k_curr = #k_list
15828 wt_pos = (wt_pos >= table.getn(Babel.kashida_wts)) and 1 or wt_pos+1
15829 else
15830 k_curr = k_curr - 1
15831 end
15832 end
15833
15834 % Limit the number of tatweel by removing them. Not very efficient,
15835 % but it does the job in a quite predictable way.
15836 if Babel.arabic.kashida_limit > -1 then
15837 cnt = 0
15838 for n in node.traverse_id(GLYPH, line.head) do
15839 if n.char == 0x0640 then
15840 cnt = cnt + 1
15841 if cnt > Babel.arabic.kashida_limit then
15842 node.remove(line.head, n)
15843 end
15844 else
15845 cnt = 0
15846 end
15847 end
15848 end
15849
15850 ::next_line::
15851
15852 % Must take into account marks and ins, see luatex manual.
15853 % Have to be executed only if there are changes. Investigate
15854 % what's going on exactly.
15855 if subst_done and not gc then
15856 d = node.hpack(line.head, full, 'exactly')
15857 d.shift = shift
15858 node.insert_before(head, line, d)
15859 node.remove(head, line)
15860 end
15861 end % if process line
15862 end
15863 }
15864 \endgroup
15865 \fi\fi % ends Arabic just block: \ifnum\bbl@bidimode>100...
15866 % \end{macrocode}
15867 %
15868 % \subsection{Common stuff}
15869 %
15870 % First, a couple of auxiliary macros to set the renderer according
15871 % to the script. This is done by patching temporarily the low-level
15872 % \textsf{fontspec} macro containing the current features set with
15873 % |\defaultfontfeatures|. Admittedly this is somewhat dangerous, but
15874 % that way the latter command still works as expected, because the
15875 % renderer is set just before other settings. In \xetex\ they are set
15876 % to |\relax|.
15877 %
15878 % \begin{macrocode}
15879 \def\bbl@scr@node@list{%
15880 ,Armenian,Coptic,Cyrillic,Georgian,,Glagolitic,Gothic,%
15881 ,Greek,Latin,Old Church Slavonic Cyrillic,}
15882 \ifnum\bbl@bidimode=102 % bidi-r
15883 \bbl@add\bbl@scr@node@list{Arabic,Hebrew,Syriac}
15884 \fi
15885 \def\bbl@set@renderer{%
15886 \bbl@xin@{\bbl@cl{sname}}{\bbl@scr@node@list}%
15887 \ifin@
15888 \let\bbl@unset@renderer\relax
15889 \else
15890 \bbl@exp{%
15891 \def\\\bbl@unset@renderer{%
15892 \def\<g__fontspec_default_fontopts_clist>{%
15893 \[g__fontspec_default_fontopts_clist]}}%
15894 \def\<g__fontspec_default_fontopts_clist>{%
15895 Renderer=Harfbuzz,\[g__fontspec_default_fontopts_clist]}}%
15896 \fi}
15897 <@Font selection@>
15898 % \end{macrocode}
15899 %
15900 % \subsection{Automatic fonts and ids switching}
15901 %
15902 % After defining the blocks for a number of scripts (must be extended
15903 % and very likely fine tuned), we define a the function
15904 % |Babel.locale_map|, which just traverse the node list to carry out
15905 % the replacements. The table |loc_to_scr| stores the script range for
15906 % each locale (whose id is the key), copied from this table (so that it
15907 % can be modified on a locale basis); there is an intermediate table
15908 % named |chr_to_loc| built on the fly for optimization, which maps a
15909 % char to the locale. This locale is then used to get the |\language|
15910 % as stored in |locale_props|, as well as the font (as requested). In
15911 % the latter table a key starting with |/| maps the font from the
15912 % global one (the key) to the local one (the value). Maths are skipped
15913 % and discretionaries are handled in a special way.
15914 %
15915 % There are two situations where the replacement is not carried out:
15916 % either the \texttt{letters} option has been set and the character is
15917 % not a letter (in the \TeX\ sense), or the current script is the same
15918 % as the new one.
15919 %
15920 % \begin{macrocode}
15921 \directlua{% DL6
15922 Babel.script_blocks = {
15923 ['dflt'] = {},
15924 ['Arab'] = {{0x0600, 0x06FF}, {0x08A0, 0x08FF}, {0x0750, 0x077F},
15925 {0xFE70, 0xFEFF}, {0xFB50, 0xFDFF}, {0x1EE00, 0x1EEFF}},
15926 ['Armn'] = {{0x0530, 0x058F}},
15927 ['Beng'] = {{0x0980, 0x09FF}},
15928 ['Cher'] = {{0x13A0, 0x13FF}, {0xAB70, 0xABBF}},
15929 ['Copt'] = {{0x03E2, 0x03EF}, {0x2C80, 0x2CFF}, {0x102E0, 0x102FF}},
15930 ['Cyrl'] = {{0x0400, 0x04FF}, {0x0500, 0x052F}, {0x1C80, 0x1C8F},
15931 {0x2DE0, 0x2DFF}, {0xA640, 0xA69F}},
15932 ['Deva'] = {{0x0900, 0x097F}, {0xA8E0, 0xA8FF}},
15933 ['Ethi'] = {{0x1200, 0x137F}, {0x1380, 0x139F}, {0x2D80, 0x2DDF},
15934 {0xAB00, 0xAB2F}},
15935 ['Geor'] = {{0x10A0, 0x10FF}, {0x2D00, 0x2D2F}},
15936 % Don't follow strictly Unicode, which places some Coptic letters in
15937 % the 'Greek and Coptic' block
15938 ['Grek'] = {{0x0370, 0x03E1}, {0x03F0, 0x03FF}, {0x1F00, 0x1FFF}},
15939 ['Hans'] = {{0x2E80, 0x2EFF}, {0x3000, 0x303F}, {0x31C0, 0x31EF},
15940 {0x3300, 0x33FF}, {0x3400, 0x4DBF}, {0x4E00, 0x9FFF},
15941 {0xF900, 0xFAFF}, {0xFE30, 0xFE4F}, {0xFF00, 0xFFEF},
15942 {0x20000, 0x2A6DF}, {0x2A700, 0x2B73F},
15943 {0x2B740, 0x2B81F}, {0x2B820, 0x2CEAF},
15944 {0x2CEB0, 0x2EBEF}, {0x2F800, 0x2FA1F}},
15945 ['Hebr'] = {{0x0590, 0x05FF},
15946 {0xFB1F, 0xFB4E}}, % <- Includes some <reserved>
15947 ['Jpan'] = {{0x3000, 0x303F}, {0x3040, 0x309F}, {0x30A0, 0x30FF},
15948 {0x4E00, 0x9FAF}, {0xFF00, 0xFFEF}},
15949 ['Khmr'] = {{0x1780, 0x17FF}, {0x19E0, 0x19FF}},
15950 ['Knda'] = {{0x0C80, 0x0CFF}},
15951 ['Kore'] = {{0x1100, 0x11FF}, {0x3000, 0x303F}, {0x3130, 0x318F},
15952 {0x4E00, 0x9FAF}, {0xA960, 0xA97F}, {0xAC00, 0xD7AF},
15953 {0xD7B0, 0xD7FF}, {0xFF00, 0xFFEF}},
15954 ['Laoo'] = {{0x0E80, 0x0EFF}},
15955 ['Latn'] = {{0x0000, 0x007F}, {0x0080, 0x00FF}, {0x0100, 0x017F},
15956 {0x0180, 0x024F}, {0x1E00, 0x1EFF}, {0x2C60, 0x2C7F},
15957 {0xA720, 0xA7FF}, {0xAB30, 0xAB6F}},
15958 ['Mahj'] = {{0x11150, 0x1117F}},
15959 ['Mlym'] = {{0x0D00, 0x0D7F}},
15960 ['Mymr'] = {{0x1000, 0x109F}, {0xAA60, 0xAA7F}, {0xA9E0, 0xA9FF}},
15961 ['Orya'] = {{0x0B00, 0x0B7F}},
15962 ['Sinh'] = {{0x0D80, 0x0DFF}, {0x111E0, 0x111FF}},
15963 ['Syrc'] = {{0x0700, 0x074F}, {0x0860, 0x086F}},
15964 ['Taml'] = {{0x0B80, 0x0BFF}},
15965 ['Telu'] = {{0x0C00, 0x0C7F}},
15966 ['Tfng'] = {{0x2D30, 0x2D7F}},
15967 ['Thai'] = {{0x0E00, 0x0E7F}},
15968 ['Tibt'] = {{0x0F00, 0x0FFF}},
15969 ['Vaii'] = {{0xA500, 0xA63F}},
15970 ['Yiii'] = {{0xA000, 0xA48F}, {0xA490, 0xA4CF}}
15971 }
15972
15973 Babel.script_blocks.Cyrs = Babel.script_blocks.Cyrl
15974 Babel.script_blocks.Hant = Babel.script_blocks.Hans
15975 Babel.script_blocks.Kana = Babel.script_blocks.Jpan
15976
15977 function Babel.locale_map(head)
15978 if not Babel.locale_mapped then return head end
15979
15980 local LOCALE = Babel.attr_locale
15981 local GLYPH = node.id('glyph')
15982 local inmath = false
15983 local toloc_save
15984 for item in node.traverse(head) do
15985 local toloc
15986 if not inmath and item.id == GLYPH then
15987 % Optimization: build a table with the chars found
15988 if Babel.chr_to_loc[item.char] then
15989 toloc = Babel.chr_to_loc[item.char]
15990 else
15991 for lc, maps in pairs(Babel.loc_to_scr) do
15992 for _, rg in pairs(maps) do
15993 if item.char >= rg[1] and item.char <= rg[2] then
15994 Babel.chr_to_loc[item.char] = lc
15995 toloc = lc
15996 break
15997 end
15998 end
15999 end
16000 % Treat composite chars in a different fashion, because they
16001 % 'inherit' the previous locale.
16002 if (item.char >= 0x0300 and item.char <= 0x036F) or
16003 (item.char >= 0x1AB0 and item.char <= 0x1AFF) or
16004 (item.char >= 0x1DC0 and item.char <= 0x1DFF) then
16005 Babel.chr_to_loc[item.char] = -2000
16006 toloc = -2000
16007 end
16008 if not toloc then
16009 Babel.chr_to_loc[item.char] = -1000
16010 end
16011 end
16012 if toloc == -2000 then
16013 toloc = toloc_save
16014 elseif toloc == -1000 then
16015 toloc = nil
16016 end
16017 if toloc and Babel.locale_props[toloc] and
16018 Babel.locale_props[toloc].letters and
16019 tex.getcatcode(item.char) \string~= 11 then
16020 toloc = nil
16021 end
16022 if toloc and Babel.locale_props[toloc].script
16023 and Babel.locale_props[node.get_attribute(item, LOCALE)].script
16024 and Babel.locale_props[toloc].script ==
16025 Babel.locale_props[node.get_attribute(item, LOCALE)].script then
16026 toloc = nil
16027 end
16028 if toloc then
16029 if Babel.locale_props[toloc].lg then
16030 item.lang = Babel.locale_props[toloc].lg
16031 node.set_attribute(item, LOCALE, toloc)
16032 end
16033 if Babel.locale_props[toloc]['/'..item.font] then
16034 item.font = Babel.locale_props[toloc]['/'..item.font]
16035 end
16036 end
16037 toloc_save = toloc
16038 elseif not inmath and item.id == 7 then % Apply recursively
16039 item.replace = item.replace and Babel.locale_map(item.replace)
16040 item.pre = item.pre and Babel.locale_map(item.pre)
16041 item.post = item.post and Babel.locale_map(item.post)
16042 elseif item.id == node.id'math' then
16043 inmath = (item.subtype == 0)
16044 end
16045 end
16046 return head
16047 end
16048 }
16049 % \end{macrocode}
16050 %
16051 % The code for |\babelcharproperty| is straightforward. Just note the
16052 % modified lua table can be different.
16053 %
16054 % \begin{macrocode}
16055 \newcommand\babelcharproperty[1]{%
16056 \count@=#1\relax
16057 \ifvmode
16058 \expandafter\bbl@chprop
16059 \else
16060 \bbl@error{charproperty-only-vertical}{}{}{}%
16061 \fi}
16062 \newcommand\bbl@chprop[3][\the\count@]{%
16063 \@tempcnta=#1\relax
16064 \bbl@ifunset{bbl@chprop@#2}% {unknown-char-property}
16065 {\bbl@error{unknown-char-property}{}{#2}{}}%
16066 {}%
16067 \loop
16068 \bbl@cs{chprop@#2}{#3}%
16069 \ifnum\count@<\@tempcnta
16070 \advance\count@\@ne
16071 \repeat}
16072 %
16073 \def\bbl@chprop@direction#1{%
16074 \directlua{
16075 Babel.characters[\the\count@] = Babel.characters[\the\count@] or {}
16076 Babel.characters[\the\count@]['d'] = '#1'
16077 }}
16078 \let\bbl@chprop@bc\bbl@chprop@direction
16079 %
16080 \def\bbl@chprop@mirror#1{%
16081 \directlua{
16082 Babel.characters[\the\count@] = Babel.characters[\the\count@] or {}
16083 Babel.characters[\the\count@]['m'] = '\number#1'
16084 }}
16085 \let\bbl@chprop@bmg\bbl@chprop@mirror
16086 %
16087 \def\bbl@chprop@linebreak#1{%
16088 \directlua{
16089 Babel.cjk_characters[\the\count@] = Babel.cjk_characters[\the\count@] or {}
16090 Babel.cjk_characters[\the\count@]['c'] = '#1'
16091 }}
16092 \let\bbl@chprop@lb\bbl@chprop@linebreak
16093 %
16094 \def\bbl@chprop@locale#1{%
16095 \directlua{
16096 Babel.chr_to_loc = Babel.chr_to_loc or {}
16097 Babel.chr_to_loc[\the\count@] =
16098 \bbl@ifblank{#1}{-1000}{\the\bbl@cs{id@@#1}}\space
16099 }}
16100 % \end{macrocode}
16101 %
16102 % Post-handling hyphenation patterns for non-standard rules, like |ff|
16103 % to |ff-f|. There are still some issues with speed (not very slow, but
16104 % still slow). The Lua code is below.
16105 %
16106 % \begin{macrocode}
16107 \directlua{% DL7
16108 Babel.nohyphenation = \the\l@nohyphenation
16109 }
16110 % \end{macrocode}
16111 %
16112 % Now the \TeX{} high level interface, which requires the function
16113 % defined above for converting strings to functions returning a string.
16114 % These functions handle the |{|\textit{n}|}| syntax. For example,
16115 % |pre={1}{1}-| becomes |function(m) return m[1]..m[1]..'-' end|, where
16116 % |m| are the matches returned after applying the pattern. With a
16117 % mapped capture the functions are similar to
16118 % |function(m) return Babel.capt_map(m[1],1) end|, where the last
16119 % argument identifies the mapping to be applied to |m[1]|. The way it
16120 % is carried out is somewhat tricky, but the effect in not dissimilar
16121 % to lua |load| – save the code as string in a TeX macro, and expand
16122 % this macro at the appropriate place. As |\directlua| does not take
16123 % into account the current catcode of |@|, we just avoid this character
16124 % in macro names (which explains the internal group, too).
16125 %
16126 % \begin{macrocode}
16127 \begingroup
16128 \catcode`\~=12
16129 \catcode`\%=12
16130 \catcode`\&=14
16131 \catcode`\|=12
16132 \gdef\babelprehyphenation{&%
16133 \@ifnextchar[{\bbl@settransform{0}}{\bbl@settransform{0}[]}}
16134 \gdef\babelposthyphenation{&%
16135 \@ifnextchar[{\bbl@settransform{1}}{\bbl@settransform{1}[]}}
16136 %
16137 \gdef\bbl@settransform#1[#2]#3#4#5{&%
16138 \ifcase#1
16139 \bbl@activateprehyphen
16140 \or
16141 \bbl@activateposthyphen
16142 \fi
16143 \begingroup
16144 \def\babeltempa{\bbl@add@list\babeltempb}&%
16145 \let\babeltempb\@empty
16146 \def\bbl@tempa{#5}&%
16147 \bbl@replace\bbl@tempa{,}{ ,}&% TODO. Ugly trick to preserve {}
16148 \expandafter\bbl@foreach\expandafter{\bbl@tempa}{&%
16149 \bbl@ifsamestring{##1}{remove}&%
16150 {\bbl@add@list\babeltempb{nil}}&%
16151 {\directlua{
16152 local rep = [=[##1]=]
16153 local three_args = '%s*=%s*([%-%d%.%a{}|]+)%s+([%-%d%.%a{}|]+)%s+([%-%d%.%a{}|]+)'
16154 &% Numeric passes directly: kern, penalty...
16155 rep = rep:gsub('^%s*(remove)%s*$', 'remove = true')
16156 rep = rep:gsub('^%s*(insert)%s*,', 'insert = true, ')
16157 rep = rep:gsub('^%s*(after)%s*,', 'after = true, ')
16158 rep = rep:gsub('(string)%s*=%s*([^%s,]*)', Babel.capture_func)
16159 rep = rep:gsub('node%s*=%s*(%a+)%s*(%a*)', Babel.capture_node)
16160 rep = rep:gsub( '(norule)' .. three_args,
16161 'norule = {' .. '%2, %3, %4' .. '}')
16162 if #1 == 0 or #1 == 2 then
16163 rep = rep:gsub( '(space)' .. three_args,
16164 'space = {' .. '%2, %3, %4' .. '}')
16165 rep = rep:gsub( '(spacefactor)' .. three_args,
16166 'spacefactor = {' .. '%2, %3, %4' .. '}')
16167 rep = rep:gsub('(kashida)%s*=%s*([^%s,]*)', Babel.capture_kashida)
16168 &% Transform values
16169 rep, n = rep:gsub( '{([%a%-%.]+)|([%a%_%.]+)}',
16170 function(v,d)
16171 return string.format (
16172 '{\the\csname bbl@id@@#3\endcsname,"%s",%s}',
16173 v,
16174 load( 'return Babel.locale_props'..
16175 '[\the\csname bbl@id@@#3\endcsname].' .. d)() )
16176 end )
16177 rep, n = rep:gsub( '{([%a%-%.]+)|([%-%d%.]+)}',
16178 '{\the\csname bbl@id@@#3\endcsname,"%1",%2}')
16179 end
16180 if #1 == 1 then
16181 rep = rep:gsub( '(no)%s*=%s*([^%s,]*)', Babel.capture_func)
16182 rep = rep:gsub( '(pre)%s*=%s*([^%s,]*)', Babel.capture_func)
16183 rep = rep:gsub( '(post)%s*=%s*([^%s,]*)', Babel.capture_func)
16184 end
16185 tex.print([[\string\babeltempa{{]] .. rep .. [[}}]])
16186 }}}&%
16187 \bbl@foreach\babeltempb{&%
16188 \bbl@forkv{{##1}}{&%
16189 \in@{,####1,}{,nil,step,data,remove,insert,string,no,pre,no,&%
16190 post,penalty,kashida,space,spacefactor,kern,node,after,norule,}&%
16191 \ifin@\else
16192 \bbl@error{bad-transform-option}{####1}{}{}&%
16193 \fi}}&%
16194 \let\bbl@kv@attribute\relax
16195 \let\bbl@kv@label\relax
16196 \let\bbl@kv@fonts\@empty
16197 \let\bbl@kv@prepend\relax
16198 \bbl@forkv{#2}{\bbl@csarg\edef{kv@##1}{##2}}&%
16199 \ifx\bbl@kv@fonts\@empty\else\bbl@settransfont\fi
16200 \ifx\bbl@kv@attribute\relax
16201 \ifx\bbl@kv@label\relax\else
16202 \bbl@exp{\\\bbl@trim@def\\\bbl@kv@fonts{\bbl@kv@fonts}}&%
16203 \bbl@replace\bbl@kv@fonts{ }{,}&%
16204 \edef\bbl@kv@attribute{bbl@ATR@\bbl@kv@label @#3@\bbl@kv@fonts}&%
16205 \count@\z@
16206 \def\bbl@elt##1##2##3{&%
16207 \bbl@ifsamestring{#3,\bbl@kv@label}{##1,##2}&%
16208 {\bbl@ifsamestring{\bbl@kv@fonts}{##3}&%
16209 {\count@\@ne}&%
16210 {\bbl@error{font-conflict-transforms}{}{}{}}}&%
16211 {}}&%
16212 \bbl@transfont@list
16213 \ifnum\count@=\z@
16214 \bbl@exp{\global\\\bbl@add\\\bbl@transfont@list
16215 {\\\bbl@elt{#3}{\bbl@kv@label}{\bbl@kv@fonts}}}&%
16216 \fi
16217 \bbl@ifunset{\bbl@kv@attribute}&%
16218 {\global\bbl@carg\newattribute{\bbl@kv@attribute}}&%
16219 {}&%
16220 \global\bbl@carg\setattribute{\bbl@kv@attribute}\@ne
16221 \fi
16222 \else
16223 \edef\bbl@kv@attribute{\expandafter\bbl@stripslash\bbl@kv@attribute}&%
16224 \fi
16225 \directlua{
16226 local lbkr = Babel.linebreaking.replacements[#1]
16227 local u = unicode.utf8
16228 local id, attr, label
16229 if #1 == 0 then
16230 id = \the\csname bbl@id@@#3\endcsname\space
16231 else
16232 id = \the\csname l@#3\endcsname\space
16233 end
16234 \ifx\bbl@kv@attribute\relax
16235 attr = -1
16236 \else
16237 attr = luatexbase.registernumber'\bbl@kv@attribute'
16238 \fi
16239 \ifx\bbl@kv@label\relax\else &% Same refs:
16240 label = [==[\bbl@kv@label]==]
16241 \fi
16242 &% Convert pattern:
16243 local patt = string.gsub([==[#4]==], '%s', '')
16244 if #1 == 0 then
16245 patt = string.gsub(patt, '|', ' ')
16246 end
16247 if not u.find(patt, '()', nil, true) then
16248 patt = '()' .. patt .. '()'
16249 end
16250 patt = string.gsub(patt, '%(%)%^', '^()')
16251 patt = string.gsub(patt, '%$%(%)', '()$')
16252 patt = u.gsub(patt, '{(.)}',
16253 function (n)
16254 return '%' .. (tonumber(n) and (tonumber(n)+1) or n)
16255 end)
16256 patt = u.gsub(patt, '{(%x%x%x%x+)}',
16257 function (n)
16258 return u.gsub(u.char(tonumber(n, 16)), '(%p)', '%%%1')
16259 end)
16260 lbkr[id] = lbkr[id] or {}
16261 table.insert(lbkr[id], \ifx\bbl@kv@prepend\relax\else 1,\fi
16262 { label=label, attr=attr, pattern=patt, replace={\babeltempb} })
16263 }&%
16264 \endgroup}
16265 \endgroup
16266 %
16267 \let\bbl@transfont@list\@empty
16268 \def\bbl@settransfont{%
16269 \global\let\bbl@settransfont\relax % Execute only once
16270 \gdef\bbl@transfont{%
16271 \def\bbl@elt####1####2####3{%
16272 \bbl@ifblank{####3}%
16273 {\count@\tw@}% Do nothing if no fonts
16274 {\count@\z@
16275 \bbl@vforeach{####3}{%
16276 \def\bbl@tempd{########1}%
16277 \edef\bbl@tempe{\bbl@transfam/\f@series/\f@shape}%
16278 \ifx\bbl@tempd\bbl@tempe
16279 \count@\@ne
16280 \else\ifx\bbl@tempd\bbl@transfam
16281 \count@\@ne
16282 \fi\fi}%
16283 \ifcase\count@
16284 \bbl@csarg\unsetattribute{ATR@####2@####1@####3}%
16285 \or
16286 \bbl@csarg\setattribute{ATR@####2@####1@####3}\@ne
16287 \fi}}%
16288 \bbl@transfont@list}%
16289 \AddToHook{selectfont}{\bbl@transfont}% Hooks are global.
16290 \gdef\bbl@transfam{-unknown-}%
16291 \bbl@foreach\bbl@font@fams{%
16292 \AddToHook{##1family}{\def\bbl@transfam{##1}}%
16293 \bbl@ifsamestring{\@nameuse{##1default}}\familydefault
16294 {\xdef\bbl@transfam{##1}}%
16295 {}}}
16296 %
16297 \DeclareRobustCommand\enablelocaletransform[1]{%
16298 \bbl@ifunset{bbl@ATR@#1@\languagename @}%
16299 {\bbl@error{transform-not-available}{#1}{}{}}%
16300 {\bbl@csarg\setattribute{ATR@#1@\languagename @}\@ne}}
16301 \DeclareRobustCommand\disablelocaletransform[1]{%
16302 \bbl@ifunset{bbl@ATR@#1@\languagename @}%
16303 {\bbl@error{transform-not-available-b}{#1}{}{}}%
16304 {\bbl@csarg\unsetattribute{ATR@#1@\languagename @}}}
16305 % \end{macrocode}
16306 %
16307 % The following two macros load the Lua code for transforms, but only
16308 % once. The only difference is in |add_after| and |add_before|.
16309 %
16310 % \begin{macrocode}
16311 \def\bbl@activateposthyphen{%
16312 \let\bbl@activateposthyphen\relax
16313 \ifx\bbl@attr@hboxed\@undefined
16314 \newattribute\bbl@attr@hboxed
16315 \fi
16316 \directlua{
16317 require('babel-transforms.lua')
16318 Babel.linebreaking.add_after(Babel.post_hyphenate_replace)
16319 }}
16320 \def\bbl@activateprehyphen{%
16321 \let\bbl@activateprehyphen\relax
16322 \ifx\bbl@attr@hboxed\@undefined
16323 \newattribute\bbl@attr@hboxed
16324 \fi
16325 \directlua{
16326 require('babel-transforms.lua')
16327 Babel.linebreaking.add_before(Babel.pre_hyphenate_replace)
16328 }}
16329 \newcommand\SetTransformValue[3]{%
16330 \directlua{
16331 Babel.locale_props[\the\csname bbl@id@@#1\endcsname].vars["#2"] = #3
16332 }}
16333 % \end{macrocode}
16334 %
16335 % The code in |babel-transforms.lua| prints at some points the current
16336 % string being transformed. This macro first make sure this file is
16337 % loaded. Then, activates temporarily this feature and typeset inside a
16338 % box the text in the argument.
16339 %
16340 % \begin{macrocode}
16341 \newcommand\ShowBabelTransforms[1]{%
16342 \bbl@activateprehyphen
16343 \bbl@activateposthyphen
16344 \begingroup
16345 \directlua{ Babel.show_transforms = true }%
16346 \setbox\z@\vbox{#1}%
16347 \directlua{ Babel.show_transforms = false }%
16348 \endgroup}
16349 % \end{macrocode}
16350 %
16351 % The following experimental (and unfinished) macro applies the
16352 % prehyphenation transforms for the current locale to a string
16353 % (characters and spaces) and processes it in a fully expandable way
16354 % (among other limitations, the string can’t contain |]==]|). The way
16355 % it operates is admittedly rather cumbersome: it converts the string
16356 % to a node list, processes it, and converts it back to a string. The
16357 % lua code is in the lua file below.
16358 %
16359 % \begin{macrocode}
16360 \newcommand\localeprehyphenation[1]{%
16361 \directlua{ Babel.string_prehyphenation([==[#1]==], \the\localeid) }}
16362 % \end{macrocode}
16363 %
16364 % \subsection{Bidi}
16365 %
16366 % As a first step, add a handler for bidi and digits (and potentially
16367 % other processes) just before \textsf{luaoftload} is applied, which is
16368 % loaded by default by \LaTeX. Just in case, consider the possibility
16369 % it has not been loaded.
16370 %
16371 % \begin{macrocode}
16372 \def\bbl@activate@preotf{%
16373 \let\bbl@activate@preotf\relax % only once
16374 \directlua{
16375 function Babel.pre_otfload_v(head)
16376 if Babel.numbers and Babel.digits_mapped then
16377 head = Babel.numbers(head)
16378 end
16379 if Babel.bidi_enabled then
16380 head = Babel.bidi(head, false, dir)
16381 end
16382 return head
16383 end
16384 %
16385 function Babel.pre_otfload_h(head, gc, sz, pt, dir)
16386 if Babel.numbers and Babel.digits_mapped then
16387 head = Babel.numbers(head)
16388 end
16389 if Babel.bidi_enabled then
16390 head = Babel.bidi(head, false, dir)
16391 end
16392 return head
16393 end
16394 %
16395 luatexbase.add_to_callback('pre_linebreak_filter',
16396 Babel.pre_otfload_v,
16397 'Babel.pre_otfload_v',
16398 Babel.priority_in_callback('pre_linebreak_filter',
16399 'luaotfload.node_processor') or nil)
16400 %
16401 luatexbase.add_to_callback('hpack_filter',
16402 Babel.pre_otfload_h,
16403 'Babel.pre_otfload_h',
16404 Babel.priority_in_callback('hpack_filter',
16405 'luaotfload.node_processor') or nil)
16406 }}
16407 % \end{macrocode}
16408 %
16409 % The basic setup. The output is modified at a very low level to set
16410 % the |\bodydir| to the |\pagedir|. Sadly, we have to deal with boxes
16411 % in math with basic, so the |\bbl@mathboxdir| hack is activated every
16412 % math with the package option bidi=. The hack for the PUA is no longer
16413 % necessary with |basic| (24.8), but it’s kept in |basic-r|.
16414 %
16415 % \begin{macrocode}
16416 \ifnum\bbl@bidimode>\@ne % Any bidi= except default (=1)
16417 \let\bbl@beforeforeign\leavevmode
16418 \AtEndOfPackage{\EnableBabelHook{babel-bidi}}
16419 \RequirePackage{luatexbase}
16420 \bbl@activate@preotf
16421 \directlua{
16422 require('babel-data-bidi.lua')
16423 \ifcase\expandafter\@gobbletwo\the\bbl@bidimode\or
16424 require('babel-bidi-basic.lua')
16425 \or
16426 require('babel-bidi-basic-r.lua')
16427 table.insert(Babel.ranges, {0xE000, 0xF8FF, 'on'})
16428 table.insert(Babel.ranges, {0xF0000, 0xFFFFD, 'on'})
16429 table.insert(Babel.ranges, {0x100000, 0x10FFFD, 'on'})
16430 \fi}
16431 \newattribute\bbl@attr@dir
16432 \directlua{ Babel.attr_dir = luatexbase.registernumber'bbl@attr@dir' }
16433 \bbl@exp{\output{\bodydir\pagedir\the\output}}
16434 \fi
16435 %
16436 \chardef\bbl@thetextdir\z@
16437 \chardef\bbl@thepardir\z@
16438 \def\bbl@setluadir#1#2{% 1=\text/pardirection 2= 0:l 1:r 2:al
16439 \ifcase#2\relax
16440 \ifcase#1\else#1=\z@\fi
16441 \else
16442 \ifcase#1#1=\@ne\fi
16443 \fi}
16444 % \end{macrocode}
16445 %
16446 % |\bbl@attr@dir| stores the directions with a mask: |..00PPTT|, with
16447 % masks 0xC (|PP| is the par dir) and 0x3 (|TT| is the text dir). These
16448 % macro names are shared by the 3 engines, with different definitions.
16449 %
16450 % \begin{macrocode}
16451 \def\bbl@thedir{0}
16452 \def\bbl@textdir#1{%
16453 \bbl@setluadir\textdirection{#1}%
16454 \chardef\bbl@thetextdir#1\relax
16455 \edef\bbl@thedir{\the\numexpr\bbl@thepardir*4+#1}%
16456 \setattribute\bbl@attr@dir{\numexpr\bbl@thepardir*4+#1}}
16457 \def\bbl@pardir#1{% Used twice
16458 \bbl@setluadir\pardirection{#1}%
16459 \chardef\bbl@thepardir#1\relax}
16460 \def\bbl@bodydir{\bbl@setluadir\bodydirection}% Used once
16461 \def\bbl@dirparastext{\pardirection=\textdirection\relax}% Used once
16462 % \end{macrocode}
16463 %
16464 % RTL text inside math needs special attention. It affects not only to
16465 % actual math stuff, but also to `tabular`, which is based on a fake
16466 % math.
16467 %
16468 % \begin{macrocode}
16469 \ifnum\bbl@bidimode>\z@ % Any bidi=
16470 \def\bbl@insidemath{0}%
16471 \def\bbl@everymath{\def\bbl@insidemath{1}}
16472 \def\bbl@everydisplay{\def\bbl@insidemath{2}}
16473 \frozen@everymath\expandafter{%
16474 \expandafter\bbl@everymath\the\frozen@everymath}
16475 \frozen@everydisplay\expandafter{%
16476 \expandafter\bbl@everydisplay\the\frozen@everydisplay}
16477 \AtBeginDocument{
16478 \directlua{
16479 function Babel.math_box_dir(head)
16480 if not (token.get_macro('bbl@insidemath') == '0') then
16481 if Babel.hlist_has_bidi(head) then
16482 local d = node.new(node.id'dir')
16483 d.dir = '+TRT'
16484 for item in node.traverse(head) do
16485 if item.id == 11 or item.id == node.id'glyph' then
16486 head = node.insert_before(head, item, d)
16487 break
16488 end
16489 end
16490 local inmath = false
16491 for item in node.traverse(head) do
16492 if item.id == 11 then
16493 inmath = (item.subtype == 0)
16494 elseif not inmath then
16495 node.set_attribute(item,
16496 Babel.attr_dir, token.get_macro('bbl@thedir'))
16497 end
16498 end
16499 end
16500 end
16501 return head
16502 end
16503 luatexbase.add_to_callback("hpack_filter", Babel.math_box_dir,
16504 "Babel.math_box_dir", 0)
16505 if Babel.unset_atdir then
16506 luatexbase.add_to_callback("pre_linebreak_filter", Babel.unset_atdir,
16507 "Babel.unset_atdir")
16508 luatexbase.add_to_callback("hpack_filter", Babel.unset_atdir,
16509 "Babel.unset_atdir")
16510 end
16511 luatexbase.add_to_callback("post_mlist_to_hlist_filter", function(head)
16512 local dir = tex.mathdirection
16513 local n = node.new("dir")
16514 n.direction = dir
16515 head = node.insert_before(head,head,n)
16516 n = node.new("dir",1)
16517 n.direction = dir
16518 head = node.insert_after(head,node.tail(head),n)
16519 return head
16520 end,"Babel.ensure_math_dir")
16521 }}%
16522 \fi
16523 % \end{macrocode}
16524 %
16525 % Experimental. Tentative name.
16526 %
16527 % \begin{macrocode}
16528 \DeclareRobustCommand\localebox[1]{%
16529 {\def\bbl@insidemath{0}%
16530 \mbox{\foreignlanguage{\languagename}{#1}}}}
16531 % \end{macrocode}
16532 %
16533 % \subsection{Layout}
16534 %
16535 % Unlike \xetex{}, \luatex{} requires only minimal changes for
16536 % right-to-left layouts, particularly in monolingual documents (the
16537 % engine itself reverses boxes -- including column order or headings
16538 % --, margins, etc.)\ with |bidi=basic|, without having to patch
16539 % almost any macro where text direction is relevant.
16540 %
16541 % Still, there are three areas deserving special attention, namely,
16542 % tabular, math, and graphics, text and intrinsically left-to-right
16543 % elements are intermingled. I've made some progress in graphics, but
16544 % they're essentially hacks; I've also made some progress in `tabular`,
16545 % but when I decided to tackle math (both standard math and `amsmath`)
16546 % the nightmare began. I'm still not sure how `amsmath` should be
16547 % modified, but the main problem is that, boxes are “generic”
16548 % containers that can hold text, math, and graphics (even at the same
16549 % time; remember that inline math is included in the list of text nodes
16550 % marked with 'math' (11) nodes too).
16551 %
16552 % |\@hangfrom| is useful in many contexts and it is redefined always
16553 % with the |layout| option.
16554 %
16555 % There are, however, a number of issues when the text direction is not
16556 % the same as the box direction (as set by |\bodydir|), and when
16557 % |\parbox| and |\hangindent| are involved. Fortunately, latest
16558 % releases of \luatex{} simplify a lot the solution with |\shapemode|.
16559 %
16560 % With the issue \#15 I realized commands are best patched, instead of
16561 % redefined. With a few lines, a modification could be applied to
16562 % several classes and packages. Now, |tabular| seems to work (at least
16563 % in simple cases) with \textsf{array}, \textsf{tabularx},
16564 % \textsf{hhline}, \textsf{colortbl}, \textsf{longtable},
16565 % \textsf{booktabs}, etc. However, \textsf{dcolumn} still fails.
16566 %
16567 % \begin{macrocode}
16568 \bbl@trace{Redefinitions for bidi layout}
16569 %
16570 %<<*More package options>>
16571 \chardef\bbl@eqnpos\z@
16572 \DeclareOption{leqno}{\chardef\bbl@eqnpos\@ne}
16573 \DeclareOption{fleqn}{\chardef\bbl@eqnpos\tw@}
16574 %<</More package options>>
16575 %
16576 \ifnum\bbl@bidimode>\z@ % Any bidi=
16577 \matheqdirmode\@ne % Several luatex primitives.
16578 \mathemptydisplaymode\@ne % For fixes.
16579 \breakafterdirmode\@ne %
16580 \fixupboxesmode\@ne %
16581 \let\bbl@eqnodir\relax
16582 \def\bbl@eqdel{()}
16583 \def\bbl@eqnum{%
16584 {\normalfont\normalcolor
16585 \expandafter\@firstoftwo\bbl@eqdel
16586 \theequation
16587 \expandafter\@secondoftwo\bbl@eqdel}}
16588 \def\bbl@puteqno#1{\eqno\hbox{#1}}
16589 \def\bbl@putleqno#1{\leqno\hbox{#1}}
16590 \def\bbl@eqno@flip#1{% So
16591 \ifdim\predisplaysize=-\maxdimen % For consecutive displays
16592 \eqno
16593 \hb@[email protected]{%
16594 \hb@xt@\displaywidth{\hss{#1\glet\bbl@upset\@currentlabel}}\hss}%
16595 \else
16596 \leqno\hbox{#1\glet\bbl@upset\@currentlabel}%
16597 \fi
16598 \bbl@exp{\def\\\@currentlabel{\[bbl@upset]}}}
16599 \def\bbl@leqno@flip#1{%
16600 \ifdim\predisplaysize=-\maxdimen % For consecutive displays
16601 \leqno
16602 \hb@[email protected]{%
16603 \hss\hb@xt@\displaywidth{{#1\glet\bbl@upset\@currentlabel}\hss}}%
16604 \else
16605 \eqno\hbox{#1\glet\bbl@upset\@currentlabel}%
16606 \fi
16607 \bbl@exp{\def\\\@currentlabel{\[bbl@upset]}}}
16608 %
16609 \AtBeginDocument{%
16610 \ifx\bbl@noamsmath\relax\else
16611 \ifx\maketag@@@\@undefined % Normal equation, eqnarray
16612 \ifnum\bbl@eqnpos=\tw@
16613 \bbl@replace\equation{\hb@xt@\linewidth}%
16614 {\hbox bdir\mathdirection to\linewidth}%
16615 \bbl@carg\bbl@sreplace{[ }{\hb@xt@\linewidth}%
16616 {\hbox bdir\mathdirection to\linewidth}%
16617 \fi
16618 \AddToHook{env/equation/begin}{%
16619 \ifnum\bbl@thetextdir>\z@
16620 \def\bbl@mathboxdir{\def\bbl@insidemath{1}}%
16621 \let\@eqnnum\bbl@eqnum
16622 \edef\bbl@eqnodir{\noexpand\bbl@textdir{\the\bbl@thetextdir}}%
16623 \chardef\bbl@thetextdir\z@
16624 \bbl@add\normalfont{\bbl@eqnodir}%
16625 \ifcase\bbl@eqnpos
16626 \let\bbl@puteqno\bbl@eqno@flip
16627 \or
16628 \let\bbl@puteqno\bbl@leqno@flip
16629 \fi
16630 \fi}%
16631 \ifnum\bbl@eqnpos=\tw@\else
16632 \def\endequation{\bbl@puteqno{\@eqnnum}$$\@ignoretrue}%
16633 \fi
16634 \AddToHook{env/eqnarray/begin}{%
16635 \ifnum\bbl@thetextdir>\z@
16636 \def\bbl@mathboxdir{\def\bbl@insidemath{1}}%
16637 \edef\bbl@eqnodir{\noexpand\bbl@textdir{\the\bbl@thetextdir}}%
16638 \chardef\bbl@thetextdir\z@
16639 \bbl@add\normalfont{\bbl@eqnodir}%
16640 \ifnum\bbl@eqnpos=\@ne
16641 \def\@eqnnum{%
16642 \setbox\z@\hbox{\bbl@eqnum}%
16643 \hbox to0.01pt{\hss\hbox to\displaywidth{\box\z@\hss}}}%
16644 \else
16645 \let\@eqnnum\bbl@eqnum
16646 \fi
16647 \fi}
16648 \else % amstex
16649 \ifnum\bbl@eqnpos=\tw@
16650 \bbl@exp{% Hack to hide maybe undefined conditionals:
16651 \\\bbl@sreplace\\\multline@\crcr{\<if@fleqn>\tabskip\z@skip\<fi>\crcr}}%
16652 \fi
16653 \bbl@exp{% Hack to hide maybe undefined conditionals:
16654 \chardef\bbl@eqnpos=0%
16655 \<iftagsleft@>1\<else>\<if@fleqn>2\<fi>\<fi>\relax}%
16656 \ifnum\bbl@eqnpos=\@ne
16657 \let\bbl@ams@lap\hbox
16658 \else
16659 \let\bbl@ams@lap\llap
16660 \fi
16661 \ExplSyntaxOn % Required by \bbl@sreplace with \intertext@
16662 \bbl@sreplace\intertext@{\normalbaselines}%
16663 {\normalbaselines
16664 \ifx\bbl@eqnodir\relax\else\bbl@pardir\@ne\bbl@eqnodir\fi}%
16665 \ExplSyntaxOff
16666 \def\bbl@ams@tagbox#1#2{#1{\bbl@eqnodir#2}}% #1=hbox|@lap|flip
16667 \ifx\bbl@ams@lap\hbox % leqno
16668 \def\bbl@ams@flip#1{%
16669 \hbox to 0.01pt{\hss\hbox to\displaywidth{{#1}\hss}}}%
16670 \else % eqno
16671 \def\bbl@ams@flip#1{%
16672 \hbox to 0.01pt{\hbox to\displaywidth{\hss{#1}}\hss}}%
16673 \fi
16674 \def\bbl@ams@preset#1{%
16675 \def\bbl@mathboxdir{\def\bbl@insidemath{1}}%
16676 \ifnum\bbl@thetextdir>\z@
16677 \edef\bbl@eqnodir{\noexpand\bbl@textdir{\the\bbl@thetextdir}}%
16678 \bbl@sreplace\textdef@{\hbox}{\bbl@ams@tagbox\hbox}%
16679 \bbl@sreplace\maketag@@@{\hbox}{\bbl@ams@tagbox#1}%
16680 \fi}%
16681 \def\bbl@ams@equation{%
16682 \def\bbl@mathboxdir{\def\bbl@insidemath{1}}%
16683 \ifnum\bbl@thetextdir>\z@
16684 \edef\bbl@eqnodir{\noexpand\bbl@textdir{\the\bbl@thetextdir}}%
16685 \chardef\bbl@thetextdir\z@
16686 \bbl@add\normalfont{\bbl@eqnodir}%
16687 \ifcase\bbl@eqnpos
16688 \def\veqno##1##2{\bbl@eqno@flip{##1##2}}%
16689 \or
16690 \def\veqno##1##2{\bbl@leqno@flip{##1##2}}%
16691 \fi
16692 \fi}%
16693 \AddToHook{env/equation/begin}{\bbl@ams@equation}%
16694 \AddToHook{env/equation*/begin}{\bbl@ams@equation}%
16695 \AddToHook{env/cases/begin}{\bbl@ams@preset\bbl@ams@lap}%
16696 \AddToHook{env/multline/begin}{\bbl@ams@preset\hbox}%
16697 \AddToHook{env/gather/begin}{\bbl@ams@preset\bbl@ams@lap}%
16698 \AddToHook{env/gather*/begin}{\bbl@ams@preset\bbl@ams@lap}%
16699 \AddToHook{env/align/begin}{\bbl@ams@preset\bbl@ams@lap}%
16700 \AddToHook{env/align*/begin}{\bbl@ams@preset\bbl@ams@lap}%
16701 \AddToHook{env/alignat/begin}{\bbl@ams@preset\bbl@ams@lap}%
16702 \AddToHook{env/alignat*/begin}{\bbl@ams@preset\bbl@ams@lap}%
16703 \AddToHook{env/eqnalign/begin}{\bbl@ams@preset\hbox}%
16704 % Hackish, for proper alignment. Don’t ask me why it works!:
16705 \bbl@exp{% Avoid a 'visible' conditional
16706 \\\AddToHook{env/align*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}%
16707 \\\AddToHook{env/alignat*/end}{\<iftag@>\<else>\\\tag*{}\<fi>}}%
16708 \AddToHook{env/flalign/begin}{\bbl@ams@preset\hbox}%
16709 \AddToHook{env/split/before}{%
16710 \def\bbl@mathboxdir{\def\bbl@insidemath{1}}%
16711 \ifnum\bbl@thetextdir>\z@
16712 \bbl@ifsamestring\@currenvir{equation}%
16713 {\ifx\bbl@ams@lap\hbox % leqno
16714 \def\bbl@ams@flip#1{%
16715 \hbox to 0.01pt{\hbox to\displaywidth{{#1}\hss}\hss}}%
16716 \else
16717 \def\bbl@ams@flip#1{%
16718 \hbox to 0.01pt{\hss\hbox to\displaywidth{\hss{#1}}}}%
16719 \fi}%
16720 {}%
16721 \fi}%
16722 \fi\fi}
16723 \fi
16724 % \end{macrocode}
16725 %
16726 % Declarations specific to lua, called by |\babelprovide|.
16727 %
16728 % \begin{macrocode}
16729 \def\bbl@provide@extra#1{%
16730 % == onchar ==
16731 \ifx\bbl@KVP@onchar\@nnil\else
16732 \bbl@luahyphenate
16733 \bbl@exp{%
16734 \\\AddToHook{env/document/before}{%
16735 {\let\\\bbl@ifrestoring\\\@firstoftwo
16736 \\\select@language{#1}{}}}}%
16737 \directlua{
16738 if Babel.locale_mapped == nil then
16739 Babel.locale_mapped = true
16740 Babel.linebreaking.add_before(Babel.locale_map, 1)
16741 Babel.loc_to_scr = {}
16742 Babel.chr_to_loc = Babel.chr_to_loc or {}
16743 end
16744 Babel.locale_props[\the\localeid].letters = false
16745 }%
16746 \bbl@xin@{ letters }{ \bbl@KVP@onchar\space}%
16747 \ifin@
16748 \directlua{
16749 Babel.locale_props[\the\localeid].letters = true
16750 }%
16751 \fi
16752 \bbl@xin@{ ids }{ \bbl@KVP@onchar\space}%
16753 \ifin@
16754 \ifx\bbl@starthyphens\@undefined % Needed if no explicit selection
16755 \AddBabelHook{babel-onchar}{beforestart}{{\bbl@starthyphens}}%
16756 \fi
16757 \bbl@exp{\\\bbl@add\\\bbl@starthyphens
16758 {\\\bbl@patterns@lua{\languagename}}}%
16759 \directlua{
16760 if Babel.script_blocks['\bbl@cl{sbcp}'] then
16761 Babel.loc_to_scr[\the\localeid] = Babel.script_blocks['\bbl@cl{sbcp}']
16762 Babel.locale_props[\the\localeid].lg = \the\@nameuse{l@\languagename}\space
16763 end
16764 }%
16765 \fi
16766 \bbl@xin@{ fonts }{ \bbl@KVP@onchar\space}%
16767 \ifin@
16768 \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}%
16769 \bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}%
16770 \directlua{
16771 if Babel.script_blocks['\bbl@cl{sbcp}'] then
16772 Babel.loc_to_scr[\the\localeid] =
16773 Babel.script_blocks['\bbl@cl{sbcp}']
16774 end}%
16775 \ifx\bbl@mapselect\@undefined
16776 \AtBeginDocument{%
16777 \bbl@patchfont{{\bbl@mapselect}}%
16778 {\selectfont}}%
16779 \def\bbl@mapselect{%
16780 \let\bbl@mapselect\relax
16781 \edef\bbl@prefontid{\fontid\font}}%
16782 \def\bbl@mapdir##1{%
16783 \begingroup
16784 \setbox\z@\hbox{% Force text mode
16785 \def\languagename{##1}%
16786 \let\bbl@ifrestoring\@firstoftwo % To avoid font warning
16787 \bbl@switchfont
16788 \ifnum\fontid\font>\z@ % A hack, for the pgf nullfont hack
16789 \directlua{
16790 Babel.locale_props[\the\csname bbl@id@@##1\endcsname]%
16791 ['/\bbl@prefontid'] = \fontid\font\space}%
16792 \fi}%
16793 \endgroup}%
16794 \fi
16795 \bbl@exp{\\\bbl@add\\\bbl@mapselect{\\\bbl@mapdir{\languagename}}}%
16796 \fi
16797 \fi
16798 % == mapfont ==
16799 % For bidi texts, to switch the font based on direction. Deprecated
16800 \ifx\bbl@KVP@mapfont\@nnil\else
16801 \bbl@ifsamestring{\bbl@KVP@mapfont}{direction}{}%
16802 {\bbl@error{unknown-mapfont}{}{}{}}%
16803 \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}%
16804 \bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}%
16805 \ifx\bbl@mapselect\@undefined
16806 \AtBeginDocument{%
16807 \bbl@patchfont{{\bbl@mapselect}}%
16808 {\selectfont}}%
16809 \def\bbl@mapselect{%
16810 \let\bbl@mapselect\relax
16811 \edef\bbl@prefontid{\fontid\font}}%
16812 \def\bbl@mapdir##1{%
16813 {\def\languagename{##1}%
16814 \let\bbl@ifrestoring\@firstoftwo % avoid font warning
16815 \bbl@switchfont
16816 \directlua{Babel.fontmap
16817 [\the\csname bbl@wdir@##1\endcsname]%
16818 [\bbl@prefontid]=\fontid\font}}}%
16819 \fi
16820 \bbl@exp{\\\bbl@add\\\bbl@mapselect{\\\bbl@mapdir{\languagename}}}%
16821 \fi
16822 % == Line breaking: CJK quotes ==
16823 \ifcase\bbl@engine\or
16824 \bbl@xin@{/c}{/\bbl@cl{lnbrk}}%
16825 \ifin@
16826 \bbl@ifunset{bbl@quote@\languagename}{}%
16827 {\directlua{
16828 Babel.locale_props[\the\localeid].cjk_quotes = {}
16829 local cs = 'op'
16830 for c in string.utfvalues(%
16831 [[\csname bbl@quote@\languagename\endcsname]]) do
16832 if Babel.cjk_characters[c].c == 'qu' then
16833 Babel.locale_props[\the\localeid].cjk_quotes[c] = cs
16834 end
16835 cs = ( cs == 'op') and 'cl' or 'op'
16836 end
16837 }}%
16838 \fi
16839 \fi
16840 % == Counters: mapdigits ==
16841 % Native digits
16842 \ifx\bbl@KVP@mapdigits\@nnil\else
16843 \bbl@ifunset{bbl@dgnat@\languagename}{}%
16844 {\bbl@activate@preotf
16845 \directlua{
16846 Babel.digits_mapped = true
16847 Babel.digits = Babel.digits or {}
16848 Babel.digits[\the\localeid] =
16849 table.pack(string.utfvalue('\bbl@cl{dgnat}'))
16850 if not Babel.numbers then
16851 function Babel.numbers(head)
16852 local LOCALE = Babel.attr_locale
16853 local GLYPH = node.id'glyph'
16854 local inmath = false
16855 for item in node.traverse(head) do
16856 if not inmath and item.id == GLYPH then
16857 local temp = node.get_attribute(item, LOCALE)
16858 if Babel.digits[temp] then
16859 local chr = item.char
16860 if chr > 47 and chr < 58 then
16861 item.char = Babel.digits[temp][chr-47]
16862 end
16863 end
16864 elseif item.id == node.id'math' then
16865 inmath = (item.subtype == 0)
16866 end
16867 end
16868 return head
16869 end
16870 end
16871 }}%
16872 \fi
16873 % == transforms ==
16874 \ifx\bbl@KVP@transforms\@nnil\else
16875 \def\bbl@elt##1##2##3{%
16876 \in@{$transforms.}{$##1}%
16877 \ifin@
16878 \def\bbl@tempa{##1}%
16879 \bbl@replace\bbl@tempa{transforms.}{}%
16880 \bbl@carg\bbl@transforms{babel\bbl@tempa}{##2}{##3}%
16881 \fi}%
16882 \bbl@exp{%
16883 \\\bbl@ifblank{\bbl@cl{dgnat}}%
16884 {\let\\\bbl@tempa\relax}%
16885 {\def\\\bbl@tempa{%
16886 \\\bbl@elt{transforms.prehyphenation}%
16887 {digits.native.1.0}{([0-9])}%
16888 \\\bbl@elt{transforms.prehyphenation}%
16889 {digits.native.1.1}{string={1\string|0123456789\string|\bbl@cl{dgnat}}}}}}%
16890 \ifx\bbl@tempa\relax\else
16891 \toks@\expandafter\expandafter\expandafter{%
16892 \csname bbl@inidata@\languagename\endcsname}%
16893 \bbl@csarg\edef{inidata@\languagename}{%
16894 \unexpanded\expandafter{\bbl@tempa}%
16895 \the\toks@}%
16896 \fi
16897 \csname bbl@inidata@\languagename\endcsname
16898 \bbl@release@transforms\relax % \relax closes the last item.
16899 \fi}
16900 % \end{macrocode}
16901 %
16902 % Start tabular here:
16903 %
16904 % \begin{macrocode}
16905 \def\localerestoredirs{%
16906 \ifcase\bbl@thetextdir
16907 \ifnum\textdirection=\z@\else\textdirection=\z@\fi
16908 \else
16909 \ifnum\textdirection=\@ne\else\textdirection=\@ne\fi
16910 \fi
16911 \ifcase\bbl@thepardir
16912 \ifnum\pardirection=\z@\else\pardirection=\z@\bodydirection=\z@\fi
16913 \else
16914 \ifnum\pardirection=\@ne\else\pardirection=\@ne\bodydirection=\@ne\fi
16915 \fi}
16916 %
16917 \IfBabelLayout{tabular}%
16918 {\chardef\bbl@tabular@mode\tw@}% All RTL
16919 {\IfBabelLayout{notabular}%
16920 {\chardef\bbl@tabular@mode\z@}%
16921 {\chardef\bbl@tabular@mode\@ne}}% Mixed, with LTR cols
16922 %
16923 \ifnum\bbl@bidimode>\@ne % Any lua bidi= except default=1
16924 % Redefine: vrules mess up dirs (why?).
16925 \AtBeginDocument{\def\@arstrut{\relax\copy\@arstrutbox}}%
16926 \ifcase\bbl@tabular@mode\or % 1 = Mixed - default
16927 \let\bbl@parabefore\relax
16928 \AddToHook{para/before}{\bbl@parabefore}
16929 \AtBeginDocument{%
16930 \bbl@replace\@tabular{$}{$%
16931 \def\bbl@insidemath{0}%
16932 \def\bbl@parabefore{\localerestoredirs}}%
16933 \ifnum\bbl@tabular@mode=\@ne
16934 \bbl@ifunset{@tabclassz}{}{%
16935 \bbl@exp{% Hide conditionals
16936 \\\bbl@sreplace\\\@tabclassz
16937 {\<ifcase>\\\@chnum}%
16938 {\\\localerestoredirs\<ifcase>\\\@chnum}}}%
16939 \@ifpackageloaded{colortbl}%
16940 {\bbl@sreplace\@classz
16941 {\hbox\bgroup\bgroup}{\hbox\bgroup\bgroup\localerestoredirs}}%
16942 {\@ifpackageloaded{array}%
16943 {\bbl@exp{% Hide conditionals
16944 \\\bbl@sreplace\\\@classz
16945 {\<ifcase>\\\@chnum}%
16946 {\bgroup\\\localerestoredirs\<ifcase>\\\@chnum}%
16947 \\\bbl@sreplace\\\@classz
16948 {\\\do@row@strut\<fi>}{\\\do@row@strut\<fi>\egroup}}}%
16949 {}}%
16950 \fi}%
16951 \or % 2 = All RTL - tabular
16952 \let\bbl@parabefore\relax
16953 \AddToHook{para/before}{\bbl@parabefore}%
16954 \AtBeginDocument{%
16955 \@ifpackageloaded{colortbl}%
16956 {\bbl@replace\@tabular{$}{$%
16957 \def\bbl@insidemath{0}%
16958 \def\bbl@parabefore{\localerestoredirs}}%
16959 \bbl@sreplace\@classz
16960 {\hbox\bgroup\bgroup}{\hbox\bgroup\bgroup\localerestoredirs}}%
16961 {}}%
16962 \fi
16963 % \end{macrocode}
16964 %
16965 % Very likely the |\output| routine must be patched in a quite general
16966 % way to make sure the |\bodydir| is set to |\pagedir|. Note outside
16967 % |\output| they can be different (and often are). For the moment, two
16968 % \textit{ad hoc} changes.
16969 %
16970 % \begin{macrocode}
16971 \AtBeginDocument{%
16972 \@ifpackageloaded{multicol}%
16973 {\toks@\expandafter{\multi@column@out}%
16974 \edef\multi@column@out{\bodydir\pagedir\the\toks@}}%
16975 {}%
16976 \@ifpackageloaded{paracol}%
16977 {\edef\pcol@output{%
16978 \bodydir\pagedir\unexpanded\expandafter{\pcol@output}}}%
16979 {}}%
16980 \fi
16981 % \end{macrocode}
16982 %
16983 % Finish here if there in no |layout|.
16984 %
16985 % \begin{macrocode}
16986 \ifx\bbl@opt@layout\@nnil\endinput\fi
16987 % \end{macrocode}
16988 %
16989 % \textsc{Omega} provided a companion to |\mathdir| (|\nextfakemath|)
16990 % for those cases where we did not want it to be applied, so that the
16991 % writing direction of the main text was left unchanged.
16992 % |\bbl@nextfake| is an attempt to emulate it, because \luatex{} has
16993 % removed it without an alternative. Used in tabular, |\underline| and
16994 % |\LaTeX|. Also, |\hangindent| does not honour direction changes by
16995 % default, so we need to redefine |\@hangfrom|.
16996 %
16997 % \begin{macrocode}
16998 \chardef\bbl@trace@vboxdir\z@
16999 \ifnum\bbl@bidimode>\z@ % Any bidi=
17000 \def\bbl@nextfake#1{% non-local changes, use always inside a group!
17001 \bbl@exp{%
17002 \mathdir\the\bodydir
17003 #1% Once entered in math, set boxes to restore values
17004 \def\\\bbl@insidemath{0}%
17005 \<ifmmode>%
17006 \everyvbox{%
17007 \the\everyvbox
17008 \bodydir\the\bodydir
17009 \mathdir\the\mathdir
17010 \everyhbox{\the\everyhbox}%
17011 \everyvbox{\the\everyvbox}}%
17012 \everyhbox{%
17013 \the\everyhbox
17014 \bodydir\the\bodydir
17015 \mathdir\the\mathdir
17016 \everyhbox{\the\everyhbox}%
17017 \everyvbox{\the\everyvbox}}%
17018 \<fi>}}%
17019 \IfBabelLayout{nopars}{}
17020 {\edef\bbl@opt@layout{\bbl@[email protected].}}%
17021 \IfBabelLayout{pars}
17022 {\chardef\bbl@trace@vboxdir\@ne
17023 \def\@hangfrom#1{%
17024 \setbox\@tempboxa\hbox{{#1}}%
17025 \hangindent\wd\@tempboxa
17026 \ifnum\bbl@vbox@bodydir=\pardirection\else
17027 \shapemode\@ne
17028 \fi
17029 \noindent\box\@tempboxa}}
17030 {}
17031 \fi
17032 %
17033 \IfBabelLayout{tabular}
17034 {\let\bbl@OL@@tabular\@tabular
17035 \bbl@exp{\\\in@{\\\UseMathForPositioningText}{\[@tabular]}}%
17036 \ifin@
17037 \bbl@replace\@tabular{\UseMathForPositioningText$}%
17038 {\bbl@nextfake{\UseMathForPositioningText$}}%
17039 \else
17040 \bbl@replace\@tabular{$}{\bbl@nextfake$}%
17041 \fi
17042 \let\bbl@NL@@tabular\@tabular
17043 \AtBeginDocument{%
17044 \ifx\bbl@NL@@tabular\@tabular\else
17045 \bbl@exp{\\\in@{\\\UseMathForPositioningText}{\[@tabular]}}%
17046 \ifin@\else
17047 \ifin@
17048 \bbl@replace\@tabular{\UseMathForPositioningText$}%
17049 {\bbl@nextfake{\UseMathForPositioningText$}}%
17050 \else
17051 \bbl@replace\@tabular{$}{\bbl@nextfake$}%
17052 \fi
17053 \fi
17054 \let\bbl@NL@@tabular\@tabular
17055 \fi}}
17056 {}
17057 % \end{macrocode}
17058 %
17059 % We need to patch lists in documents with both LTR and RTL paragraphs.
17060 % See issue \#395 in GitHub. There was a partial solution, but a better
17061 % one has been devised by Udi Fogiel (in 26.4).
17062 %
17063 % \begin{macrocode}
17064 \IfBabelLayout{lists}
17065 {\chardef\bbl@trace@vboxdir\@ne
17066 \let\bbl@OL@list\list
17067 \bbl@sreplace\list{\parshape}{\bbl@listparshape}%
17068 \let\bbl@NL@list\list
17069 \def\bbl@listparshape#1#2#3{%
17070 \parshape #1 #2 #3 %
17071 \ifnum\bbl@vbox@bodydir=\pardirection\else
17072 \shapemode\tw@
17073 \fi}}
17074 {}
17075 %
17076 \ifcase\bbl@trace@vboxdir\else
17077 \AtBeginDocument{\chardef\bbl@vbox@bodydir\pagedirection}%
17078 \def\bbl@vbox@lists{\chardef\bbl@vbox@bodydir\bodydirection}%
17079 \let\bbl@bidi@vbox\everyvbox
17080 \@nameuse{newtoks}\everyvbox % \outer in Plain
17081 \everyvbox\expandafter{\the\bbl@bidi@vbox}%
17082 \bbl@bidi@vbox{\bbl@vbox@lists\the\everyvbox}%
17083 \fi
17084 %
17085 \IfBabelLayout{graphics}
17086 {\let\bbl@pictresetdir\relax
17087 \def\bbl@pictsetdir#1{%
17088 \ifcase\bbl@thetextdir
17089 \let\bbl@pictresetdir\relax
17090 \else
17091 \ifcase#1\bodydir TLT % Remember this sets the inner boxes
17092 \or\textdir TLT
17093 \else\bodydir TLT \textdir TLT
17094 \fi
17095 % \(text|par)dir required in pgf:
17096 \def\bbl@pictresetdir{\bodydir TRT\pardir TRT\textdir TRT\relax}%
17097 \fi}%
17098 \AddToHook{env/picture/begin}{\bbl@pictsetdir\tw@}%
17099 \directlua{
17100 Babel.get_picture_dir = true
17101 Babel.picture_has_bidi = 0
17102 %
17103 function Babel.picture_dir (head)
17104 if not Babel.get_picture_dir then return head end
17105 if Babel.hlist_has_bidi(head) then
17106 Babel.picture_has_bidi = 1
17107 end
17108 return head
17109 end
17110 luatexbase.add_to_callback("hpack_filter", Babel.picture_dir,
17111 "Babel.picture_dir")
17112 }%
17113 \AddToHook{package/graphics/after}{%
17114 \bbl@exp{%
17115 \\\bbl@sreplace\\\rotatebox{\hbox{{\string#2}}}
17116 {\hbox bdir\z@{\hbox bdir\<ifcase>\bbl@thetextdir\z@\<else>\@ne\<fi>{{\string#2}}}}}}
17117 \AddToHook{package/graphicx/after}{%
17118 \bbl@exp{%
17119 \\\bbl@sreplace\\\Grot@box@std{\hbox{{\string#2}}}
17120 {\hbox bdir\z@{\hbox bdir\<ifcase>\bbl@thetextdir\z@\<else>\@ne\<fi>{{\string#2}}}}%
17121 \\\bbl@sreplace\\\Grot@box@kv{\hbox{\string#3}}
17122 {{\hbox bdir\z@}{\hbox bdir\<ifcase>\bbl@thetextdir\z@\<else>\@ne\<fi>{{\string#3}}}}%
17123 \\\bbl@sreplace\\\Grot@box{\hbox}{\hbox bdir\z@}}}
17124 \AtBeginDocument{%
17125 \long\def\put(#1,#2)#3{%
17126 \@killglue
17127 % Try:
17128 \ifx\bbl@pictresetdir\relax
17129 \def\bbl@tempc{0}%
17130 \else
17131 \directlua{
17132 Babel.get_picture_dir = true
17133 Babel.picture_has_bidi = 0
17134 }%
17135 \setbox\z@\hb@xt@\z@{%
17136 \@defaultunitsset\@tempdimc{#1}\unitlength
17137 \kern\@tempdimc
17138 #3\hss}%
17139 \edef\bbl@tempc{\directlua{tex.print(Babel.picture_has_bidi)}}%
17140 \fi
17141 % Do:
17142 \@defaultunitsset\@tempdimc{#2}\unitlength
17143 \raise\@tempdimc\hb@xt@\z@{%
17144 \@defaultunitsset\@tempdimc{#1}\unitlength
17145 \kern\@tempdimc
17146 {\ifnum\bbl@tempc>\z@\bbl@pictresetdir\fi#3}\hss}%
17147 \ignorespaces}%
17148 \MakeRobust\put}%
17149 \AtBeginDocument
17150 {\AddToHook{cmd/diagbox@pict/before}{\let\bbl@pictsetdir\@gobble}%
17151 \ifx\pgfpicture\@undefined\else
17152 \AddToHook{env/pgfpicture/begin}{\bbl@pictsetdir\@ne}%
17153 \bbl@add\pgfinterruptpicture{\bbl@pictresetdir}%
17154 \bbl@add\pgfsys@beginpicture{\bbl@pictsetdir\z@}%
17155 \fi
17156 \ifx\tikzpicture\@undefined\else
17157 \AddToHook{env/tikzpicture/begin}{\bbl@pictsetdir\tw@}%
17158 \bbl@add\tikz@atbegin@node{\bbl@pictresetdir}%
17159 \bbl@sreplace\tikz{\begingroup}{\begingroup\bbl@pictsetdir\tw@}%
17160 \bbl@sreplace\tikzpicture{\begingroup}{\begingroup\bbl@pictsetdir\tw@}%
17161 \fi
17162 }}
17163 {}
17164 % \end{macrocode}
17165 %
17166 % Implicitly reverses sectioning labels in bidi=basic-r, because the
17167 % full stop is not in contact with L numbers any more. I think there
17168 % must be a better way. Assumes |bidi=basic|, but there are some
17169 % additional readjustments for |bidi=default|.
17170 %
17171 % \begin{macrocode}
17172 \IfBabelLayout{counters*}%
17173 {\bbl@add\bbl@opt@layout{.counters.}%
17174 \directlua{
17175 luatexbase.add_to_callback("process_output_buffer",
17176 Babel.discard_sublr , "Babel.discard_sublr") }%
17177 }{}
17178 \IfBabelLayout{counters}%
17179 {\let\bbl@OL@@textsuperscript\@textsuperscript
17180 \bbl@sreplace\@textsuperscript{\m@th}{\m@th\mathdir\pagedir}%
17181 \let\bbl@latinarabic=\@arabic
17182 \let\bbl@OL@@arabic\@arabic
17183 \def\@arabic#1{\babelsublr{\bbl@latinarabic#1}}%
17184 \@ifpackagewith{babel}{bidi=default}%
17185 {\let\bbl@asciiroman=\@roman
17186 \let\bbl@OL@@roman\@roman
17187 \def\@roman#1{\babelsublr{\ensureascii{\bbl@asciiroman#1}}}%
17188 \let\bbl@asciiRoman=\@Roman
17189 \let\bbl@OL@@roman\@Roman
17190 \def\@Roman#1{\babelsublr{\ensureascii{\bbl@asciiRoman#1}}}%
17191 \let\bbl@OL@labelenumii\labelenumii
17192 \def\labelenumii{)\theenumii(}%
17193 \let\bbl@OL@p@enumiii\p@enumiii
17194 \def\p@enumiii{\p@enumii)\theenumii(}}{}}{}
17195 % \end{macrocode}
17196 %
17197 % Some \LaTeX{} macros use internally the math mode for text
17198 % formatting. They have very little in common and are grouped here, as
17199 % a single option.
17200 %
17201 % \begin{macrocode}
17202 \IfBabelLayout{extras}%
17203 {\bbl@ncarg\let\bbl@OL@underline{underline }%
17204 \bbl@carg\bbl@sreplace{underline }{\hbox}%
17205 {\def\bbl@insidemath{0}\hbox bdir\ifcase\bbl@thetextdir\z@\else\@ne\fi}%
17206 \let\bbl@OL@LaTeXe\LaTeXe
17207 \DeclareRobustCommand{\LaTeXe}{\mbox{\m@th
17208 \if b\expandafter\@car\f@series\@nil\boldmath\fi
17209 \babelsublr{%
17210 \LaTeX\kern.15em2\bbl@nextfake$_{\textstyle\varepsilon}$}}}}
17211 {}
17212 %</luatex>
17213 % \end{macrocode}
17214 %
17215 % \subsection{Lua: transforms}
17216 %
17217 % After declaring the table containing the patterns with their
17218 % replacements, we define some auxiliary functions: |str_to_nodes|
17219 % converts the string returned by a function to a node list, taking the
17220 % node at |base| as a model (font, language, etc.); |fetch_word|
17221 % fetches a series of glyphs and discretionaries, which |pattern| is
17222 % matched against (if there is a match, it is called again before
17223 % trying other patterns, and this is very likely the main bottleneck).
17224 %
17225 % |post_hyphenate_replace| is the callback applied after
17226 % |lang.hyphenate|. This means the automatic hyphenation points are
17227 % known. As empty captures return a byte position (as explained in the
17228 % \luatex{} manual), we must convert it to a utf8 position. With
17229 % |first|, the last byte can be the leading byte in a utf8 sequence, so
17230 % we just remove it and add 1 to the resulting length. With |last| we
17231 % must take into account the capture position points to the next
17232 % character. Here |word_head| points to the starting node of the text
17233 % to be matched.
17234 %
17235 % \begin{macrocode}
17236 %<*transforms>
17237 Babel.linebreaking.replacements = {}
17238 Babel.linebreaking.replacements[0] = {} -- pre
17239 Babel.linebreaking.replacements[1] = {} -- post
17240
17241 function Babel.tovalue(v)
17242 if type(v) == 'table' then
17243 return Babel.locale_props[v[1]].vars[v[2]] or v[3]
17244 else
17245 return v
17246 end
17247 end
17248
17249 Babel.attr_hboxed = luatexbase.registernumber'bbl@attr@hboxed'
17250
17251 function Babel.set_hboxed(head, gc)
17252 for item in node.traverse(head) do
17253 node.set_attribute(item, Babel.attr_hboxed, 1)
17254 end
17255 return head
17256 end
17257
17258 Babel.fetch_subtext = {}
17259
17260 Babel.ignore_pre_char = function(node)
17261 return (node.lang == Babel.nohyphenation)
17262 end
17263
17264 Babel.show_transforms = false
17265
17266 -- Merging both functions doesn't seen feasible, because there are too
17267 -- many differences.
17268 Babel.fetch_subtext[0] = function(head)
17269 local word_string = ''
17270 local word_nodes = {}
17271 local lang
17272 local item = head
17273 local inmath = false
17274
17275 while item do
17276
17277 if item.id == 11 then
17278 inmath = (item.subtype == 0)
17279 end
17280
17281 if inmath then
17282 -- pass
17283
17284 elseif item.id == 29 then
17285 local locale = node.get_attribute(item, Babel.attr_locale)
17286
17287 if lang == locale or lang == nil then
17288 lang = lang or locale
17289 if Babel.ignore_pre_char(item) then
17290 word_string = word_string .. Babel.us_char
17291 else
17292 if node.has_attribute(item, Babel.attr_hboxed) then
17293 word_string = word_string .. Babel.us_char
17294 else
17295 word_string = word_string .. unicode.utf8.char(item.char)
17296 end
17297 end
17298 word_nodes[#word_nodes+1] = item
17299 else
17300 break
17301 end
17302
17303 elseif item.id == 12 and item.subtype == 13 then
17304 if node.has_attribute(item, Babel.attr_hboxed) then
17305 word_string = word_string .. Babel.us_char
17306 else
17307 word_string = word_string .. ' '
17308 end
17309 word_nodes[#word_nodes+1] = item
17310
17311 -- Ignore leading unrecognized nodes, too.
17312 elseif word_string ~= '' then
17313 word_string = word_string .. Babel.us_char
17314 word_nodes[#word_nodes+1] = item -- Will be ignored
17315 end
17316
17317 item = item.next
17318 end
17319
17320 -- Here and above we remove some trailing chars but not the
17321 -- corresponding nodes. But they aren't accessed.
17322 if word_string:sub(-1) == ' ' then
17323 word_string = word_string:sub(1,-2)
17324 end
17325 if Babel.show_transforms then texio.write_nl(word_string) end
17326 word_string = unicode.utf8.gsub(word_string, Babel.us_char .. '+$', '')
17327 return word_string, word_nodes, item, lang
17328 end
17329
17330 Babel.fetch_subtext[1] = function(head)
17331 local word_string = ''
17332 local word_nodes = {}
17333 local lang
17334 local item = head
17335 local inmath = false
17336
17337 while item do
17338
17339 if item.id == 11 then
17340 inmath = (item.subtype == 0)
17341 end
17342
17343 if inmath then
17344 -- pass
17345
17346 elseif item.id == 29 then
17347 if item.lang == lang or lang == nil then
17348 lang = lang or item.lang
17349 if node.has_attribute(item, Babel.attr_hboxed) then
17350 word_string = word_string .. Babel.us_char
17351 elseif (item.char == 124) or (item.char == 61) then -- not =, not |
17352 word_string = word_string .. Babel.us_char
17353 else
17354 word_string = word_string .. unicode.utf8.char(item.char)
17355 end
17356 word_nodes[#word_nodes+1] = item
17357 else
17358 break
17359 end
17360
17361 elseif item.id == 7 and item.subtype == 2 then
17362 if node.has_attribute(item, Babel.attr_hboxed) then
17363 word_string = word_string .. Babel.us_char
17364 else
17365 word_string = word_string .. '='
17366 end
17367 word_nodes[#word_nodes+1] = item
17368
17369 elseif item.id == 7 and item.subtype == 3 then
17370 if node.has_attribute(item, Babel.attr_hboxed) then
17371 word_string = word_string .. Babel.us_char
17372 else
17373 word_string = word_string .. '|'
17374 end
17375 word_nodes[#word_nodes+1] = item
17376
17377 -- (1) Go to next word if nothing was found, and (2) implicitly
17378 -- remove leading USs.
17379 elseif word_string == '' then
17380 -- pass
17381
17382 -- This is the responsible for splitting by words.
17383 elseif (item.id == 12 and item.subtype == 13) then
17384 break
17385
17386 else
17387 word_string = word_string .. Babel.us_char
17388 word_nodes[#word_nodes+1] = item -- Will be ignored
17389 end
17390
17391 item = item.next
17392 end
17393 if Babel.show_transforms then texio.write_nl(word_string) end
17394 word_string = unicode.utf8.gsub(word_string, Babel.us_char .. '+$', '')
17395 return word_string, word_nodes, item, lang
17396 end
17397
17398 function Babel.pre_hyphenate_replace(head)
17399 Babel.hyphenate_replace(head, 0)
17400 end
17401
17402 function Babel.post_hyphenate_replace(head)
17403 Babel.hyphenate_replace(head, 1)
17404 end
17405
17406 Babel.us_char = string.char(31)
17407
17408 function Babel.hyphenate_replace(head, mode)
17409 local u = unicode.utf8
17410 local lbkr = Babel.linebreaking.replacements[mode]
17411 local tovalue = Babel.tovalue
17412
17413 local word_head = head
17414
17415 if Babel.show_transforms then
17416 texio.write_nl('\n==== Showing ' .. (mode == 0 and 'pre' or 'post') .. 'hyphenation ====')
17417 end
17418
17419 while true do -- for each subtext block
17420
17421 local w, w_nodes, nw, lang = Babel.fetch_subtext[mode](word_head)
17422
17423 if Babel.debug then
17424 print()
17425 print((mode == 0) and '@@@@<' or '@@@@>', w)
17426 end
17427
17428 if nw == nil and w == '' then break end
17429
17430 if not lang then goto next end
17431 if not lbkr[lang] then goto next end
17432
17433 -- For each saved (pre|post)hyphenation. TODO. Reconsider how
17434 -- loops are nested.
17435 for k=1, #lbkr[lang] do
17436 local p = lbkr[lang][k].pattern
17437 local r = lbkr[lang][k].replace
17438 local attr = lbkr[lang][k].attr or -1
17439
17440 if Babel.debug then
17441 print('*****', p, mode)
17442 end
17443
17444 -- This variable is set in some cases below to the first *byte*
17445 -- after the match, either as found by u.match (faster) or the
17446 -- computed position based on sc if w has changed.
17447 local last_match = 0
17448 local step = 0
17449
17450 -- For every match.
17451 while true do
17452 if Babel.debug then
17453 print('=====')
17454 end
17455 local new -- used when inserting and removing nodes
17456 local dummy_node -- used by after
17457
17458 local matches = { u.match(w, p, last_match) }
17459
17460 if #matches < 2 then break end
17461
17462 -- Get and remove empty captures (with ()'s, which return a
17463 -- number with the position), and keep actual captures
17464 -- (from (...)), if any, in matches.
17465 local first = table.remove(matches, 1)
17466 local last = table.remove(matches, #matches)
17467 -- Non re-fetched substrings may contain \31, which separates
17468 -- subsubstrings.
17469 if string.find(w:sub(first, last-1), Babel.us_char) then break end
17470
17471 local save_last = last -- with A()BC()D, points to D
17472
17473 -- Fix offsets, from bytes to unicode. Explained above.
17474 first = u.len(w:sub(1, first-1)) + 1
17475 last = u.len(w:sub(1, last-1)) -- now last points to C
17476
17477 -- This loop stores in a small table the nodes
17478 -- corresponding to the pattern. Used by 'data' to provide a
17479 -- predictable behavior with 'insert' (w_nodes is modified on
17480 -- the fly), and also access to 'remove'd nodes.
17481 local sc = first-1 -- Used below, too
17482 local data_nodes = {}
17483
17484 local enabled = true
17485 for q = 1, last-first+1 do
17486 data_nodes[q] = w_nodes[sc+q]
17487 if enabled
17488 and attr > -1
17489 and not node.has_attribute(data_nodes[q], attr)
17490 then
17491 enabled = false
17492 end
17493 end
17494
17495 -- This loop traverses the matched substring and takes the
17496 -- corresponding action stored in the replacement list.
17497 -- sc = the position in substr nodes / string
17498 -- rc = the replacement table index
17499 local rc = 0
17500
17501 ------- TODO. dummy_node?
17502 while rc < last-first+1 or dummy_node do -- for each replacement
17503 if Babel.debug then
17504 print('.....', rc + 1)
17505 end
17506 sc = sc + 1
17507 rc = rc + 1
17508
17509 if Babel.debug then
17510 Babel.debug_hyph(w, w_nodes, sc, first, last, last_match)
17511 local ss = ''
17512 for itt in node.traverse(head) do
17513 if itt.id == 29 then
17514 ss = ss .. unicode.utf8.char(itt.char)
17515 else
17516 ss = ss .. '{' .. itt.id .. '}'
17517 end
17518 end
17519 print('*****************', ss)
17520
17521 end
17522
17523 local crep = r[rc]
17524 local item = w_nodes[sc]
17525 local item_base = item
17526 local placeholder = Babel.us_char
17527 local d
17528
17529 if crep and crep.data then
17530 item_base = data_nodes[crep.data]
17531 end
17532
17533 if crep then
17534 step = crep.step or step
17535 end
17536
17537 if crep and crep.after then
17538 crep.insert = true
17539 if dummy_node then
17540 item = dummy_node
17541 else -- TODO. if there is a node after?
17542 d = node.copy(item_base)
17543 head, item = node.insert_after(head, item, d)
17544 dummy_node = item
17545 end
17546 end
17547
17548 if crep and not crep.after and dummy_node then
17549 node.remove(head, dummy_node)
17550 dummy_node = nil
17551 end
17552
17553 if not enabled then
17554 last_match = save_last
17555 goto next
17556
17557 elseif crep and next(crep) == nil then -- = {}
17558 if step == 0 then
17559 last_match = save_last -- Optimization
17560 else
17561 last_match = utf8.offset(w, sc+step)
17562 end
17563 goto next
17564
17565 elseif crep == nil or crep.remove then
17566 node.remove(head, item)
17567 table.remove(w_nodes, sc)
17568 w = u.sub(w, 1, sc-1) .. u.sub(w, sc+1)
17569 sc = sc - 1 -- Nothing has been inserted.
17570 last_match = utf8.offset(w, sc+1+step)
17571 goto next
17572
17573 elseif crep and crep.kashida then
17574 node.set_attribute(item,
17575 Babel.attr_kashida,
17576 crep.kashida)
17577 last_match = utf8.offset(w, sc+1+step)
17578 goto next
17579
17580 elseif crep and crep.string then
17581 local str = crep.string(matches)
17582 if str == '' then -- Gather with nil
17583 node.remove(head, item)
17584 table.remove(w_nodes, sc)
17585 w = u.sub(w, 1, sc-1) .. u.sub(w, sc+1)
17586 sc = sc - 1 -- Nothing has been inserted.
17587 else
17588 local loop_first = true
17589 for s in string.utfvalues(str) do
17590 d = node.copy(item_base)
17591 d.char = s
17592 if loop_first then
17593 loop_first = false
17594 head, new = node.insert_before(head, item, d)
17595 if sc == 1 then
17596 word_head = head
17597 end
17598 w_nodes[sc] = d
17599 w = u.sub(w, 1, sc-1) .. u.char(s) .. u.sub(w, sc+1)
17600 else
17601 sc = sc + 1
17602 head, new = node.insert_before(head, item, d)
17603 table.insert(w_nodes, sc, new)
17604 w = u.sub(w, 1, sc-1) .. u.char(s) .. u.sub(w, sc)
17605 end
17606 if Babel.debug then
17607 print('.....', 'str')
17608 Babel.debug_hyph(w, w_nodes, sc, first, last, last_match)
17609 end
17610 end -- for
17611 node.remove(head, item)
17612 end -- if ''
17613 last_match = utf8.offset(w, sc+1+step)
17614 goto next
17615
17616 elseif mode == 1 and crep and (crep.pre or crep.no or crep.post) then
17617 d = node.new(7, 3) -- (disc, regular)
17618 d.pre = Babel.str_to_nodes(crep.pre, matches, item_base)
17619 d.post = Babel.str_to_nodes(crep.post, matches, item_base)
17620 d.replace = Babel.str_to_nodes(crep.no, matches, item_base)
17621 d.attr = item_base.attr
17622 if crep.pre == nil then -- TeXbook p96
17623 d.penalty = tovalue(crep.penalty) or tex.hyphenpenalty
17624 else
17625 d.penalty = tovalue(crep.penalty) or tex.exhyphenpenalty
17626 end
17627 placeholder = '|'
17628 head, new = node.insert_before(head, item, d)
17629
17630 elseif mode == 0 and crep and (crep.pre or crep.no or crep.post) then
17631 -- ERROR
17632
17633 elseif crep and crep.penalty then
17634 d = node.new(14, 0) -- (penalty, userpenalty)
17635 d.attr = item_base.attr
17636 d.penalty = tovalue(crep.penalty)
17637 head, new = node.insert_before(head, item, d)
17638
17639 elseif crep and crep.space then
17640 -- 655360 = 10 pt = 10 * 65536 sp
17641 d = node.new(12, 13) -- (glue, spaceskip)
17642 local quad = font.getfont(item_base.font).size or 655360
17643 node.setglue(d, tovalue(crep.space[1]) * quad,
17644 tovalue(crep.space[2]) * quad,
17645 tovalue(crep.space[3]) * quad)
17646 if mode == 0 then
17647 placeholder = ' '
17648 end
17649 head, new = node.insert_before(head, item, d)
17650
17651 elseif crep and crep.norule then
17652 -- 655360 = 10 pt = 10 * 65536 sp
17653 d = node.new(2, 3) -- (rule, empty) = \no*rule
17654 local quad = font.getfont(item_base.font).size or 655360
17655 d.width = tovalue(crep.norule[1]) * quad
17656 d.height = tovalue(crep.norule[2]) * quad
17657 d.depth = tovalue(crep.norule[3]) * quad
17658 head, new = node.insert_before(head, item, d)
17659
17660 elseif crep and crep.spacefactor then
17661 d = node.new(12, 13) -- (glue, spaceskip)
17662 local base_font = font.getfont(item_base.font)
17663 node.setglue(d,
17664 tovalue(crep.spacefactor[1]) * base_font.parameters['space'],
17665 tovalue(crep.spacefactor[2]) * base_font.parameters['space_stretch'],
17666 tovalue(crep.spacefactor[3]) * base_font.parameters['space_shrink'])
17667 if mode == 0 then
17668 placeholder = ' '
17669 end
17670 head, new = node.insert_before(head, item, d)
17671
17672 elseif mode == 0 and crep and crep.space then
17673 -- ERROR
17674
17675 elseif crep and crep.kern then
17676 d = node.new(13, 1) -- (kern, user)
17677 local quad = font.getfont(item_base.font).size or 655360
17678 d.attr = item_base.attr
17679 d.kern = tovalue(crep.kern) * quad
17680 head, new = node.insert_before(head, item, d)
17681
17682 elseif crep and crep.node then
17683 d = node.new(crep.node[1], crep.node[2])
17684 d.attr = item_base.attr
17685 head, new = node.insert_before(head, item, d)
17686
17687 end -- i.e., replacement cases
17688
17689 -- Shared by disc, space(factor), kern, node and penalty.
17690 if sc == 1 then
17691 word_head = head
17692 end
17693 if crep.insert then
17694 w = u.sub(w, 1, sc-1) .. placeholder .. u.sub(w, sc)
17695 table.insert(w_nodes, sc, new)
17696 last = last + 1
17697 else
17698 w_nodes[sc] = d
17699 node.remove(head, item)
17700 w = u.sub(w, 1, sc-1) .. placeholder .. u.sub(w, sc+1)
17701 end
17702
17703 last_match = utf8.offset(w, sc+1+step)
17704
17705 ::next::
17706
17707 end -- for each replacement
17708
17709 if Babel.show_transforms then texio.write_nl('> ' .. w) end
17710 if Babel.debug then
17711 print('.....', '/')
17712 Babel.debug_hyph(w, w_nodes, sc, first, last, last_match)
17713 end
17714
17715 if dummy_node then
17716 node.remove(head, dummy_node)
17717 dummy_node = nil
17718 end
17719
17720 end -- for match
17721
17722 end -- for patterns
17723
17724 ::next::
17725 word_head = nw
17726 end -- for substring
17727
17728 if Babel.show_transforms then texio.write_nl(string.rep('-', 32) .. '\n') end
17729 return head
17730 end
17731
17732 -- This table stores capture maps, numbered consecutively
17733 Babel.capture_maps = {}
17734
17735 function Babel.esc_hex_to_char(h)
17736 if tex.getcatcode(tonumber(h, 16)) ~= 11 and
17737 tex.getcatcode(tonumber(h, 16)) ~= 12 then
17738 return string.format([[\Uchar"%X ]], tonumber(h,16))
17739 else
17740 return unicode.utf8.char(tonumber(h, 16))
17741 end
17742 end
17743
17744 -- The following functions belong to the next macro
17745 function Babel.capture_func(key, cap)
17746 local ret = "[[" .. cap:gsub('{([0-9])}', "]]..m[%1]..[[") .. "]]"
17747 local cnt
17748 local u = unicode.utf8
17749 ret = u.gsub(ret, '{(%x%x%x%x+)}', '\x01%1\x04')
17750 ret, cnt = ret:gsub('{([0-9])|([^|]+)|(.-)}', Babel.capture_func_map)
17751 ret = u.gsub(ret, '\x01(%x%x%x%x+)\x04', Babel.esc_hex_to_char)
17752 ret = ret:gsub("%[%[%]%]%.%.", '')
17753 ret = ret:gsub("%.%.%[%[%]%]", '')
17754 return key .. [[=function(m) return ]] .. ret .. [[ end]]
17755 end
17756
17757 function Babel.capt_map(from, mapno)
17758 return Babel.capture_maps[mapno][from] or from
17759 end
17760
17761 -- Handle the {n|abc|ABC} syntax in captures
17762 function Babel.capture_func_map(capno, from, to)
17763 local u = unicode.utf8
17764 from = u.gsub(from, '\x01(%x%x%x%x+)\x04',
17765 function (n)
17766 return u.char(tonumber(n, 16))
17767 end)
17768 to = u.gsub(to, '\x01(%x%x%x%x+)\x04',
17769 function (n)
17770 return u.char(tonumber(n, 16))
17771 end)
17772 local froms = {}
17773 for s in string.utfcharacters(from) do
17774 table.insert(froms, s)
17775 end
17776 local cnt = 1
17777 table.insert(Babel.capture_maps, {})
17778 local mlen = table.getn(Babel.capture_maps)
17779 for s in string.utfcharacters(to) do
17780 Babel.capture_maps[mlen][froms[cnt]] = s
17781 cnt = cnt + 1
17782 end
17783 return "]]..Babel.capt_map(m[" .. capno .. "]," ..
17784 (mlen) .. ").." .. "[["
17785 end
17786
17787 -- Create/Extend reversed sorted list of kashida weights:
17788 function Babel.capture_kashida(key, wt)
17789 wt = tonumber(wt)
17790 if Babel.kashida_wts then
17791 for p, q in ipairs(Babel.kashida_wts) do
17792 if wt == q then
17793 break
17794 elseif wt > q then
17795 table.insert(Babel.kashida_wts, p, wt)
17796 break
17797 elseif table.getn(Babel.kashida_wts) == p then
17798 table.insert(Babel.kashida_wts, wt)
17799 end
17800 end
17801 else
17802 Babel.kashida_wts = { wt }
17803 end
17804 return 'kashida = ' .. wt
17805 end
17806
17807 function Babel.capture_node(id, subtype)
17808 local sbt = 0
17809 for k, v in pairs(node.subtypes(id)) do
17810 if v == subtype then sbt = k end
17811 end
17812 return 'node = {' .. node.id(id) .. ', ' .. sbt .. '}'
17813 end
17814
17815 -- Experimental: applies prehyphenation transforms to a string (letters
17816 -- and spaces).
17817 function Babel.string_prehyphenation(str, locale)
17818 local n, head, last, res
17819 head = node.new(8, 0) -- dummy (hack just to start)
17820 last = head
17821 for s in string.utfvalues(str) do
17822 if s == 20 then
17823 n = node.new(12, 0)
17824 else
17825 n = node.new(29, 0)
17826 n.char = s
17827 end
17828 node.set_attribute(n, Babel.attr_locale, locale)
17829 last.next = n
17830 last = n
17831 end
17832 head = Babel.hyphenate_replace(head, 0)
17833 res = ''
17834 for n in node.traverse(head) do
17835 if n.id == 12 then
17836 res = res .. ' '
17837 elseif n.id == 29 then
17838 res = res .. unicode.utf8.char(n.char)
17839 end
17840 end
17841 tex.print(res)
17842 end
17843 %</transforms>
17844 % \end{macrocode}
17845 %
17846 % \subsection{Lua: Auto bidi with \texttt{basic} and \texttt{basic-r}}
17847 %
17848 % The file \textsf{babel-data-bidi.lua} currently only contains data. It is
17849 % a large and boring file and it is not shown here (see the generated file),
17850 % but here is a sample:
17851 %\begin{verbatim}
17852 % [0x25]={d='et'},
17853 % [0x26]={d='on'},
17854 % [0x27]={d='on'},
17855 % [0x28]={d='on', m=0x29},
17856 % [0x29]={d='on', m=0x28},
17857 % [0x2A]={d='on'},
17858 % [0x2B]={d='es'},
17859 % [0x2C]={d='cs'},
17860 %\end{verbatim}
17861 % For the meaning of these codes, see the Unicode standard.
17862 %
17863 %\iffalse
17864 % \begin{macrocode}
17865 %<*bididata>
17866 -- Data from Unicode and ConTeXt
17867
17868 Babel.ranges = {
17869 {0x0590, 0x05FF, 'r'},
17870 {0x0600, 0x07BF, 'al'},
17871 {0x07C0, 0x085F, 'r'},
17872 {0x0860, 0x086F, 'al'},
17873 {0x08A0, 0x08FF, 'al'},
17874 {0xFB1D, 0xFB4F, 'r'},
17875 {0xFB50, 0xFDFF, 'al'},
17876 {0xFE70, 0xFEFF, 'al'},
17877 {0x10800, 0x10CFF, 'r'},
17878 {0x10D00, 0x10D3F, 'al'},
17879 {0x10D40, 0x10EBF, 'r'},
17880 {0x10EC0, 0x10EFF, 'al'},
17881 {0x10F00, 0x10F2F, 'r'},
17882 {0x10F30, 0x10F6F, 'al'},
17883 {0x10F70, 0x10FFF, 'r'},
17884 {0x1E800, 0x1E95F, 'r'},
17885 {0x1EE00, 0x1EEFF, 'al'},
17886 {0x1F300, 0x1F9FF, 'on'}
17887 }
17888
17889 Babel.characters = {
17890 [0x0]={d='bn'},
17891 [0x1]={d='bn'},
17892 [0x2]={d='bn'},
17893 [0x3]={d='bn'},
17894 [0x4]={d='bn'},
17895 [0x5]={d='bn'},
17896 [0x6]={d='bn'},
17897 [0x7]={d='bn'},
17898 [0x8]={d='bn'},
17899 [0x9]={d='s'},
17900 [0xA]={d='b'},
17901 [0xB]={d='s'},
17902 [0xC]={d='ws'},
17903 [0xD]={d='b'},
17904 [0xE]={d='bn'},
17905 [0xF]={d='bn'},
17906 [0x10]={d='bn'},
17907 [0x11]={d='bn'},
17908 [0x12]={d='bn'},
17909 [0x13]={d='bn'},
17910 [0x14]={d='bn'},
17911 [0x15]={d='bn'},
17912 [0x16]={d='bn'},
17913 [0x17]={d='bn'},
17914 [0x18]={d='bn'},
17915 [0x19]={d='bn'},
17916 [0x1A]={d='bn'},
17917 [0x1B]={d='bn'},
17918 [0x1C]={d='b'},
17919 [0x1D]={d='b'},
17920 [0x1E]={d='b'},
17921 [0x1F]={d='s'},
17922 [0x20]={d='ws'},
17923 [0x21]={d='on'},
17924 [0x22]={d='on'},
17925 [0x23]={d='et'},
17926 [0x24]={d='et'},
17927 [0x25]={d='et'},
17928 [0x26]={d='on'},
17929 [0x27]={d='on'},
17930 [0x28]={d='on', m=0x29},
17931 [0x29]={d='on', m=0x28},
17932 [0x2A]={d='on'},
17933 [0x2B]={d='es'},
17934 [0x2C]={d='cs'},
17935 [0x2D]={d='es'},
17936 [0x2E]={d='cs'},
17937 [0x2F]={d='cs'},
17938 [0x30]={d='en'},
17939 [0x31]={d='en'},
17940 [0x32]={d='en'},
17941 [0x33]={d='en'},
17942 [0x34]={d='en'},
17943 [0x35]={d='en'},
17944 [0x36]={d='en'},
17945 [0x37]={d='en'},
17946 [0x38]={d='en'},
17947 [0x39]={d='en'},
17948 [0x3A]={d='cs'},
17949 [0x3B]={d='on'},
17950 [0x3C]={d='on', m=0x3E},
17951 [0x3D]={d='on'},
17952 [0x3E]={d='on', m=0x3C},
17953 [0x3F]={d='on'},
17954 [0x40]={d='on'},
17955 [0x5B]={d='on', m=0x5D},
17956 [0x5C]={d='on'},
17957 [0x5D]={d='on', m=0x5B},
17958 [0x5E]={d='on'},
17959 [0x5F]={d='on'},
17960 [0x60]={d='on'},
17961 [0x7B]={d='on', m=0x7D},
17962 [0x7C]={d='on'},
17963 [0x7D]={d='on', m=0x7B},
17964 [0x7E]={d='on'},
17965 [0x7F]={d='bn'},
17966 [0x80]={d='bn'},
17967 [0x81]={d='bn'},
17968 [0x82]={d='bn'},
17969 [0x83]={d='bn'},
17970 [0x84]={d='bn'},
17971 [0x85]={d='b'},
17972 [0x86]={d='bn'},
17973 [0x87]={d='bn'},
17974 [0x88]={d='bn'},
17975 [0x89]={d='bn'},
17976 [0x8A]={d='bn'},
17977 [0x8B]={d='bn'},
17978 [0x8C]={d='bn'},
17979 [0x8D]={d='bn'},
17980 [0x8E]={d='bn'},
17981 [0x8F]={d='bn'},
17982 [0x90]={d='bn'},
17983 [0x91]={d='bn'},
17984 [0x92]={d='bn'},
17985 [0x93]={d='bn'},
17986 [0x94]={d='bn'},
17987 [0x95]={d='bn'},
17988 [0x96]={d='bn'},
17989 [0x97]={d='bn'},
17990 [0x98]={d='bn'},
17991 [0x99]={d='bn'},
17992 [0x9A]={d='bn'},
17993 [0x9B]={d='bn'},
17994 [0x9C]={d='bn'},
17995 [0x9D]={d='bn'},
17996 [0x9E]={d='bn'},
17997 [0x9F]={d='bn'},
17998 [0xA0]={d='cs'},
17999 [0xA1]={d='on'},
18000 [0xA2]={d='et'},
18001 [0xA3]={d='et'},
18002 [0xA4]={d='et'},
18003 [0xA5]={d='et'},
18004 [0xA6]={d='on'},
18005 [0xA7]={d='on'},
18006 [0xA8]={d='on'},
18007 [0xA9]={d='on'},
18008 [0xAB]={d='on', m=0xBB},
18009 [0xAC]={d='on'},
18010 [0xAD]={d='bn'},
18011 [0xAE]={d='on'},
18012 [0xAF]={d='on'},
18013 [0xB0]={d='et'},
18014 [0xB1]={d='et'},
18015 [0xB2]={d='en'},
18016 [0xB3]={d='en'},
18017 [0xB4]={d='on'},
18018 [0xB6]={d='on'},
18019 [0xB7]={d='on'},
18020 [0xB8]={d='on'},
18021 [0xB9]={d='en'},
18022 [0xBB]={d='on', m=0xAB},
18023 [0xBC]={d='on'},
18024 [0xBD]={d='on'},
18025 [0xBE]={d='on'},
18026 [0xBF]={d='on'},
18027 [0xD7]={d='on'},
18028 [0xF7]={d='on'},
18029 [0x2B9]={d='on'},
18030 [0x2BA]={d='on'},
18031 [0x2C2]={d='on'},
18032 [0x2C3]={d='on'},
18033 [0x2C4]={d='on'},
18034 [0x2C5]={d='on'},
18035 [0x2C6]={d='on'},
18036 [0x2C7]={d='on'},
18037 [0x2C8]={d='on'},
18038 [0x2C9]={d='on'},
18039 [0x2CA]={d='on'},
18040 [0x2CB]={d='on'},
18041 [0x2CC]={d='on'},
18042 [0x2CD]={d='on'},
18043 [0x2CE]={d='on'},
18044 [0x2CF]={d='on'},
18045 [0x2D2]={d='on'},
18046 [0x2D3]={d='on'},
18047 [0x2D4]={d='on'},
18048 [0x2D5]={d='on'},
18049 [0x2D6]={d='on'},
18050 [0x2D7]={d='on'},
18051 [0x2D8]={d='on'},
18052 [0x2D9]={d='on'},
18053 [0x2DA]={d='on'},
18054 [0x2DB]={d='on'},
18055 [0x2DC]={d='on'},
18056 [0x2DD]={d='on'},
18057 [0x2DE]={d='on'},
18058 [0x2DF]={d='on'},
18059 [0x2E5]={d='on'},
18060 [0x2E6]={d='on'},
18061 [0x2E7]={d='on'},
18062 [0x2E8]={d='on'},
18063 [0x2E9]={d='on'},
18064 [0x2EA]={d='on'},
18065 [0x2EB]={d='on'},
18066 [0x2EC]={d='on'},
18067 [0x2ED]={d='on'},
18068 [0x2EF]={d='on'},
18069 [0x2F0]={d='on'},
18070 [0x2F1]={d='on'},
18071 [0x2F2]={d='on'},
18072 [0x2F3]={d='on'},
18073 [0x2F4]={d='on'},
18074 [0x2F5]={d='on'},
18075 [0x2F6]={d='on'},
18076 [0x2F7]={d='on'},
18077 [0x2F8]={d='on'},
18078 [0x2F9]={d='on'},
18079 [0x2FA]={d='on'},
18080 [0x2FB]={d='on'},
18081 [0x2FC]={d='on'},
18082 [0x2FD]={d='on'},
18083 [0x2FE]={d='on'},
18084 [0x2FF]={d='on'},
18085 [0x300]={d='nsm'},
18086 [0x301]={d='nsm'},
18087 [0x302]={d='nsm'},
18088 [0x303]={d='nsm'},
18089 [0x304]={d='nsm'},
18090 [0x305]={d='nsm'},
18091 [0x306]={d='nsm'},
18092 [0x307]={d='nsm'},
18093 [0x308]={d='nsm'},
18094 [0x309]={d='nsm'},
18095 [0x30A]={d='nsm'},
18096 [0x30B]={d='nsm'},
18097 [0x30C]={d='nsm'},
18098 [0x30D]={d='nsm'},
18099 [0x30E]={d='nsm'},
18100 [0x30F]={d='nsm'},
18101 [0x310]={d='nsm'},
18102 [0x311]={d='nsm'},
18103 [0x312]={d='nsm'},
18104 [0x313]={d='nsm'},
18105 [0x314]={d='nsm'},
18106 [0x315]={d='nsm'},
18107 [0x316]={d='nsm'},
18108 [0x317]={d='nsm'},
18109 [0x318]={d='nsm'},
18110 [0x319]={d='nsm'},
18111 [0x31A]={d='nsm'},
18112 [0x31B]={d='nsm'},
18113 [0x31C]={d='nsm'},
18114 [0x31D]={d='nsm'},
18115 [0x31E]={d='nsm'},
18116 [0x31F]={d='nsm'},
18117 [0x320]={d='nsm'},
18118 [0x321]={d='nsm'},
18119 [0x322]={d='nsm'},
18120 [0x323]={d='nsm'},
18121 [0x324]={d='nsm'},
18122 [0x325]={d='nsm'},
18123 [0x326]={d='nsm'},
18124 [0x327]={d='nsm'},
18125 [0x328]={d='nsm'},
18126 [0x329]={d='nsm'},
18127 [0x32A]={d='nsm'},
18128 [0x32B]={d='nsm'},
18129 [0x32C]={d='nsm'},
18130 [0x32D]={d='nsm'},
18131 [0x32E]={d='nsm'},
18132 [0x32F]={d='nsm'},
18133 [0x330]={d='nsm'},
18134 [0x331]={d='nsm'},
18135 [0x332]={d='nsm'},
18136 [0x333]={d='nsm'},
18137 [0x334]={d='nsm'},
18138 [0x335]={d='nsm'},
18139 [0x336]={d='nsm'},
18140 [0x337]={d='nsm'},
18141 [0x338]={d='nsm'},
18142 [0x339]={d='nsm'},
18143 [0x33A]={d='nsm'},
18144 [0x33B]={d='nsm'},
18145 [0x33C]={d='nsm'},
18146 [0x33D]={d='nsm'},
18147 [0x33E]={d='nsm'},
18148 [0x33F]={d='nsm'},
18149 [0x340]={d='nsm'},
18150 [0x341]={d='nsm'},
18151 [0x342]={d='nsm'},
18152 [0x343]={d='nsm'},
18153 [0x344]={d='nsm'},
18154 [0x345]={d='nsm'},
18155 [0x346]={d='nsm'},
18156 [0x347]={d='nsm'},
18157 [0x348]={d='nsm'},
18158 [0x349]={d='nsm'},
18159 [0x34A]={d='nsm'},
18160 [0x34B]={d='nsm'},
18161 [0x34C]={d='nsm'},
18162 [0x34D]={d='nsm'},
18163 [0x34E]={d='nsm'},
18164 [0x34F]={d='nsm'},
18165 [0x350]={d='nsm'},
18166 [0x351]={d='nsm'},
18167 [0x352]={d='nsm'},
18168 [0x353]={d='nsm'},
18169 [0x354]={d='nsm'},
18170 [0x355]={d='nsm'},
18171 [0x356]={d='nsm'},
18172 [0x357]={d='nsm'},
18173 [0x358]={d='nsm'},
18174 [0x359]={d='nsm'},
18175 [0x35A]={d='nsm'},
18176 [0x35B]={d='nsm'},
18177 [0x35C]={d='nsm'},
18178 [0x35D]={d='nsm'},
18179 [0x35E]={d='nsm'},
18180 [0x35F]={d='nsm'},
18181 [0x360]={d='nsm'},
18182 [0x361]={d='nsm'},
18183 [0x362]={d='nsm'},
18184 [0x363]={d='nsm'},
18185 [0x364]={d='nsm'},
18186 [0x365]={d='nsm'},
18187 [0x366]={d='nsm'},
18188 [0x367]={d='nsm'},
18189 [0x368]={d='nsm'},
18190 [0x369]={d='nsm'},
18191 [0x36A]={d='nsm'},
18192 [0x36B]={d='nsm'},
18193 [0x36C]={d='nsm'},
18194 [0x36D]={d='nsm'},
18195 [0x36E]={d='nsm'},
18196 [0x36F]={d='nsm'},
18197 [0x374]={d='on'},
18198 [0x375]={d='on'},
18199 [0x37E]={d='on'},
18200 [0x384]={d='on'},
18201 [0x385]={d='on'},
18202 [0x387]={d='on'},
18203 [0x3F6]={d='on'},
18204 [0x483]={d='nsm'},
18205 [0x484]={d='nsm'},
18206 [0x485]={d='nsm'},
18207 [0x486]={d='nsm'},
18208 [0x487]={d='nsm'},
18209 [0x488]={d='nsm'},
18210 [0x489]={d='nsm'},
18211 [0x58A]={d='on'},
18212 [0x58D]={d='on'},
18213 [0x58E]={d='on'},
18214 [0x58F]={d='et'},
18215 [0x591]={d='nsm'},
18216 [0x592]={d='nsm'},
18217 [0x593]={d='nsm'},
18218 [0x594]={d='nsm'},
18219 [0x595]={d='nsm'},
18220 [0x596]={d='nsm'},
18221 [0x597]={d='nsm'},
18222 [0x598]={d='nsm'},
18223 [0x599]={d='nsm'},
18224 [0x59A]={d='nsm'},
18225 [0x59B]={d='nsm'},
18226 [0x59C]={d='nsm'},
18227 [0x59D]={d='nsm'},
18228 [0x59E]={d='nsm'},
18229 [0x59F]={d='nsm'},
18230 [0x5A0]={d='nsm'},
18231 [0x5A1]={d='nsm'},
18232 [0x5A2]={d='nsm'},
18233 [0x5A3]={d='nsm'},
18234 [0x5A4]={d='nsm'},
18235 [0x5A5]={d='nsm'},
18236 [0x5A6]={d='nsm'},
18237 [0x5A7]={d='nsm'},
18238 [0x5A8]={d='nsm'},
18239 [0x5A9]={d='nsm'},
18240 [0x5AA]={d='nsm'},
18241 [0x5AB]={d='nsm'},
18242 [0x5AC]={d='nsm'},
18243 [0x5AD]={d='nsm'},
18244 [0x5AE]={d='nsm'},
18245 [0x5AF]={d='nsm'},
18246 [0x5B0]={d='nsm'},
18247 [0x5B1]={d='nsm'},
18248 [0x5B2]={d='nsm'},
18249 [0x5B3]={d='nsm'},
18250 [0x5B4]={d='nsm'},
18251 [0x5B5]={d='nsm'},
18252 [0x5B6]={d='nsm'},
18253 [0x5B7]={d='nsm'},
18254 [0x5B8]={d='nsm'},
18255 [0x5B9]={d='nsm'},
18256 [0x5BA]={d='nsm'},
18257 [0x5BB]={d='nsm'},
18258 [0x5BC]={d='nsm'},
18259 [0x5BD]={d='nsm'},
18260 [0x5BF]={d='nsm'},
18261 [0x5C1]={d='nsm'},
18262 [0x5C2]={d='nsm'},
18263 [0x5C4]={d='nsm'},
18264 [0x5C5]={d='nsm'},
18265 [0x5C7]={d='nsm'},
18266 [0x600]={d='an'},
18267 [0x601]={d='an'},
18268 [0x602]={d='an'},
18269 [0x603]={d='an'},
18270 [0x604]={d='an'},
18271 [0x605]={d='an'},
18272 [0x606]={d='on'},
18273 [0x607]={d='on'},
18274 [0x608]={d='al'},
18275 [0x609]={d='et'},
18276 [0x60A]={d='et'},
18277 [0x60B]={d='al'},
18278 [0x60C]={d='cs'},
18279 [0x60D]={d='al'},
18280 [0x60E]={d='on'},
18281 [0x60F]={d='on'},
18282 [0x610]={d='nsm'},
18283 [0x611]={d='nsm'},
18284 [0x612]={d='nsm'},
18285 [0x613]={d='nsm'},
18286 [0x614]={d='nsm'},
18287 [0x615]={d='nsm'},
18288 [0x616]={d='nsm'},
18289 [0x617]={d='nsm'},
18290 [0x618]={d='nsm'},
18291 [0x619]={d='nsm'},
18292 [0x61A]={d='nsm'},
18293 [0x64B]={d='nsm'},
18294 [0x64C]={d='nsm'},
18295 [0x64D]={d='nsm'},
18296 [0x64E]={d='nsm'},
18297 [0x64F]={d='nsm'},
18298 [0x650]={d='nsm'},
18299 [0x651]={d='nsm'},
18300 [0x652]={d='nsm'},
18301 [0x653]={d='nsm'},
18302 [0x654]={d='nsm'},
18303 [0x655]={d='nsm'},
18304 [0x656]={d='nsm'},
18305 [0x657]={d='nsm'},
18306 [0x658]={d='nsm'},
18307 [0x659]={d='nsm'},
18308 [0x65A]={d='nsm'},
18309 [0x65B]={d='nsm'},
18310 [0x65C]={d='nsm'},
18311 [0x65D]={d='nsm'},
18312 [0x65E]={d='nsm'},
18313 [0x65F]={d='nsm'},
18314 [0x660]={d='an'},
18315 [0x661]={d='an'},
18316 [0x662]={d='an'},
18317 [0x663]={d='an'},
18318 [0x664]={d='an'},
18319 [0x665]={d='an'},
18320 [0x666]={d='an'},
18321 [0x667]={d='an'},
18322 [0x668]={d='an'},
18323 [0x669]={d='an'},
18324 [0x66A]={d='et'},
18325 [0x66B]={d='an'},
18326 [0x66C]={d='an'},
18327 [0x670]={d='nsm'},
18328 [0x6D6]={d='nsm'},
18329 [0x6D7]={d='nsm'},
18330 [0x6D8]={d='nsm'},
18331 [0x6D9]={d='nsm'},
18332 [0x6DA]={d='nsm'},
18333 [0x6DB]={d='nsm'},
18334 [0x6DC]={d='nsm'},
18335 [0x6DD]={d='an'},
18336 [0x6DE]={d='on'},
18337 [0x6DF]={d='nsm'},
18338 [0x6E0]={d='nsm'},
18339 [0x6E1]={d='nsm'},
18340 [0x6E2]={d='nsm'},
18341 [0x6E3]={d='nsm'},
18342 [0x6E4]={d='nsm'},
18343 [0x6E7]={d='nsm'},
18344 [0x6E8]={d='nsm'},
18345 [0x6E9]={d='on'},
18346 [0x6EA]={d='nsm'},
18347 [0x6EB]={d='nsm'},
18348 [0x6EC]={d='nsm'},
18349 [0x6ED]={d='nsm'},
18350 [0x6F0]={d='en'},
18351 [0x6F1]={d='en'},
18352 [0x6F2]={d='en'},
18353 [0x6F3]={d='en'},
18354 [0x6F4]={d='en'},
18355 [0x6F5]={d='en'},
18356 [0x6F6]={d='en'},
18357 [0x6F7]={d='en'},
18358 [0x6F8]={d='en'},
18359 [0x6F9]={d='en'},
18360 [0x711]={d='nsm'},
18361 [0x730]={d='nsm'},
18362 [0x731]={d='nsm'},
18363 [0x732]={d='nsm'},
18364 [0x733]={d='nsm'},
18365 [0x734]={d='nsm'},
18366 [0x735]={d='nsm'},
18367 [0x736]={d='nsm'},
18368 [0x737]={d='nsm'},
18369 [0x738]={d='nsm'},
18370 [0x739]={d='nsm'},
18371 [0x73A]={d='nsm'},
18372 [0x73B]={d='nsm'},
18373 [0x73C]={d='nsm'},
18374 [0x73D]={d='nsm'},
18375 [0x73E]={d='nsm'},
18376 [0x73F]={d='nsm'},
18377 [0x740]={d='nsm'},
18378 [0x741]={d='nsm'},
18379 [0x742]={d='nsm'},
18380 [0x743]={d='nsm'},
18381 [0x744]={d='nsm'},
18382 [0x745]={d='nsm'},
18383 [0x746]={d='nsm'},
18384 [0x747]={d='nsm'},
18385 [0x748]={d='nsm'},
18386 [0x749]={d='nsm'},
18387 [0x74A]={d='nsm'},
18388 [0x7A6]={d='nsm'},
18389 [0x7A7]={d='nsm'},
18390 [0x7A8]={d='nsm'},
18391 [0x7A9]={d='nsm'},
18392 [0x7AA]={d='nsm'},
18393 [0x7AB]={d='nsm'},
18394 [0x7AC]={d='nsm'},
18395 [0x7AD]={d='nsm'},
18396 [0x7AE]={d='nsm'},
18397 [0x7AF]={d='nsm'},
18398 [0x7B0]={d='nsm'},
18399 [0x7EB]={d='nsm'},
18400 [0x7EC]={d='nsm'},
18401 [0x7ED]={d='nsm'},
18402 [0x7EE]={d='nsm'},
18403 [0x7EF]={d='nsm'},
18404 [0x7F0]={d='nsm'},
18405 [0x7F1]={d='nsm'},
18406 [0x7F2]={d='nsm'},
18407 [0x7F3]={d='nsm'},
18408 [0x7F6]={d='on'},
18409 [0x7F7]={d='on'},
18410 [0x7F8]={d='on'},
18411 [0x7F9]={d='on'},
18412 [0x816]={d='nsm'},
18413 [0x817]={d='nsm'},
18414 [0x818]={d='nsm'},
18415 [0x819]={d='nsm'},
18416 [0x81B]={d='nsm'},
18417 [0x81C]={d='nsm'},
18418 [0x81D]={d='nsm'},
18419 [0x81E]={d='nsm'},
18420 [0x81F]={d='nsm'},
18421 [0x820]={d='nsm'},
18422 [0x821]={d='nsm'},
18423 [0x822]={d='nsm'},
18424 [0x823]={d='nsm'},
18425 [0x825]={d='nsm'},
18426 [0x826]={d='nsm'},
18427 [0x827]={d='nsm'},
18428 [0x829]={d='nsm'},
18429 [0x82A]={d='nsm'},
18430 [0x82B]={d='nsm'},
18431 [0x82C]={d='nsm'},
18432 [0x82D]={d='nsm'},
18433 [0x859]={d='nsm'},
18434 [0x85A]={d='nsm'},
18435 [0x85B]={d='nsm'},
18436 [0x8D4]={d='nsm'},
18437 [0x8D5]={d='nsm'},
18438 [0x8D6]={d='nsm'},
18439 [0x8D7]={d='nsm'},
18440 [0x8D8]={d='nsm'},
18441 [0x8D9]={d='nsm'},
18442 [0x8DA]={d='nsm'},
18443 [0x8DB]={d='nsm'},
18444 [0x8DC]={d='nsm'},
18445 [0x8DD]={d='nsm'},
18446 [0x8DE]={d='nsm'},
18447 [0x8DF]={d='nsm'},
18448 [0x8E0]={d='nsm'},
18449 [0x8E1]={d='nsm'},
18450 [0x8E2]={d='an'},
18451 [0x8E3]={d='nsm'},
18452 [0x8E4]={d='nsm'},
18453 [0x8E5]={d='nsm'},
18454 [0x8E6]={d='nsm'},
18455 [0x8E7]={d='nsm'},
18456 [0x8E8]={d='nsm'},
18457 [0x8E9]={d='nsm'},
18458 [0x8EA]={d='nsm'},
18459 [0x8EB]={d='nsm'},
18460 [0x8EC]={d='nsm'},
18461 [0x8ED]={d='nsm'},
18462 [0x8EE]={d='nsm'},
18463 [0x8EF]={d='nsm'},
18464 [0x8F0]={d='nsm'},
18465 [0x8F1]={d='nsm'},
18466 [0x8F2]={d='nsm'},
18467 [0x8F3]={d='nsm'},
18468 [0x8F4]={d='nsm'},
18469 [0x8F5]={d='nsm'},
18470 [0x8F6]={d='nsm'},
18471 [0x8F7]={d='nsm'},
18472 [0x8F8]={d='nsm'},
18473 [0x8F9]={d='nsm'},
18474 [0x8FA]={d='nsm'},
18475 [0x8FB]={d='nsm'},
18476 [0x8FC]={d='nsm'},
18477 [0x8FD]={d='nsm'},
18478 [0x8FE]={d='nsm'},
18479 [0x8FF]={d='nsm'},
18480 [0x900]={d='nsm'},
18481 [0x901]={d='nsm'},
18482 [0x902]={d='nsm'},
18483 [0x93A]={d='nsm'},
18484 [0x93C]={d='nsm'},
18485 [0x941]={d='nsm'},
18486 [0x942]={d='nsm'},
18487 [0x943]={d='nsm'},
18488 [0x944]={d='nsm'},
18489 [0x945]={d='nsm'},
18490 [0x946]={d='nsm'},
18491 [0x947]={d='nsm'},
18492 [0x948]={d='nsm'},
18493 [0x94D]={d='nsm'},
18494 [0x951]={d='nsm'},
18495 [0x952]={d='nsm'},
18496 [0x953]={d='nsm'},
18497 [0x954]={d='nsm'},
18498 [0x955]={d='nsm'},
18499 [0x956]={d='nsm'},
18500 [0x957]={d='nsm'},
18501 [0x962]={d='nsm'},
18502 [0x963]={d='nsm'},
18503 [0x981]={d='nsm'},
18504 [0x9BC]={d='nsm'},
18505 [0x9C1]={d='nsm'},
18506 [0x9C2]={d='nsm'},
18507 [0x9C3]={d='nsm'},
18508 [0x9C4]={d='nsm'},
18509 [0x9CD]={d='nsm'},
18510 [0x9E2]={d='nsm'},
18511 [0x9E3]={d='nsm'},
18512 [0x9F2]={d='et'},
18513 [0x9F3]={d='et'},
18514 [0x9FB]={d='et'},
18515 [0xA01]={d='nsm'},
18516 [0xA02]={d='nsm'},
18517 [0xA3C]={d='nsm'},
18518 [0xA41]={d='nsm'},
18519 [0xA42]={d='nsm'},
18520 [0xA47]={d='nsm'},
18521 [0xA48]={d='nsm'},
18522 [0xA4B]={d='nsm'},
18523 [0xA4C]={d='nsm'},
18524 [0xA4D]={d='nsm'},
18525 [0xA51]={d='nsm'},
18526 [0xA70]={d='nsm'},
18527 [0xA71]={d='nsm'},
18528 [0xA75]={d='nsm'},
18529 [0xA81]={d='nsm'},
18530 [0xA82]={d='nsm'},
18531 [0xABC]={d='nsm'},
18532 [0xAC1]={d='nsm'},
18533 [0xAC2]={d='nsm'},
18534 [0xAC3]={d='nsm'},
18535 [0xAC4]={d='nsm'},
18536 [0xAC5]={d='nsm'},
18537 [0xAC7]={d='nsm'},
18538 [0xAC8]={d='nsm'},
18539 [0xACD]={d='nsm'},
18540 [0xAE2]={d='nsm'},
18541 [0xAE3]={d='nsm'},
18542 [0xAF1]={d='et'},
18543 [0xB01]={d='nsm'},
18544 [0xB3C]={d='nsm'},
18545 [0xB3F]={d='nsm'},
18546 [0xB41]={d='nsm'},
18547 [0xB42]={d='nsm'},
18548 [0xB43]={d='nsm'},
18549 [0xB44]={d='nsm'},
18550 [0xB4D]={d='nsm'},
18551 [0xB56]={d='nsm'},
18552 [0xB62]={d='nsm'},
18553 [0xB63]={d='nsm'},
18554 [0xB82]={d='nsm'},
18555 [0xBC0]={d='nsm'},
18556 [0xBCD]={d='nsm'},
18557 [0xBF3]={d='on'},
18558 [0xBF4]={d='on'},
18559 [0xBF5]={d='on'},
18560 [0xBF6]={d='on'},
18561 [0xBF7]={d='on'},
18562 [0xBF8]={d='on'},
18563 [0xBF9]={d='et'},
18564 [0xBFA]={d='on'},
18565 [0xC00]={d='nsm'},
18566 [0xC3E]={d='nsm'},
18567 [0xC3F]={d='nsm'},
18568 [0xC40]={d='nsm'},
18569 [0xC46]={d='nsm'},
18570 [0xC47]={d='nsm'},
18571 [0xC48]={d='nsm'},
18572 [0xC4A]={d='nsm'},
18573 [0xC4B]={d='nsm'},
18574 [0xC4C]={d='nsm'},
18575 [0xC4D]={d='nsm'},
18576 [0xC55]={d='nsm'},
18577 [0xC56]={d='nsm'},
18578 [0xC62]={d='nsm'},
18579 [0xC63]={d='nsm'},
18580 [0xC78]={d='on'},
18581 [0xC79]={d='on'},
18582 [0xC7A]={d='on'},
18583 [0xC7B]={d='on'},
18584 [0xC7C]={d='on'},
18585 [0xC7D]={d='on'},
18586 [0xC7E]={d='on'},
18587 [0xC81]={d='nsm'},
18588 [0xCBC]={d='nsm'},
18589 [0xCCC]={d='nsm'},
18590 [0xCCD]={d='nsm'},
18591 [0xCE2]={d='nsm'},
18592 [0xCE3]={d='nsm'},
18593 [0xD01]={d='nsm'},
18594 [0xD41]={d='nsm'},
18595 [0xD42]={d='nsm'},
18596 [0xD43]={d='nsm'},
18597 [0xD44]={d='nsm'},
18598 [0xD4D]={d='nsm'},
18599 [0xD62]={d='nsm'},
18600 [0xD63]={d='nsm'},
18601 [0xDCA]={d='nsm'},
18602 [0xDD2]={d='nsm'},
18603 [0xDD3]={d='nsm'},
18604 [0xDD4]={d='nsm'},
18605 [0xDD6]={d='nsm'},
18606 [0xE31]={d='nsm'},
18607 [0xE34]={d='nsm'},
18608 [0xE35]={d='nsm'},
18609 [0xE36]={d='nsm'},
18610 [0xE37]={d='nsm'},
18611 [0xE38]={d='nsm'},
18612 [0xE39]={d='nsm'},
18613 [0xE3A]={d='nsm'},
18614 [0xE3F]={d='et'},
18615 [0xE47]={d='nsm'},
18616 [0xE48]={d='nsm'},
18617 [0xE49]={d='nsm'},
18618 [0xE4A]={d='nsm'},
18619 [0xE4B]={d='nsm'},
18620 [0xE4C]={d='nsm'},
18621 [0xE4D]={d='nsm'},
18622 [0xE4E]={d='nsm'},
18623 [0xEB1]={d='nsm'},
18624 [0xEB4]={d='nsm'},
18625 [0xEB5]={d='nsm'},
18626 [0xEB6]={d='nsm'},
18627 [0xEB7]={d='nsm'},
18628 [0xEB8]={d='nsm'},
18629 [0xEB9]={d='nsm'},
18630 [0xEBB]={d='nsm'},
18631 [0xEBC]={d='nsm'},
18632 [0xEC8]={d='nsm'},
18633 [0xEC9]={d='nsm'},
18634 [0xECA]={d='nsm'},
18635 [0xECB]={d='nsm'},
18636 [0xECC]={d='nsm'},
18637 [0xECD]={d='nsm'},
18638 [0xF18]={d='nsm'},
18639 [0xF19]={d='nsm'},
18640 [0xF35]={d='nsm'},
18641 [0xF37]={d='nsm'},
18642 [0xF39]={d='nsm'},
18643 [0xF3A]={d='on', m=0xF3B},
18644 [0xF3B]={d='on', m=0xF3A},
18645 [0xF3C]={d='on', m=0xF3D},
18646 [0xF3D]={d='on', m=0xF3C},
18647 [0xF71]={d='nsm'},
18648 [0xF72]={d='nsm'},
18649 [0xF73]={d='nsm'},
18650 [0xF74]={d='nsm'},
18651 [0xF75]={d='nsm'},
18652 [0xF76]={d='nsm'},
18653 [0xF77]={d='nsm'},
18654 [0xF78]={d='nsm'},
18655 [0xF79]={d='nsm'},
18656 [0xF7A]={d='nsm'},
18657 [0xF7B]={d='nsm'},
18658 [0xF7C]={d='nsm'},
18659 [0xF7D]={d='nsm'},
18660 [0xF7E]={d='nsm'},
18661 [0xF80]={d='nsm'},
18662 [0xF81]={d='nsm'},
18663 [0xF82]={d='nsm'},
18664 [0xF83]={d='nsm'},
18665 [0xF84]={d='nsm'},
18666 [0xF86]={d='nsm'},
18667 [0xF87]={d='nsm'},
18668 [0xF8D]={d='nsm'},
18669 [0xF8E]={d='nsm'},
18670 [0xF8F]={d='nsm'},
18671 [0xF90]={d='nsm'},
18672 [0xF91]={d='nsm'},
18673 [0xF92]={d='nsm'},
18674 [0xF93]={d='nsm'},
18675 [0xF94]={d='nsm'},
18676 [0xF95]={d='nsm'},
18677 [0xF96]={d='nsm'},
18678 [0xF97]={d='nsm'},
18679 [0xF99]={d='nsm'},
18680 [0xF9A]={d='nsm'},
18681 [0xF9B]={d='nsm'},
18682 [0xF9C]={d='nsm'},
18683 [0xF9D]={d='nsm'},
18684 [0xF9E]={d='nsm'},
18685 [0xF9F]={d='nsm'},
18686 [0xFA0]={d='nsm'},
18687 [0xFA1]={d='nsm'},
18688 [0xFA2]={d='nsm'},
18689 [0xFA3]={d='nsm'},
18690 [0xFA4]={d='nsm'},
18691 [0xFA5]={d='nsm'},
18692 [0xFA6]={d='nsm'},
18693 [0xFA7]={d='nsm'},
18694 [0xFA8]={d='nsm'},
18695 [0xFA9]={d='nsm'},
18696 [0xFAA]={d='nsm'},
18697 [0xFAB]={d='nsm'},
18698 [0xFAC]={d='nsm'},
18699 [0xFAD]={d='nsm'},
18700 [0xFAE]={d='nsm'},
18701 [0xFAF]={d='nsm'},
18702 [0xFB0]={d='nsm'},
18703 [0xFB1]={d='nsm'},
18704 [0xFB2]={d='nsm'},
18705 [0xFB3]={d='nsm'},
18706 [0xFB4]={d='nsm'},
18707 [0xFB5]={d='nsm'},
18708 [0xFB6]={d='nsm'},
18709 [0xFB7]={d='nsm'},
18710 [0xFB8]={d='nsm'},
18711 [0xFB9]={d='nsm'},
18712 [0xFBA]={d='nsm'},
18713 [0xFBB]={d='nsm'},
18714 [0xFBC]={d='nsm'},
18715 [0xFC6]={d='nsm'},
18716 [0x102D]={d='nsm'},
18717 [0x102E]={d='nsm'},
18718 [0x102F]={d='nsm'},
18719 [0x1030]={d='nsm'},
18720 [0x1032]={d='nsm'},
18721 [0x1033]={d='nsm'},
18722 [0x1034]={d='nsm'},
18723 [0x1035]={d='nsm'},
18724 [0x1036]={d='nsm'},
18725 [0x1037]={d='nsm'},
18726 [0x1039]={d='nsm'},
18727 [0x103A]={d='nsm'},
18728 [0x103D]={d='nsm'},
18729 [0x103E]={d='nsm'},
18730 [0x1058]={d='nsm'},
18731 [0x1059]={d='nsm'},
18732 [0x105E]={d='nsm'},
18733 [0x105F]={d='nsm'},
18734 [0x1060]={d='nsm'},
18735 [0x1071]={d='nsm'},
18736 [0x1072]={d='nsm'},
18737 [0x1073]={d='nsm'},
18738 [0x1074]={d='nsm'},
18739 [0x1082]={d='nsm'},
18740 [0x1085]={d='nsm'},
18741 [0x1086]={d='nsm'},
18742 [0x108D]={d='nsm'},
18743 [0x109D]={d='nsm'},
18744 [0x135D]={d='nsm'},
18745 [0x135E]={d='nsm'},
18746 [0x135F]={d='nsm'},
18747 [0x1390]={d='on'},
18748 [0x1391]={d='on'},
18749 [0x1392]={d='on'},
18750 [0x1393]={d='on'},
18751 [0x1394]={d='on'},
18752 [0x1395]={d='on'},
18753 [0x1396]={d='on'},
18754 [0x1397]={d='on'},
18755 [0x1398]={d='on'},
18756 [0x1399]={d='on'},
18757 [0x1400]={d='on'},
18758 [0x1680]={d='ws'},
18759 [0x169B]={d='on', m=0x169C},
18760 [0x169C]={d='on', m=0x169B},
18761 [0x1712]={d='nsm'},
18762 [0x1713]={d='nsm'},
18763 [0x1714]={d='nsm'},
18764 [0x1732]={d='nsm'},
18765 [0x1733]={d='nsm'},
18766 [0x1734]={d='nsm'},
18767 [0x1752]={d='nsm'},
18768 [0x1753]={d='nsm'},
18769 [0x1772]={d='nsm'},
18770 [0x1773]={d='nsm'},
18771 [0x17B4]={d='nsm'},
18772 [0x17B5]={d='nsm'},
18773 [0x17B7]={d='nsm'},
18774 [0x17B8]={d='nsm'},
18775 [0x17B9]={d='nsm'},
18776 [0x17BA]={d='nsm'},
18777 [0x17BB]={d='nsm'},
18778 [0x17BC]={d='nsm'},
18779 [0x17BD]={d='nsm'},
18780 [0x17C6]={d='nsm'},
18781 [0x17C9]={d='nsm'},
18782 [0x17CA]={d='nsm'},
18783 [0x17CB]={d='nsm'},
18784 [0x17CC]={d='nsm'},
18785 [0x17CD]={d='nsm'},
18786 [0x17CE]={d='nsm'},
18787 [0x17CF]={d='nsm'},
18788 [0x17D0]={d='nsm'},
18789 [0x17D1]={d='nsm'},
18790 [0x17D2]={d='nsm'},
18791 [0x17D3]={d='nsm'},
18792 [0x17DB]={d='et'},
18793 [0x17DD]={d='nsm'},
18794 [0x17F0]={d='on'},
18795 [0x17F1]={d='on'},
18796 [0x17F2]={d='on'},
18797 [0x17F3]={d='on'},
18798 [0x17F4]={d='on'},
18799 [0x17F5]={d='on'},
18800 [0x17F6]={d='on'},
18801 [0x17F7]={d='on'},
18802 [0x17F8]={d='on'},
18803 [0x17F9]={d='on'},
18804 [0x1800]={d='on'},
18805 [0x1801]={d='on'},
18806 [0x1802]={d='on'},
18807 [0x1803]={d='on'},
18808 [0x1804]={d='on'},
18809 [0x1805]={d='on'},
18810 [0x1806]={d='on'},
18811 [0x1807]={d='on'},
18812 [0x1808]={d='on'},
18813 [0x1809]={d='on'},
18814 [0x180A]={d='on'},
18815 [0x180B]={d='nsm'},
18816 [0x180C]={d='nsm'},
18817 [0x180D]={d='nsm'},
18818 [0x180E]={d='bn'},
18819 [0x1885]={d='nsm'},
18820 [0x1886]={d='nsm'},
18821 [0x18A9]={d='nsm'},
18822 [0x1920]={d='nsm'},
18823 [0x1921]={d='nsm'},
18824 [0x1922]={d='nsm'},
18825 [0x1927]={d='nsm'},
18826 [0x1928]={d='nsm'},
18827 [0x1932]={d='nsm'},
18828 [0x1939]={d='nsm'},
18829 [0x193A]={d='nsm'},
18830 [0x193B]={d='nsm'},
18831 [0x1940]={d='on'},
18832 [0x1944]={d='on'},
18833 [0x1945]={d='on'},
18834 [0x19DE]={d='on'},
18835 [0x19DF]={d='on'},
18836 [0x19E0]={d='on'},
18837 [0x19E1]={d='on'},
18838 [0x19E2]={d='on'},
18839 [0x19E3]={d='on'},
18840 [0x19E4]={d='on'},
18841 [0x19E5]={d='on'},
18842 [0x19E6]={d='on'},
18843 [0x19E7]={d='on'},
18844 [0x19E8]={d='on'},
18845 [0x19E9]={d='on'},
18846 [0x19EA]={d='on'},
18847 [0x19EB]={d='on'},
18848 [0x19EC]={d='on'},
18849 [0x19ED]={d='on'},
18850 [0x19EE]={d='on'},
18851 [0x19EF]={d='on'},
18852 [0x19F0]={d='on'},
18853 [0x19F1]={d='on'},
18854 [0x19F2]={d='on'},
18855 [0x19F3]={d='on'},
18856 [0x19F4]={d='on'},
18857 [0x19F5]={d='on'},
18858 [0x19F6]={d='on'},
18859 [0x19F7]={d='on'},
18860 [0x19F8]={d='on'},
18861 [0x19F9]={d='on'},
18862 [0x19FA]={d='on'},
18863 [0x19FB]={d='on'},
18864 [0x19FC]={d='on'},
18865 [0x19FD]={d='on'},
18866 [0x19FE]={d='on'},
18867 [0x19FF]={d='on'},
18868 [0x1A17]={d='nsm'},
18869 [0x1A18]={d='nsm'},
18870 [0x1A1B]={d='nsm'},
18871 [0x1A56]={d='nsm'},
18872 [0x1A58]={d='nsm'},
18873 [0x1A59]={d='nsm'},
18874 [0x1A5A]={d='nsm'},
18875 [0x1A5B]={d='nsm'},
18876 [0x1A5C]={d='nsm'},
18877 [0x1A5D]={d='nsm'},
18878 [0x1A5E]={d='nsm'},
18879 [0x1A60]={d='nsm'},
18880 [0x1A62]={d='nsm'},
18881 [0x1A65]={d='nsm'},
18882 [0x1A66]={d='nsm'},
18883 [0x1A67]={d='nsm'},
18884 [0x1A68]={d='nsm'},
18885 [0x1A69]={d='nsm'},
18886 [0x1A6A]={d='nsm'},
18887 [0x1A6B]={d='nsm'},
18888 [0x1A6C]={d='nsm'},
18889 [0x1A73]={d='nsm'},
18890 [0x1A74]={d='nsm'},
18891 [0x1A75]={d='nsm'},
18892 [0x1A76]={d='nsm'},
18893 [0x1A77]={d='nsm'},
18894 [0x1A78]={d='nsm'},
18895 [0x1A79]={d='nsm'},
18896 [0x1A7A]={d='nsm'},
18897 [0x1A7B]={d='nsm'},
18898 [0x1A7C]={d='nsm'},
18899 [0x1A7F]={d='nsm'},
18900 [0x1AB0]={d='nsm'},
18901 [0x1AB1]={d='nsm'},
18902 [0x1AB2]={d='nsm'},
18903 [0x1AB3]={d='nsm'},
18904 [0x1AB4]={d='nsm'},
18905 [0x1AB5]={d='nsm'},
18906 [0x1AB6]={d='nsm'},
18907 [0x1AB7]={d='nsm'},
18908 [0x1AB8]={d='nsm'},
18909 [0x1AB9]={d='nsm'},
18910 [0x1ABA]={d='nsm'},
18911 [0x1ABB]={d='nsm'},
18912 [0x1ABC]={d='nsm'},
18913 [0x1ABD]={d='nsm'},
18914 [0x1ABE]={d='nsm'},
18915 [0x1B00]={d='nsm'},
18916 [0x1B01]={d='nsm'},
18917 [0x1B02]={d='nsm'},
18918 [0x1B03]={d='nsm'},
18919 [0x1B34]={d='nsm'},
18920 [0x1B36]={d='nsm'},
18921 [0x1B37]={d='nsm'},
18922 [0x1B38]={d='nsm'},
18923 [0x1B39]={d='nsm'},
18924 [0x1B3A]={d='nsm'},
18925 [0x1B3C]={d='nsm'},
18926 [0x1B42]={d='nsm'},
18927 [0x1B6B]={d='nsm'},
18928 [0x1B6C]={d='nsm'},
18929 [0x1B6D]={d='nsm'},
18930 [0x1B6E]={d='nsm'},
18931 [0x1B6F]={d='nsm'},
18932 [0x1B70]={d='nsm'},
18933 [0x1B71]={d='nsm'},
18934 [0x1B72]={d='nsm'},
18935 [0x1B73]={d='nsm'},
18936 [0x1B80]={d='nsm'},
18937 [0x1B81]={d='nsm'},
18938 [0x1BA2]={d='nsm'},
18939 [0x1BA3]={d='nsm'},
18940 [0x1BA4]={d='nsm'},
18941 [0x1BA5]={d='nsm'},
18942 [0x1BA8]={d='nsm'},
18943 [0x1BA9]={d='nsm'},
18944 [0x1BAB]={d='nsm'},
18945 [0x1BAC]={d='nsm'},
18946 [0x1BAD]={d='nsm'},
18947 [0x1BE6]={d='nsm'},
18948 [0x1BE8]={d='nsm'},
18949 [0x1BE9]={d='nsm'},
18950 [0x1BED]={d='nsm'},
18951 [0x1BEF]={d='nsm'},
18952 [0x1BF0]={d='nsm'},
18953 [0x1BF1]={d='nsm'},
18954 [0x1C2C]={d='nsm'},
18955 [0x1C2D]={d='nsm'},
18956 [0x1C2E]={d='nsm'},
18957 [0x1C2F]={d='nsm'},
18958 [0x1C30]={d='nsm'},
18959 [0x1C31]={d='nsm'},
18960 [0x1C32]={d='nsm'},
18961 [0x1C33]={d='nsm'},
18962 [0x1C36]={d='nsm'},
18963 [0x1C37]={d='nsm'},
18964 [0x1CD0]={d='nsm'},
18965 [0x1CD1]={d='nsm'},
18966 [0x1CD2]={d='nsm'},
18967 [0x1CD4]={d='nsm'},
18968 [0x1CD5]={d='nsm'},
18969 [0x1CD6]={d='nsm'},
18970 [0x1CD7]={d='nsm'},
18971 [0x1CD8]={d='nsm'},
18972 [0x1CD9]={d='nsm'},
18973 [0x1CDA]={d='nsm'},
18974 [0x1CDB]={d='nsm'},
18975 [0x1CDC]={d='nsm'},
18976 [0x1CDD]={d='nsm'},
18977 [0x1CDE]={d='nsm'},
18978 [0x1CDF]={d='nsm'},
18979 [0x1CE0]={d='nsm'},
18980 [0x1CE2]={d='nsm'},
18981 [0x1CE3]={d='nsm'},
18982 [0x1CE4]={d='nsm'},
18983 [0x1CE5]={d='nsm'},
18984 [0x1CE6]={d='nsm'},
18985 [0x1CE7]={d='nsm'},
18986 [0x1CE8]={d='nsm'},
18987 [0x1CED]={d='nsm'},
18988 [0x1CF4]={d='nsm'},
18989 [0x1CF8]={d='nsm'},
18990 [0x1CF9]={d='nsm'},
18991 [0x1DC0]={d='nsm'},
18992 [0x1DC1]={d='nsm'},
18993 [0x1DC2]={d='nsm'},
18994 [0x1DC3]={d='nsm'},
18995 [0x1DC4]={d='nsm'},
18996 [0x1DC5]={d='nsm'},
18997 [0x1DC6]={d='nsm'},
18998 [0x1DC7]={d='nsm'},
18999 [0x1DC8]={d='nsm'},
19000 [0x1DC9]={d='nsm'},
19001 [0x1DCA]={d='nsm'},
19002 [0x1DCB]={d='nsm'},
19003 [0x1DCC]={d='nsm'},
19004 [0x1DCD]={d='nsm'},
19005 [0x1DCE]={d='nsm'},
19006 [0x1DCF]={d='nsm'},
19007 [0x1DD0]={d='nsm'},
19008 [0x1DD1]={d='nsm'},
19009 [0x1DD2]={d='nsm'},
19010 [0x1DD3]={d='nsm'},
19011 [0x1DD4]={d='nsm'},
19012 [0x1DD5]={d='nsm'},
19013 [0x1DD6]={d='nsm'},
19014 [0x1DD7]={d='nsm'},
19015 [0x1DD8]={d='nsm'},
19016 [0x1DD9]={d='nsm'},
19017 [0x1DDA]={d='nsm'},
19018 [0x1DDB]={d='nsm'},
19019 [0x1DDC]={d='nsm'},
19020 [0x1DDD]={d='nsm'},
19021 [0x1DDE]={d='nsm'},
19022 [0x1DDF]={d='nsm'},
19023 [0x1DE0]={d='nsm'},
19024 [0x1DE1]={d='nsm'},
19025 [0x1DE2]={d='nsm'},
19026 [0x1DE3]={d='nsm'},
19027 [0x1DE4]={d='nsm'},
19028 [0x1DE5]={d='nsm'},
19029 [0x1DE6]={d='nsm'},
19030 [0x1DE7]={d='nsm'},
19031 [0x1DE8]={d='nsm'},
19032 [0x1DE9]={d='nsm'},
19033 [0x1DEA]={d='nsm'},
19034 [0x1DEB]={d='nsm'},
19035 [0x1DEC]={d='nsm'},
19036 [0x1DED]={d='nsm'},
19037 [0x1DEE]={d='nsm'},
19038 [0x1DEF]={d='nsm'},
19039 [0x1DF0]={d='nsm'},
19040 [0x1DF1]={d='nsm'},
19041 [0x1DF2]={d='nsm'},
19042 [0x1DF3]={d='nsm'},
19043 [0x1DF4]={d='nsm'},
19044 [0x1DF5]={d='nsm'},
19045 [0x1DFB]={d='nsm'},
19046 [0x1DFC]={d='nsm'},
19047 [0x1DFD]={d='nsm'},
19048 [0x1DFE]={d='nsm'},
19049 [0x1DFF]={d='nsm'},
19050 [0x1FBD]={d='on'},
19051 [0x1FBF]={d='on'},
19052 [0x1FC0]={d='on'},
19053 [0x1FC1]={d='on'},
19054 [0x1FCD]={d='on'},
19055 [0x1FCE]={d='on'},
19056 [0x1FCF]={d='on'},
19057 [0x1FDD]={d='on'},
19058 [0x1FDE]={d='on'},
19059 [0x1FDF]={d='on'},
19060 [0x1FED]={d='on'},
19061 [0x1FEE]={d='on'},
19062 [0x1FEF]={d='on'},
19063 [0x1FFD]={d='on'},
19064 [0x1FFE]={d='on'},
19065 [0x2000]={d='ws'},
19066 [0x2001]={d='ws'},
19067 [0x2002]={d='ws'},
19068 [0x2003]={d='ws'},
19069 [0x2004]={d='ws'},
19070 [0x2005]={d='ws'},
19071 [0x2006]={d='ws'},
19072 [0x2007]={d='ws'},
19073 [0x2008]={d='ws'},
19074 [0x2009]={d='ws'},
19075 [0x200A]={d='ws'},
19076 [0x200B]={d='bn'},
19077 [0x200C]={d='bn'},
19078 [0x200D]={d='bn'},
19079 [0x200F]={d='r'},
19080 [0x2010]={d='on'},
19081 [0x2011]={d='on'},
19082 [0x2012]={d='on'},
19083 [0x2013]={d='on'},
19084 [0x2014]={d='on'},
19085 [0x2015]={d='on'},
19086 [0x2016]={d='on'},
19087 [0x2017]={d='on'},
19088 [0x2018]={d='on'},
19089 [0x2019]={d='on'},
19090 [0x201A]={d='on'},
19091 [0x201B]={d='on'},
19092 [0x201C]={d='on'},
19093 [0x201D]={d='on'},
19094 [0x201E]={d='on'},
19095 [0x201F]={d='on'},
19096 [0x2020]={d='on'},
19097 [0x2021]={d='on'},
19098 [0x2022]={d='on'},
19099 [0x2023]={d='on'},
19100 [0x2024]={d='on'},
19101 [0x2025]={d='on'},
19102 [0x2026]={d='on'},
19103 [0x2027]={d='on'},
19104 [0x2028]={d='ws'},
19105 [0x2029]={d='b'},
19106 [0x202A]={d='lre'},
19107 [0x202B]={d='rle'},
19108 [0x202C]={d='pdf'},
19109 [0x202D]={d='lro'},
19110 [0x202E]={d='rlo'},
19111 [0x202F]={d='cs'},
19112 [0x2030]={d='et'},
19113 [0x2031]={d='et'},
19114 [0x2032]={d='et'},
19115 [0x2033]={d='et'},
19116 [0x2034]={d='et'},
19117 [0x2035]={d='on'},
19118 [0x2036]={d='on'},
19119 [0x2037]={d='on'},
19120 [0x2038]={d='on'},
19121 [0x2039]={d='on', m=0x203A},
19122 [0x203A]={d='on', m=0x2039},
19123 [0x203B]={d='on'},
19124 [0x203C]={d='on'},
19125 [0x203D]={d='on'},
19126 [0x203E]={d='on'},
19127 [0x203F]={d='on'},
19128 [0x2040]={d='on'},
19129 [0x2041]={d='on'},
19130 [0x2042]={d='on'},
19131 [0x2043]={d='on'},
19132 [0x2044]={d='cs'},
19133 [0x2045]={d='on', m=0x2046},
19134 [0x2046]={d='on', m=0x2045},
19135 [0x2047]={d='on'},
19136 [0x2048]={d='on'},
19137 [0x2049]={d='on'},
19138 [0x204A]={d='on'},
19139 [0x204B]={d='on'},
19140 [0x204C]={d='on'},
19141 [0x204D]={d='on'},
19142 [0x204E]={d='on'},
19143 [0x204F]={d='on'},
19144 [0x2050]={d='on'},
19145 [0x2051]={d='on'},
19146 [0x2052]={d='on'},
19147 [0x2053]={d='on'},
19148 [0x2054]={d='on'},
19149 [0x2055]={d='on'},
19150 [0x2056]={d='on'},
19151 [0x2057]={d='on'},
19152 [0x2058]={d='on'},
19153 [0x2059]={d='on'},
19154 [0x205A]={d='on'},
19155 [0x205B]={d='on'},
19156 [0x205C]={d='on'},
19157 [0x205D]={d='on'},
19158 [0x205E]={d='on'},
19159 [0x205F]={d='ws'},
19160 [0x2060]={d='bn'},
19161 [0x2061]={d='bn'},
19162 [0x2062]={d='bn'},
19163 [0x2063]={d='bn'},
19164 [0x2064]={d='bn'},
19165 [0x2066]={d='lri'},
19166 [0x2067]={d='rli'},
19167 [0x2068]={d='fsi'},
19168 [0x2069]={d='pdi'},
19169 [0x206A]={d='bn'},
19170 [0x206B]={d='bn'},
19171 [0x206C]={d='bn'},
19172 [0x206D]={d='bn'},
19173 [0x206E]={d='bn'},
19174 [0x206F]={d='bn'},
19175 [0x2070]={d='en'},
19176 [0x2074]={d='en'},
19177 [0x2075]={d='en'},
19178 [0x2076]={d='en'},
19179 [0x2077]={d='en'},
19180 [0x2078]={d='en'},
19181 [0x2079]={d='en'},
19182 [0x207A]={d='es'},
19183 [0x207B]={d='es'},
19184 [0x207C]={d='on'},
19185 [0x207D]={d='on', m=0x207E},
19186 [0x207E]={d='on', m=0x207D},
19187 [0x2080]={d='en'},
19188 [0x2081]={d='en'},
19189 [0x2082]={d='en'},
19190 [0x2083]={d='en'},
19191 [0x2084]={d='en'},
19192 [0x2085]={d='en'},
19193 [0x2086]={d='en'},
19194 [0x2087]={d='en'},
19195 [0x2088]={d='en'},
19196 [0x2089]={d='en'},
19197 [0x208A]={d='es'},
19198 [0x208B]={d='es'},
19199 [0x208C]={d='on'},
19200 [0x208D]={d='on', m=0x208E},
19201 [0x208E]={d='on', m=0x208D},
19202 [0x20A0]={d='et'},
19203 [0x20A1]={d='et'},
19204 [0x20A2]={d='et'},
19205 [0x20A3]={d='et'},
19206 [0x20A4]={d='et'},
19207 [0x20A5]={d='et'},
19208 [0x20A6]={d='et'},
19209 [0x20A7]={d='et'},
19210 [0x20A8]={d='et'},
19211 [0x20A9]={d='et'},
19212 [0x20AA]={d='et'},
19213 [0x20AB]={d='et'},
19214 [0x20AC]={d='et'},
19215 [0x20AD]={d='et'},
19216 [0x20AE]={d='et'},
19217 [0x20AF]={d='et'},
19218 [0x20B0]={d='et'},
19219 [0x20B1]={d='et'},
19220 [0x20B2]={d='et'},
19221 [0x20B3]={d='et'},
19222 [0x20B4]={d='et'},
19223 [0x20B5]={d='et'},
19224 [0x20B6]={d='et'},
19225 [0x20B7]={d='et'},
19226 [0x20B8]={d='et'},
19227 [0x20B9]={d='et'},
19228 [0x20BA]={d='et'},
19229 [0x20BB]={d='et'},
19230 [0x20BC]={d='et'},
19231 [0x20BD]={d='et'},
19232 [0x20BE]={d='et'},
19233 [0x20D0]={d='nsm'},
19234 [0x20D1]={d='nsm'},
19235 [0x20D2]={d='nsm'},
19236 [0x20D3]={d='nsm'},
19237 [0x20D4]={d='nsm'},
19238 [0x20D5]={d='nsm'},
19239 [0x20D6]={d='nsm'},
19240 [0x20D7]={d='nsm'},
19241 [0x20D8]={d='nsm'},
19242 [0x20D9]={d='nsm'},
19243 [0x20DA]={d='nsm'},
19244 [0x20DB]={d='nsm'},
19245 [0x20DC]={d='nsm'},
19246 [0x20DD]={d='nsm'},
19247 [0x20DE]={d='nsm'},
19248 [0x20DF]={d='nsm'},
19249 [0x20E0]={d='nsm'},
19250 [0x20E1]={d='nsm'},
19251 [0x20E2]={d='nsm'},
19252 [0x20E3]={d='nsm'},
19253 [0x20E4]={d='nsm'},
19254 [0x20E5]={d='nsm'},
19255 [0x20E6]={d='nsm'},
19256 [0x20E7]={d='nsm'},
19257 [0x20E8]={d='nsm'},
19258 [0x20E9]={d='nsm'},
19259 [0x20EA]={d='nsm'},
19260 [0x20EB]={d='nsm'},
19261 [0x20EC]={d='nsm'},
19262 [0x20ED]={d='nsm'},
19263 [0x20EE]={d='nsm'},
19264 [0x20EF]={d='nsm'},
19265 [0x20F0]={d='nsm'},
19266 [0x2100]={d='on'},
19267 [0x2101]={d='on'},
19268 [0x2103]={d='on'},
19269 [0x2104]={d='on'},
19270 [0x2105]={d='on'},
19271 [0x2106]={d='on'},
19272 [0x2108]={d='on'},
19273 [0x2109]={d='on'},
19274 [0x2114]={d='on'},
19275 [0x2116]={d='on'},
19276 [0x2117]={d='on'},
19277 [0x2118]={d='on'},
19278 [0x211E]={d='on'},
19279 [0x211F]={d='on'},
19280 [0x2120]={d='on'},
19281 [0x2121]={d='on'},
19282 [0x2122]={d='on'},
19283 [0x2123]={d='on'},
19284 [0x2125]={d='on'},
19285 [0x2127]={d='on'},
19286 [0x2129]={d='on'},
19287 [0x212E]={d='et'},
19288 [0x213A]={d='on'},
19289 [0x213B]={d='on'},
19290 [0x2140]={d='on'},
19291 [0x2141]={d='on'},
19292 [0x2142]={d='on'},
19293 [0x2143]={d='on'},
19294 [0x2144]={d='on'},
19295 [0x214A]={d='on'},
19296 [0x214B]={d='on'},
19297 [0x214C]={d='on'},
19298 [0x214D]={d='on'},
19299 [0x2150]={d='on'},
19300 [0x2151]={d='on'},
19301 [0x2152]={d='on'},
19302 [0x2153]={d='on'},
19303 [0x2154]={d='on'},
19304 [0x2155]={d='on'},
19305 [0x2156]={d='on'},
19306 [0x2157]={d='on'},
19307 [0x2158]={d='on'},
19308 [0x2159]={d='on'},
19309 [0x215A]={d='on'},
19310 [0x215B]={d='on'},
19311 [0x215C]={d='on'},
19312 [0x215D]={d='on'},
19313 [0x215E]={d='on'},
19314 [0x215F]={d='on'},
19315 [0x2189]={d='on'},
19316 [0x218A]={d='on'},
19317 [0x218B]={d='on'},
19318 [0x2190]={d='on'},
19319 [0x2191]={d='on'},
19320 [0x2192]={d='on'},
19321 [0x2193]={d='on'},
19322 [0x2194]={d='on'},
19323 [0x2195]={d='on'},
19324 [0x2196]={d='on'},
19325 [0x2197]={d='on'},
19326 [0x2198]={d='on'},
19327 [0x2199]={d='on'},
19328 [0x219A]={d='on'},
19329 [0x219B]={d='on'},
19330 [0x219C]={d='on'},
19331 [0x219D]={d='on'},
19332 [0x219E]={d='on'},
19333 [0x219F]={d='on'},
19334 [0x21A0]={d='on'},
19335 [0x21A1]={d='on'},
19336 [0x21A2]={d='on'},
19337 [0x21A3]={d='on'},
19338 [0x21A4]={d='on'},
19339 [0x21A5]={d='on'},
19340 [0x21A6]={d='on'},
19341 [0x21A7]={d='on'},
19342 [0x21A8]={d='on'},
19343 [0x21A9]={d='on'},
19344 [0x21AA]={d='on'},
19345 [0x21AB]={d='on'},
19346 [0x21AC]={d='on'},
19347 [0x21AD]={d='on'},
19348 [0x21AE]={d='on'},
19349 [0x21AF]={d='on'},
19350 [0x21B0]={d='on'},
19351 [0x21B1]={d='on'},
19352 [0x21B2]={d='on'},
19353 [0x21B3]={d='on'},
19354 [0x21B4]={d='on'},
19355 [0x21B5]={d='on'},
19356 [0x21B6]={d='on'},
19357 [0x21B7]={d='on'},
19358 [0x21B8]={d='on'},
19359 [0x21B9]={d='on'},
19360 [0x21BA]={d='on'},
19361 [0x21BB]={d='on'},
19362 [0x21BC]={d='on'},
19363 [0x21BD]={d='on'},
19364 [0x21BE]={d='on'},
19365 [0x21BF]={d='on'},
19366 [0x21C0]={d='on'},
19367 [0x21C1]={d='on'},
19368 [0x21C2]={d='on'},
19369 [0x21C3]={d='on'},
19370 [0x21C4]={d='on'},
19371 [0x21C5]={d='on'},
19372 [0x21C6]={d='on'},
19373 [0x21C7]={d='on'},
19374 [0x21C8]={d='on'},
19375 [0x21C9]={d='on'},
19376 [0x21CA]={d='on'},
19377 [0x21CB]={d='on'},
19378 [0x21CC]={d='on'},
19379 [0x21CD]={d='on'},
19380 [0x21CE]={d='on'},
19381 [0x21CF]={d='on'},
19382 [0x21D0]={d='on'},
19383 [0x21D1]={d='on'},
19384 [0x21D2]={d='on'},
19385 [0x21D3]={d='on'},
19386 [0x21D4]={d='on'},
19387 [0x21D5]={d='on'},
19388 [0x21D6]={d='on'},
19389 [0x21D7]={d='on'},
19390 [0x21D8]={d='on'},
19391 [0x21D9]={d='on'},
19392 [0x21DA]={d='on'},
19393 [0x21DB]={d='on'},
19394 [0x21DC]={d='on'},
19395 [0x21DD]={d='on'},
19396 [0x21DE]={d='on'},
19397 [0x21DF]={d='on'},
19398 [0x21E0]={d='on'},
19399 [0x21E1]={d='on'},
19400 [0x21E2]={d='on'},
19401 [0x21E3]={d='on'},
19402 [0x21E4]={d='on'},
19403 [0x21E5]={d='on'},
19404 [0x21E6]={d='on'},
19405 [0x21E7]={d='on'},
19406 [0x21E8]={d='on'},
19407 [0x21E9]={d='on'},
19408 [0x21EA]={d='on'},
19409 [0x21EB]={d='on'},
19410 [0x21EC]={d='on'},
19411 [0x21ED]={d='on'},
19412 [0x21EE]={d='on'},
19413 [0x21EF]={d='on'},
19414 [0x21F0]={d='on'},
19415 [0x21F1]={d='on'},
19416 [0x21F2]={d='on'},
19417 [0x21F3]={d='on'},
19418 [0x21F4]={d='on'},
19419 [0x21F5]={d='on'},
19420 [0x21F6]={d='on'},
19421 [0x21F7]={d='on'},
19422 [0x21F8]={d='on'},
19423 [0x21F9]={d='on'},
19424 [0x21FA]={d='on'},
19425 [0x21FB]={d='on'},
19426 [0x21FC]={d='on'},
19427 [0x21FD]={d='on'},
19428 [0x21FE]={d='on'},
19429 [0x21FF]={d='on'},
19430 [0x2200]={d='on'},
19431 [0x2201]={d='on'},
19432 [0x2202]={d='on'},
19433 [0x2203]={d='on'},
19434 [0x2204]={d='on'},
19435 [0x2205]={d='on'},
19436 [0x2206]={d='on'},
19437 [0x2207]={d='on'},
19438 [0x2208]={d='on', m=0x220B},
19439 [0x2209]={d='on', m=0x220C},
19440 [0x220A]={d='on', m=0x220D},
19441 [0x220B]={d='on', m=0x2208},
19442 [0x220C]={d='on', m=0x2209},
19443 [0x220D]={d='on', m=0x220A},
19444 [0x220E]={d='on'},
19445 [0x220F]={d='on'},
19446 [0x2210]={d='on'},
19447 [0x2211]={d='on'},
19448 [0x2212]={d='es'},
19449 [0x2213]={d='et'},
19450 [0x2214]={d='on'},
19451 [0x2215]={d='on', m=0x29F5},
19452 [0x2216]={d='on'},
19453 [0x2217]={d='on'},
19454 [0x2218]={d='on'},
19455 [0x2219]={d='on'},
19456 [0x221A]={d='on'},
19457 [0x221B]={d='on'},
19458 [0x221C]={d='on'},
19459 [0x221D]={d='on'},
19460 [0x221E]={d='on'},
19461 [0x221F]={d='on'},
19462 [0x2220]={d='on'},
19463 [0x2221]={d='on'},
19464 [0x2222]={d='on'},
19465 [0x2223]={d='on'},
19466 [0x2224]={d='on'},
19467 [0x2225]={d='on'},
19468 [0x2226]={d='on'},
19469 [0x2227]={d='on'},
19470 [0x2228]={d='on'},
19471 [0x2229]={d='on'},
19472 [0x222A]={d='on'},
19473 [0x222B]={d='on'},
19474 [0x222C]={d='on'},
19475 [0x222D]={d='on'},
19476 [0x222E]={d='on'},
19477 [0x222F]={d='on'},
19478 [0x2230]={d='on'},
19479 [0x2231]={d='on'},
19480 [0x2232]={d='on'},
19481 [0x2233]={d='on'},
19482 [0x2234]={d='on'},
19483 [0x2235]={d='on'},
19484 [0x2236]={d='on'},
19485 [0x2237]={d='on'},
19486 [0x2238]={d='on'},
19487 [0x2239]={d='on'},
19488 [0x223A]={d='on'},
19489 [0x223B]={d='on'},
19490 [0x223C]={d='on', m=0x223D},
19491 [0x223D]={d='on', m=0x223C},
19492 [0x223E]={d='on'},
19493 [0x223F]={d='on'},
19494 [0x2240]={d='on'},
19495 [0x2241]={d='on'},
19496 [0x2242]={d='on'},
19497 [0x2243]={d='on', m=0x22CD},
19498 [0x2244]={d='on'},
19499 [0x2245]={d='on'},
19500 [0x2246]={d='on'},
19501 [0x2247]={d='on'},
19502 [0x2248]={d='on'},
19503 [0x2249]={d='on'},
19504 [0x224A]={d='on'},
19505 [0x224B]={d='on'},
19506 [0x224C]={d='on'},
19507 [0x224D]={d='on'},
19508 [0x224E]={d='on'},
19509 [0x224F]={d='on'},
19510 [0x2250]={d='on'},
19511 [0x2251]={d='on'},
19512 [0x2252]={d='on', m=0x2253},
19513 [0x2253]={d='on', m=0x2252},
19514 [0x2254]={d='on', m=0x2255},
19515 [0x2255]={d='on', m=0x2254},
19516 [0x2256]={d='on'},
19517 [0x2257]={d='on'},
19518 [0x2258]={d='on'},
19519 [0x2259]={d='on'},
19520 [0x225A]={d='on'},
19521 [0x225B]={d='on'},
19522 [0x225C]={d='on'},
19523 [0x225D]={d='on'},
19524 [0x225E]={d='on'},
19525 [0x225F]={d='on'},
19526 [0x2260]={d='on'},
19527 [0x2261]={d='on'},
19528 [0x2262]={d='on'},
19529 [0x2263]={d='on'},
19530 [0x2264]={d='on', m=0x2265},
19531 [0x2265]={d='on', m=0x2264},
19532 [0x2266]={d='on', m=0x2267},
19533 [0x2267]={d='on', m=0x2266},
19534 [0x2268]={d='on', m=0x2269},
19535 [0x2269]={d='on', m=0x2268},
19536 [0x226A]={d='on', m=0x226B},
19537 [0x226B]={d='on', m=0x226A},
19538 [0x226C]={d='on'},
19539 [0x226D]={d='on'},
19540 [0x226E]={d='on', m=0x226F},
19541 [0x226F]={d='on', m=0x226E},
19542 [0x2270]={d='on', m=0x2271},
19543 [0x2271]={d='on', m=0x2270},
19544 [0x2272]={d='on', m=0x2273},
19545 [0x2273]={d='on', m=0x2272},
19546 [0x2274]={d='on', m=0x2275},
19547 [0x2275]={d='on', m=0x2274},
19548 [0x2276]={d='on', m=0x2277},
19549 [0x2277]={d='on', m=0x2276},
19550 [0x2278]={d='on', m=0x2279},
19551 [0x2279]={d='on', m=0x2278},
19552 [0x227A]={d='on', m=0x227B},
19553 [0x227B]={d='on', m=0x227A},
19554 [0x227C]={d='on', m=0x227D},
19555 [0x227D]={d='on', m=0x227C},
19556 [0x227E]={d='on', m=0x227F},
19557 [0x227F]={d='on', m=0x227E},
19558 [0x2280]={d='on', m=0x2281},
19559 [0x2281]={d='on', m=0x2280},
19560 [0x2282]={d='on', m=0x2283},
19561 [0x2283]={d='on', m=0x2282},
19562 [0x2284]={d='on', m=0x2285},
19563 [0x2285]={d='on', m=0x2284},
19564 [0x2286]={d='on', m=0x2287},
19565 [0x2287]={d='on', m=0x2286},
19566 [0x2288]={d='on', m=0x2289},
19567 [0x2289]={d='on', m=0x2288},
19568 [0x228A]={d='on', m=0x228B},
19569 [0x228B]={d='on', m=0x228A},
19570 [0x228C]={d='on'},
19571 [0x228D]={d='on'},
19572 [0x228E]={d='on'},
19573 [0x228F]={d='on', m=0x2290},
19574 [0x2290]={d='on', m=0x228F},
19575 [0x2291]={d='on', m=0x2292},
19576 [0x2292]={d='on', m=0x2291},
19577 [0x2293]={d='on'},
19578 [0x2294]={d='on'},
19579 [0x2295]={d='on'},
19580 [0x2296]={d='on'},
19581 [0x2297]={d='on'},
19582 [0x2298]={d='on', m=0x29B8},
19583 [0x2299]={d='on'},
19584 [0x229A]={d='on'},
19585 [0x229B]={d='on'},
19586 [0x229C]={d='on'},
19587 [0x229D]={d='on'},
19588 [0x229E]={d='on'},
19589 [0x229F]={d='on'},
19590 [0x22A0]={d='on'},
19591 [0x22A1]={d='on'},
19592 [0x22A2]={d='on', m=0x22A3},
19593 [0x22A3]={d='on', m=0x22A2},
19594 [0x22A4]={d='on'},
19595 [0x22A5]={d='on'},
19596 [0x22A6]={d='on', m=0x2ADE},
19597 [0x22A7]={d='on'},
19598 [0x22A8]={d='on', m=0x2AE4},
19599 [0x22A9]={d='on', m=0x2AE3},
19600 [0x22AA]={d='on'},
19601 [0x22AB]={d='on', m=0x2AE5},
19602 [0x22AC]={d='on'},
19603 [0x22AD]={d='on'},
19604 [0x22AE]={d='on'},
19605 [0x22AF]={d='on'},
19606 [0x22B0]={d='on', m=0x22B1},
19607 [0x22B1]={d='on', m=0x22B0},
19608 [0x22B2]={d='on', m=0x22B3},
19609 [0x22B3]={d='on', m=0x22B2},
19610 [0x22B4]={d='on', m=0x22B5},
19611 [0x22B5]={d='on', m=0x22B4},
19612 [0x22B6]={d='on', m=0x22B7},
19613 [0x22B7]={d='on', m=0x22B6},
19614 [0x22B8]={d='on'},
19615 [0x22B9]={d='on'},
19616 [0x22BA]={d='on'},
19617 [0x22BB]={d='on'},
19618 [0x22BC]={d='on'},
19619 [0x22BD]={d='on'},
19620 [0x22BE]={d='on'},
19621 [0x22BF]={d='on'},
19622 [0x22C0]={d='on'},
19623 [0x22C1]={d='on'},
19624 [0x22C2]={d='on'},
19625 [0x22C3]={d='on'},
19626 [0x22C4]={d='on'},
19627 [0x22C5]={d='on'},
19628 [0x22C6]={d='on'},
19629 [0x22C7]={d='on'},
19630 [0x22C8]={d='on'},
19631 [0x22C9]={d='on', m=0x22CA},
19632 [0x22CA]={d='on', m=0x22C9},
19633 [0x22CB]={d='on', m=0x22CC},
19634 [0x22CC]={d='on', m=0x22CB},
19635 [0x22CD]={d='on', m=0x2243},
19636 [0x22CE]={d='on'},
19637 [0x22CF]={d='on'},
19638 [0x22D0]={d='on', m=0x22D1},
19639 [0x22D1]={d='on', m=0x22D0},
19640 [0x22D2]={d='on'},
19641 [0x22D3]={d='on'},
19642 [0x22D4]={d='on'},
19643 [0x22D5]={d='on'},
19644 [0x22D6]={d='on', m=0x22D7},
19645 [0x22D7]={d='on', m=0x22D6},
19646 [0x22D8]={d='on', m=0x22D9},
19647 [0x22D9]={d='on', m=0x22D8},
19648 [0x22DA]={d='on', m=0x22DB},
19649 [0x22DB]={d='on', m=0x22DA},
19650 [0x22DC]={d='on', m=0x22DD},
19651 [0x22DD]={d='on', m=0x22DC},
19652 [0x22DE]={d='on', m=0x22DF},
19653 [0x22DF]={d='on', m=0x22DE},
19654 [0x22E0]={d='on', m=0x22E1},
19655 [0x22E1]={d='on', m=0x22E0},
19656 [0x22E2]={d='on', m=0x22E3},
19657 [0x22E3]={d='on', m=0x22E2},
19658 [0x22E4]={d='on', m=0x22E5},
19659 [0x22E5]={d='on', m=0x22E4},
19660 [0x22E6]={d='on', m=0x22E7},
19661 [0x22E7]={d='on', m=0x22E6},
19662 [0x22E8]={d='on', m=0x22E9},
19663 [0x22E9]={d='on', m=0x22E8},
19664 [0x22EA]={d='on', m=0x22EB},
19665 [0x22EB]={d='on', m=0x22EA},
19666 [0x22EC]={d='on', m=0x22ED},
19667 [0x22ED]={d='on', m=0x22EC},
19668 [0x22EE]={d='on'},
19669 [0x22EF]={d='on'},
19670 [0x22F0]={d='on', m=0x22F1},
19671 [0x22F1]={d='on', m=0x22F0},
19672 [0x22F2]={d='on', m=0x22FA},
19673 [0x22F3]={d='on', m=0x22FB},
19674 [0x22F4]={d='on', m=0x22FC},
19675 [0x22F5]={d='on'},
19676 [0x22F6]={d='on', m=0x22FD},
19677 [0x22F7]={d='on', m=0x22FE},
19678 [0x22F8]={d='on'},
19679 [0x22F9]={d='on'},
19680 [0x22FA]={d='on', m=0x22F2},
19681 [0x22FB]={d='on', m=0x22F3},
19682 [0x22FC]={d='on', m=0x22F4},
19683 [0x22FD]={d='on', m=0x22F6},
19684 [0x22FE]={d='on', m=0x22F7},
19685 [0x22FF]={d='on'},
19686 [0x2300]={d='on'},
19687 [0x2301]={d='on'},
19688 [0x2302]={d='on'},
19689 [0x2303]={d='on'},
19690 [0x2304]={d='on'},
19691 [0x2305]={d='on'},
19692 [0x2306]={d='on'},
19693 [0x2307]={d='on'},
19694 [0x2308]={d='on', m=0x2309},
19695 [0x2309]={d='on', m=0x2308},
19696 [0x230A]={d='on', m=0x230B},
19697 [0x230B]={d='on', m=0x230A},
19698 [0x230C]={d='on'},
19699 [0x230D]={d='on'},
19700 [0x230E]={d='on'},
19701 [0x230F]={d='on'},
19702 [0x2310]={d='on'},
19703 [0x2311]={d='on'},
19704 [0x2312]={d='on'},
19705 [0x2313]={d='on'},
19706 [0x2314]={d='on'},
19707 [0x2315]={d='on'},
19708 [0x2316]={d='on'},
19709 [0x2317]={d='on'},
19710 [0x2318]={d='on'},
19711 [0x2319]={d='on'},
19712 [0x231A]={d='on'},
19713 [0x231B]={d='on'},
19714 [0x231C]={d='on'},
19715 [0x231D]={d='on'},
19716 [0x231E]={d='on'},
19717 [0x231F]={d='on'},
19718 [0x2320]={d='on'},
19719 [0x2321]={d='on'},
19720 [0x2322]={d='on'},
19721 [0x2323]={d='on'},
19722 [0x2324]={d='on'},
19723 [0x2325]={d='on'},
19724 [0x2326]={d='on'},
19725 [0x2327]={d='on'},
19726 [0x2328]={d='on'},
19727 [0x2329]={d='on', m=0x232A},
19728 [0x232A]={d='on', m=0x2329},
19729 [0x232B]={d='on'},
19730 [0x232C]={d='on'},
19731 [0x232D]={d='on'},
19732 [0x232E]={d='on'},
19733 [0x232F]={d='on'},
19734 [0x2330]={d='on'},
19735 [0x2331]={d='on'},
19736 [0x2332]={d='on'},
19737 [0x2333]={d='on'},
19738 [0x2334]={d='on'},
19739 [0x2335]={d='on'},
19740 [0x237B]={d='on'},
19741 [0x237C]={d='on'},
19742 [0x237D]={d='on'},
19743 [0x237E]={d='on'},
19744 [0x237F]={d='on'},
19745 [0x2380]={d='on'},
19746 [0x2381]={d='on'},
19747 [0x2382]={d='on'},
19748 [0x2383]={d='on'},
19749 [0x2384]={d='on'},
19750 [0x2385]={d='on'},
19751 [0x2386]={d='on'},
19752 [0x2387]={d='on'},
19753 [0x2388]={d='on'},
19754 [0x2389]={d='on'},
19755 [0x238A]={d='on'},
19756 [0x238B]={d='on'},
19757 [0x238C]={d='on'},
19758 [0x238D]={d='on'},
19759 [0x238E]={d='on'},
19760 [0x238F]={d='on'},
19761 [0x2390]={d='on'},
19762 [0x2391]={d='on'},
19763 [0x2392]={d='on'},
19764 [0x2393]={d='on'},
19765 [0x2394]={d='on'},
19766 [0x2396]={d='on'},
19767 [0x2397]={d='on'},
19768 [0x2398]={d='on'},
19769 [0x2399]={d='on'},
19770 [0x239A]={d='on'},
19771 [0x239B]={d='on'},
19772 [0x239C]={d='on'},
19773 [0x239D]={d='on'},
19774 [0x239E]={d='on'},
19775 [0x239F]={d='on'},
19776 [0x23A0]={d='on'},
19777 [0x23A1]={d='on'},
19778 [0x23A2]={d='on'},
19779 [0x23A3]={d='on'},
19780 [0x23A4]={d='on'},
19781 [0x23A5]={d='on'},
19782 [0x23A6]={d='on'},
19783 [0x23A7]={d='on'},
19784 [0x23A8]={d='on'},
19785 [0x23A9]={d='on'},
19786 [0x23AA]={d='on'},
19787 [0x23AB]={d='on'},
19788 [0x23AC]={d='on'},
19789 [0x23AD]={d='on'},
19790 [0x23AE]={d='on'},
19791 [0x23AF]={d='on'},
19792 [0x23B0]={d='on'},
19793 [0x23B1]={d='on'},
19794 [0x23B2]={d='on'},
19795 [0x23B3]={d='on'},
19796 [0x23B4]={d='on'},
19797 [0x23B5]={d='on'},
19798 [0x23B6]={d='on'},
19799 [0x23B7]={d='on'},
19800 [0x23B8]={d='on'},
19801 [0x23B9]={d='on'},
19802 [0x23BA]={d='on'},
19803 [0x23BB]={d='on'},
19804 [0x23BC]={d='on'},
19805 [0x23BD]={d='on'},
19806 [0x23BE]={d='on'},
19807 [0x23BF]={d='on'},
19808 [0x23C0]={d='on'},
19809 [0x23C1]={d='on'},
19810 [0x23C2]={d='on'},
19811 [0x23C3]={d='on'},
19812 [0x23C4]={d='on'},
19813 [0x23C5]={d='on'},
19814 [0x23C6]={d='on'},
19815 [0x23C7]={d='on'},
19816 [0x23C8]={d='on'},
19817 [0x23C9]={d='on'},
19818 [0x23CA]={d='on'},
19819 [0x23CB]={d='on'},
19820 [0x23CC]={d='on'},
19821 [0x23CD]={d='on'},
19822 [0x23CE]={d='on'},
19823 [0x23CF]={d='on'},
19824 [0x23D0]={d='on'},
19825 [0x23D1]={d='on'},
19826 [0x23D2]={d='on'},
19827 [0x23D3]={d='on'},
19828 [0x23D4]={d='on'},
19829 [0x23D5]={d='on'},
19830 [0x23D6]={d='on'},
19831 [0x23D7]={d='on'},
19832 [0x23D8]={d='on'},
19833 [0x23D9]={d='on'},
19834 [0x23DA]={d='on'},
19835 [0x23DB]={d='on'},
19836 [0x23DC]={d='on'},
19837 [0x23DD]={d='on'},
19838 [0x23DE]={d='on'},
19839 [0x23DF]={d='on'},
19840 [0x23E0]={d='on'},
19841 [0x23E1]={d='on'},
19842 [0x23E2]={d='on'},
19843 [0x23E3]={d='on'},
19844 [0x23E4]={d='on'},
19845 [0x23E5]={d='on'},
19846 [0x23E6]={d='on'},
19847 [0x23E7]={d='on'},
19848 [0x23E8]={d='on'},
19849 [0x23E9]={d='on'},
19850 [0x23EA]={d='on'},
19851 [0x23EB]={d='on'},
19852 [0x23EC]={d='on'},
19853 [0x23ED]={d='on'},
19854 [0x23EE]={d='on'},
19855 [0x23EF]={d='on'},
19856 [0x23F0]={d='on'},
19857 [0x23F1]={d='on'},
19858 [0x23F2]={d='on'},
19859 [0x23F3]={d='on'},
19860 [0x23F4]={d='on'},
19861 [0x23F5]={d='on'},
19862 [0x23F6]={d='on'},
19863 [0x23F7]={d='on'},
19864 [0x23F8]={d='on'},
19865 [0x23F9]={d='on'},
19866 [0x23FA]={d='on'},
19867 [0x23FB]={d='on'},
19868 [0x23FC]={d='on'},
19869 [0x23FD]={d='on'},
19870 [0x23FE]={d='on'},
19871 [0x2400]={d='on'},
19872 [0x2401]={d='on'},
19873 [0x2402]={d='on'},
19874 [0x2403]={d='on'},
19875 [0x2404]={d='on'},
19876 [0x2405]={d='on'},
19877 [0x2406]={d='on'},
19878 [0x2407]={d='on'},
19879 [0x2408]={d='on'},
19880 [0x2409]={d='on'},
19881 [0x240A]={d='on'},
19882 [0x240B]={d='on'},
19883 [0x240C]={d='on'},
19884 [0x240D]={d='on'},
19885 [0x240E]={d='on'},
19886 [0x240F]={d='on'},
19887 [0x2410]={d='on'},
19888 [0x2411]={d='on'},
19889 [0x2412]={d='on'},
19890 [0x2413]={d='on'},
19891 [0x2414]={d='on'},
19892 [0x2415]={d='on'},
19893 [0x2416]={d='on'},
19894 [0x2417]={d='on'},
19895 [0x2418]={d='on'},
19896 [0x2419]={d='on'},
19897 [0x241A]={d='on'},
19898 [0x241B]={d='on'},
19899 [0x241C]={d='on'},
19900 [0x241D]={d='on'},
19901 [0x241E]={d='on'},
19902 [0x241F]={d='on'},
19903 [0x2420]={d='on'},
19904 [0x2421]={d='on'},
19905 [0x2422]={d='on'},
19906 [0x2423]={d='on'},
19907 [0x2424]={d='on'},
19908 [0x2425]={d='on'},
19909 [0x2426]={d='on'},
19910 [0x2440]={d='on'},
19911 [0x2441]={d='on'},
19912 [0x2442]={d='on'},
19913 [0x2443]={d='on'},
19914 [0x2444]={d='on'},
19915 [0x2445]={d='on'},
19916 [0x2446]={d='on'},
19917 [0x2447]={d='on'},
19918 [0x2448]={d='on'},
19919 [0x2449]={d='on'},
19920 [0x244A]={d='on'},
19921 [0x2460]={d='on'},
19922 [0x2461]={d='on'},
19923 [0x2462]={d='on'},
19924 [0x2463]={d='on'},
19925 [0x2464]={d='on'},
19926 [0x2465]={d='on'},
19927 [0x2466]={d='on'},
19928 [0x2467]={d='on'},
19929 [0x2468]={d='on'},
19930 [0x2469]={d='on'},
19931 [0x246A]={d='on'},
19932 [0x246B]={d='on'},
19933 [0x246C]={d='on'},
19934 [0x246D]={d='on'},
19935 [0x246E]={d='on'},
19936 [0x246F]={d='on'},
19937 [0x2470]={d='on'},
19938 [0x2471]={d='on'},
19939 [0x2472]={d='on'},
19940 [0x2473]={d='on'},
19941 [0x2474]={d='on'},
19942 [0x2475]={d='on'},
19943 [0x2476]={d='on'},
19944 [0x2477]={d='on'},
19945 [0x2478]={d='on'},
19946 [0x2479]={d='on'},
19947 [0x247A]={d='on'},
19948 [0x247B]={d='on'},
19949 [0x247C]={d='on'},
19950 [0x247D]={d='on'},
19951 [0x247E]={d='on'},
19952 [0x247F]={d='on'},
19953 [0x2480]={d='on'},
19954 [0x2481]={d='on'},
19955 [0x2482]={d='on'},
19956 [0x2483]={d='on'},
19957 [0x2484]={d='on'},
19958 [0x2485]={d='on'},
19959 [0x2486]={d='on'},
19960 [0x2487]={d='on'},
19961 [0x2488]={d='en'},
19962 [0x2489]={d='en'},
19963 [0x248A]={d='en'},
19964 [0x248B]={d='en'},
19965 [0x248C]={d='en'},
19966 [0x248D]={d='en'},
19967 [0x248E]={d='en'},
19968 [0x248F]={d='en'},
19969 [0x2490]={d='en'},
19970 [0x2491]={d='en'},
19971 [0x2492]={d='en'},
19972 [0x2493]={d='en'},
19973 [0x2494]={d='en'},
19974 [0x2495]={d='en'},
19975 [0x2496]={d='en'},
19976 [0x2497]={d='en'},
19977 [0x2498]={d='en'},
19978 [0x2499]={d='en'},
19979 [0x249A]={d='en'},
19980 [0x249B]={d='en'},
19981 [0x24EA]={d='on'},
19982 [0x24EB]={d='on'},
19983 [0x24EC]={d='on'},
19984 [0x24ED]={d='on'},
19985 [0x24EE]={d='on'},
19986 [0x24EF]={d='on'},
19987 [0x24F0]={d='on'},
19988 [0x24F1]={d='on'},
19989 [0x24F2]={d='on'},
19990 [0x24F3]={d='on'},
19991 [0x24F4]={d='on'},
19992 [0x24F5]={d='on'},
19993 [0x24F6]={d='on'},
19994 [0x24F7]={d='on'},
19995 [0x24F8]={d='on'},
19996 [0x24F9]={d='on'},
19997 [0x24FA]={d='on'},
19998 [0x24FB]={d='on'},
19999 [0x24FC]={d='on'},
20000 [0x24FD]={d='on'},
20001 [0x24FE]={d='on'},
20002 [0x24FF]={d='on'},
20003 [0x2500]={d='on'},
20004 [0x2501]={d='on'},
20005 [0x2502]={d='on'},
20006 [0x2503]={d='on'},
20007 [0x2504]={d='on'},
20008 [0x2505]={d='on'},
20009 [0x2506]={d='on'},
20010 [0x2507]={d='on'},
20011 [0x2508]={d='on'},
20012 [0x2509]={d='on'},
20013 [0x250A]={d='on'},
20014 [0x250B]={d='on'},
20015 [0x250C]={d='on'},
20016 [0x250D]={d='on'},
20017 [0x250E]={d='on'},
20018 [0x250F]={d='on'},
20019 [0x2510]={d='on'},
20020 [0x2511]={d='on'},
20021 [0x2512]={d='on'},
20022 [0x2513]={d='on'},
20023 [0x2514]={d='on'},
20024 [0x2515]={d='on'},
20025 [0x2516]={d='on'},
20026 [0x2517]={d='on'},
20027 [0x2518]={d='on'},
20028 [0x2519]={d='on'},
20029 [0x251A]={d='on'},
20030 [0x251B]={d='on'},
20031 [0x251C]={d='on'},
20032 [0x251D]={d='on'},
20033 [0x251E]={d='on'},
20034 [0x251F]={d='on'},
20035 [0x2520]={d='on'},
20036 [0x2521]={d='on'},
20037 [0x2522]={d='on'},
20038 [0x2523]={d='on'},
20039 [0x2524]={d='on'},
20040 [0x2525]={d='on'},
20041 [0x2526]={d='on'},
20042 [0x2527]={d='on'},
20043 [0x2528]={d='on'},
20044 [0x2529]={d='on'},
20045 [0x252A]={d='on'},
20046 [0x252B]={d='on'},
20047 [0x252C]={d='on'},
20048 [0x252D]={d='on'},
20049 [0x252E]={d='on'},
20050 [0x252F]={d='on'},
20051 [0x2530]={d='on'},
20052 [0x2531]={d='on'},
20053 [0x2532]={d='on'},
20054 [0x2533]={d='on'},
20055 [0x2534]={d='on'},
20056 [0x2535]={d='on'},
20057 [0x2536]={d='on'},
20058 [0x2537]={d='on'},
20059 [0x2538]={d='on'},
20060 [0x2539]={d='on'},
20061 [0x253A]={d='on'},
20062 [0x253B]={d='on'},
20063 [0x253C]={d='on'},
20064 [0x253D]={d='on'},
20065 [0x253E]={d='on'},
20066 [0x253F]={d='on'},
20067 [0x2540]={d='on'},
20068 [0x2541]={d='on'},
20069 [0x2542]={d='on'},
20070 [0x2543]={d='on'},
20071 [0x2544]={d='on'},
20072 [0x2545]={d='on'},
20073 [0x2546]={d='on'},
20074 [0x2547]={d='on'},
20075 [0x2548]={d='on'},
20076 [0x2549]={d='on'},
20077 [0x254A]={d='on'},
20078 [0x254B]={d='on'},
20079 [0x254C]={d='on'},
20080 [0x254D]={d='on'},
20081 [0x254E]={d='on'},
20082 [0x254F]={d='on'},
20083 [0x2550]={d='on'},
20084 [0x2551]={d='on'},
20085 [0x2552]={d='on'},
20086 [0x2553]={d='on'},
20087 [0x2554]={d='on'},
20088 [0x2555]={d='on'},
20089 [0x2556]={d='on'},
20090 [0x2557]={d='on'},
20091 [0x2558]={d='on'},
20092 [0x2559]={d='on'},
20093 [0x255A]={d='on'},
20094 [0x255B]={d='on'},
20095 [0x255C]={d='on'},
20096 [0x255D]={d='on'},
20097 [0x255E]={d='on'},
20098 [0x255F]={d='on'},
20099 [0x2560]={d='on'},
20100 [0x2561]={d='on'},
20101 [0x2562]={d='on'},
20102 [0x2563]={d='on'},
20103 [0x2564]={d='on'},
20104 [0x2565]={d='on'},
20105 [0x2566]={d='on'},
20106 [0x2567]={d='on'},
20107 [0x2568]={d='on'},
20108 [0x2569]={d='on'},
20109 [0x256A]={d='on'},
20110 [0x256B]={d='on'},
20111 [0x256C]={d='on'},
20112 [0x256D]={d='on'},
20113 [0x256E]={d='on'},
20114 [0x256F]={d='on'},
20115 [0x2570]={d='on'},
20116 [0x2571]={d='on'},
20117 [0x2572]={d='on'},
20118 [0x2573]={d='on'},
20119 [0x2574]={d='on'},
20120 [0x2575]={d='on'},
20121 [0x2576]={d='on'},
20122 [0x2577]={d='on'},
20123 [0x2578]={d='on'},
20124 [0x2579]={d='on'},
20125 [0x257A]={d='on'},
20126 [0x257B]={d='on'},
20127 [0x257C]={d='on'},
20128 [0x257D]={d='on'},
20129 [0x257E]={d='on'},
20130 [0x257F]={d='on'},
20131 [0x2580]={d='on'},
20132 [0x2581]={d='on'},
20133 [0x2582]={d='on'},
20134 [0x2583]={d='on'},
20135 [0x2584]={d='on'},
20136 [0x2585]={d='on'},
20137 [0x2586]={d='on'},
20138 [0x2587]={d='on'},
20139 [0x2588]={d='on'},
20140 [0x2589]={d='on'},
20141 [0x258A]={d='on'},
20142 [0x258B]={d='on'},
20143 [0x258C]={d='on'},
20144 [0x258D]={d='on'},
20145 [0x258E]={d='on'},
20146 [0x258F]={d='on'},
20147 [0x2590]={d='on'},
20148 [0x2591]={d='on'},
20149 [0x2592]={d='on'},
20150 [0x2593]={d='on'},
20151 [0x2594]={d='on'},
20152 [0x2595]={d='on'},
20153 [0x2596]={d='on'},
20154 [0x2597]={d='on'},
20155 [0x2598]={d='on'},
20156 [0x2599]={d='on'},
20157 [0x259A]={d='on'},
20158 [0x259B]={d='on'},
20159 [0x259C]={d='on'},
20160 [0x259D]={d='on'},
20161 [0x259E]={d='on'},
20162 [0x259F]={d='on'},
20163 [0x25A0]={d='on'},
20164 [0x25A1]={d='on'},
20165 [0x25A2]={d='on'},
20166 [0x25A3]={d='on'},
20167 [0x25A4]={d='on'},
20168 [0x25A5]={d='on'},
20169 [0x25A6]={d='on'},
20170 [0x25A7]={d='on'},
20171 [0x25A8]={d='on'},
20172 [0x25A9]={d='on'},
20173 [0x25AA]={d='on'},
20174 [0x25AB]={d='on'},
20175 [0x25AC]={d='on'},
20176 [0x25AD]={d='on'},
20177 [0x25AE]={d='on'},
20178 [0x25AF]={d='on'},
20179 [0x25B0]={d='on'},
20180 [0x25B1]={d='on'},
20181 [0x25B2]={d='on'},
20182 [0x25B3]={d='on'},
20183 [0x25B4]={d='on'},
20184 [0x25B5]={d='on'},
20185 [0x25B6]={d='on'},
20186 [0x25B7]={d='on'},
20187 [0x25B8]={d='on'},
20188 [0x25B9]={d='on'},
20189 [0x25BA]={d='on'},
20190 [0x25BB]={d='on'},
20191 [0x25BC]={d='on'},
20192 [0x25BD]={d='on'},
20193 [0x25BE]={d='on'},
20194 [0x25BF]={d='on'},
20195 [0x25C0]={d='on'},
20196 [0x25C1]={d='on'},
20197 [0x25C2]={d='on'},
20198 [0x25C3]={d='on'},
20199 [0x25C4]={d='on'},
20200 [0x25C5]={d='on'},
20201 [0x25C6]={d='on'},
20202 [0x25C7]={d='on'},
20203 [0x25C8]={d='on'},
20204 [0x25C9]={d='on'},
20205 [0x25CA]={d='on'},
20206 [0x25CB]={d='on'},
20207 [0x25CC]={d='on'},
20208 [0x25CD]={d='on'},
20209 [0x25CE]={d='on'},
20210 [0x25CF]={d='on'},
20211 [0x25D0]={d='on'},
20212 [0x25D1]={d='on'},
20213 [0x25D2]={d='on'},
20214 [0x25D3]={d='on'},
20215 [0x25D4]={d='on'},
20216 [0x25D5]={d='on'},
20217 [0x25D6]={d='on'},
20218 [0x25D7]={d='on'},
20219 [0x25D8]={d='on'},
20220 [0x25D9]={d='on'},
20221 [0x25DA]={d='on'},
20222 [0x25DB]={d='on'},
20223 [0x25DC]={d='on'},
20224 [0x25DD]={d='on'},
20225 [0x25DE]={d='on'},
20226 [0x25DF]={d='on'},
20227 [0x25E0]={d='on'},
20228 [0x25E1]={d='on'},
20229 [0x25E2]={d='on'},
20230 [0x25E3]={d='on'},
20231 [0x25E4]={d='on'},
20232 [0x25E5]={d='on'},
20233 [0x25E6]={d='on'},
20234 [0x25E7]={d='on'},
20235 [0x25E8]={d='on'},
20236 [0x25E9]={d='on'},
20237 [0x25EA]={d='on'},
20238 [0x25EB]={d='on'},
20239 [0x25EC]={d='on'},
20240 [0x25ED]={d='on'},
20241 [0x25EE]={d='on'},
20242 [0x25EF]={d='on'},
20243 [0x25F0]={d='on'},
20244 [0x25F1]={d='on'},
20245 [0x25F2]={d='on'},
20246 [0x25F3]={d='on'},
20247 [0x25F4]={d='on'},
20248 [0x25F5]={d='on'},
20249 [0x25F6]={d='on'},
20250 [0x25F7]={d='on'},
20251 [0x25F8]={d='on'},
20252 [0x25F9]={d='on'},
20253 [0x25FA]={d='on'},
20254 [0x25FB]={d='on'},
20255 [0x25FC]={d='on'},
20256 [0x25FD]={d='on'},
20257 [0x25FE]={d='on'},
20258 [0x25FF]={d='on'},
20259 [0x2600]={d='on'},
20260 [0x2601]={d='on'},
20261 [0x2602]={d='on'},
20262 [0x2603]={d='on'},
20263 [0x2604]={d='on'},
20264 [0x2605]={d='on'},
20265 [0x2606]={d='on'},
20266 [0x2607]={d='on'},
20267 [0x2608]={d='on'},
20268 [0x2609]={d='on'},
20269 [0x260A]={d='on'},
20270 [0x260B]={d='on'},
20271 [0x260C]={d='on'},
20272 [0x260D]={d='on'},
20273 [0x260E]={d='on'},
20274 [0x260F]={d='on'},
20275 [0x2610]={d='on'},
20276 [0x2611]={d='on'},
20277 [0x2612]={d='on'},
20278 [0x2613]={d='on'},
20279 [0x2614]={d='on'},
20280 [0x2615]={d='on'},
20281 [0x2616]={d='on'},
20282 [0x2617]={d='on'},
20283 [0x2618]={d='on'},
20284 [0x2619]={d='on'},
20285 [0x261A]={d='on'},
20286 [0x261B]={d='on'},
20287 [0x261C]={d='on'},
20288 [0x261D]={d='on'},
20289 [0x261E]={d='on'},
20290 [0x261F]={d='on'},
20291 [0x2620]={d='on'},
20292 [0x2621]={d='on'},
20293 [0x2622]={d='on'},
20294 [0x2623]={d='on'},
20295 [0x2624]={d='on'},
20296 [0x2625]={d='on'},
20297 [0x2626]={d='on'},
20298 [0x2627]={d='on'},
20299 [0x2628]={d='on'},
20300 [0x2629]={d='on'},
20301 [0x262A]={d='on'},
20302 [0x262B]={d='on'},
20303 [0x262C]={d='on'},
20304 [0x262D]={d='on'},
20305 [0x262E]={d='on'},
20306 [0x262F]={d='on'},
20307 [0x2630]={d='on'},
20308 [0x2631]={d='on'},
20309 [0x2632]={d='on'},
20310 [0x2633]={d='on'},
20311 [0x2634]={d='on'},
20312 [0x2635]={d='on'},
20313 [0x2636]={d='on'},
20314 [0x2637]={d='on'},
20315 [0x2638]={d='on'},
20316 [0x2639]={d='on'},
20317 [0x263A]={d='on'},
20318 [0x263B]={d='on'},
20319 [0x263C]={d='on'},
20320 [0x263D]={d='on'},
20321 [0x263E]={d='on'},
20322 [0x263F]={d='on'},
20323 [0x2640]={d='on'},
20324 [0x2641]={d='on'},
20325 [0x2642]={d='on'},
20326 [0x2643]={d='on'},
20327 [0x2644]={d='on'},
20328 [0x2645]={d='on'},
20329 [0x2646]={d='on'},
20330 [0x2647]={d='on'},
20331 [0x2648]={d='on'},
20332 [0x2649]={d='on'},
20333 [0x264A]={d='on'},
20334 [0x264B]={d='on'},
20335 [0x264C]={d='on'},
20336 [0x264D]={d='on'},
20337 [0x264E]={d='on'},
20338 [0x264F]={d='on'},
20339 [0x2650]={d='on'},
20340 [0x2651]={d='on'},
20341 [0x2652]={d='on'},
20342 [0x2653]={d='on'},
20343 [0x2654]={d='on'},
20344 [0x2655]={d='on'},
20345 [0x2656]={d='on'},
20346 [0x2657]={d='on'},
20347 [0x2658]={d='on'},
20348 [0x2659]={d='on'},
20349 [0x265A]={d='on'},
20350 [0x265B]={d='on'},
20351 [0x265C]={d='on'},
20352 [0x265D]={d='on'},
20353 [0x265E]={d='on'},
20354 [0x265F]={d='on'},
20355 [0x2660]={d='on'},
20356 [0x2661]={d='on'},
20357 [0x2662]={d='on'},
20358 [0x2663]={d='on'},
20359 [0x2664]={d='on'},
20360 [0x2665]={d='on'},
20361 [0x2666]={d='on'},
20362 [0x2667]={d='on'},
20363 [0x2668]={d='on'},
20364 [0x2669]={d='on'},
20365 [0x266A]={d='on'},
20366 [0x266B]={d='on'},
20367 [0x266C]={d='on'},
20368 [0x266D]={d='on'},
20369 [0x266E]={d='on'},
20370 [0x266F]={d='on'},
20371 [0x2670]={d='on'},
20372 [0x2671]={d='on'},
20373 [0x2672]={d='on'},
20374 [0x2673]={d='on'},
20375 [0x2674]={d='on'},
20376 [0x2675]={d='on'},
20377 [0x2676]={d='on'},
20378 [0x2677]={d='on'},
20379 [0x2678]={d='on'},
20380 [0x2679]={d='on'},
20381 [0x267A]={d='on'},
20382 [0x267B]={d='on'},
20383 [0x267C]={d='on'},
20384 [0x267D]={d='on'},
20385 [0x267E]={d='on'},
20386 [0x267F]={d='on'},
20387 [0x2680]={d='on'},
20388 [0x2681]={d='on'},
20389 [0x2682]={d='on'},
20390 [0x2683]={d='on'},
20391 [0x2684]={d='on'},
20392 [0x2685]={d='on'},
20393 [0x2686]={d='on'},
20394 [0x2687]={d='on'},
20395 [0x2688]={d='on'},
20396 [0x2689]={d='on'},
20397 [0x268A]={d='on'},
20398 [0x268B]={d='on'},
20399 [0x268C]={d='on'},
20400 [0x268D]={d='on'},
20401 [0x268E]={d='on'},
20402 [0x268F]={d='on'},
20403 [0x2690]={d='on'},
20404 [0x2691]={d='on'},
20405 [0x2692]={d='on'},
20406 [0x2693]={d='on'},
20407 [0x2694]={d='on'},
20408 [0x2695]={d='on'},
20409 [0x2696]={d='on'},
20410 [0x2697]={d='on'},
20411 [0x2698]={d='on'},
20412 [0x2699]={d='on'},
20413 [0x269A]={d='on'},
20414 [0x269B]={d='on'},
20415 [0x269C]={d='on'},
20416 [0x269D]={d='on'},
20417 [0x269E]={d='on'},
20418 [0x269F]={d='on'},
20419 [0x26A0]={d='on'},
20420 [0x26A1]={d='on'},
20421 [0x26A2]={d='on'},
20422 [0x26A3]={d='on'},
20423 [0x26A4]={d='on'},
20424 [0x26A5]={d='on'},
20425 [0x26A6]={d='on'},
20426 [0x26A7]={d='on'},
20427 [0x26A8]={d='on'},
20428 [0x26A9]={d='on'},
20429 [0x26AA]={d='on'},
20430 [0x26AB]={d='on'},
20431 [0x26AD]={d='on'},
20432 [0x26AE]={d='on'},
20433 [0x26AF]={d='on'},
20434 [0x26B0]={d='on'},
20435 [0x26B1]={d='on'},
20436 [0x26B2]={d='on'},
20437 [0x26B3]={d='on'},
20438 [0x26B4]={d='on'},
20439 [0x26B5]={d='on'},
20440 [0x26B6]={d='on'},
20441 [0x26B7]={d='on'},
20442 [0x26B8]={d='on'},
20443 [0x26B9]={d='on'},
20444 [0x26BA]={d='on'},
20445 [0x26BB]={d='on'},
20446 [0x26BC]={d='on'},
20447 [0x26BD]={d='on'},
20448 [0x26BE]={d='on'},
20449 [0x26BF]={d='on'},
20450 [0x26C0]={d='on'},
20451 [0x26C1]={d='on'},
20452 [0x26C2]={d='on'},
20453 [0x26C3]={d='on'},
20454 [0x26C4]={d='on'},
20455 [0x26C5]={d='on'},
20456 [0x26C6]={d='on'},
20457 [0x26C7]={d='on'},
20458 [0x26C8]={d='on'},
20459 [0x26C9]={d='on'},
20460 [0x26CA]={d='on'},
20461 [0x26CB]={d='on'},
20462 [0x26CC]={d='on'},
20463 [0x26CD]={d='on'},
20464 [0x26CE]={d='on'},
20465 [0x26CF]={d='on'},
20466 [0x26D0]={d='on'},
20467 [0x26D1]={d='on'},
20468 [0x26D2]={d='on'},
20469 [0x26D3]={d='on'},
20470 [0x26D4]={d='on'},
20471 [0x26D5]={d='on'},
20472 [0x26D6]={d='on'},
20473 [0x26D7]={d='on'},
20474 [0x26D8]={d='on'},
20475 [0x26D9]={d='on'},
20476 [0x26DA]={d='on'},
20477 [0x26DB]={d='on'},
20478 [0x26DC]={d='on'},
20479 [0x26DD]={d='on'},
20480 [0x26DE]={d='on'},
20481 [0x26DF]={d='on'},
20482 [0x26E0]={d='on'},
20483 [0x26E1]={d='on'},
20484 [0x26E2]={d='on'},
20485 [0x26E3]={d='on'},
20486 [0x26E4]={d='on'},
20487 [0x26E5]={d='on'},
20488 [0x26E6]={d='on'},
20489 [0x26E7]={d='on'},
20490 [0x26E8]={d='on'},
20491 [0x26E9]={d='on'},
20492 [0x26EA]={d='on'},
20493 [0x26EB]={d='on'},
20494 [0x26EC]={d='on'},
20495 [0x26ED]={d='on'},
20496 [0x26EE]={d='on'},
20497 [0x26EF]={d='on'},
20498 [0x26F0]={d='on'},
20499 [0x26F1]={d='on'},
20500 [0x26F2]={d='on'},
20501 [0x26F3]={d='on'},
20502 [0x26F4]={d='on'},
20503 [0x26F5]={d='on'},
20504 [0x26F6]={d='on'},
20505 [0x26F7]={d='on'},
20506 [0x26F8]={d='on'},
20507 [0x26F9]={d='on'},
20508 [0x26FA]={d='on'},
20509 [0x26FB]={d='on'},
20510 [0x26FC]={d='on'},
20511 [0x26FD]={d='on'},
20512 [0x26FE]={d='on'},
20513 [0x26FF]={d='on'},
20514 [0x2700]={d='on'},
20515 [0x2701]={d='on'},
20516 [0x2702]={d='on'},
20517 [0x2703]={d='on'},
20518 [0x2704]={d='on'},
20519 [0x2705]={d='on'},
20520 [0x2706]={d='on'},
20521 [0x2707]={d='on'},
20522 [0x2708]={d='on'},
20523 [0x2709]={d='on'},
20524 [0x270A]={d='on'},
20525 [0x270B]={d='on'},
20526 [0x270C]={d='on'},
20527 [0x270D]={d='on'},
20528 [0x270E]={d='on'},
20529 [0x270F]={d='on'},
20530 [0x2710]={d='on'},
20531 [0x2711]={d='on'},
20532 [0x2712]={d='on'},
20533 [0x2713]={d='on'},
20534 [0x2714]={d='on'},
20535 [0x2715]={d='on'},
20536 [0x2716]={d='on'},
20537 [0x2717]={d='on'},
20538 [0x2718]={d='on'},
20539 [0x2719]={d='on'},
20540 [0x271A]={d='on'},
20541 [0x271B]={d='on'},
20542 [0x271C]={d='on'},
20543 [0x271D]={d='on'},
20544 [0x271E]={d='on'},
20545 [0x271F]={d='on'},
20546 [0x2720]={d='on'},
20547 [0x2721]={d='on'},
20548 [0x2722]={d='on'},
20549 [0x2723]={d='on'},
20550 [0x2724]={d='on'},
20551 [0x2725]={d='on'},
20552 [0x2726]={d='on'},
20553 [0x2727]={d='on'},
20554 [0x2728]={d='on'},
20555 [0x2729]={d='on'},
20556 [0x272A]={d='on'},
20557 [0x272B]={d='on'},
20558 [0x272C]={d='on'},
20559 [0x272D]={d='on'},
20560 [0x272E]={d='on'},
20561 [0x272F]={d='on'},
20562 [0x2730]={d='on'},
20563 [0x2731]={d='on'},
20564 [0x2732]={d='on'},
20565 [0x2733]={d='on'},
20566 [0x2734]={d='on'},
20567 [0x2735]={d='on'},
20568 [0x2736]={d='on'},
20569 [0x2737]={d='on'},
20570 [0x2738]={d='on'},
20571 [0x2739]={d='on'},
20572 [0x273A]={d='on'},
20573 [0x273B]={d='on'},
20574 [0x273C]={d='on'},
20575 [0x273D]={d='on'},
20576 [0x273E]={d='on'},
20577 [0x273F]={d='on'},
20578 [0x2740]={d='on'},
20579 [0x2741]={d='on'},
20580 [0x2742]={d='on'},
20581 [0x2743]={d='on'},
20582 [0x2744]={d='on'},
20583 [0x2745]={d='on'},
20584 [0x2746]={d='on'},
20585 [0x2747]={d='on'},
20586 [0x2748]={d='on'},
20587 [0x2749]={d='on'},
20588 [0x274A]={d='on'},
20589 [0x274B]={d='on'},
20590 [0x274C]={d='on'},
20591 [0x274D]={d='on'},
20592 [0x274E]={d='on'},
20593 [0x274F]={d='on'},
20594 [0x2750]={d='on'},
20595 [0x2751]={d='on'},
20596 [0x2752]={d='on'},
20597 [0x2753]={d='on'},
20598 [0x2754]={d='on'},
20599 [0x2755]={d='on'},
20600 [0x2756]={d='on'},
20601 [0x2757]={d='on'},
20602 [0x2758]={d='on'},
20603 [0x2759]={d='on'},
20604 [0x275A]={d='on'},
20605 [0x275B]={d='on'},
20606 [0x275C]={d='on'},
20607 [0x275D]={d='on'},
20608 [0x275E]={d='on'},
20609 [0x275F]={d='on'},
20610 [0x2760]={d='on'},
20611 [0x2761]={d='on'},
20612 [0x2762]={d='on'},
20613 [0x2763]={d='on'},
20614 [0x2764]={d='on'},
20615 [0x2765]={d='on'},
20616 [0x2766]={d='on'},
20617 [0x2767]={d='on'},
20618 [0x2768]={d='on', m=0x2769},
20619 [0x2769]={d='on', m=0x2768},
20620 [0x276A]={d='on', m=0x276B},
20621 [0x276B]={d='on', m=0x276A},
20622 [0x276C]={d='on', m=0x276D},
20623 [0x276D]={d='on', m=0x276C},
20624 [0x276E]={d='on', m=0x276F},
20625 [0x276F]={d='on', m=0x276E},
20626 [0x2770]={d='on', m=0x2771},
20627 [0x2771]={d='on', m=0x2770},
20628 [0x2772]={d='on', m=0x2773},
20629 [0x2773]={d='on', m=0x2772},
20630 [0x2774]={d='on', m=0x2775},
20631 [0x2775]={d='on', m=0x2774},
20632 [0x2776]={d='on'},
20633 [0x2777]={d='on'},
20634 [0x2778]={d='on'},
20635 [0x2779]={d='on'},
20636 [0x277A]={d='on'},
20637 [0x277B]={d='on'},
20638 [0x277C]={d='on'},
20639 [0x277D]={d='on'},
20640 [0x277E]={d='on'},
20641 [0x277F]={d='on'},
20642 [0x2780]={d='on'},
20643 [0x2781]={d='on'},
20644 [0x2782]={d='on'},
20645 [0x2783]={d='on'},
20646 [0x2784]={d='on'},
20647 [0x2785]={d='on'},
20648 [0x2786]={d='on'},
20649 [0x2787]={d='on'},
20650 [0x2788]={d='on'},
20651 [0x2789]={d='on'},
20652 [0x278A]={d='on'},
20653 [0x278B]={d='on'},
20654 [0x278C]={d='on'},
20655 [0x278D]={d='on'},
20656 [0x278E]={d='on'},
20657 [0x278F]={d='on'},
20658 [0x2790]={d='on'},
20659 [0x2791]={d='on'},
20660 [0x2792]={d='on'},
20661 [0x2793]={d='on'},
20662 [0x2794]={d='on'},
20663 [0x2795]={d='on'},
20664 [0x2796]={d='on'},
20665 [0x2797]={d='on'},
20666 [0x2798]={d='on'},
20667 [0x2799]={d='on'},
20668 [0x279A]={d='on'},
20669 [0x279B]={d='on'},
20670 [0x279C]={d='on'},
20671 [0x279D]={d='on'},
20672 [0x279E]={d='on'},
20673 [0x279F]={d='on'},
20674 [0x27A0]={d='on'},
20675 [0x27A1]={d='on'},
20676 [0x27A2]={d='on'},
20677 [0x27A3]={d='on'},
20678 [0x27A4]={d='on'},
20679 [0x27A5]={d='on'},
20680 [0x27A6]={d='on'},
20681 [0x27A7]={d='on'},
20682 [0x27A8]={d='on'},
20683 [0x27A9]={d='on'},
20684 [0x27AA]={d='on'},
20685 [0x27AB]={d='on'},
20686 [0x27AC]={d='on'},
20687 [0x27AD]={d='on'},
20688 [0x27AE]={d='on'},
20689 [0x27AF]={d='on'},
20690 [0x27B0]={d='on'},
20691 [0x27B1]={d='on'},
20692 [0x27B2]={d='on'},
20693 [0x27B3]={d='on'},
20694 [0x27B4]={d='on'},
20695 [0x27B5]={d='on'},
20696 [0x27B6]={d='on'},
20697 [0x27B7]={d='on'},
20698 [0x27B8]={d='on'},
20699 [0x27B9]={d='on'},
20700 [0x27BA]={d='on'},
20701 [0x27BB]={d='on'},
20702 [0x27BC]={d='on'},
20703 [0x27BD]={d='on'},
20704 [0x27BE]={d='on'},
20705 [0x27BF]={d='on'},
20706 [0x27C0]={d='on'},
20707 [0x27C1]={d='on'},
20708 [0x27C2]={d='on'},
20709 [0x27C3]={d='on', m=0x27C4},
20710 [0x27C4]={d='on', m=0x27C3},
20711 [0x27C5]={d='on', m=0x27C6},
20712 [0x27C6]={d='on', m=0x27C5},
20713 [0x27C7]={d='on'},
20714 [0x27C8]={d='on', m=0x27C9},
20715 [0x27C9]={d='on', m=0x27C8},
20716 [0x27CA]={d='on'},
20717 [0x27CB]={d='on', m=0x27CD},
20718 [0x27CC]={d='on'},
20719 [0x27CD]={d='on', m=0x27CB},
20720 [0x27CE]={d='on'},
20721 [0x27CF]={d='on'},
20722 [0x27D0]={d='on'},
20723 [0x27D1]={d='on'},
20724 [0x27D2]={d='on'},
20725 [0x27D3]={d='on'},
20726 [0x27D4]={d='on'},
20727 [0x27D5]={d='on', m=0x27D6},
20728 [0x27D6]={d='on', m=0x27D5},
20729 [0x27D7]={d='on'},
20730 [0x27D8]={d='on'},
20731 [0x27D9]={d='on'},
20732 [0x27DA]={d='on'},
20733 [0x27DB]={d='on'},
20734 [0x27DC]={d='on'},
20735 [0x27DD]={d='on', m=0x27DE},
20736 [0x27DE]={d='on', m=0x27DD},
20737 [0x27DF]={d='on'},
20738 [0x27E0]={d='on'},
20739 [0x27E1]={d='on'},
20740 [0x27E2]={d='on', m=0x27E3},
20741 [0x27E3]={d='on', m=0x27E2},
20742 [0x27E4]={d='on', m=0x27E5},
20743 [0x27E5]={d='on', m=0x27E4},
20744 [0x27E6]={d='on', m=0x27E7},
20745 [0x27E7]={d='on', m=0x27E6},
20746 [0x27E8]={d='on', m=0x27E9},
20747 [0x27E9]={d='on', m=0x27E8},
20748 [0x27EA]={d='on', m=0x27EB},
20749 [0x27EB]={d='on', m=0x27EA},
20750 [0x27EC]={d='on', m=0x27ED},
20751 [0x27ED]={d='on', m=0x27EC},
20752 [0x27EE]={d='on', m=0x27EF},
20753 [0x27EF]={d='on', m=0x27EE},
20754 [0x27F0]={d='on'},
20755 [0x27F1]={d='on'},
20756 [0x27F2]={d='on'},
20757 [0x27F3]={d='on'},
20758 [0x27F4]={d='on'},
20759 [0x27F5]={d='on'},
20760 [0x27F6]={d='on'},
20761 [0x27F7]={d='on'},
20762 [0x27F8]={d='on'},
20763 [0x27F9]={d='on'},
20764 [0x27FA]={d='on'},
20765 [0x27FB]={d='on'},
20766 [0x27FC]={d='on'},
20767 [0x27FD]={d='on'},
20768 [0x27FE]={d='on'},
20769 [0x27FF]={d='on'},
20770 [0x2900]={d='on'},
20771 [0x2901]={d='on'},
20772 [0x2902]={d='on'},
20773 [0x2903]={d='on'},
20774 [0x2904]={d='on'},
20775 [0x2905]={d='on'},
20776 [0x2906]={d='on'},
20777 [0x2907]={d='on'},
20778 [0x2908]={d='on'},
20779 [0x2909]={d='on'},
20780 [0x290A]={d='on'},
20781 [0x290B]={d='on'},
20782 [0x290C]={d='on'},
20783 [0x290D]={d='on'},
20784 [0x290E]={d='on'},
20785 [0x290F]={d='on'},
20786 [0x2910]={d='on'},
20787 [0x2911]={d='on'},
20788 [0x2912]={d='on'},
20789 [0x2913]={d='on'},
20790 [0x2914]={d='on'},
20791 [0x2915]={d='on'},
20792 [0x2916]={d='on'},
20793 [0x2917]={d='on'},
20794 [0x2918]={d='on'},
20795 [0x2919]={d='on'},
20796 [0x291A]={d='on'},
20797 [0x291B]={d='on'},
20798 [0x291C]={d='on'},
20799 [0x291D]={d='on'},
20800 [0x291E]={d='on'},
20801 [0x291F]={d='on'},
20802 [0x2920]={d='on'},
20803 [0x2921]={d='on'},
20804 [0x2922]={d='on'},
20805 [0x2923]={d='on'},
20806 [0x2924]={d='on'},
20807 [0x2925]={d='on'},
20808 [0x2926]={d='on'},
20809 [0x2927]={d='on'},
20810 [0x2928]={d='on'},
20811 [0x2929]={d='on'},
20812 [0x292A]={d='on'},
20813 [0x292B]={d='on'},
20814 [0x292C]={d='on'},
20815 [0x292D]={d='on'},
20816 [0x292E]={d='on'},
20817 [0x292F]={d='on'},
20818 [0x2930]={d='on'},
20819 [0x2931]={d='on'},
20820 [0x2932]={d='on'},
20821 [0x2933]={d='on'},
20822 [0x2934]={d='on'},
20823 [0x2935]={d='on'},
20824 [0x2936]={d='on'},
20825 [0x2937]={d='on'},
20826 [0x2938]={d='on'},
20827 [0x2939]={d='on'},
20828 [0x293A]={d='on'},
20829 [0x293B]={d='on'},
20830 [0x293C]={d='on'},
20831 [0x293D]={d='on'},
20832 [0x293E]={d='on'},
20833 [0x293F]={d='on'},
20834 [0x2940]={d='on'},
20835 [0x2941]={d='on'},
20836 [0x2942]={d='on'},
20837 [0x2943]={d='on'},
20838 [0x2944]={d='on'},
20839 [0x2945]={d='on'},
20840 [0x2946]={d='on'},
20841 [0x2947]={d='on'},
20842 [0x2948]={d='on'},
20843 [0x2949]={d='on'},
20844 [0x294A]={d='on'},
20845 [0x294B]={d='on'},
20846 [0x294C]={d='on'},
20847 [0x294D]={d='on'},
20848 [0x294E]={d='on'},
20849 [0x294F]={d='on'},
20850 [0x2950]={d='on'},
20851 [0x2951]={d='on'},
20852 [0x2952]={d='on'},
20853 [0x2953]={d='on'},
20854 [0x2954]={d='on'},
20855 [0x2955]={d='on'},
20856 [0x2956]={d='on'},
20857 [0x2957]={d='on'},
20858 [0x2958]={d='on'},
20859 [0x2959]={d='on'},
20860 [0x295A]={d='on'},
20861 [0x295B]={d='on'},
20862 [0x295C]={d='on'},
20863 [0x295D]={d='on'},
20864 [0x295E]={d='on'},
20865 [0x295F]={d='on'},
20866 [0x2960]={d='on'},
20867 [0x2961]={d='on'},
20868 [0x2962]={d='on'},
20869 [0x2963]={d='on'},
20870 [0x2964]={d='on'},
20871 [0x2965]={d='on'},
20872 [0x2966]={d='on'},
20873 [0x2967]={d='on'},
20874 [0x2968]={d='on'},
20875 [0x2969]={d='on'},
20876 [0x296A]={d='on'},
20877 [0x296B]={d='on'},
20878 [0x296C]={d='on'},
20879 [0x296D]={d='on'},
20880 [0x296E]={d='on'},
20881 [0x296F]={d='on'},
20882 [0x2970]={d='on'},
20883 [0x2971]={d='on'},
20884 [0x2972]={d='on'},
20885 [0x2973]={d='on'},
20886 [0x2974]={d='on'},
20887 [0x2975]={d='on'},
20888 [0x2976]={d='on'},
20889 [0x2977]={d='on'},
20890 [0x2978]={d='on'},
20891 [0x2979]={d='on'},
20892 [0x297A]={d='on'},
20893 [0x297B]={d='on'},
20894 [0x297C]={d='on'},
20895 [0x297D]={d='on'},
20896 [0x297E]={d='on'},
20897 [0x297F]={d='on'},
20898 [0x2980]={d='on'},
20899 [0x2981]={d='on'},
20900 [0x2982]={d='on'},
20901 [0x2983]={d='on', m=0x2984},
20902 [0x2984]={d='on', m=0x2983},
20903 [0x2985]={d='on', m=0x2986},
20904 [0x2986]={d='on', m=0x2985},
20905 [0x2987]={d='on', m=0x2988},
20906 [0x2988]={d='on', m=0x2987},
20907 [0x2989]={d='on', m=0x298A},
20908 [0x298A]={d='on', m=0x2989},
20909 [0x298B]={d='on', m=0x298C},
20910 [0x298C]={d='on', m=0x298B},
20911 [0x298D]={d='on', m=0x2990},
20912 [0x298E]={d='on', m=0x298F},
20913 [0x298F]={d='on', m=0x298E},
20914 [0x2990]={d='on', m=0x298D},
20915 [0x2991]={d='on', m=0x2992},
20916 [0x2992]={d='on', m=0x2991},
20917 [0x2993]={d='on', m=0x2994},
20918 [0x2994]={d='on', m=0x2993},
20919 [0x2995]={d='on', m=0x2996},
20920 [0x2996]={d='on', m=0x2995},
20921 [0x2997]={d='on', m=0x2998},
20922 [0x2998]={d='on', m=0x2997},
20923 [0x2999]={d='on'},
20924 [0x299A]={d='on'},
20925 [0x299B]={d='on'},
20926 [0x299C]={d='on'},
20927 [0x299D]={d='on'},
20928 [0x299E]={d='on'},
20929 [0x299F]={d='on'},
20930 [0x29A0]={d='on'},
20931 [0x29A1]={d='on'},
20932 [0x29A2]={d='on'},
20933 [0x29A3]={d='on'},
20934 [0x29A4]={d='on'},
20935 [0x29A5]={d='on'},
20936 [0x29A6]={d='on'},
20937 [0x29A7]={d='on'},
20938 [0x29A8]={d='on'},
20939 [0x29A9]={d='on'},
20940 [0x29AA]={d='on'},
20941 [0x29AB]={d='on'},
20942 [0x29AC]={d='on'},
20943 [0x29AD]={d='on'},
20944 [0x29AE]={d='on'},
20945 [0x29AF]={d='on'},
20946 [0x29B0]={d='on'},
20947 [0x29B1]={d='on'},
20948 [0x29B2]={d='on'},
20949 [0x29B3]={d='on'},
20950 [0x29B4]={d='on'},
20951 [0x29B5]={d='on'},
20952 [0x29B6]={d='on'},
20953 [0x29B7]={d='on'},
20954 [0x29B8]={d='on', m=0x2298},
20955 [0x29B9]={d='on'},
20956 [0x29BA]={d='on'},
20957 [0x29BB]={d='on'},
20958 [0x29BC]={d='on'},
20959 [0x29BD]={d='on'},
20960 [0x29BE]={d='on'},
20961 [0x29BF]={d='on'},
20962 [0x29C0]={d='on', m=0x29C1},
20963 [0x29C1]={d='on', m=0x29C0},
20964 [0x29C2]={d='on'},
20965 [0x29C3]={d='on'},
20966 [0x29C4]={d='on', m=0x29C5},
20967 [0x29C5]={d='on', m=0x29C4},
20968 [0x29C6]={d='on'},
20969 [0x29C7]={d='on'},
20970 [0x29C8]={d='on'},
20971 [0x29C9]={d='on'},
20972 [0x29CA]={d='on'},
20973 [0x29CB]={d='on'},
20974 [0x29CC]={d='on'},
20975 [0x29CD]={d='on'},
20976 [0x29CE]={d='on'},
20977 [0x29CF]={d='on', m=0x29D0},
20978 [0x29D0]={d='on', m=0x29CF},
20979 [0x29D1]={d='on', m=0x29D2},
20980 [0x29D2]={d='on', m=0x29D1},
20981 [0x29D3]={d='on'},
20982 [0x29D4]={d='on', m=0x29D5},
20983 [0x29D5]={d='on', m=0x29D4},
20984 [0x29D6]={d='on'},
20985 [0x29D7]={d='on'},
20986 [0x29D8]={d='on', m=0x29D9},
20987 [0x29D9]={d='on', m=0x29D8},
20988 [0x29DA]={d='on', m=0x29DB},
20989 [0x29DB]={d='on', m=0x29DA},
20990 [0x29DC]={d='on'},
20991 [0x29DD]={d='on'},
20992 [0x29DE]={d='on'},
20993 [0x29DF]={d='on'},
20994 [0x29E0]={d='on'},
20995 [0x29E1]={d='on'},
20996 [0x29E2]={d='on'},
20997 [0x29E3]={d='on'},
20998 [0x29E4]={d='on'},
20999 [0x29E5]={d='on'},
21000 [0x29E6]={d='on'},
21001 [0x29E7]={d='on'},
21002 [0x29E8]={d='on'},
21003 [0x29E9]={d='on'},
21004 [0x29EA]={d='on'},
21005 [0x29EB]={d='on'},
21006 [0x29EC]={d='on'},
21007 [0x29ED]={d='on'},
21008 [0x29EE]={d='on'},
21009 [0x29EF]={d='on'},
21010 [0x29F0]={d='on'},
21011 [0x29F1]={d='on'},
21012 [0x29F2]={d='on'},
21013 [0x29F3]={d='on'},
21014 [0x29F4]={d='on'},
21015 [0x29F5]={d='on', m=0x2215},
21016 [0x29F6]={d='on'},
21017 [0x29F7]={d='on'},
21018 [0x29F8]={d='on', m=0x29F9},
21019 [0x29F9]={d='on', m=0x29F8},
21020 [0x29FA]={d='on'},
21021 [0x29FB]={d='on'},
21022 [0x29FC]={d='on', m=0x29FD},
21023 [0x29FD]={d='on', m=0x29FC},
21024 [0x29FE]={d='on'},
21025 [0x29FF]={d='on'},
21026 [0x2A00]={d='on'},
21027 [0x2A01]={d='on'},
21028 [0x2A02]={d='on'},
21029 [0x2A03]={d='on'},
21030 [0x2A04]={d='on'},
21031 [0x2A05]={d='on'},
21032 [0x2A06]={d='on'},
21033 [0x2A07]={d='on'},
21034 [0x2A08]={d='on'},
21035 [0x2A09]={d='on'},
21036 [0x2A0A]={d='on'},
21037 [0x2A0B]={d='on'},
21038 [0x2A0C]={d='on'},
21039 [0x2A0D]={d='on'},
21040 [0x2A0E]={d='on'},
21041 [0x2A0F]={d='on'},
21042 [0x2A10]={d='on'},
21043 [0x2A11]={d='on'},
21044 [0x2A12]={d='on'},
21045 [0x2A13]={d='on'},
21046 [0x2A14]={d='on'},
21047 [0x2A15]={d='on'},
21048 [0x2A16]={d='on'},
21049 [0x2A17]={d='on'},
21050 [0x2A18]={d='on'},
21051 [0x2A19]={d='on'},
21052 [0x2A1A]={d='on'},
21053 [0x2A1B]={d='on'},
21054 [0x2A1C]={d='on'},
21055 [0x2A1D]={d='on'},
21056 [0x2A1E]={d='on'},
21057 [0x2A1F]={d='on'},
21058 [0x2A20]={d='on'},
21059 [0x2A21]={d='on'},
21060 [0x2A22]={d='on'},
21061 [0x2A23]={d='on'},
21062 [0x2A24]={d='on'},
21063 [0x2A25]={d='on'},
21064 [0x2A26]={d='on'},
21065 [0x2A27]={d='on'},
21066 [0x2A28]={d='on'},
21067 [0x2A29]={d='on'},
21068 [0x2A2A]={d='on'},
21069 [0x2A2B]={d='on', m=0x2A2C},
21070 [0x2A2C]={d='on', m=0x2A2B},
21071 [0x2A2D]={d='on', m=0x2A2E},
21072 [0x2A2E]={d='on', m=0x2A2D},
21073 [0x2A2F]={d='on'},
21074 [0x2A30]={d='on'},
21075 [0x2A31]={d='on'},
21076 [0x2A32]={d='on'},
21077 [0x2A33]={d='on'},
21078 [0x2A34]={d='on', m=0x2A35},
21079 [0x2A35]={d='on', m=0x2A34},
21080 [0x2A36]={d='on'},
21081 [0x2A37]={d='on'},
21082 [0x2A38]={d='on'},
21083 [0x2A39]={d='on'},
21084 [0x2A3A]={d='on'},
21085 [0x2A3B]={d='on'},
21086 [0x2A3C]={d='on', m=0x2A3D},
21087 [0x2A3D]={d='on', m=0x2A3C},
21088 [0x2A3E]={d='on'},
21089 [0x2A3F]={d='on'},
21090 [0x2A40]={d='on'},
21091 [0x2A41]={d='on'},
21092 [0x2A42]={d='on'},
21093 [0x2A43]={d='on'},
21094 [0x2A44]={d='on'},
21095 [0x2A45]={d='on'},
21096 [0x2A46]={d='on'},
21097 [0x2A47]={d='on'},
21098 [0x2A48]={d='on'},
21099 [0x2A49]={d='on'},
21100 [0x2A4A]={d='on'},
21101 [0x2A4B]={d='on'},
21102 [0x2A4C]={d='on'},
21103 [0x2A4D]={d='on'},
21104 [0x2A4E]={d='on'},
21105 [0x2A4F]={d='on'},
21106 [0x2A50]={d='on'},
21107 [0x2A51]={d='on'},
21108 [0x2A52]={d='on'},
21109 [0x2A53]={d='on'},
21110 [0x2A54]={d='on'},
21111 [0x2A55]={d='on'},
21112 [0x2A56]={d='on'},
21113 [0x2A57]={d='on'},
21114 [0x2A58]={d='on'},
21115 [0x2A59]={d='on'},
21116 [0x2A5A]={d='on'},
21117 [0x2A5B]={d='on'},
21118 [0x2A5C]={d='on'},
21119 [0x2A5D]={d='on'},
21120 [0x2A5E]={d='on'},
21121 [0x2A5F]={d='on'},
21122 [0x2A60]={d='on'},
21123 [0x2A61]={d='on'},
21124 [0x2A62]={d='on'},
21125 [0x2A63]={d='on'},
21126 [0x2A64]={d='on', m=0x2A65},
21127 [0x2A65]={d='on', m=0x2A64},
21128 [0x2A66]={d='on'},
21129 [0x2A67]={d='on'},
21130 [0x2A68]={d='on'},
21131 [0x2A69]={d='on'},
21132 [0x2A6A]={d='on'},
21133 [0x2A6B]={d='on'},
21134 [0x2A6C]={d='on'},
21135 [0x2A6D]={d='on'},
21136 [0x2A6E]={d='on'},
21137 [0x2A6F]={d='on'},
21138 [0x2A70]={d='on'},
21139 [0x2A71]={d='on'},
21140 [0x2A72]={d='on'},
21141 [0x2A73]={d='on'},
21142 [0x2A74]={d='on'},
21143 [0x2A75]={d='on'},
21144 [0x2A76]={d='on'},
21145 [0x2A77]={d='on'},
21146 [0x2A78]={d='on'},
21147 [0x2A79]={d='on', m=0x2A7A},
21148 [0x2A7A]={d='on', m=0x2A79},
21149 [0x2A7B]={d='on'},
21150 [0x2A7C]={d='on'},
21151 [0x2A7D]={d='on', m=0x2A7E},
21152 [0x2A7E]={d='on', m=0x2A7D},
21153 [0x2A7F]={d='on', m=0x2A80},
21154 [0x2A80]={d='on', m=0x2A7F},
21155 [0x2A81]={d='on', m=0x2A82},
21156 [0x2A82]={d='on', m=0x2A81},
21157 [0x2A83]={d='on', m=0x2A84},
21158 [0x2A84]={d='on', m=0x2A83},
21159 [0x2A85]={d='on'},
21160 [0x2A86]={d='on'},
21161 [0x2A87]={d='on'},
21162 [0x2A88]={d='on'},
21163 [0x2A89]={d='on'},
21164 [0x2A8A]={d='on'},
21165 [0x2A8B]={d='on', m=0x2A8C},
21166 [0x2A8C]={d='on', m=0x2A8B},
21167 [0x2A8D]={d='on'},
21168 [0x2A8E]={d='on'},
21169 [0x2A8F]={d='on'},
21170 [0x2A90]={d='on'},
21171 [0x2A91]={d='on', m=0x2A92},
21172 [0x2A92]={d='on', m=0x2A91},
21173 [0x2A93]={d='on', m=0x2A94},
21174 [0x2A94]={d='on', m=0x2A93},
21175 [0x2A95]={d='on', m=0x2A96},
21176 [0x2A96]={d='on', m=0x2A95},
21177 [0x2A97]={d='on', m=0x2A98},
21178 [0x2A98]={d='on', m=0x2A97},
21179 [0x2A99]={d='on', m=0x2A9A},
21180 [0x2A9A]={d='on', m=0x2A99},
21181 [0x2A9B]={d='on', m=0x2A9C},
21182 [0x2A9C]={d='on', m=0x2A9B},
21183 [0x2A9D]={d='on'},
21184 [0x2A9E]={d='on'},
21185 [0x2A9F]={d='on'},
21186 [0x2AA0]={d='on'},
21187 [0x2AA1]={d='on', m=0x2AA2},
21188 [0x2AA2]={d='on', m=0x2AA1},
21189 [0x2AA3]={d='on'},
21190 [0x2AA4]={d='on'},
21191 [0x2AA5]={d='on'},
21192 [0x2AA6]={d='on', m=0x2AA7},
21193 [0x2AA7]={d='on', m=0x2AA6},
21194 [0x2AA8]={d='on', m=0x2AA9},
21195 [0x2AA9]={d='on', m=0x2AA8},
21196 [0x2AAA]={d='on', m=0x2AAB},
21197 [0x2AAB]={d='on', m=0x2AAA},
21198 [0x2AAC]={d='on', m=0x2AAD},
21199 [0x2AAD]={d='on', m=0x2AAC},
21200 [0x2AAE]={d='on'},
21201 [0x2AAF]={d='on', m=0x2AB0},
21202 [0x2AB0]={d='on', m=0x2AAF},
21203 [0x2AB1]={d='on'},
21204 [0x2AB2]={d='on'},
21205 [0x2AB3]={d='on', m=0x2AB4},
21206 [0x2AB4]={d='on', m=0x2AB3},
21207 [0x2AB5]={d='on'},
21208 [0x2AB6]={d='on'},
21209 [0x2AB7]={d='on'},
21210 [0x2AB8]={d='on'},
21211 [0x2AB9]={d='on'},
21212 [0x2ABA]={d='on'},
21213 [0x2ABB]={d='on', m=0x2ABC},
21214 [0x2ABC]={d='on', m=0x2ABB},
21215 [0x2ABD]={d='on', m=0x2ABE},
21216 [0x2ABE]={d='on', m=0x2ABD},
21217 [0x2ABF]={d='on', m=0x2AC0},
21218 [0x2AC0]={d='on', m=0x2ABF},
21219 [0x2AC1]={d='on', m=0x2AC2},
21220 [0x2AC2]={d='on', m=0x2AC1},
21221 [0x2AC3]={d='on', m=0x2AC4},
21222 [0x2AC4]={d='on', m=0x2AC3},
21223 [0x2AC5]={d='on', m=0x2AC6},
21224 [0x2AC6]={d='on', m=0x2AC5},
21225 [0x2AC7]={d='on'},
21226 [0x2AC8]={d='on'},
21227 [0x2AC9]={d='on'},
21228 [0x2ACA]={d='on'},
21229 [0x2ACB]={d='on'},
21230 [0x2ACC]={d='on'},
21231 [0x2ACD]={d='on', m=0x2ACE},
21232 [0x2ACE]={d='on', m=0x2ACD},
21233 [0x2ACF]={d='on', m=0x2AD0},
21234 [0x2AD0]={d='on', m=0x2ACF},
21235 [0x2AD1]={d='on', m=0x2AD2},
21236 [0x2AD2]={d='on', m=0x2AD1},
21237 [0x2AD3]={d='on', m=0x2AD4},
21238 [0x2AD4]={d='on', m=0x2AD3},
21239 [0x2AD5]={d='on', m=0x2AD6},
21240 [0x2AD6]={d='on', m=0x2AD5},
21241 [0x2AD7]={d='on'},
21242 [0x2AD8]={d='on'},
21243 [0x2AD9]={d='on'},
21244 [0x2ADA]={d='on'},
21245 [0x2ADB]={d='on'},
21246 [0x2ADC]={d='on'},
21247 [0x2ADD]={d='on'},
21248 [0x2ADE]={d='on', m=0x22A6},
21249 [0x2ADF]={d='on'},
21250 [0x2AE0]={d='on'},
21251 [0x2AE1]={d='on'},
21252 [0x2AE2]={d='on'},
21253 [0x2AE3]={d='on', m=0x22A9},
21254 [0x2AE4]={d='on', m=0x22A8},
21255 [0x2AE5]={d='on', m=0x22AB},
21256 [0x2AE6]={d='on'},
21257 [0x2AE7]={d='on'},
21258 [0x2AE8]={d='on'},
21259 [0x2AE9]={d='on'},
21260 [0x2AEA]={d='on'},
21261 [0x2AEB]={d='on'},
21262 [0x2AEC]={d='on', m=0x2AED},
21263 [0x2AED]={d='on', m=0x2AEC},
21264 [0x2AEE]={d='on'},
21265 [0x2AEF]={d='on'},
21266 [0x2AF0]={d='on'},
21267 [0x2AF1]={d='on'},
21268 [0x2AF2]={d='on'},
21269 [0x2AF3]={d='on'},
21270 [0x2AF4]={d='on'},
21271 [0x2AF5]={d='on'},
21272 [0x2AF6]={d='on'},
21273 [0x2AF7]={d='on', m=0x2AF8},
21274 [0x2AF8]={d='on', m=0x2AF7},
21275 [0x2AF9]={d='on', m=0x2AFA},
21276 [0x2AFA]={d='on', m=0x2AF9},
21277 [0x2AFB]={d='on'},
21278 [0x2AFC]={d='on'},
21279 [0x2AFD]={d='on'},
21280 [0x2AFE]={d='on'},
21281 [0x2AFF]={d='on'},
21282 [0x2B00]={d='on'},
21283 [0x2B01]={d='on'},
21284 [0x2B02]={d='on'},
21285 [0x2B03]={d='on'},
21286 [0x2B04]={d='on'},
21287 [0x2B05]={d='on'},
21288 [0x2B06]={d='on'},
21289 [0x2B07]={d='on'},
21290 [0x2B08]={d='on'},
21291 [0x2B09]={d='on'},
21292 [0x2B0A]={d='on'},
21293 [0x2B0B]={d='on'},
21294 [0x2B0C]={d='on'},
21295 [0x2B0D]={d='on'},
21296 [0x2B0E]={d='on'},
21297 [0x2B0F]={d='on'},
21298 [0x2B10]={d='on'},
21299 [0x2B11]={d='on'},
21300 [0x2B12]={d='on'},
21301 [0x2B13]={d='on'},
21302 [0x2B14]={d='on'},
21303 [0x2B15]={d='on'},
21304 [0x2B16]={d='on'},
21305 [0x2B17]={d='on'},
21306 [0x2B18]={d='on'},
21307 [0x2B19]={d='on'},
21308 [0x2B1A]={d='on'},
21309 [0x2B1B]={d='on'},
21310 [0x2B1C]={d='on'},
21311 [0x2B1D]={d='on'},
21312 [0x2B1E]={d='on'},
21313 [0x2B1F]={d='on'},
21314 [0x2B20]={d='on'},
21315 [0x2B21]={d='on'},
21316 [0x2B22]={d='on'},
21317 [0x2B23]={d='on'},
21318 [0x2B24]={d='on'},
21319 [0x2B25]={d='on'},
21320 [0x2B26]={d='on'},
21321 [0x2B27]={d='on'},
21322 [0x2B28]={d='on'},
21323 [0x2B29]={d='on'},
21324 [0x2B2A]={d='on'},
21325 [0x2B2B]={d='on'},
21326 [0x2B2C]={d='on'},
21327 [0x2B2D]={d='on'},
21328 [0x2B2E]={d='on'},
21329 [0x2B2F]={d='on'},
21330 [0x2B30]={d='on'},
21331 [0x2B31]={d='on'},
21332 [0x2B32]={d='on'},
21333 [0x2B33]={d='on'},
21334 [0x2B34]={d='on'},
21335 [0x2B35]={d='on'},
21336 [0x2B36]={d='on'},
21337 [0x2B37]={d='on'},
21338 [0x2B38]={d='on'},
21339 [0x2B39]={d='on'},
21340 [0x2B3A]={d='on'},
21341 [0x2B3B]={d='on'},
21342 [0x2B3C]={d='on'},
21343 [0x2B3D]={d='on'},
21344 [0x2B3E]={d='on'},
21345 [0x2B3F]={d='on'},
21346 [0x2B40]={d='on'},
21347 [0x2B41]={d='on'},
21348 [0x2B42]={d='on'},
21349 [0x2B43]={d='on'},
21350 [0x2B44]={d='on'},
21351 [0x2B45]={d='on'},
21352 [0x2B46]={d='on'},
21353 [0x2B47]={d='on'},
21354 [0x2B48]={d='on'},
21355 [0x2B49]={d='on'},
21356 [0x2B4A]={d='on'},
21357 [0x2B4B]={d='on'},
21358 [0x2B4C]={d='on'},
21359 [0x2B4D]={d='on'},
21360 [0x2B4E]={d='on'},
21361 [0x2B4F]={d='on'},
21362 [0x2B50]={d='on'},
21363 [0x2B51]={d='on'},
21364 [0x2B52]={d='on'},
21365 [0x2B53]={d='on'},
21366 [0x2B54]={d='on'},
21367 [0x2B55]={d='on'},
21368 [0x2B56]={d='on'},
21369 [0x2B57]={d='on'},
21370 [0x2B58]={d='on'},
21371 [0x2B59]={d='on'},
21372 [0x2B5A]={d='on'},
21373 [0x2B5B]={d='on'},
21374 [0x2B5C]={d='on'},
21375 [0x2B5D]={d='on'},
21376 [0x2B5E]={d='on'},
21377 [0x2B5F]={d='on'},
21378 [0x2B60]={d='on'},
21379 [0x2B61]={d='on'},
21380 [0x2B62]={d='on'},
21381 [0x2B63]={d='on'},
21382 [0x2B64]={d='on'},
21383 [0x2B65]={d='on'},
21384 [0x2B66]={d='on'},
21385 [0x2B67]={d='on'},
21386 [0x2B68]={d='on'},
21387 [0x2B69]={d='on'},
21388 [0x2B6A]={d='on'},
21389 [0x2B6B]={d='on'},
21390 [0x2B6C]={d='on'},
21391 [0x2B6D]={d='on'},
21392 [0x2B6E]={d='on'},
21393 [0x2B6F]={d='on'},
21394 [0x2B70]={d='on'},
21395 [0x2B71]={d='on'},
21396 [0x2B72]={d='on'},
21397 [0x2B73]={d='on'},
21398 [0x2B76]={d='on'},
21399 [0x2B77]={d='on'},
21400 [0x2B78]={d='on'},
21401 [0x2B79]={d='on'},
21402 [0x2B7A]={d='on'},
21403 [0x2B7B]={d='on'},
21404 [0x2B7C]={d='on'},
21405 [0x2B7D]={d='on'},
21406 [0x2B7E]={d='on'},
21407 [0x2B7F]={d='on'},
21408 [0x2B80]={d='on'},
21409 [0x2B81]={d='on'},
21410 [0x2B82]={d='on'},
21411 [0x2B83]={d='on'},
21412 [0x2B84]={d='on'},
21413 [0x2B85]={d='on'},
21414 [0x2B86]={d='on'},
21415 [0x2B87]={d='on'},
21416 [0x2B88]={d='on'},
21417 [0x2B89]={d='on'},
21418 [0x2B8A]={d='on'},
21419 [0x2B8B]={d='on'},
21420 [0x2B8C]={d='on'},
21421 [0x2B8D]={d='on'},
21422 [0x2B8E]={d='on'},
21423 [0x2B8F]={d='on'},
21424 [0x2B90]={d='on'},
21425 [0x2B91]={d='on'},
21426 [0x2B92]={d='on'},
21427 [0x2B93]={d='on'},
21428 [0x2B94]={d='on'},
21429 [0x2B95]={d='on'},
21430 [0x2B98]={d='on'},
21431 [0x2B99]={d='on'},
21432 [0x2B9A]={d='on'},
21433 [0x2B9B]={d='on'},
21434 [0x2B9C]={d='on'},
21435 [0x2B9D]={d='on'},
21436 [0x2B9E]={d='on'},
21437 [0x2B9F]={d='on'},
21438 [0x2BA0]={d='on'},
21439 [0x2BA1]={d='on'},
21440 [0x2BA2]={d='on'},
21441 [0x2BA3]={d='on'},
21442 [0x2BA4]={d='on'},
21443 [0x2BA5]={d='on'},
21444 [0x2BA6]={d='on'},
21445 [0x2BA7]={d='on'},
21446 [0x2BA8]={d='on'},
21447 [0x2BA9]={d='on'},
21448 [0x2BAA]={d='on'},
21449 [0x2BAB]={d='on'},
21450 [0x2BAC]={d='on'},
21451 [0x2BAD]={d='on'},
21452 [0x2BAE]={d='on'},
21453 [0x2BAF]={d='on'},
21454 [0x2BB0]={d='on'},
21455 [0x2BB1]={d='on'},
21456 [0x2BB2]={d='on'},
21457 [0x2BB3]={d='on'},
21458 [0x2BB4]={d='on'},
21459 [0x2BB5]={d='on'},
21460 [0x2BB6]={d='on'},
21461 [0x2BB7]={d='on'},
21462 [0x2BB8]={d='on'},
21463 [0x2BB9]={d='on'},
21464 [0x2BBD]={d='on'},
21465 [0x2BBE]={d='on'},
21466 [0x2BBF]={d='on'},
21467 [0x2BC0]={d='on'},
21468 [0x2BC1]={d='on'},
21469 [0x2BC2]={d='on'},
21470 [0x2BC3]={d='on'},
21471 [0x2BC4]={d='on'},
21472 [0x2BC5]={d='on'},
21473 [0x2BC6]={d='on'},
21474 [0x2BC7]={d='on'},
21475 [0x2BC8]={d='on'},
21476 [0x2BCA]={d='on'},
21477 [0x2BCB]={d='on'},
21478 [0x2BCC]={d='on'},
21479 [0x2BCD]={d='on'},
21480 [0x2BCE]={d='on'},
21481 [0x2BCF]={d='on'},
21482 [0x2BD0]={d='on'},
21483 [0x2BD1]={d='on'},
21484 [0x2BEC]={d='on'},
21485 [0x2BED]={d='on'},
21486 [0x2BEE]={d='on'},
21487 [0x2BEF]={d='on'},
21488 [0x2CE5]={d='on'},
21489 [0x2CE6]={d='on'},
21490 [0x2CE7]={d='on'},
21491 [0x2CE8]={d='on'},
21492 [0x2CE9]={d='on'},
21493 [0x2CEA]={d='on'},
21494 [0x2CEF]={d='nsm'},
21495 [0x2CF0]={d='nsm'},
21496 [0x2CF1]={d='nsm'},
21497 [0x2CF9]={d='on'},
21498 [0x2CFA]={d='on'},
21499 [0x2CFB]={d='on'},
21500 [0x2CFC]={d='on'},
21501 [0x2CFD]={d='on'},
21502 [0x2CFE]={d='on'},
21503 [0x2CFF]={d='on'},
21504 [0x2D7F]={d='nsm'},
21505 [0x2DE0]={d='nsm'},
21506 [0x2DE1]={d='nsm'},
21507 [0x2DE2]={d='nsm'},
21508 [0x2DE3]={d='nsm'},
21509 [0x2DE4]={d='nsm'},
21510 [0x2DE5]={d='nsm'},
21511 [0x2DE6]={d='nsm'},
21512 [0x2DE7]={d='nsm'},
21513 [0x2DE8]={d='nsm'},
21514 [0x2DE9]={d='nsm'},
21515 [0x2DEA]={d='nsm'},
21516 [0x2DEB]={d='nsm'},
21517 [0x2DEC]={d='nsm'},
21518 [0x2DED]={d='nsm'},
21519 [0x2DEE]={d='nsm'},
21520 [0x2DEF]={d='nsm'},
21521 [0x2DF0]={d='nsm'},
21522 [0x2DF1]={d='nsm'},
21523 [0x2DF2]={d='nsm'},
21524 [0x2DF3]={d='nsm'},
21525 [0x2DF4]={d='nsm'},
21526 [0x2DF5]={d='nsm'},
21527 [0x2DF6]={d='nsm'},
21528 [0x2DF7]={d='nsm'},
21529 [0x2DF8]={d='nsm'},
21530 [0x2DF9]={d='nsm'},
21531 [0x2DFA]={d='nsm'},
21532 [0x2DFB]={d='nsm'},
21533 [0x2DFC]={d='nsm'},
21534 [0x2DFD]={d='nsm'},
21535 [0x2DFE]={d='nsm'},
21536 [0x2DFF]={d='nsm'},
21537 [0x2E00]={d='on'},
21538 [0x2E01]={d='on'},
21539 [0x2E02]={d='on', m=0x2E03},
21540 [0x2E03]={d='on', m=0x2E02},
21541 [0x2E04]={d='on', m=0x2E05},
21542 [0x2E05]={d='on', m=0x2E04},
21543 [0x2E06]={d='on'},
21544 [0x2E07]={d='on'},
21545 [0x2E08]={d='on'},
21546 [0x2E09]={d='on', m=0x2E0A},
21547 [0x2E0A]={d='on', m=0x2E09},
21548 [0x2E0B]={d='on'},
21549 [0x2E0C]={d='on', m=0x2E0D},
21550 [0x2E0D]={d='on', m=0x2E0C},
21551 [0x2E0E]={d='on'},
21552 [0x2E0F]={d='on'},
21553 [0x2E10]={d='on'},
21554 [0x2E11]={d='on'},
21555 [0x2E12]={d='on'},
21556 [0x2E13]={d='on'},
21557 [0x2E14]={d='on'},
21558 [0x2E15]={d='on'},
21559 [0x2E16]={d='on'},
21560 [0x2E17]={d='on'},
21561 [0x2E18]={d='on'},
21562 [0x2E19]={d='on'},
21563 [0x2E1A]={d='on'},
21564 [0x2E1B]={d='on'},
21565 [0x2E1C]={d='on', m=0x2E1D},
21566 [0x2E1D]={d='on', m=0x2E1C},
21567 [0x2E1E]={d='on'},
21568 [0x2E1F]={d='on'},
21569 [0x2E20]={d='on', m=0x2E21},
21570 [0x2E21]={d='on', m=0x2E20},
21571 [0x2E22]={d='on', m=0x2E23},
21572 [0x2E23]={d='on', m=0x2E22},
21573 [0x2E24]={d='on', m=0x2E25},
21574 [0x2E25]={d='on', m=0x2E24},
21575 [0x2E26]={d='on', m=0x2E27},
21576 [0x2E27]={d='on', m=0x2E26},
21577 [0x2E28]={d='on', m=0x2E29},
21578 [0x2E29]={d='on', m=0x2E28},
21579 [0x2E2A]={d='on'},
21580 [0x2E2B]={d='on'},
21581 [0x2E2C]={d='on'},
21582 [0x2E2D]={d='on'},
21583 [0x2E2E]={d='on'},
21584 [0x2E2F]={d='on'},
21585 [0x2E30]={d='on'},
21586 [0x2E31]={d='on'},
21587 [0x2E32]={d='on'},
21588 [0x2E33]={d='on'},
21589 [0x2E34]={d='on'},
21590 [0x2E35]={d='on'},
21591 [0x2E36]={d='on'},
21592 [0x2E37]={d='on'},
21593 [0x2E38]={d='on'},
21594 [0x2E39]={d='on'},
21595 [0x2E3A]={d='on'},
21596 [0x2E3B]={d='on'},
21597 [0x2E3C]={d='on'},
21598 [0x2E3D]={d='on'},
21599 [0x2E3E]={d='on'},
21600 [0x2E3F]={d='on'},
21601 [0x2E40]={d='on'},
21602 [0x2E41]={d='on'},
21603 [0x2E42]={d='on'},
21604 [0x2E43]={d='on'},
21605 [0x2E44]={d='on'},
21606 [0x2E80]={d='on'},
21607 [0x2E81]={d='on'},
21608 [0x2E82]={d='on'},
21609 [0x2E83]={d='on'},
21610 [0x2E84]={d='on'},
21611 [0x2E85]={d='on'},
21612 [0x2E86]={d='on'},
21613 [0x2E87]={d='on'},
21614 [0x2E88]={d='on'},
21615 [0x2E89]={d='on'},
21616 [0x2E8A]={d='on'},
21617 [0x2E8B]={d='on'},
21618 [0x2E8C]={d='on'},
21619 [0x2E8D]={d='on'},
21620 [0x2E8E]={d='on'},
21621 [0x2E8F]={d='on'},
21622 [0x2E90]={d='on'},
21623 [0x2E91]={d='on'},
21624 [0x2E92]={d='on'},
21625 [0x2E93]={d='on'},
21626 [0x2E94]={d='on'},
21627 [0x2E95]={d='on'},
21628 [0x2E96]={d='on'},
21629 [0x2E97]={d='on'},
21630 [0x2E98]={d='on'},
21631 [0x2E99]={d='on'},
21632 [0x2E9B]={d='on'},
21633 [0x2E9C]={d='on'},
21634 [0x2E9D]={d='on'},
21635 [0x2E9E]={d='on'},
21636 [0x2E9F]={d='on'},
21637 [0x2EA0]={d='on'},
21638 [0x2EA1]={d='on'},
21639 [0x2EA2]={d='on'},
21640 [0x2EA3]={d='on'},
21641 [0x2EA4]={d='on'},
21642 [0x2EA5]={d='on'},
21643 [0x2EA6]={d='on'},
21644 [0x2EA7]={d='on'},
21645 [0x2EA8]={d='on'},
21646 [0x2EA9]={d='on'},
21647 [0x2EAA]={d='on'},
21648 [0x2EAB]={d='on'},
21649 [0x2EAC]={d='on'},
21650 [0x2EAD]={d='on'},
21651 [0x2EAE]={d='on'},
21652 [0x2EAF]={d='on'},
21653 [0x2EB0]={d='on'},
21654 [0x2EB1]={d='on'},
21655 [0x2EB2]={d='on'},
21656 [0x2EB3]={d='on'},
21657 [0x2EB4]={d='on'},
21658 [0x2EB5]={d='on'},
21659 [0x2EB6]={d='on'},
21660 [0x2EB7]={d='on'},
21661 [0x2EB8]={d='on'},
21662 [0x2EB9]={d='on'},
21663 [0x2EBA]={d='on'},
21664 [0x2EBB]={d='on'},
21665 [0x2EBC]={d='on'},
21666 [0x2EBD]={d='on'},
21667 [0x2EBE]={d='on'},
21668 [0x2EBF]={d='on'},
21669 [0x2EC0]={d='on'},
21670 [0x2EC1]={d='on'},
21671 [0x2EC2]={d='on'},
21672 [0x2EC3]={d='on'},
21673 [0x2EC4]={d='on'},
21674 [0x2EC5]={d='on'},
21675 [0x2EC6]={d='on'},
21676 [0x2EC7]={d='on'},
21677 [0x2EC8]={d='on'},
21678 [0x2EC9]={d='on'},
21679 [0x2ECA]={d='on'},
21680 [0x2ECB]={d='on'},
21681 [0x2ECC]={d='on'},
21682 [0x2ECD]={d='on'},
21683 [0x2ECE]={d='on'},
21684 [0x2ECF]={d='on'},
21685 [0x2ED0]={d='on'},
21686 [0x2ED1]={d='on'},
21687 [0x2ED2]={d='on'},
21688 [0x2ED3]={d='on'},
21689 [0x2ED4]={d='on'},
21690 [0x2ED5]={d='on'},
21691 [0x2ED6]={d='on'},
21692 [0x2ED7]={d='on'},
21693 [0x2ED8]={d='on'},
21694 [0x2ED9]={d='on'},
21695 [0x2EDA]={d='on'},
21696 [0x2EDB]={d='on'},
21697 [0x2EDC]={d='on'},
21698 [0x2EDD]={d='on'},
21699 [0x2EDE]={d='on'},
21700 [0x2EDF]={d='on'},
21701 [0x2EE0]={d='on'},
21702 [0x2EE1]={d='on'},
21703 [0x2EE2]={d='on'},
21704 [0x2EE3]={d='on'},
21705 [0x2EE4]={d='on'},
21706 [0x2EE5]={d='on'},
21707 [0x2EE6]={d='on'},
21708 [0x2EE7]={d='on'},
21709 [0x2EE8]={d='on'},
21710 [0x2EE9]={d='on'},
21711 [0x2EEA]={d='on'},
21712 [0x2EEB]={d='on'},
21713 [0x2EEC]={d='on'},
21714 [0x2EED]={d='on'},
21715 [0x2EEE]={d='on'},
21716 [0x2EEF]={d='on'},
21717 [0x2EF0]={d='on'},
21718 [0x2EF1]={d='on'},
21719 [0x2EF2]={d='on'},
21720 [0x2EF3]={d='on'},
21721 [0x2F00]={d='on'},
21722 [0x2F01]={d='on'},
21723 [0x2F02]={d='on'},
21724 [0x2F03]={d='on'},
21725 [0x2F04]={d='on'},
21726 [0x2F05]={d='on'},
21727 [0x2F06]={d='on'},
21728 [0x2F07]={d='on'},
21729 [0x2F08]={d='on'},
21730 [0x2F09]={d='on'},
21731 [0x2F0A]={d='on'},
21732 [0x2F0B]={d='on'},
21733 [0x2F0C]={d='on'},
21734 [0x2F0D]={d='on'},
21735 [0x2F0E]={d='on'},
21736 [0x2F0F]={d='on'},
21737 [0x2F10]={d='on'},
21738 [0x2F11]={d='on'},
21739 [0x2F12]={d='on'},
21740 [0x2F13]={d='on'},
21741 [0x2F14]={d='on'},
21742 [0x2F15]={d='on'},
21743 [0x2F16]={d='on'},
21744 [0x2F17]={d='on'},
21745 [0x2F18]={d='on'},
21746 [0x2F19]={d='on'},
21747 [0x2F1A]={d='on'},
21748 [0x2F1B]={d='on'},
21749 [0x2F1C]={d='on'},
21750 [0x2F1D]={d='on'},
21751 [0x2F1E]={d='on'},
21752 [0x2F1F]={d='on'},
21753 [0x2F20]={d='on'},
21754 [0x2F21]={d='on'},
21755 [0x2F22]={d='on'},
21756 [0x2F23]={d='on'},
21757 [0x2F24]={d='on'},
21758 [0x2F25]={d='on'},
21759 [0x2F26]={d='on'},
21760 [0x2F27]={d='on'},
21761 [0x2F28]={d='on'},
21762 [0x2F29]={d='on'},
21763 [0x2F2A]={d='on'},
21764 [0x2F2B]={d='on'},
21765 [0x2F2C]={d='on'},
21766 [0x2F2D]={d='on'},
21767 [0x2F2E]={d='on'},
21768 [0x2F2F]={d='on'},
21769 [0x2F30]={d='on'},
21770 [0x2F31]={d='on'},
21771 [0x2F32]={d='on'},
21772 [0x2F33]={d='on'},
21773 [0x2F34]={d='on'},
21774 [0x2F35]={d='on'},
21775 [0x2F36]={d='on'},
21776 [0x2F37]={d='on'},
21777 [0x2F38]={d='on'},
21778 [0x2F39]={d='on'},
21779 [0x2F3A]={d='on'},
21780 [0x2F3B]={d='on'},
21781 [0x2F3C]={d='on'},
21782 [0x2F3D]={d='on'},
21783 [0x2F3E]={d='on'},
21784 [0x2F3F]={d='on'},
21785 [0x2F40]={d='on'},
21786 [0x2F41]={d='on'},
21787 [0x2F42]={d='on'},
21788 [0x2F43]={d='on'},
21789 [0x2F44]={d='on'},
21790 [0x2F45]={d='on'},
21791 [0x2F46]={d='on'},
21792 [0x2F47]={d='on'},
21793 [0x2F48]={d='on'},
21794 [0x2F49]={d='on'},
21795 [0x2F4A]={d='on'},
21796 [0x2F4B]={d='on'},
21797 [0x2F4C]={d='on'},
21798 [0x2F4D]={d='on'},
21799 [0x2F4E]={d='on'},
21800 [0x2F4F]={d='on'},
21801 [0x2F50]={d='on'},
21802 [0x2F51]={d='on'},
21803 [0x2F52]={d='on'},
21804 [0x2F53]={d='on'},
21805 [0x2F54]={d='on'},
21806 [0x2F55]={d='on'},
21807 [0x2F56]={d='on'},
21808 [0x2F57]={d='on'},
21809 [0x2F58]={d='on'},
21810 [0x2F59]={d='on'},
21811 [0x2F5A]={d='on'},
21812 [0x2F5B]={d='on'},
21813 [0x2F5C]={d='on'},
21814 [0x2F5D]={d='on'},
21815 [0x2F5E]={d='on'},
21816 [0x2F5F]={d='on'},
21817 [0x2F60]={d='on'},
21818 [0x2F61]={d='on'},
21819 [0x2F62]={d='on'},
21820 [0x2F63]={d='on'},
21821 [0x2F64]={d='on'},
21822 [0x2F65]={d='on'},
21823 [0x2F66]={d='on'},
21824 [0x2F67]={d='on'},
21825 [0x2F68]={d='on'},
21826 [0x2F69]={d='on'},
21827 [0x2F6A]={d='on'},
21828 [0x2F6B]={d='on'},
21829 [0x2F6C]={d='on'},
21830 [0x2F6D]={d='on'},
21831 [0x2F6E]={d='on'},
21832 [0x2F6F]={d='on'},
21833 [0x2F70]={d='on'},
21834 [0x2F71]={d='on'},
21835 [0x2F72]={d='on'},
21836 [0x2F73]={d='on'},
21837 [0x2F74]={d='on'},
21838 [0x2F75]={d='on'},
21839 [0x2F76]={d='on'},
21840 [0x2F77]={d='on'},
21841 [0x2F78]={d='on'},
21842 [0x2F79]={d='on'},
21843 [0x2F7A]={d='on'},
21844 [0x2F7B]={d='on'},
21845 [0x2F7C]={d='on'},
21846 [0x2F7D]={d='on'},
21847 [0x2F7E]={d='on'},
21848 [0x2F7F]={d='on'},
21849 [0x2F80]={d='on'},
21850 [0x2F81]={d='on'},
21851 [0x2F82]={d='on'},
21852 [0x2F83]={d='on'},
21853 [0x2F84]={d='on'},
21854 [0x2F85]={d='on'},
21855 [0x2F86]={d='on'},
21856 [0x2F87]={d='on'},
21857 [0x2F88]={d='on'},
21858 [0x2F89]={d='on'},
21859 [0x2F8A]={d='on'},
21860 [0x2F8B]={d='on'},
21861 [0x2F8C]={d='on'},
21862 [0x2F8D]={d='on'},
21863 [0x2F8E]={d='on'},
21864 [0x2F8F]={d='on'},
21865 [0x2F90]={d='on'},
21866 [0x2F91]={d='on'},
21867 [0x2F92]={d='on'},
21868 [0x2F93]={d='on'},
21869 [0x2F94]={d='on'},
21870 [0x2F95]={d='on'},
21871 [0x2F96]={d='on'},
21872 [0x2F97]={d='on'},
21873 [0x2F98]={d='on'},
21874 [0x2F99]={d='on'},
21875 [0x2F9A]={d='on'},
21876 [0x2F9B]={d='on'},
21877 [0x2F9C]={d='on'},
21878 [0x2F9D]={d='on'},
21879 [0x2F9E]={d='on'},
21880 [0x2F9F]={d='on'},
21881 [0x2FA0]={d='on'},
21882 [0x2FA1]={d='on'},
21883 [0x2FA2]={d='on'},
21884 [0x2FA3]={d='on'},
21885 [0x2FA4]={d='on'},
21886 [0x2FA5]={d='on'},
21887 [0x2FA6]={d='on'},
21888 [0x2FA7]={d='on'},
21889 [0x2FA8]={d='on'},
21890 [0x2FA9]={d='on'},
21891 [0x2FAA]={d='on'},
21892 [0x2FAB]={d='on'},
21893 [0x2FAC]={d='on'},
21894 [0x2FAD]={d='on'},
21895 [0x2FAE]={d='on'},
21896 [0x2FAF]={d='on'},
21897 [0x2FB0]={d='on'},
21898 [0x2FB1]={d='on'},
21899 [0x2FB2]={d='on'},
21900 [0x2FB3]={d='on'},
21901 [0x2FB4]={d='on'},
21902 [0x2FB5]={d='on'},
21903 [0x2FB6]={d='on'},
21904 [0x2FB7]={d='on'},
21905 [0x2FB8]={d='on'},
21906 [0x2FB9]={d='on'},
21907 [0x2FBA]={d='on'},
21908 [0x2FBB]={d='on'},
21909 [0x2FBC]={d='on'},
21910 [0x2FBD]={d='on'},
21911 [0x2FBE]={d='on'},
21912 [0x2FBF]={d='on'},
21913 [0x2FC0]={d='on'},
21914 [0x2FC1]={d='on'},
21915 [0x2FC2]={d='on'},
21916 [0x2FC3]={d='on'},
21917 [0x2FC4]={d='on'},
21918 [0x2FC5]={d='on'},
21919 [0x2FC6]={d='on'},
21920 [0x2FC7]={d='on'},
21921 [0x2FC8]={d='on'},
21922 [0x2FC9]={d='on'},
21923 [0x2FCA]={d='on'},
21924 [0x2FCB]={d='on'},
21925 [0x2FCC]={d='on'},
21926 [0x2FCD]={d='on'},
21927 [0x2FCE]={d='on'},
21928 [0x2FCF]={d='on'},
21929 [0x2FD0]={d='on'},
21930 [0x2FD1]={d='on'},
21931 [0x2FD2]={d='on'},
21932 [0x2FD3]={d='on'},
21933 [0x2FD4]={d='on'},
21934 [0x2FD5]={d='on'},
21935 [0x2FF0]={d='on'},
21936 [0x2FF1]={d='on'},
21937 [0x2FF2]={d='on'},
21938 [0x2FF3]={d='on'},
21939 [0x2FF4]={d='on'},
21940 [0x2FF5]={d='on'},
21941 [0x2FF6]={d='on'},
21942 [0x2FF7]={d='on'},
21943 [0x2FF8]={d='on'},
21944 [0x2FF9]={d='on'},
21945 [0x2FFA]={d='on'},
21946 [0x2FFB]={d='on'},
21947 [0x3000]={d='ws'},
21948 [0x3001]={d='on'},
21949 [0x3002]={d='on'},
21950 [0x3003]={d='on'},
21951 [0x3004]={d='on'},
21952 [0x3008]={d='on', m=0x3009},
21953 [0x3009]={d='on', m=0x3008},
21954 [0x300A]={d='on', m=0x300B},
21955 [0x300B]={d='on', m=0x300A},
21956 [0x300C]={d='on', m=0x300D},
21957 [0x300D]={d='on', m=0x300C},
21958 [0x300E]={d='on', m=0x300F},
21959 [0x300F]={d='on', m=0x300E},
21960 [0x3010]={d='on', m=0x3011},
21961 [0x3011]={d='on', m=0x3010},
21962 [0x3012]={d='on'},
21963 [0x3013]={d='on'},
21964 [0x3014]={d='on', m=0x3015},
21965 [0x3015]={d='on', m=0x3014},
21966 [0x3016]={d='on', m=0x3017},
21967 [0x3017]={d='on', m=0x3016},
21968 [0x3018]={d='on', m=0x3019},
21969 [0x3019]={d='on', m=0x3018},
21970 [0x301A]={d='on', m=0x301B},
21971 [0x301B]={d='on', m=0x301A},
21972 [0x301C]={d='on'},
21973 [0x301D]={d='on'},
21974 [0x301E]={d='on'},
21975 [0x301F]={d='on'},
21976 [0x3020]={d='on'},
21977 [0x302A]={d='nsm'},
21978 [0x302B]={d='nsm'},
21979 [0x302C]={d='nsm'},
21980 [0x302D]={d='nsm'},
21981 [0x3030]={d='on'},
21982 [0x3036]={d='on'},
21983 [0x3037]={d='on'},
21984 [0x303D]={d='on'},
21985 [0x303E]={d='on'},
21986 [0x303F]={d='on'},
21987 [0x3099]={d='nsm'},
21988 [0x309A]={d='nsm'},
21989 [0x309B]={d='on'},
21990 [0x309C]={d='on'},
21991 [0x30A0]={d='on'},
21992 [0x30FB]={d='on'},
21993 [0x31C0]={d='on'},
21994 [0x31C1]={d='on'},
21995 [0x31C2]={d='on'},
21996 [0x31C3]={d='on'},
21997 [0x31C4]={d='on'},
21998 [0x31C5]={d='on'},
21999 [0x31C6]={d='on'},
22000 [0x31C7]={d='on'},
22001 [0x31C8]={d='on'},
22002 [0x31C9]={d='on'},
22003 [0x31CA]={d='on'},
22004 [0x31CB]={d='on'},
22005 [0x31CC]={d='on'},
22006 [0x31CD]={d='on'},
22007 [0x31CE]={d='on'},
22008 [0x31CF]={d='on'},
22009 [0x31D0]={d='on'},
22010 [0x31D1]={d='on'},
22011 [0x31D2]={d='on'},
22012 [0x31D3]={d='on'},
22013 [0x31D4]={d='on'},
22014 [0x31D5]={d='on'},
22015 [0x31D6]={d='on'},
22016 [0x31D7]={d='on'},
22017 [0x31D8]={d='on'},
22018 [0x31D9]={d='on'},
22019 [0x31DA]={d='on'},
22020 [0x31DB]={d='on'},
22021 [0x31DC]={d='on'},
22022 [0x31DD]={d='on'},
22023 [0x31DE]={d='on'},
22024 [0x31DF]={d='on'},
22025 [0x31E0]={d='on'},
22026 [0x31E1]={d='on'},
22027 [0x31E2]={d='on'},
22028 [0x31E3]={d='on'},
22029 [0x321D]={d='on'},
22030 [0x321E]={d='on'},
22031 [0x3250]={d='on'},
22032 [0x3251]={d='on'},
22033 [0x3252]={d='on'},
22034 [0x3253]={d='on'},
22035 [0x3254]={d='on'},
22036 [0x3255]={d='on'},
22037 [0x3256]={d='on'},
22038 [0x3257]={d='on'},
22039 [0x3258]={d='on'},
22040 [0x3259]={d='on'},
22041 [0x325A]={d='on'},
22042 [0x325B]={d='on'},
22043 [0x325C]={d='on'},
22044 [0x325D]={d='on'},
22045 [0x325E]={d='on'},
22046 [0x325F]={d='on'},
22047 [0x327C]={d='on'},
22048 [0x327D]={d='on'},
22049 [0x327E]={d='on'},
22050 [0x32B1]={d='on'},
22051 [0x32B2]={d='on'},
22052 [0x32B3]={d='on'},
22053 [0x32B4]={d='on'},
22054 [0x32B5]={d='on'},
22055 [0x32B6]={d='on'},
22056 [0x32B7]={d='on'},
22057 [0x32B8]={d='on'},
22058 [0x32B9]={d='on'},
22059 [0x32BA]={d='on'},
22060 [0x32BB]={d='on'},
22061 [0x32BC]={d='on'},
22062 [0x32BD]={d='on'},
22063 [0x32BE]={d='on'},
22064 [0x32BF]={d='on'},
22065 [0x32CC]={d='on'},
22066 [0x32CD]={d='on'},
22067 [0x32CE]={d='on'},
22068 [0x32CF]={d='on'},
22069 [0x3377]={d='on'},
22070 [0x3378]={d='on'},
22071 [0x3379]={d='on'},
22072 [0x337A]={d='on'},
22073 [0x33DE]={d='on'},
22074 [0x33DF]={d='on'},
22075 [0x33FF]={d='on'},
22076 [0x4DC0]={d='on'},
22077 [0x4DC1]={d='on'},
22078 [0x4DC2]={d='on'},
22079 [0x4DC3]={d='on'},
22080 [0x4DC4]={d='on'},
22081 [0x4DC5]={d='on'},
22082 [0x4DC6]={d='on'},
22083 [0x4DC7]={d='on'},
22084 [0x4DC8]={d='on'},
22085 [0x4DC9]={d='on'},
22086 [0x4DCA]={d='on'},
22087 [0x4DCB]={d='on'},
22088 [0x4DCC]={d='on'},
22089 [0x4DCD]={d='on'},
22090 [0x4DCE]={d='on'},
22091 [0x4DCF]={d='on'},
22092 [0x4DD0]={d='on'},
22093 [0x4DD1]={d='on'},
22094 [0x4DD2]={d='on'},
22095 [0x4DD3]={d='on'},
22096 [0x4DD4]={d='on'},
22097 [0x4DD5]={d='on'},
22098 [0x4DD6]={d='on'},
22099 [0x4DD7]={d='on'},
22100 [0x4DD8]={d='on'},
22101 [0x4DD9]={d='on'},
22102 [0x4DDA]={d='on'},
22103 [0x4DDB]={d='on'},
22104 [0x4DDC]={d='on'},
22105 [0x4DDD]={d='on'},
22106 [0x4DDE]={d='on'},
22107 [0x4DDF]={d='on'},
22108 [0x4DE0]={d='on'},
22109 [0x4DE1]={d='on'},
22110 [0x4DE2]={d='on'},
22111 [0x4DE3]={d='on'},
22112 [0x4DE4]={d='on'},
22113 [0x4DE5]={d='on'},
22114 [0x4DE6]={d='on'},
22115 [0x4DE7]={d='on'},
22116 [0x4DE8]={d='on'},
22117 [0x4DE9]={d='on'},
22118 [0x4DEA]={d='on'},
22119 [0x4DEB]={d='on'},
22120 [0x4DEC]={d='on'},
22121 [0x4DED]={d='on'},
22122 [0x4DEE]={d='on'},
22123 [0x4DEF]={d='on'},
22124 [0x4DF0]={d='on'},
22125 [0x4DF1]={d='on'},
22126 [0x4DF2]={d='on'},
22127 [0x4DF3]={d='on'},
22128 [0x4DF4]={d='on'},
22129 [0x4DF5]={d='on'},
22130 [0x4DF6]={d='on'},
22131 [0x4DF7]={d='on'},
22132 [0x4DF8]={d='on'},
22133 [0x4DF9]={d='on'},
22134 [0x4DFA]={d='on'},
22135 [0x4DFB]={d='on'},
22136 [0x4DFC]={d='on'},
22137 [0x4DFD]={d='on'},
22138 [0x4DFE]={d='on'},
22139 [0x4DFF]={d='on'},
22140 [0xA490]={d='on'},
22141 [0xA491]={d='on'},
22142 [0xA492]={d='on'},
22143 [0xA493]={d='on'},
22144 [0xA494]={d='on'},
22145 [0xA495]={d='on'},
22146 [0xA496]={d='on'},
22147 [0xA497]={d='on'},
22148 [0xA498]={d='on'},
22149 [0xA499]={d='on'},
22150 [0xA49A]={d='on'},
22151 [0xA49B]={d='on'},
22152 [0xA49C]={d='on'},
22153 [0xA49D]={d='on'},
22154 [0xA49E]={d='on'},
22155 [0xA49F]={d='on'},
22156 [0xA4A0]={d='on'},
22157 [0xA4A1]={d='on'},
22158 [0xA4A2]={d='on'},
22159 [0xA4A3]={d='on'},
22160 [0xA4A4]={d='on'},
22161 [0xA4A5]={d='on'},
22162 [0xA4A6]={d='on'},
22163 [0xA4A7]={d='on'},
22164 [0xA4A8]={d='on'},
22165 [0xA4A9]={d='on'},
22166 [0xA4AA]={d='on'},
22167 [0xA4AB]={d='on'},
22168 [0xA4AC]={d='on'},
22169 [0xA4AD]={d='on'},
22170 [0xA4AE]={d='on'},
22171 [0xA4AF]={d='on'},
22172 [0xA4B0]={d='on'},
22173 [0xA4B1]={d='on'},
22174 [0xA4B2]={d='on'},
22175 [0xA4B3]={d='on'},
22176 [0xA4B4]={d='on'},
22177 [0xA4B5]={d='on'},
22178 [0xA4B6]={d='on'},
22179 [0xA4B7]={d='on'},
22180 [0xA4B8]={d='on'},
22181 [0xA4B9]={d='on'},
22182 [0xA4BA]={d='on'},
22183 [0xA4BB]={d='on'},
22184 [0xA4BC]={d='on'},
22185 [0xA4BD]={d='on'},
22186 [0xA4BE]={d='on'},
22187 [0xA4BF]={d='on'},
22188 [0xA4C0]={d='on'},
22189 [0xA4C1]={d='on'},
22190 [0xA4C2]={d='on'},
22191 [0xA4C3]={d='on'},
22192 [0xA4C4]={d='on'},
22193 [0xA4C5]={d='on'},
22194 [0xA4C6]={d='on'},
22195 [0xA60D]={d='on'},
22196 [0xA60E]={d='on'},
22197 [0xA60F]={d='on'},
22198 [0xA66F]={d='nsm'},
22199 [0xA670]={d='nsm'},
22200 [0xA671]={d='nsm'},
22201 [0xA672]={d='nsm'},
22202 [0xA673]={d='on'},
22203 [0xA674]={d='nsm'},
22204 [0xA675]={d='nsm'},
22205 [0xA676]={d='nsm'},
22206 [0xA677]={d='nsm'},
22207 [0xA678]={d='nsm'},
22208 [0xA679]={d='nsm'},
22209 [0xA67A]={d='nsm'},
22210 [0xA67B]={d='nsm'},
22211 [0xA67C]={d='nsm'},
22212 [0xA67D]={d='nsm'},
22213 [0xA67E]={d='on'},
22214 [0xA67F]={d='on'},
22215 [0xA69E]={d='nsm'},
22216 [0xA69F]={d='nsm'},
22217 [0xA6F0]={d='nsm'},
22218 [0xA6F1]={d='nsm'},
22219 [0xA700]={d='on'},
22220 [0xA701]={d='on'},
22221 [0xA702]={d='on'},
22222 [0xA703]={d='on'},
22223 [0xA704]={d='on'},
22224 [0xA705]={d='on'},
22225 [0xA706]={d='on'},
22226 [0xA707]={d='on'},
22227 [0xA708]={d='on'},
22228 [0xA709]={d='on'},
22229 [0xA70A]={d='on'},
22230 [0xA70B]={d='on'},
22231 [0xA70C]={d='on'},
22232 [0xA70D]={d='on'},
22233 [0xA70E]={d='on'},
22234 [0xA70F]={d='on'},
22235 [0xA710]={d='on'},
22236 [0xA711]={d='on'},
22237 [0xA712]={d='on'},
22238 [0xA713]={d='on'},
22239 [0xA714]={d='on'},
22240 [0xA715]={d='on'},
22241 [0xA716]={d='on'},
22242 [0xA717]={d='on'},
22243 [0xA718]={d='on'},
22244 [0xA719]={d='on'},
22245 [0xA71A]={d='on'},
22246 [0xA71B]={d='on'},
22247 [0xA71C]={d='on'},
22248 [0xA71D]={d='on'},
22249 [0xA71E]={d='on'},
22250 [0xA71F]={d='on'},
22251 [0xA720]={d='on'},
22252 [0xA721]={d='on'},
22253 [0xA788]={d='on'},
22254 [0xA802]={d='nsm'},
22255 [0xA806]={d='nsm'},
22256 [0xA80B]={d='nsm'},
22257 [0xA825]={d='nsm'},
22258 [0xA826]={d='nsm'},
22259 [0xA828]={d='on'},
22260 [0xA829]={d='on'},
22261 [0xA82A]={d='on'},
22262 [0xA82B]={d='on'},
22263 [0xA838]={d='et'},
22264 [0xA839]={d='et'},
22265 [0xA874]={d='on'},
22266 [0xA875]={d='on'},
22267 [0xA876]={d='on'},
22268 [0xA877]={d='on'},
22269 [0xA8C4]={d='nsm'},
22270 [0xA8C5]={d='nsm'},
22271 [0xA8E0]={d='nsm'},
22272 [0xA8E1]={d='nsm'},
22273 [0xA8E2]={d='nsm'},
22274 [0xA8E3]={d='nsm'},
22275 [0xA8E4]={d='nsm'},
22276 [0xA8E5]={d='nsm'},
22277 [0xA8E6]={d='nsm'},
22278 [0xA8E7]={d='nsm'},
22279 [0xA8E8]={d='nsm'},
22280 [0xA8E9]={d='nsm'},
22281 [0xA8EA]={d='nsm'},
22282 [0xA8EB]={d='nsm'},
22283 [0xA8EC]={d='nsm'},
22284 [0xA8ED]={d='nsm'},
22285 [0xA8EE]={d='nsm'},
22286 [0xA8EF]={d='nsm'},
22287 [0xA8F0]={d='nsm'},
22288 [0xA8F1]={d='nsm'},
22289 [0xA926]={d='nsm'},
22290 [0xA927]={d='nsm'},
22291 [0xA928]={d='nsm'},
22292 [0xA929]={d='nsm'},
22293 [0xA92A]={d='nsm'},
22294 [0xA92B]={d='nsm'},
22295 [0xA92C]={d='nsm'},
22296 [0xA92D]={d='nsm'},
22297 [0xA947]={d='nsm'},
22298 [0xA948]={d='nsm'},
22299 [0xA949]={d='nsm'},
22300 [0xA94A]={d='nsm'},
22301 [0xA94B]={d='nsm'},
22302 [0xA94C]={d='nsm'},
22303 [0xA94D]={d='nsm'},
22304 [0xA94E]={d='nsm'},
22305 [0xA94F]={d='nsm'},
22306 [0xA950]={d='nsm'},
22307 [0xA951]={d='nsm'},
22308 [0xA980]={d='nsm'},
22309 [0xA981]={d='nsm'},
22310 [0xA982]={d='nsm'},
22311 [0xA9B3]={d='nsm'},
22312 [0xA9B6]={d='nsm'},
22313 [0xA9B7]={d='nsm'},
22314 [0xA9B8]={d='nsm'},
22315 [0xA9B9]={d='nsm'},
22316 [0xA9BC]={d='nsm'},
22317 [0xA9E5]={d='nsm'},
22318 [0xAA29]={d='nsm'},
22319 [0xAA2A]={d='nsm'},
22320 [0xAA2B]={d='nsm'},
22321 [0xAA2C]={d='nsm'},
22322 [0xAA2D]={d='nsm'},
22323 [0xAA2E]={d='nsm'},
22324 [0xAA31]={d='nsm'},
22325 [0xAA32]={d='nsm'},
22326 [0xAA35]={d='nsm'},
22327 [0xAA36]={d='nsm'},
22328 [0xAA43]={d='nsm'},
22329 [0xAA4C]={d='nsm'},
22330 [0xAA7C]={d='nsm'},
22331 [0xAAB0]={d='nsm'},
22332 [0xAAB2]={d='nsm'},
22333 [0xAAB3]={d='nsm'},
22334 [0xAAB4]={d='nsm'},
22335 [0xAAB7]={d='nsm'},
22336 [0xAAB8]={d='nsm'},
22337 [0xAABE]={d='nsm'},
22338 [0xAABF]={d='nsm'},
22339 [0xAAC1]={d='nsm'},
22340 [0xAAEC]={d='nsm'},
22341 [0xAAED]={d='nsm'},
22342 [0xAAF6]={d='nsm'},
22343 [0xABE5]={d='nsm'},
22344 [0xABE8]={d='nsm'},
22345 [0xABED]={d='nsm'},
22346 [0xFB1E]={d='nsm'},
22347 [0xFB29]={d='es'},
22348 [0xFD3E]={d='on'},
22349 [0xFD3F]={d='on'},
22350 [0xFDFD]={d='on'},
22351 [0xFE10]={d='on'},
22352 [0xFE11]={d='on'},
22353 [0xFE12]={d='on'},
22354 [0xFE13]={d='on'},
22355 [0xFE14]={d='on'},
22356 [0xFE15]={d='on'},
22357 [0xFE16]={d='on'},
22358 [0xFE17]={d='on'},
22359 [0xFE18]={d='on'},
22360 [0xFE19]={d='on'},
22361 [0xFE20]={d='nsm'},
22362 [0xFE21]={d='nsm'},
22363 [0xFE22]={d='nsm'},
22364 [0xFE23]={d='nsm'},
22365 [0xFE24]={d='nsm'},
22366 [0xFE25]={d='nsm'},
22367 [0xFE26]={d='nsm'},
22368 [0xFE27]={d='nsm'},
22369 [0xFE28]={d='nsm'},
22370 [0xFE29]={d='nsm'},
22371 [0xFE2A]={d='nsm'},
22372 [0xFE2B]={d='nsm'},
22373 [0xFE2C]={d='nsm'},
22374 [0xFE2D]={d='nsm'},
22375 [0xFE2E]={d='nsm'},
22376 [0xFE2F]={d='nsm'},
22377 [0xFE30]={d='on'},
22378 [0xFE31]={d='on'},
22379 [0xFE32]={d='on'},
22380 [0xFE33]={d='on'},
22381 [0xFE34]={d='on'},
22382 [0xFE35]={d='on'},
22383 [0xFE36]={d='on'},
22384 [0xFE37]={d='on'},
22385 [0xFE38]={d='on'},
22386 [0xFE39]={d='on'},
22387 [0xFE3A]={d='on'},
22388 [0xFE3B]={d='on'},
22389 [0xFE3C]={d='on'},
22390 [0xFE3D]={d='on'},
22391 [0xFE3E]={d='on'},
22392 [0xFE3F]={d='on'},
22393 [0xFE40]={d='on'},
22394 [0xFE41]={d='on'},
22395 [0xFE42]={d='on'},
22396 [0xFE43]={d='on'},
22397 [0xFE44]={d='on'},
22398 [0xFE45]={d='on'},
22399 [0xFE46]={d='on'},
22400 [0xFE47]={d='on'},
22401 [0xFE48]={d='on'},
22402 [0xFE49]={d='on'},
22403 [0xFE4A]={d='on'},
22404 [0xFE4B]={d='on'},
22405 [0xFE4C]={d='on'},
22406 [0xFE4D]={d='on'},
22407 [0xFE4E]={d='on'},
22408 [0xFE4F]={d='on'},
22409 [0xFE50]={d='cs'},
22410 [0xFE51]={d='on'},
22411 [0xFE52]={d='cs'},
22412 [0xFE54]={d='on'},
22413 [0xFE55]={d='cs'},
22414 [0xFE56]={d='on'},
22415 [0xFE57]={d='on'},
22416 [0xFE58]={d='on'},
22417 [0xFE59]={d='on', m=0xFE5A},
22418 [0xFE5A]={d='on', m=0xFE59},
22419 [0xFE5B]={d='on', m=0xFE5C},
22420 [0xFE5C]={d='on', m=0xFE5B},
22421 [0xFE5D]={d='on', m=0xFE5E},
22422 [0xFE5E]={d='on', m=0xFE5D},
22423 [0xFE5F]={d='et'},
22424 [0xFE60]={d='on'},
22425 [0xFE61]={d='on'},
22426 [0xFE62]={d='es'},
22427 [0xFE63]={d='es'},
22428 [0xFE64]={d='on', m=0xFE65},
22429 [0xFE65]={d='on', m=0xFE64},
22430 [0xFE66]={d='on'},
22431 [0xFE68]={d='on'},
22432 [0xFE69]={d='et'},
22433 [0xFE6A]={d='et'},
22434 [0xFE6B]={d='on'},
22435 [0xFEFF]={d='bn'},
22436 [0xFF01]={d='on'},
22437 [0xFF02]={d='on'},
22438 [0xFF03]={d='et'},
22439 [0xFF04]={d='et'},
22440 [0xFF05]={d='et'},
22441 [0xFF06]={d='on'},
22442 [0xFF07]={d='on'},
22443 [0xFF08]={d='on', m=0xFF09},
22444 [0xFF09]={d='on', m=0xFF08},
22445 [0xFF0A]={d='on'},
22446 [0xFF0B]={d='es'},
22447 [0xFF0C]={d='cs'},
22448 [0xFF0D]={d='es'},
22449 [0xFF0E]={d='cs'},
22450 [0xFF0F]={d='cs'},
22451 [0xFF10]={d='en'},
22452 [0xFF11]={d='en'},
22453 [0xFF12]={d='en'},
22454 [0xFF13]={d='en'},
22455 [0xFF14]={d='en'},
22456 [0xFF15]={d='en'},
22457 [0xFF16]={d='en'},
22458 [0xFF17]={d='en'},
22459 [0xFF18]={d='en'},
22460 [0xFF19]={d='en'},
22461 [0xFF1A]={d='cs'},
22462 [0xFF1B]={d='on'},
22463 [0xFF1C]={d='on', m=0xFF1E},
22464 [0xFF1D]={d='on'},
22465 [0xFF1E]={d='on', m=0xFF1C},
22466 [0xFF1F]={d='on'},
22467 [0xFF20]={d='on'},
22468 [0xFF3B]={d='on', m=0xFF3D},
22469 [0xFF3C]={d='on'},
22470 [0xFF3D]={d='on', m=0xFF3B},
22471 [0xFF3E]={d='on'},
22472 [0xFF3F]={d='on'},
22473 [0xFF40]={d='on'},
22474 [0xFF5B]={d='on', m=0xFF5D},
22475 [0xFF5C]={d='on'},
22476 [0xFF5D]={d='on', m=0xFF5B},
22477 [0xFF5E]={d='on'},
22478 [0xFF5F]={d='on', m=0xFF60},
22479 [0xFF60]={d='on', m=0xFF5F},
22480 [0xFF61]={d='on'},
22481 [0xFF62]={d='on', m=0xFF63},
22482 [0xFF63]={d='on', m=0xFF62},
22483 [0xFF64]={d='on'},
22484 [0xFF65]={d='on'},
22485 [0xFFE0]={d='et'},
22486 [0xFFE1]={d='et'},
22487 [0xFFE2]={d='on'},
22488 [0xFFE3]={d='on'},
22489 [0xFFE4]={d='on'},
22490 [0xFFE5]={d='et'},
22491 [0xFFE6]={d='et'},
22492 [0xFFE8]={d='on'},
22493 [0xFFE9]={d='on'},
22494 [0xFFEA]={d='on'},
22495 [0xFFEB]={d='on'},
22496 [0xFFEC]={d='on'},
22497 [0xFFED]={d='on'},
22498 [0xFFEE]={d='on'},
22499 [0xFFF9]={d='on'},
22500 [0xFFFA]={d='on'},
22501 [0xFFFB]={d='on'},
22502 [0xFFFC]={d='on'},
22503 [0xFFFD]={d='on'},
22504 [0x10101]={d='on'},
22505 [0x10140]={d='on'},
22506 [0x10141]={d='on'},
22507 [0x10142]={d='on'},
22508 [0x10143]={d='on'},
22509 [0x10144]={d='on'},
22510 [0x10145]={d='on'},
22511 [0x10146]={d='on'},
22512 [0x10147]={d='on'},
22513 [0x10148]={d='on'},
22514 [0x10149]={d='on'},
22515 [0x1014A]={d='on'},
22516 [0x1014B]={d='on'},
22517 [0x1014C]={d='on'},
22518 [0x1014D]={d='on'},
22519 [0x1014E]={d='on'},
22520 [0x1014F]={d='on'},
22521 [0x10150]={d='on'},
22522 [0x10151]={d='on'},
22523 [0x10152]={d='on'},
22524 [0x10153]={d='on'},
22525 [0x10154]={d='on'},
22526 [0x10155]={d='on'},
22527 [0x10156]={d='on'},
22528 [0x10157]={d='on'},
22529 [0x10158]={d='on'},
22530 [0x10159]={d='on'},
22531 [0x1015A]={d='on'},
22532 [0x1015B]={d='on'},
22533 [0x1015C]={d='on'},
22534 [0x1015D]={d='on'},
22535 [0x1015E]={d='on'},
22536 [0x1015F]={d='on'},
22537 [0x10160]={d='on'},
22538 [0x10161]={d='on'},
22539 [0x10162]={d='on'},
22540 [0x10163]={d='on'},
22541 [0x10164]={d='on'},
22542 [0x10165]={d='on'},
22543 [0x10166]={d='on'},
22544 [0x10167]={d='on'},
22545 [0x10168]={d='on'},
22546 [0x10169]={d='on'},
22547 [0x1016A]={d='on'},
22548 [0x1016B]={d='on'},
22549 [0x1016C]={d='on'},
22550 [0x1016D]={d='on'},
22551 [0x1016E]={d='on'},
22552 [0x1016F]={d='on'},
22553 [0x10170]={d='on'},
22554 [0x10171]={d='on'},
22555 [0x10172]={d='on'},
22556 [0x10173]={d='on'},
22557 [0x10174]={d='on'},
22558 [0x10175]={d='on'},
22559 [0x10176]={d='on'},
22560 [0x10177]={d='on'},
22561 [0x10178]={d='on'},
22562 [0x10179]={d='on'},
22563 [0x1017A]={d='on'},
22564 [0x1017B]={d='on'},
22565 [0x1017C]={d='on'},
22566 [0x1017D]={d='on'},
22567 [0x1017E]={d='on'},
22568 [0x1017F]={d='on'},
22569 [0x10180]={d='on'},
22570 [0x10181]={d='on'},
22571 [0x10182]={d='on'},
22572 [0x10183]={d='on'},
22573 [0x10184]={d='on'},
22574 [0x10185]={d='on'},
22575 [0x10186]={d='on'},
22576 [0x10187]={d='on'},
22577 [0x10188]={d='on'},
22578 [0x10189]={d='on'},
22579 [0x1018A]={d='on'},
22580 [0x1018B]={d='on'},
22581 [0x1018C]={d='on'},
22582 [0x10190]={d='on'},
22583 [0x10191]={d='on'},
22584 [0x10192]={d='on'},
22585 [0x10193]={d='on'},
22586 [0x10194]={d='on'},
22587 [0x10195]={d='on'},
22588 [0x10196]={d='on'},
22589 [0x10197]={d='on'},
22590 [0x10198]={d='on'},
22591 [0x10199]={d='on'},
22592 [0x1019A]={d='on'},
22593 [0x1019B]={d='on'},
22594 [0x101A0]={d='on'},
22595 [0x101FD]={d='nsm'},
22596 [0x102E0]={d='nsm'},
22597 [0x102E1]={d='en'},
22598 [0x102E2]={d='en'},
22599 [0x102E3]={d='en'},
22600 [0x102E4]={d='en'},
22601 [0x102E5]={d='en'},
22602 [0x102E6]={d='en'},
22603 [0x102E7]={d='en'},
22604 [0x102E8]={d='en'},
22605 [0x102E9]={d='en'},
22606 [0x102EA]={d='en'},
22607 [0x102EB]={d='en'},
22608 [0x102EC]={d='en'},
22609 [0x102ED]={d='en'},
22610 [0x102EE]={d='en'},
22611 [0x102EF]={d='en'},
22612 [0x102F0]={d='en'},
22613 [0x102F1]={d='en'},
22614 [0x102F2]={d='en'},
22615 [0x102F3]={d='en'},
22616 [0x102F4]={d='en'},
22617 [0x102F5]={d='en'},
22618 [0x102F6]={d='en'},
22619 [0x102F7]={d='en'},
22620 [0x102F8]={d='en'},
22621 [0x102F9]={d='en'},
22622 [0x102FA]={d='en'},
22623 [0x102FB]={d='en'},
22624 [0x10376]={d='nsm'},
22625 [0x10377]={d='nsm'},
22626 [0x10378]={d='nsm'},
22627 [0x10379]={d='nsm'},
22628 [0x1037A]={d='nsm'},
22629 [0x1091F]={d='on'},
22630 [0x10A01]={d='nsm'},
22631 [0x10A02]={d='nsm'},
22632 [0x10A03]={d='nsm'},
22633 [0x10A05]={d='nsm'},
22634 [0x10A06]={d='nsm'},
22635 [0x10A0C]={d='nsm'},
22636 [0x10A0D]={d='nsm'},
22637 [0x10A0E]={d='nsm'},
22638 [0x10A0F]={d='nsm'},
22639 [0x10A38]={d='nsm'},
22640 [0x10A39]={d='nsm'},
22641 [0x10A3A]={d='nsm'},
22642 [0x10A3F]={d='nsm'},
22643 [0x10AE5]={d='nsm'},
22644 [0x10AE6]={d='nsm'},
22645 [0x10B39]={d='on'},
22646 [0x10B3A]={d='on'},
22647 [0x10B3B]={d='on'},
22648 [0x10B3C]={d='on'},
22649 [0x10B3D]={d='on'},
22650 [0x10B3E]={d='on'},
22651 [0x10B3F]={d='on'},
22652 [0x10E60]={d='an'},
22653 [0x10E61]={d='an'},
22654 [0x10E62]={d='an'},
22655 [0x10E63]={d='an'},
22656 [0x10E64]={d='an'},
22657 [0x10E65]={d='an'},
22658 [0x10E66]={d='an'},
22659 [0x10E67]={d='an'},
22660 [0x10E68]={d='an'},
22661 [0x10E69]={d='an'},
22662 [0x10E6A]={d='an'},
22663 [0x10E6B]={d='an'},
22664 [0x10E6C]={d='an'},
22665 [0x10E6D]={d='an'},
22666 [0x10E6E]={d='an'},
22667 [0x10E6F]={d='an'},
22668 [0x10E70]={d='an'},
22669 [0x10E71]={d='an'},
22670 [0x10E72]={d='an'},
22671 [0x10E73]={d='an'},
22672 [0x10E74]={d='an'},
22673 [0x10E75]={d='an'},
22674 [0x10E76]={d='an'},
22675 [0x10E77]={d='an'},
22676 [0x10E78]={d='an'},
22677 [0x10E79]={d='an'},
22678 [0x10E7A]={d='an'},
22679 [0x10E7B]={d='an'},
22680 [0x10E7C]={d='an'},
22681 [0x10E7D]={d='an'},
22682 [0x10E7E]={d='an'},
22683 [0x11001]={d='nsm'},
22684 [0x11038]={d='nsm'},
22685 [0x11039]={d='nsm'},
22686 [0x1103A]={d='nsm'},
22687 [0x1103B]={d='nsm'},
22688 [0x1103C]={d='nsm'},
22689 [0x1103D]={d='nsm'},
22690 [0x1103E]={d='nsm'},
22691 [0x1103F]={d='nsm'},
22692 [0x11040]={d='nsm'},
22693 [0x11041]={d='nsm'},
22694 [0x11042]={d='nsm'},
22695 [0x11043]={d='nsm'},
22696 [0x11044]={d='nsm'},
22697 [0x11045]={d='nsm'},
22698 [0x11046]={d='nsm'},
22699 [0x11052]={d='on'},
22700 [0x11053]={d='on'},
22701 [0x11054]={d='on'},
22702 [0x11055]={d='on'},
22703 [0x11056]={d='on'},
22704 [0x11057]={d='on'},
22705 [0x11058]={d='on'},
22706 [0x11059]={d='on'},
22707 [0x1105A]={d='on'},
22708 [0x1105B]={d='on'},
22709 [0x1105C]={d='on'},
22710 [0x1105D]={d='on'},
22711 [0x1105E]={d='on'},
22712 [0x1105F]={d='on'},
22713 [0x11060]={d='on'},
22714 [0x11061]={d='on'},
22715 [0x11062]={d='on'},
22716 [0x11063]={d='on'},
22717 [0x11064]={d='on'},
22718 [0x11065]={d='on'},
22719 [0x1107F]={d='nsm'},
22720 [0x11080]={d='nsm'},
22721 [0x11081]={d='nsm'},
22722 [0x110B3]={d='nsm'},
22723 [0x110B4]={d='nsm'},
22724 [0x110B5]={d='nsm'},
22725 [0x110B6]={d='nsm'},
22726 [0x110B9]={d='nsm'},
22727 [0x110BA]={d='nsm'},
22728 [0x11100]={d='nsm'},
22729 [0x11101]={d='nsm'},
22730 [0x11102]={d='nsm'},
22731 [0x11127]={d='nsm'},
22732 [0x11128]={d='nsm'},
22733 [0x11129]={d='nsm'},
22734 [0x1112A]={d='nsm'},
22735 [0x1112B]={d='nsm'},
22736 [0x1112D]={d='nsm'},
22737 [0x1112E]={d='nsm'},
22738 [0x1112F]={d='nsm'},
22739 [0x11130]={d='nsm'},
22740 [0x11131]={d='nsm'},
22741 [0x11132]={d='nsm'},
22742 [0x11133]={d='nsm'},
22743 [0x11134]={d='nsm'},
22744 [0x11173]={d='nsm'},
22745 [0x11180]={d='nsm'},
22746 [0x11181]={d='nsm'},
22747 [0x111B6]={d='nsm'},
22748 [0x111B7]={d='nsm'},
22749 [0x111B8]={d='nsm'},
22750 [0x111B9]={d='nsm'},
22751 [0x111BA]={d='nsm'},
22752 [0x111BB]={d='nsm'},
22753 [0x111BC]={d='nsm'},
22754 [0x111BD]={d='nsm'},
22755 [0x111BE]={d='nsm'},
22756 [0x111CA]={d='nsm'},
22757 [0x111CB]={d='nsm'},
22758 [0x111CC]={d='nsm'},
22759 [0x1122F]={d='nsm'},
22760 [0x11230]={d='nsm'},
22761 [0x11231]={d='nsm'},
22762 [0x11234]={d='nsm'},
22763 [0x11236]={d='nsm'},
22764 [0x11237]={d='nsm'},
22765 [0x1123E]={d='nsm'},
22766 [0x112DF]={d='nsm'},
22767 [0x112E3]={d='nsm'},
22768 [0x112E4]={d='nsm'},
22769 [0x112E5]={d='nsm'},
22770 [0x112E6]={d='nsm'},
22771 [0x112E7]={d='nsm'},
22772 [0x112E8]={d='nsm'},
22773 [0x112E9]={d='nsm'},
22774 [0x112EA]={d='nsm'},
22775 [0x11300]={d='nsm'},
22776 [0x11301]={d='nsm'},
22777 [0x1133C]={d='nsm'},
22778 [0x11340]={d='nsm'},
22779 [0x11366]={d='nsm'},
22780 [0x11367]={d='nsm'},
22781 [0x11368]={d='nsm'},
22782 [0x11369]={d='nsm'},
22783 [0x1136A]={d='nsm'},
22784 [0x1136B]={d='nsm'},
22785 [0x1136C]={d='nsm'},
22786 [0x11370]={d='nsm'},
22787 [0x11371]={d='nsm'},
22788 [0x11372]={d='nsm'},
22789 [0x11373]={d='nsm'},
22790 [0x11374]={d='nsm'},
22791 [0x11438]={d='nsm'},
22792 [0x11439]={d='nsm'},
22793 [0x1143A]={d='nsm'},
22794 [0x1143B]={d='nsm'},
22795 [0x1143C]={d='nsm'},
22796 [0x1143D]={d='nsm'},
22797 [0x1143E]={d='nsm'},
22798 [0x1143F]={d='nsm'},
22799 [0x11442]={d='nsm'},
22800 [0x11443]={d='nsm'},
22801 [0x11444]={d='nsm'},
22802 [0x11446]={d='nsm'},
22803 [0x114B3]={d='nsm'},
22804 [0x114B4]={d='nsm'},
22805 [0x114B5]={d='nsm'},
22806 [0x114B6]={d='nsm'},
22807 [0x114B7]={d='nsm'},
22808 [0x114B8]={d='nsm'},
22809 [0x114BA]={d='nsm'},
22810 [0x114BF]={d='nsm'},
22811 [0x114C0]={d='nsm'},
22812 [0x114C2]={d='nsm'},
22813 [0x114C3]={d='nsm'},
22814 [0x115B2]={d='nsm'},
22815 [0x115B3]={d='nsm'},
22816 [0x115B4]={d='nsm'},
22817 [0x115B5]={d='nsm'},
22818 [0x115BC]={d='nsm'},
22819 [0x115BD]={d='nsm'},
22820 [0x115BF]={d='nsm'},
22821 [0x115C0]={d='nsm'},
22822 [0x115DC]={d='nsm'},
22823 [0x115DD]={d='nsm'},
22824 [0x11633]={d='nsm'},
22825 [0x11634]={d='nsm'},
22826 [0x11635]={d='nsm'},
22827 [0x11636]={d='nsm'},
22828 [0x11637]={d='nsm'},
22829 [0x11638]={d='nsm'},
22830 [0x11639]={d='nsm'},
22831 [0x1163A]={d='nsm'},
22832 [0x1163D]={d='nsm'},
22833 [0x1163F]={d='nsm'},
22834 [0x11640]={d='nsm'},
22835 [0x11660]={d='on'},
22836 [0x11661]={d='on'},
22837 [0x11662]={d='on'},
22838 [0x11663]={d='on'},
22839 [0x11664]={d='on'},
22840 [0x11665]={d='on'},
22841 [0x11666]={d='on'},
22842 [0x11667]={d='on'},
22843 [0x11668]={d='on'},
22844 [0x11669]={d='on'},
22845 [0x1166A]={d='on'},
22846 [0x1166B]={d='on'},
22847 [0x1166C]={d='on'},
22848 [0x116AB]={d='nsm'},
22849 [0x116AD]={d='nsm'},
22850 [0x116B0]={d='nsm'},
22851 [0x116B1]={d='nsm'},
22852 [0x116B2]={d='nsm'},
22853 [0x116B3]={d='nsm'},
22854 [0x116B4]={d='nsm'},
22855 [0x116B5]={d='nsm'},
22856 [0x116B7]={d='nsm'},
22857 [0x1171D]={d='nsm'},
22858 [0x1171E]={d='nsm'},
22859 [0x1171F]={d='nsm'},
22860 [0x11722]={d='nsm'},
22861 [0x11723]={d='nsm'},
22862 [0x11724]={d='nsm'},
22863 [0x11725]={d='nsm'},
22864 [0x11727]={d='nsm'},
22865 [0x11728]={d='nsm'},
22866 [0x11729]={d='nsm'},
22867 [0x1172A]={d='nsm'},
22868 [0x1172B]={d='nsm'},
22869 [0x11C30]={d='nsm'},
22870 [0x11C31]={d='nsm'},
22871 [0x11C32]={d='nsm'},
22872 [0x11C33]={d='nsm'},
22873 [0x11C34]={d='nsm'},
22874 [0x11C35]={d='nsm'},
22875 [0x11C36]={d='nsm'},
22876 [0x11C38]={d='nsm'},
22877 [0x11C39]={d='nsm'},
22878 [0x11C3A]={d='nsm'},
22879 [0x11C3B]={d='nsm'},
22880 [0x11C3C]={d='nsm'},
22881 [0x11C3D]={d='nsm'},
22882 [0x11C92]={d='nsm'},
22883 [0x11C93]={d='nsm'},
22884 [0x11C94]={d='nsm'},
22885 [0x11C95]={d='nsm'},
22886 [0x11C96]={d='nsm'},
22887 [0x11C97]={d='nsm'},
22888 [0x11C98]={d='nsm'},
22889 [0x11C99]={d='nsm'},
22890 [0x11C9A]={d='nsm'},
22891 [0x11C9B]={d='nsm'},
22892 [0x11C9C]={d='nsm'},
22893 [0x11C9D]={d='nsm'},
22894 [0x11C9E]={d='nsm'},
22895 [0x11C9F]={d='nsm'},
22896 [0x11CA0]={d='nsm'},
22897 [0x11CA1]={d='nsm'},
22898 [0x11CA2]={d='nsm'},
22899 [0x11CA3]={d='nsm'},
22900 [0x11CA4]={d='nsm'},
22901 [0x11CA5]={d='nsm'},
22902 [0x11CA6]={d='nsm'},
22903 [0x11CA7]={d='nsm'},
22904 [0x11CAA]={d='nsm'},
22905 [0x11CAB]={d='nsm'},
22906 [0x11CAC]={d='nsm'},
22907 [0x11CAD]={d='nsm'},
22908 [0x11CAE]={d='nsm'},
22909 [0x11CAF]={d='nsm'},
22910 [0x11CB0]={d='nsm'},
22911 [0x11CB2]={d='nsm'},
22912 [0x11CB3]={d='nsm'},
22913 [0x11CB5]={d='nsm'},
22914 [0x11CB6]={d='nsm'},
22915 [0x16AF0]={d='nsm'},
22916 [0x16AF1]={d='nsm'},
22917 [0x16AF2]={d='nsm'},
22918 [0x16AF3]={d='nsm'},
22919 [0x16AF4]={d='nsm'},
22920 [0x16B30]={d='nsm'},
22921 [0x16B31]={d='nsm'},
22922 [0x16B32]={d='nsm'},
22923 [0x16B33]={d='nsm'},
22924 [0x16B34]={d='nsm'},
22925 [0x16B35]={d='nsm'},
22926 [0x16B36]={d='nsm'},
22927 [0x16F8F]={d='nsm'},
22928 [0x16F90]={d='nsm'},
22929 [0x16F91]={d='nsm'},
22930 [0x16F92]={d='nsm'},
22931 [0x1BC9D]={d='nsm'},
22932 [0x1BC9E]={d='nsm'},
22933 [0x1BCA0]={d='bn'},
22934 [0x1BCA1]={d='bn'},
22935 [0x1BCA2]={d='bn'},
22936 [0x1BCA3]={d='bn'},
22937 [0x1D167]={d='nsm'},
22938 [0x1D168]={d='nsm'},
22939 [0x1D169]={d='nsm'},
22940 [0x1D173]={d='bn'},
22941 [0x1D174]={d='bn'},
22942 [0x1D175]={d='bn'},
22943 [0x1D176]={d='bn'},
22944 [0x1D177]={d='bn'},
22945 [0x1D178]={d='bn'},
22946 [0x1D179]={d='bn'},
22947 [0x1D17A]={d='bn'},
22948 [0x1D17B]={d='nsm'},
22949 [0x1D17C]={d='nsm'},
22950 [0x1D17D]={d='nsm'},
22951 [0x1D17E]={d='nsm'},
22952 [0x1D17F]={d='nsm'},
22953 [0x1D180]={d='nsm'},
22954 [0x1D181]={d='nsm'},
22955 [0x1D182]={d='nsm'},
22956 [0x1D185]={d='nsm'},
22957 [0x1D186]={d='nsm'},
22958 [0x1D187]={d='nsm'},
22959 [0x1D188]={d='nsm'},
22960 [0x1D189]={d='nsm'},
22961 [0x1D18A]={d='nsm'},
22962 [0x1D18B]={d='nsm'},
22963 [0x1D1AA]={d='nsm'},
22964 [0x1D1AB]={d='nsm'},
22965 [0x1D1AC]={d='nsm'},
22966 [0x1D1AD]={d='nsm'},
22967 [0x1D200]={d='on'},
22968 [0x1D201]={d='on'},
22969 [0x1D202]={d='on'},
22970 [0x1D203]={d='on'},
22971 [0x1D204]={d='on'},
22972 [0x1D205]={d='on'},
22973 [0x1D206]={d='on'},
22974 [0x1D207]={d='on'},
22975 [0x1D208]={d='on'},
22976 [0x1D209]={d='on'},
22977 [0x1D20A]={d='on'},
22978 [0x1D20B]={d='on'},
22979 [0x1D20C]={d='on'},
22980 [0x1D20D]={d='on'},
22981 [0x1D20E]={d='on'},
22982 [0x1D20F]={d='on'},
22983 [0x1D210]={d='on'},
22984 [0x1D211]={d='on'},
22985 [0x1D212]={d='on'},
22986 [0x1D213]={d='on'},
22987 [0x1D214]={d='on'},
22988 [0x1D215]={d='on'},
22989 [0x1D216]={d='on'},
22990 [0x1D217]={d='on'},
22991 [0x1D218]={d='on'},
22992 [0x1D219]={d='on'},
22993 [0x1D21A]={d='on'},
22994 [0x1D21B]={d='on'},
22995 [0x1D21C]={d='on'},
22996 [0x1D21D]={d='on'},
22997 [0x1D21E]={d='on'},
22998 [0x1D21F]={d='on'},
22999 [0x1D220]={d='on'},
23000 [0x1D221]={d='on'},
23001 [0x1D222]={d='on'},
23002 [0x1D223]={d='on'},
23003 [0x1D224]={d='on'},
23004 [0x1D225]={d='on'},
23005 [0x1D226]={d='on'},
23006 [0x1D227]={d='on'},
23007 [0x1D228]={d='on'},
23008 [0x1D229]={d='on'},
23009 [0x1D22A]={d='on'},
23010 [0x1D22B]={d='on'},
23011 [0x1D22C]={d='on'},
23012 [0x1D22D]={d='on'},
23013 [0x1D22E]={d='on'},
23014 [0x1D22F]={d='on'},
23015 [0x1D230]={d='on'},
23016 [0x1D231]={d='on'},
23017 [0x1D232]={d='on'},
23018 [0x1D233]={d='on'},
23019 [0x1D234]={d='on'},
23020 [0x1D235]={d='on'},
23021 [0x1D236]={d='on'},
23022 [0x1D237]={d='on'},
23023 [0x1D238]={d='on'},
23024 [0x1D239]={d='on'},
23025 [0x1D23A]={d='on'},
23026 [0x1D23B]={d='on'},
23027 [0x1D23C]={d='on'},
23028 [0x1D23D]={d='on'},
23029 [0x1D23E]={d='on'},
23030 [0x1D23F]={d='on'},
23031 [0x1D240]={d='on'},
23032 [0x1D241]={d='on'},
23033 [0x1D242]={d='nsm'},
23034 [0x1D243]={d='nsm'},
23035 [0x1D244]={d='nsm'},
23036 [0x1D245]={d='on'},
23037 [0x1D300]={d='on'},
23038 [0x1D301]={d='on'},
23039 [0x1D302]={d='on'},
23040 [0x1D303]={d='on'},
23041 [0x1D304]={d='on'},
23042 [0x1D305]={d='on'},
23043 [0x1D306]={d='on'},
23044 [0x1D307]={d='on'},
23045 [0x1D308]={d='on'},
23046 [0x1D309]={d='on'},
23047 [0x1D30A]={d='on'},
23048 [0x1D30B]={d='on'},
23049 [0x1D30C]={d='on'},
23050 [0x1D30D]={d='on'},
23051 [0x1D30E]={d='on'},
23052 [0x1D30F]={d='on'},
23053 [0x1D310]={d='on'},
23054 [0x1D311]={d='on'},
23055 [0x1D312]={d='on'},
23056 [0x1D313]={d='on'},
23057 [0x1D314]={d='on'},
23058 [0x1D315]={d='on'},
23059 [0x1D316]={d='on'},
23060 [0x1D317]={d='on'},
23061 [0x1D318]={d='on'},
23062 [0x1D319]={d='on'},
23063 [0x1D31A]={d='on'},
23064 [0x1D31B]={d='on'},
23065 [0x1D31C]={d='on'},
23066 [0x1D31D]={d='on'},
23067 [0x1D31E]={d='on'},
23068 [0x1D31F]={d='on'},
23069 [0x1D320]={d='on'},
23070 [0x1D321]={d='on'},
23071 [0x1D322]={d='on'},
23072 [0x1D323]={d='on'},
23073 [0x1D324]={d='on'},
23074 [0x1D325]={d='on'},
23075 [0x1D326]={d='on'},
23076 [0x1D327]={d='on'},
23077 [0x1D328]={d='on'},
23078 [0x1D329]={d='on'},
23079 [0x1D32A]={d='on'},
23080 [0x1D32B]={d='on'},
23081 [0x1D32C]={d='on'},
23082 [0x1D32D]={d='on'},
23083 [0x1D32E]={d='on'},
23084 [0x1D32F]={d='on'},
23085 [0x1D330]={d='on'},
23086 [0x1D331]={d='on'},
23087 [0x1D332]={d='on'},
23088 [0x1D333]={d='on'},
23089 [0x1D334]={d='on'},
23090 [0x1D335]={d='on'},
23091 [0x1D336]={d='on'},
23092 [0x1D337]={d='on'},
23093 [0x1D338]={d='on'},
23094 [0x1D339]={d='on'},
23095 [0x1D33A]={d='on'},
23096 [0x1D33B]={d='on'},
23097 [0x1D33C]={d='on'},
23098 [0x1D33D]={d='on'},
23099 [0x1D33E]={d='on'},
23100 [0x1D33F]={d='on'},
23101 [0x1D340]={d='on'},
23102 [0x1D341]={d='on'},
23103 [0x1D342]={d='on'},
23104 [0x1D343]={d='on'},
23105 [0x1D344]={d='on'},
23106 [0x1D345]={d='on'},
23107 [0x1D346]={d='on'},
23108 [0x1D347]={d='on'},
23109 [0x1D348]={d='on'},
23110 [0x1D349]={d='on'},
23111 [0x1D34A]={d='on'},
23112 [0x1D34B]={d='on'},
23113 [0x1D34C]={d='on'},
23114 [0x1D34D]={d='on'},
23115 [0x1D34E]={d='on'},
23116 [0x1D34F]={d='on'},
23117 [0x1D350]={d='on'},
23118 [0x1D351]={d='on'},
23119 [0x1D352]={d='on'},
23120 [0x1D353]={d='on'},
23121 [0x1D354]={d='on'},
23122 [0x1D355]={d='on'},
23123 [0x1D356]={d='on'},
23124 [0x1D6DB]={d='on'},
23125 [0x1D715]={d='on'},
23126 [0x1D74F]={d='on'},
23127 [0x1D789]={d='on'},
23128 [0x1D7C3]={d='on'},
23129 [0x1D7CE]={d='en'},
23130 [0x1D7CF]={d='en'},
23131 [0x1D7D0]={d='en'},
23132 [0x1D7D1]={d='en'},
23133 [0x1D7D2]={d='en'},
23134 [0x1D7D3]={d='en'},
23135 [0x1D7D4]={d='en'},
23136 [0x1D7D5]={d='en'},
23137 [0x1D7D6]={d='en'},
23138 [0x1D7D7]={d='en'},
23139 [0x1D7D8]={d='en'},
23140 [0x1D7D9]={d='en'},
23141 [0x1D7DA]={d='en'},
23142 [0x1D7DB]={d='en'},
23143 [0x1D7DC]={d='en'},
23144 [0x1D7DD]={d='en'},
23145 [0x1D7DE]={d='en'},
23146 [0x1D7DF]={d='en'},
23147 [0x1D7E0]={d='en'},
23148 [0x1D7E1]={d='en'},
23149 [0x1D7E2]={d='en'},
23150 [0x1D7E3]={d='en'},
23151 [0x1D7E4]={d='en'},
23152 [0x1D7E5]={d='en'},
23153 [0x1D7E6]={d='en'},
23154 [0x1D7E7]={d='en'},
23155 [0x1D7E8]={d='en'},
23156 [0x1D7E9]={d='en'},
23157 [0x1D7EA]={d='en'},
23158 [0x1D7EB]={d='en'},
23159 [0x1D7EC]={d='en'},
23160 [0x1D7ED]={d='en'},
23161 [0x1D7EE]={d='en'},
23162 [0x1D7EF]={d='en'},
23163 [0x1D7F0]={d='en'},
23164 [0x1D7F1]={d='en'},
23165 [0x1D7F2]={d='en'},
23166 [0x1D7F3]={d='en'},
23167 [0x1D7F4]={d='en'},
23168 [0x1D7F5]={d='en'},
23169 [0x1D7F6]={d='en'},
23170 [0x1D7F7]={d='en'},
23171 [0x1D7F8]={d='en'},
23172 [0x1D7F9]={d='en'},
23173 [0x1D7FA]={d='en'},
23174 [0x1D7FB]={d='en'},
23175 [0x1D7FC]={d='en'},
23176 [0x1D7FD]={d='en'},
23177 [0x1D7FE]={d='en'},
23178 [0x1D7FF]={d='en'},
23179 [0x1DA00]={d='nsm'},
23180 [0x1DA01]={d='nsm'},
23181 [0x1DA02]={d='nsm'},
23182 [0x1DA03]={d='nsm'},
23183 [0x1DA04]={d='nsm'},
23184 [0x1DA05]={d='nsm'},
23185 [0x1DA06]={d='nsm'},
23186 [0x1DA07]={d='nsm'},
23187 [0x1DA08]={d='nsm'},
23188 [0x1DA09]={d='nsm'},
23189 [0x1DA0A]={d='nsm'},
23190 [0x1DA0B]={d='nsm'},
23191 [0x1DA0C]={d='nsm'},
23192 [0x1DA0D]={d='nsm'},
23193 [0x1DA0E]={d='nsm'},
23194 [0x1DA0F]={d='nsm'},
23195 [0x1DA10]={d='nsm'},
23196 [0x1DA11]={d='nsm'},
23197 [0x1DA12]={d='nsm'},
23198 [0x1DA13]={d='nsm'},
23199 [0x1DA14]={d='nsm'},
23200 [0x1DA15]={d='nsm'},
23201 [0x1DA16]={d='nsm'},
23202 [0x1DA17]={d='nsm'},
23203 [0x1DA18]={d='nsm'},
23204 [0x1DA19]={d='nsm'},
23205 [0x1DA1A]={d='nsm'},
23206 [0x1DA1B]={d='nsm'},
23207 [0x1DA1C]={d='nsm'},
23208 [0x1DA1D]={d='nsm'},
23209 [0x1DA1E]={d='nsm'},
23210 [0x1DA1F]={d='nsm'},
23211 [0x1DA20]={d='nsm'},
23212 [0x1DA21]={d='nsm'},
23213 [0x1DA22]={d='nsm'},
23214 [0x1DA23]={d='nsm'},
23215 [0x1DA24]={d='nsm'},
23216 [0x1DA25]={d='nsm'},
23217 [0x1DA26]={d='nsm'},
23218 [0x1DA27]={d='nsm'},
23219 [0x1DA28]={d='nsm'},
23220 [0x1DA29]={d='nsm'},
23221 [0x1DA2A]={d='nsm'},
23222 [0x1DA2B]={d='nsm'},
23223 [0x1DA2C]={d='nsm'},
23224 [0x1DA2D]={d='nsm'},
23225 [0x1DA2E]={d='nsm'},
23226 [0x1DA2F]={d='nsm'},
23227 [0x1DA30]={d='nsm'},
23228 [0x1DA31]={d='nsm'},
23229 [0x1DA32]={d='nsm'},
23230 [0x1DA33]={d='nsm'},
23231 [0x1DA34]={d='nsm'},
23232 [0x1DA35]={d='nsm'},
23233 [0x1DA36]={d='nsm'},
23234 [0x1DA3B]={d='nsm'},
23235 [0x1DA3C]={d='nsm'},
23236 [0x1DA3D]={d='nsm'},
23237 [0x1DA3E]={d='nsm'},
23238 [0x1DA3F]={d='nsm'},
23239 [0x1DA40]={d='nsm'},
23240 [0x1DA41]={d='nsm'},
23241 [0x1DA42]={d='nsm'},
23242 [0x1DA43]={d='nsm'},
23243 [0x1DA44]={d='nsm'},
23244 [0x1DA45]={d='nsm'},
23245 [0x1DA46]={d='nsm'},
23246 [0x1DA47]={d='nsm'},
23247 [0x1DA48]={d='nsm'},
23248 [0x1DA49]={d='nsm'},
23249 [0x1DA4A]={d='nsm'},
23250 [0x1DA4B]={d='nsm'},
23251 [0x1DA4C]={d='nsm'},
23252 [0x1DA4D]={d='nsm'},
23253 [0x1DA4E]={d='nsm'},
23254 [0x1DA4F]={d='nsm'},
23255 [0x1DA50]={d='nsm'},
23256 [0x1DA51]={d='nsm'},
23257 [0x1DA52]={d='nsm'},
23258 [0x1DA53]={d='nsm'},
23259 [0x1DA54]={d='nsm'},
23260 [0x1DA55]={d='nsm'},
23261 [0x1DA56]={d='nsm'},
23262 [0x1DA57]={d='nsm'},
23263 [0x1DA58]={d='nsm'},
23264 [0x1DA59]={d='nsm'},
23265 [0x1DA5A]={d='nsm'},
23266 [0x1DA5B]={d='nsm'},
23267 [0x1DA5C]={d='nsm'},
23268 [0x1DA5D]={d='nsm'},
23269 [0x1DA5E]={d='nsm'},
23270 [0x1DA5F]={d='nsm'},
23271 [0x1DA60]={d='nsm'},
23272 [0x1DA61]={d='nsm'},
23273 [0x1DA62]={d='nsm'},
23274 [0x1DA63]={d='nsm'},
23275 [0x1DA64]={d='nsm'},
23276 [0x1DA65]={d='nsm'},
23277 [0x1DA66]={d='nsm'},
23278 [0x1DA67]={d='nsm'},
23279 [0x1DA68]={d='nsm'},
23280 [0x1DA69]={d='nsm'},
23281 [0x1DA6A]={d='nsm'},
23282 [0x1DA6B]={d='nsm'},
23283 [0x1DA6C]={d='nsm'},
23284 [0x1DA75]={d='nsm'},
23285 [0x1DA84]={d='nsm'},
23286 [0x1DA9B]={d='nsm'},
23287 [0x1DA9C]={d='nsm'},
23288 [0x1DA9D]={d='nsm'},
23289 [0x1DA9E]={d='nsm'},
23290 [0x1DA9F]={d='nsm'},
23291 [0x1DAA1]={d='nsm'},
23292 [0x1DAA2]={d='nsm'},
23293 [0x1DAA3]={d='nsm'},
23294 [0x1DAA4]={d='nsm'},
23295 [0x1DAA5]={d='nsm'},
23296 [0x1DAA6]={d='nsm'},
23297 [0x1DAA7]={d='nsm'},
23298 [0x1DAA8]={d='nsm'},
23299 [0x1DAA9]={d='nsm'},
23300 [0x1DAAA]={d='nsm'},
23301 [0x1DAAB]={d='nsm'},
23302 [0x1DAAC]={d='nsm'},
23303 [0x1DAAD]={d='nsm'},
23304 [0x1DAAE]={d='nsm'},
23305 [0x1DAAF]={d='nsm'},
23306 [0x1E000]={d='nsm'},
23307 [0x1E001]={d='nsm'},
23308 [0x1E002]={d='nsm'},
23309 [0x1E003]={d='nsm'},
23310 [0x1E004]={d='nsm'},
23311 [0x1E005]={d='nsm'},
23312 [0x1E006]={d='nsm'},
23313 [0x1E008]={d='nsm'},
23314 [0x1E009]={d='nsm'},
23315 [0x1E00A]={d='nsm'},
23316 [0x1E00B]={d='nsm'},
23317 [0x1E00C]={d='nsm'},
23318 [0x1E00D]={d='nsm'},
23319 [0x1E00E]={d='nsm'},
23320 [0x1E00F]={d='nsm'},
23321 [0x1E010]={d='nsm'},
23322 [0x1E011]={d='nsm'},
23323 [0x1E012]={d='nsm'},
23324 [0x1E013]={d='nsm'},
23325 [0x1E014]={d='nsm'},
23326 [0x1E015]={d='nsm'},
23327 [0x1E016]={d='nsm'},
23328 [0x1E017]={d='nsm'},
23329 [0x1E018]={d='nsm'},
23330 [0x1E01B]={d='nsm'},
23331 [0x1E01C]={d='nsm'},
23332 [0x1E01D]={d='nsm'},
23333 [0x1E01E]={d='nsm'},
23334 [0x1E01F]={d='nsm'},
23335 [0x1E020]={d='nsm'},
23336 [0x1E021]={d='nsm'},
23337 [0x1E023]={d='nsm'},
23338 [0x1E024]={d='nsm'},
23339 [0x1E026]={d='nsm'},
23340 [0x1E027]={d='nsm'},
23341 [0x1E028]={d='nsm'},
23342 [0x1E029]={d='nsm'},
23343 [0x1E02A]={d='nsm'},
23344 [0x1E8D0]={d='nsm'},
23345 [0x1E8D1]={d='nsm'},
23346 [0x1E8D2]={d='nsm'},
23347 [0x1E8D3]={d='nsm'},
23348 [0x1E8D4]={d='nsm'},
23349 [0x1E8D5]={d='nsm'},
23350 [0x1E8D6]={d='nsm'},
23351 [0x1E944]={d='nsm'},
23352 [0x1E945]={d='nsm'},
23353 [0x1E946]={d='nsm'},
23354 [0x1E947]={d='nsm'},
23355 [0x1E948]={d='nsm'},
23356 [0x1E949]={d='nsm'},
23357 [0x1E94A]={d='nsm'},
23358 [0x1EEF0]={d='on'},
23359 [0x1EEF1]={d='on'},
23360 [0x1F000]={d='on'},
23361 [0x1F001]={d='on'},
23362 [0x1F002]={d='on'},
23363 [0x1F003]={d='on'},
23364 [0x1F004]={d='on'},
23365 [0x1F005]={d='on'},
23366 [0x1F006]={d='on'},
23367 [0x1F007]={d='on'},
23368 [0x1F008]={d='on'},
23369 [0x1F009]={d='on'},
23370 [0x1F00A]={d='on'},
23371 [0x1F00B]={d='on'},
23372 [0x1F00C]={d='on'},
23373 [0x1F00D]={d='on'},
23374 [0x1F00E]={d='on'},
23375 [0x1F00F]={d='on'},
23376 [0x1F010]={d='on'},
23377 [0x1F011]={d='on'},
23378 [0x1F012]={d='on'},
23379 [0x1F013]={d='on'},
23380 [0x1F014]={d='on'},
23381 [0x1F015]={d='on'},
23382 [0x1F016]={d='on'},
23383 [0x1F017]={d='on'},
23384 [0x1F018]={d='on'},
23385 [0x1F019]={d='on'},
23386 [0x1F01A]={d='on'},
23387 [0x1F01B]={d='on'},
23388 [0x1F01C]={d='on'},
23389 [0x1F01D]={d='on'},
23390 [0x1F01E]={d='on'},
23391 [0x1F01F]={d='on'},
23392 [0x1F020]={d='on'},
23393 [0x1F021]={d='on'},
23394 [0x1F022]={d='on'},
23395 [0x1F023]={d='on'},
23396 [0x1F024]={d='on'},
23397 [0x1F025]={d='on'},
23398 [0x1F026]={d='on'},
23399 [0x1F027]={d='on'},
23400 [0x1F028]={d='on'},
23401 [0x1F029]={d='on'},
23402 [0x1F02A]={d='on'},
23403 [0x1F02B]={d='on'},
23404 [0x1F030]={d='on'},
23405 [0x1F031]={d='on'},
23406 [0x1F032]={d='on'},
23407 [0x1F033]={d='on'},
23408 [0x1F034]={d='on'},
23409 [0x1F035]={d='on'},
23410 [0x1F036]={d='on'},
23411 [0x1F037]={d='on'},
23412 [0x1F038]={d='on'},
23413 [0x1F039]={d='on'},
23414 [0x1F03A]={d='on'},
23415 [0x1F03B]={d='on'},
23416 [0x1F03C]={d='on'},
23417 [0x1F03D]={d='on'},
23418 [0x1F03E]={d='on'},
23419 [0x1F03F]={d='on'},
23420 [0x1F040]={d='on'},
23421 [0x1F041]={d='on'},
23422 [0x1F042]={d='on'},
23423 [0x1F043]={d='on'},
23424 [0x1F044]={d='on'},
23425 [0x1F045]={d='on'},
23426 [0x1F046]={d='on'},
23427 [0x1F047]={d='on'},
23428 [0x1F048]={d='on'},
23429 [0x1F049]={d='on'},
23430 [0x1F04A]={d='on'},
23431 [0x1F04B]={d='on'},
23432 [0x1F04C]={d='on'},
23433 [0x1F04D]={d='on'},
23434 [0x1F04E]={d='on'},
23435 [0x1F04F]={d='on'},
23436 [0x1F050]={d='on'},
23437 [0x1F051]={d='on'},
23438 [0x1F052]={d='on'},
23439 [0x1F053]={d='on'},
23440 [0x1F054]={d='on'},
23441 [0x1F055]={d='on'},
23442 [0x1F056]={d='on'},
23443 [0x1F057]={d='on'},
23444 [0x1F058]={d='on'},
23445 [0x1F059]={d='on'},
23446 [0x1F05A]={d='on'},
23447 [0x1F05B]={d='on'},
23448 [0x1F05C]={d='on'},
23449 [0x1F05D]={d='on'},
23450 [0x1F05E]={d='on'},
23451 [0x1F05F]={d='on'},
23452 [0x1F060]={d='on'},
23453 [0x1F061]={d='on'},
23454 [0x1F062]={d='on'},
23455 [0x1F063]={d='on'},
23456 [0x1F064]={d='on'},
23457 [0x1F065]={d='on'},
23458 [0x1F066]={d='on'},
23459 [0x1F067]={d='on'},
23460 [0x1F068]={d='on'},
23461 [0x1F069]={d='on'},
23462 [0x1F06A]={d='on'},
23463 [0x1F06B]={d='on'},
23464 [0x1F06C]={d='on'},
23465 [0x1F06D]={d='on'},
23466 [0x1F06E]={d='on'},
23467 [0x1F06F]={d='on'},
23468 [0x1F070]={d='on'},
23469 [0x1F071]={d='on'},
23470 [0x1F072]={d='on'},
23471 [0x1F073]={d='on'},
23472 [0x1F074]={d='on'},
23473 [0x1F075]={d='on'},
23474 [0x1F076]={d='on'},
23475 [0x1F077]={d='on'},
23476 [0x1F078]={d='on'},
23477 [0x1F079]={d='on'},
23478 [0x1F07A]={d='on'},
23479 [0x1F07B]={d='on'},
23480 [0x1F07C]={d='on'},
23481 [0x1F07D]={d='on'},
23482 [0x1F07E]={d='on'},
23483 [0x1F07F]={d='on'},
23484 [0x1F080]={d='on'},
23485 [0x1F081]={d='on'},
23486 [0x1F082]={d='on'},
23487 [0x1F083]={d='on'},
23488 [0x1F084]={d='on'},
23489 [0x1F085]={d='on'},
23490 [0x1F086]={d='on'},
23491 [0x1F087]={d='on'},
23492 [0x1F088]={d='on'},
23493 [0x1F089]={d='on'},
23494 [0x1F08A]={d='on'},
23495 [0x1F08B]={d='on'},
23496 [0x1F08C]={d='on'},
23497 [0x1F08D]={d='on'},
23498 [0x1F08E]={d='on'},
23499 [0x1F08F]={d='on'},
23500 [0x1F090]={d='on'},
23501 [0x1F091]={d='on'},
23502 [0x1F092]={d='on'},
23503 [0x1F093]={d='on'},
23504 [0x1F0A0]={d='on'},
23505 [0x1F0A1]={d='on'},
23506 [0x1F0A2]={d='on'},
23507 [0x1F0A3]={d='on'},
23508 [0x1F0A4]={d='on'},
23509 [0x1F0A5]={d='on'},
23510 [0x1F0A6]={d='on'},
23511 [0x1F0A7]={d='on'},
23512 [0x1F0A8]={d='on'},
23513 [0x1F0A9]={d='on'},
23514 [0x1F0AA]={d='on'},
23515 [0x1F0AB]={d='on'},
23516 [0x1F0AC]={d='on'},
23517 [0x1F0AD]={d='on'},
23518 [0x1F0AE]={d='on'},
23519 [0x1F0B1]={d='on'},
23520 [0x1F0B2]={d='on'},
23521 [0x1F0B3]={d='on'},
23522 [0x1F0B4]={d='on'},
23523 [0x1F0B5]={d='on'},
23524 [0x1F0B6]={d='on'},
23525 [0x1F0B7]={d='on'},
23526 [0x1F0B8]={d='on'},
23527 [0x1F0B9]={d='on'},
23528 [0x1F0BA]={d='on'},
23529 [0x1F0BB]={d='on'},
23530 [0x1F0BC]={d='on'},
23531 [0x1F0BD]={d='on'},
23532 [0x1F0BE]={d='on'},
23533 [0x1F0BF]={d='on'},
23534 [0x1F0C1]={d='on'},
23535 [0x1F0C2]={d='on'},
23536 [0x1F0C3]={d='on'},
23537 [0x1F0C4]={d='on'},
23538 [0x1F0C5]={d='on'},
23539 [0x1F0C6]={d='on'},
23540 [0x1F0C7]={d='on'},
23541 [0x1F0C8]={d='on'},
23542 [0x1F0C9]={d='on'},
23543 [0x1F0CA]={d='on'},
23544 [0x1F0CB]={d='on'},
23545 [0x1F0CC]={d='on'},
23546 [0x1F0CD]={d='on'},
23547 [0x1F0CE]={d='on'},
23548 [0x1F0CF]={d='on'},
23549 [0x1F0D1]={d='on'},
23550 [0x1F0D2]={d='on'},
23551 [0x1F0D3]={d='on'},
23552 [0x1F0D4]={d='on'},
23553 [0x1F0D5]={d='on'},
23554 [0x1F0D6]={d='on'},
23555 [0x1F0D7]={d='on'},
23556 [0x1F0D8]={d='on'},
23557 [0x1F0D9]={d='on'},
23558 [0x1F0DA]={d='on'},
23559 [0x1F0DB]={d='on'},
23560 [0x1F0DC]={d='on'},
23561 [0x1F0DD]={d='on'},
23562 [0x1F0DE]={d='on'},
23563 [0x1F0DF]={d='on'},
23564 [0x1F0E0]={d='on'},
23565 [0x1F0E1]={d='on'},
23566 [0x1F0E2]={d='on'},
23567 [0x1F0E3]={d='on'},
23568 [0x1F0E4]={d='on'},
23569 [0x1F0E5]={d='on'},
23570 [0x1F0E6]={d='on'},
23571 [0x1F0E7]={d='on'},
23572 [0x1F0E8]={d='on'},
23573 [0x1F0E9]={d='on'},
23574 [0x1F0EA]={d='on'},
23575 [0x1F0EB]={d='on'},
23576 [0x1F0EC]={d='on'},
23577 [0x1F0ED]={d='on'},
23578 [0x1F0EE]={d='on'},
23579 [0x1F0EF]={d='on'},
23580 [0x1F0F0]={d='on'},
23581 [0x1F0F1]={d='on'},
23582 [0x1F0F2]={d='on'},
23583 [0x1F0F3]={d='on'},
23584 [0x1F0F4]={d='on'},
23585 [0x1F0F5]={d='on'},
23586 [0x1F100]={d='en'},
23587 [0x1F101]={d='en'},
23588 [0x1F102]={d='en'},
23589 [0x1F103]={d='en'},
23590 [0x1F104]={d='en'},
23591 [0x1F105]={d='en'},
23592 [0x1F106]={d='en'},
23593 [0x1F107]={d='en'},
23594 [0x1F108]={d='en'},
23595 [0x1F109]={d='en'},
23596 [0x1F10A]={d='en'},
23597 [0x1F10B]={d='on'},
23598 [0x1F10C]={d='on'},
23599 [0x1F16A]={d='on'},
23600 [0x1F16B]={d='on'},
23601 [0xE0001]={d='bn'},
23602 [0xE0020]={d='bn'},
23603 [0xE0021]={d='bn'},
23604 [0xE0022]={d='bn'},
23605 [0xE0023]={d='bn'},
23606 [0xE0024]={d='bn'},
23607 [0xE0025]={d='bn'},
23608 [0xE0026]={d='bn'},
23609 [0xE0027]={d='bn'},
23610 [0xE0028]={d='bn'},
23611 [0xE0029]={d='bn'},
23612 [0xE002A]={d='bn'},
23613 [0xE002B]={d='bn'},
23614 [0xE002C]={d='bn'},
23615 [0xE002D]={d='bn'},
23616 [0xE002E]={d='bn'},
23617 [0xE002F]={d='bn'},
23618 [0xE0030]={d='bn'},
23619 [0xE0031]={d='bn'},
23620 [0xE0032]={d='bn'},
23621 [0xE0033]={d='bn'},
23622 [0xE0034]={d='bn'},
23623 [0xE0035]={d='bn'},
23624 [0xE0036]={d='bn'},
23625 [0xE0037]={d='bn'},
23626 [0xE0038]={d='bn'},
23627 [0xE0039]={d='bn'},
23628 [0xE003A]={d='bn'},
23629 [0xE003B]={d='bn'},
23630 [0xE003C]={d='bn'},
23631 [0xE003D]={d='bn'},
23632 [0xE003E]={d='bn'},
23633 [0xE003F]={d='bn'},
23634 [0xE0040]={d='bn'},
23635 [0xE0041]={d='bn'},
23636 [0xE0042]={d='bn'},
23637 [0xE0043]={d='bn'},
23638 [0xE0044]={d='bn'},
23639 [0xE0045]={d='bn'},
23640 [0xE0046]={d='bn'},
23641 [0xE0047]={d='bn'},
23642 [0xE0048]={d='bn'},
23643 [0xE0049]={d='bn'},
23644 [0xE004A]={d='bn'},
23645 [0xE004B]={d='bn'},
23646 [0xE004C]={d='bn'},
23647 [0xE004D]={d='bn'},
23648 [0xE004E]={d='bn'},
23649 [0xE004F]={d='bn'},
23650 [0xE0050]={d='bn'},
23651 [0xE0051]={d='bn'},
23652 [0xE0052]={d='bn'},
23653 [0xE0053]={d='bn'},
23654 [0xE0054]={d='bn'},
23655 [0xE0055]={d='bn'},
23656 [0xE0056]={d='bn'},
23657 [0xE0057]={d='bn'},
23658 [0xE0058]={d='bn'},
23659 [0xE0059]={d='bn'},
23660 [0xE005A]={d='bn'},
23661 [0xE005B]={d='bn'},
23662 [0xE005C]={d='bn'},
23663 [0xE005D]={d='bn'},
23664 [0xE005E]={d='bn'},
23665 [0xE005F]={d='bn'},
23666 [0xE0060]={d='bn'},
23667 [0xE0061]={d='bn'},
23668 [0xE0062]={d='bn'},
23669 [0xE0063]={d='bn'},
23670 [0xE0064]={d='bn'},
23671 [0xE0065]={d='bn'},
23672 [0xE0066]={d='bn'},
23673 [0xE0067]={d='bn'},
23674 [0xE0068]={d='bn'},
23675 [0xE0069]={d='bn'},
23676 [0xE006A]={d='bn'},
23677 [0xE006B]={d='bn'},
23678 [0xE006C]={d='bn'},
23679 [0xE006D]={d='bn'},
23680 [0xE006E]={d='bn'},
23681 [0xE006F]={d='bn'},
23682 [0xE0070]={d='bn'},
23683 [0xE0071]={d='bn'},
23684 [0xE0072]={d='bn'},
23685 [0xE0073]={d='bn'},
23686 [0xE0074]={d='bn'},
23687 [0xE0075]={d='bn'},
23688 [0xE0076]={d='bn'},
23689 [0xE0077]={d='bn'},
23690 [0xE0078]={d='bn'},
23691 [0xE0079]={d='bn'},
23692 [0xE007A]={d='bn'},
23693 [0xE007B]={d='bn'},
23694 [0xE007C]={d='bn'},
23695 [0xE007D]={d='bn'},
23696 [0xE007E]={d='bn'},
23697 [0xE007F]={d='bn'}
23698 }
23699 %</bididata>
23700 % \end{macrocode}
23701 %\fi
23702 %
23703 % Now the |basic-r| bidi mode. One of the aims is to implement a fast
23704 % and simple bidi algorithm, with a single loop. I managed to do it
23705 % for R texts, with a second smaller loop for a special case. The code
23706 % is still somewhat chaotic, but its behavior is essentially
23707 % correct. I cannot resist copying the following text from
23708 % \textsf{Emacs} |bidi.c| (which also attempts to implement the bidi
23709 % algorithm with a single loop):
23710 %
23711 % \begin{quote}
23712 % Arrrgh!! The UAX\#9 algorithm is too deeply entrenched in the
23713 % assumption of batch-style processing [...]. May the fleas of a
23714 % thousand camels infest the armpits of those who design supposedly
23715 % general-purpose algorithms by looking at their own
23716 % implementations, and fail to consider other possible
23717 % implementations!
23718 % \end{quote}
23719 %
23720 % Well, it took me some time to guess what the batch rules in UAX\#9
23721 % actually mean (in other word, \textit{what} they do and \textit{why},
23722 % and not only \textit{how}), but I think (or I hope) I've managed to
23723 % understand them.
23724 %
23725 % In some sense, there are two bidi modes, one for numbers, and the
23726 % other for text. Furthermore, setting just the direction in R text
23727 % is not enough, because there are actually \textit{two} R modes (set
23728 % explicitly in Unicode with RLM and ALM). In \babel{} the dir is set
23729 % by a higher protocol based on the language/script, which in turn
23730 % sets the correct dir (<l>, <r> or <al>).
23731 %
23732 % From UAX\#9: “Where available, markup should be used instead of the
23733 % explicit formatting characters”. So, this simple version just
23734 % ignores formatting characters. Actually, most of that annex is
23735 % devoted to how to handle them.
23736 %
23737 % BD14-BD16 are not implemented. Unicode (and the W3C) are making a
23738 % great effort to deal with some special problematic cases in
23739 % “streamed” plain text. I don't think this is the way to go --
23740 % particular issues should be fixed by a high level interface taking
23741 % into account the needs of the document. And here is where \luatex{}
23742 % excels, because everything related to bidi writing is under our
23743 % control.
23744 %
23745 % \begin{macrocode}
23746 %<*basic-r>
23747 Babel.bidi_enabled = true
23748
23749 require('babel-data-bidi.lua')
23750
23751 local characters = Babel.characters
23752 local ranges = Babel.ranges
23753
23754 local DIR = node.id("dir")
23755
23756 local function dir_mark(head, from, to, outer)
23757 dir = (outer == 'r') and 'TLT' or 'TRT' -- i.e., reverse
23758 local d = node.new(DIR)
23759 d.dir = '+' .. dir
23760 node.insert_before(head, from, d)
23761 d = node.new(DIR)
23762 d.dir = '-' .. dir
23763 node.insert_after(head, to, d)
23764 end
23765
23766 function Babel.bidi(head, ispar)
23767 local first_n, last_n -- first and last char with nums
23768 local last_es -- an auxiliary 'last' used with nums
23769 local first_d, last_d -- first and last char in L/R block
23770 local dir, dir_real
23771 % \end{macrocode}
23772 %
23773 % Next also depends on script/lang (<al>/<r>). To be set by
23774 % babel. |tex.pardir| is dangerous, could be (re)set but it
23775 % should be changed only in vmode. There are two strong's --
23776 % |strong| = l/al/r and |strong_lr| = l/r (there must be a better
23777 % way):
23778 %
23779 % \begin{macrocode}
23780 local strong = ('TRT' == tex.pardir) and 'r' or 'l'
23781 local strong_lr = (strong == 'l') and 'l' or 'r'
23782 local outer = strong
23783
23784 local new_dir = false
23785 local first_dir = false
23786 local inmath = false
23787
23788 local last_lr
23789
23790 local type_n = ''
23791
23792 for item in node.traverse(head) do
23793
23794 -- three cases: glyph, dir, otherwise
23795 if item.id == node.id'glyph'
23796 or (item.id == 7 and item.subtype == 2) then
23797
23798 local itemchar
23799 if item.id == 7 and item.subtype == 2 then
23800 itemchar = item.replace.char
23801 else
23802 itemchar = item.char
23803 end
23804 local chardata = characters[itemchar]
23805 dir = chardata and chardata.d or nil
23806 if not dir then
23807 for nn, et in ipairs(ranges) do
23808 if itemchar < et[1] then
23809 break
23810 elseif itemchar <= et[2] then
23811 dir = et[3]
23812 break
23813 end
23814 end
23815 end
23816 dir = dir or 'l'
23817 if inmath then dir = ('TRT' == tex.mathdir) and 'r' or 'l' end
23818 % \end{macrocode}
23819 %
23820 % Next is based on the assumption \babel{} sets the language
23821 % \textit{and} switches the script with its dir. We treat a language
23822 % block as a separate Unicode sequence. The following piece of code is
23823 % executed at the first glyph after a `dir' node. We don't know the
23824 % current language until then. This is not exactly true, as the math
23825 % mode may insert explicit dirs in the node list, so, for the moment
23826 % there is a hack by brute force (just above).
23827 %
23828 % \begin{macrocode}
23829 if new_dir then
23830 attr_dir = 0
23831 for at in node.traverse(item.attr) do
23832 if at.number == Babel.attr_dir then
23833 attr_dir = at.value & 0x3
23834 end
23835 end
23836 if attr_dir == 1 then
23837 strong = 'r'
23838 elseif attr_dir == 2 then
23839 strong = 'al'
23840 else
23841 strong = 'l'
23842 end
23843 strong_lr = (strong == 'l') and 'l' or 'r'
23844 outer = strong_lr
23845 new_dir = false
23846 end
23847
23848 if dir == 'nsm' then dir = strong end -- W1
23849 % \end{macrocode}
23850 %
23851 % \textbf{Numbers.} The dual <al>/<r> system for R is somewhat
23852 % cumbersome.
23853 %
23854 % \begin{macrocode}
23855 dir_real = dir -- We need dir_real to set strong below
23856 if dir == 'al' then dir = 'r' end -- W3
23857 % \end{macrocode}
23858 %
23859 % By W2, there are no <en> <et> <es> if |strong == <al>|, only
23860 % <an>. Therefore, there are not <et en> nor <en et>, W5 can be
23861 % ignored, and W6 applied:
23862 %
23863 % \begin{macrocode}
23864 if strong == 'al' then
23865 if dir == 'en' then dir = 'an' end -- W2
23866 if dir == 'et' or dir == 'es' then dir = 'on' end -- W6
23867 strong_lr = 'r' -- W3
23868 end
23869 % \end{macrocode}
23870 %
23871 % Once finished the basic setup for glyphs, consider the two other
23872 % cases: dir node and the rest.
23873 %
23874 % \begin{macrocode}
23875 elseif item.id == node.id'dir' and not inmath then
23876 new_dir = true
23877 dir = nil
23878 elseif item.id == node.id'math' then
23879 inmath = (item.subtype == 0)
23880 else
23881 dir = nil -- Not a char
23882 end
23883 % \end{macrocode}
23884 %
23885 % Numbers in R mode. A sequence of <en>, <et>, <an>, <es> and <cs> is
23886 % typeset (with some rules) in L mode. We store the starting and
23887 % ending points, and only when anything different is found (including
23888 % nil, i.e., a non-char), the textdir is set. This means you cannot
23889 % insert, say, a whatsit, but this is what I would expect (with
23890 % \textsf{luacolor} you may colorize some digits). Anyway, this
23891 % behavior could be changed with a switch in the future. Note in the
23892 % first branch only <an> is relevant if <al>.
23893 %
23894 % \begin{macrocode}
23895 if dir == 'en' or dir == 'an' or dir == 'et' then
23896 if dir ~= 'et' then
23897 type_n = dir
23898 end
23899 first_n = first_n or item
23900 last_n = last_es or item
23901 last_es = nil
23902 elseif dir == 'es' and last_n then -- W3+W6
23903 last_es = item
23904 elseif dir == 'cs' then -- it's right - do nothing
23905 elseif first_n then -- & if dir = any but en, et, an, es, cs, inc nil
23906 if strong_lr == 'r' and type_n ~= '' then
23907 dir_mark(head, first_n, last_n, 'r')
23908 elseif strong_lr == 'l' and first_d and type_n == 'an' then
23909 dir_mark(head, first_n, last_n, 'r')
23910 dir_mark(head, first_d, last_d, outer)
23911 first_d, last_d = nil, nil
23912 elseif strong_lr == 'l' and type_n ~= '' then
23913 last_d = last_n
23914 end
23915 type_n = ''
23916 first_n, last_n = nil, nil
23917 end
23918 % \end{macrocode}
23919 %
23920 % R text in L, or L text in R. Order of |dir_ mark|'s are relevant: d
23921 % goes outside n, and therefore it's emitted after. See |dir_mark| to
23922 % understand why (but is the nesting actually necessary or is a flat
23923 % dir structure enough?). Only L, R (and AL) chars are taken into
23924 % account -- everything else, including spaces, whatsits, etc., are
23925 % ignored:
23926 %
23927 % \begin{macrocode}
23928 if dir == 'l' or dir == 'r' then
23929 if dir ~= outer then
23930 first_d = first_d or item
23931 last_d = item
23932 elseif first_d and dir ~= strong_lr then
23933 dir_mark(head, first_d, last_d, outer)
23934 first_d, last_d = nil, nil
23935 end
23936 end
23937 % \end{macrocode}
23938 %
23939 % \textbf{Mirroring.} Each chunk of text in a certain language is
23940 % considered a “closed” sequence. If <r on r> and <l on l>, it's
23941 % clearly <r> and <l>, resptly, but with other combinations depends on
23942 % outer. From all these, we select only those resolving <on> $\to$
23943 % <r>. At the beginning (when |last_lr| is nil) of an R text, they are
23944 % mirrored directly. Numbers in R mode are processed. It should not be
23945 % done, but it doesn't hurt.
23946 %
23947 % \begin{macrocode}
23948 if dir and not last_lr and dir ~= 'l' and outer == 'r' then
23949 item.char = characters[item.char] and
23950 characters[item.char].m or item.char
23951 elseif (dir or new_dir) and last_lr ~= item then
23952 local mir = outer .. strong_lr .. (dir or outer)
23953 if mir == 'rrr' or mir == 'lrr' or mir == 'rrl' or mir == 'rlr' then
23954 for ch in node.traverse(node.next(last_lr)) do
23955 if ch == item then break end
23956 if ch.id == node.id'glyph' and characters[ch.char] then
23957 ch.char = characters[ch.char].m or ch.char
23958 end
23959 end
23960 end
23961 end
23962 % \end{macrocode}
23963 %
23964 % Save some values for the next iteration. If the current node is
23965 % `dir', open a new sequence. Since dir could be changed, strong is
23966 % set with its real value (|dir_real|).
23967 %
23968 % \begin{macrocode}
23969 if dir == 'l' or dir == 'r' then
23970 last_lr = item
23971 strong = dir_real -- Don't search back - best save now
23972 strong_lr = (strong == 'l') and 'l' or 'r'
23973 elseif new_dir then
23974 last_lr = nil
23975 end
23976 end
23977 % \end{macrocode}
23978 %
23979 % Mirror the last chars if they are no directed. And make sure any
23980 % open block is closed, too.
23981 %
23982 % \begin{macrocode}
23983 if last_lr and outer == 'r' then
23984 for ch in node.traverse_id(node.id'glyph', node.next(last_lr)) do
23985 if characters[ch.char] then
23986 ch.char = characters[ch.char].m or ch.char
23987 end
23988 end
23989 end
23990 if first_n then
23991 dir_mark(head, first_n, last_n, outer)
23992 end
23993 if first_d then
23994 dir_mark(head, first_d, last_d, outer)
23995 end
23996 % \end{macrocode}
23997 %
23998 % In boxes, the dir node could be added before the original head, so
23999 % the actual head is the previous node.
24000 %
24001 % \begin{macrocode}
24002 return node.prev(head) or head
24003 end
24004 %</basic-r>
24005 % \end{macrocode}
24006 %
24007 % And here the Lua code for |bidi=basic|:
24008 %
24009 % \begin{macrocode}
24010 %<*basic>
24011 -- e.g., Babel.fontmap[1][<prefontid>]=<dirfontid>
24012
24013 Babel.fontmap = Babel.fontmap or {}
24014 Babel.fontmap[0] = {} -- l
24015 Babel.fontmap[1] = {} -- r
24016 Babel.fontmap[2] = {} -- al/an
24017
24018 -- To cancel mirroring. Also OML, OMS, U?
24019 Babel.symbol_fonts = Babel.symbol_fonts or {}
24020 Babel.symbol_fonts[font.id('tenln')] = true
24021 Babel.symbol_fonts[font.id('tenlnw')] = true
24022 Babel.symbol_fonts[font.id('tencirc')] = true
24023 Babel.symbol_fonts[font.id('tencircw')] = true
24024
24025 Babel.bidi_enabled = true
24026 Babel.mirroring_enabled = true
24027
24028 require('babel-data-bidi.lua')
24029
24030 local characters = Babel.characters
24031 local ranges = Babel.ranges
24032
24033 local DIR = node.id('dir')
24034 local GLYPH = node.id('glyph')
24035
24036 local function insert_implicit(head, state, outer)
24037 local new_state = state
24038 if state.sim and state.eim and state.sim ~= state.eim then
24039 dir = ((outer == 'r') and 'TLT' or 'TRT') -- i.e., reverse
24040 local d = node.new(DIR)
24041 d.dir = '+' .. dir
24042 node.insert_before(head, state.sim, d)
24043 local d = node.new(DIR)
24044 d.dir = '-' .. dir
24045 node.insert_after(head, state.eim, d)
24046 end
24047 new_state.sim, new_state.eim = nil, nil
24048 return head, new_state
24049 end
24050
24051 local function insert_numeric(head, state)
24052 local new
24053 local new_state = state
24054 if state.san and state.ean and state.san ~= state.ean then
24055 local d = node.new(DIR)
24056 d.dir = '+TLT'
24057 _, new = node.insert_before(head, state.san, d)
24058 if state.san == state.sim then state.sim = new end
24059 local d = node.new(DIR)
24060 d.dir = '-TLT'
24061 _, new = node.insert_after(head, state.ean, d)
24062 if state.ean == state.eim then state.eim = new end
24063 end
24064 new_state.san, new_state.ean = nil, nil
24065 return head, new_state
24066 end
24067
24068 local function glyph_not_symbol_font(node)
24069 if node.id == GLYPH then
24070 return not Babel.symbol_fonts[node.font]
24071 else
24072 return false
24073 end
24074 end
24075
24076 -- TODO - \hbox with an explicit dir can lead to wrong results
24077 -- <R \hbox dir TLT{<R>}> and <L \hbox dir TRT{<L>}>. A small attempt
24078 -- was made to improve the situation, but the problem is the 3-dir
24079 -- model in babel/Unicode and the 2-dir model in LuaTeX don't fit
24080 -- well.
24081
24082 function Babel.bidi(head, ispar, hdir)
24083 local d -- d is used mainly for computations in a loop
24084 local prev_d = ''
24085 local new_d = false
24086
24087 local nodes = {}
24088 local outer_first = nil
24089 local inmath = false
24090
24091 local glue_d = nil
24092 local glue_i = nil
24093
24094 local has_en = false
24095 local first_et = nil
24096
24097 local has_hyperlink = false
24098
24099 local ATDIR = Babel.attr_dir
24100 local attr_d, temp
24101 local locale_d
24102
24103 local save_outer
24104 local locale_d = node.get_attribute(head, ATDIR)
24105 if locale_d then
24106 locale_d = locale_d & 0x3
24107 save_outer = (locale_d == 0 and 'l') or
24108 (locale_d == 1 and 'r') or
24109 (locale_d == 2 and 'al')
24110 elseif ispar then -- Or error? Shouldn't happen
24111 -- when the callback is called, we are just _after_ the box,
24112 -- and the textdir is that of the surrounding text
24113 save_outer = ('TRT' == tex.pardir) and 'r' or 'l'
24114 else -- Empty box
24115 save_outer = ('TRT' == hdir) and 'r' or 'l'
24116 end
24117 local outer = save_outer
24118 local last = outer
24119 -- 'al' is only taken into account in the first, current loop
24120 if save_outer == 'al' then save_outer = 'r' end
24121
24122 local fontmap = Babel.fontmap
24123
24124 for item in node.traverse(head) do
24125
24126 -- Mask: DxxxPPTT (Done, Pardir [0-2], Textdir [0-2])
24127 locale_d = node.get_attribute(item, ATDIR)
24128 node.set_attribute(item, ATDIR, 0x80)
24129
24130 -- In what follows, #node is the last (previous) node, because the
24131 -- current one is not added until we start processing the neutrals.
24132 -- three cases: glyph, dir, otherwise
24133 if glyph_not_symbol_font(item)
24134 or (item.id == 7 and item.subtype == 2) then
24135
24136 if inmath then goto nextnode end
24137
24138 if locale_d == 0x80 then goto nextnode end
24139 locale_d = locale_d or ((save_outer=='l') and 0 or 1)
24140
24141 local d_font = nil
24142 local item_r
24143 if item.id == 7 and item.subtype == 2 then
24144 item_r = item.replace -- automatic discs have just 1 glyph
24145 else
24146 item_r = item
24147 end
24148
24149 local chardata = characters[item_r.char]
24150 d = chardata and chardata.d or nil
24151 if not d or d == 'nsm' then
24152 for nn, et in ipairs(ranges) do
24153 if item_r.char < et[1] then
24154 break
24155 elseif item_r.char <= et[2] then
24156 if not d then d = et[3]
24157 elseif d == 'nsm' then d_font = et[3]
24158 end
24159 break
24160 end
24161 end
24162 end
24163 d = d or 'l'
24164
24165 -- A short 'pause' in bidi for mapfont
24166 -- %%%% TODO. move if fontmap here
24167 d_font = d_font or d
24168 d_font = (d_font == 'l' and 0) or
24169 (d_font == 'nsm' and 0) or
24170 (d_font == 'r' and 1) or
24171 (d_font == 'al' and 2) or
24172 (d_font == 'an' and 2) or nil
24173 if d_font and fontmap and fontmap[d_font][item_r.font] then
24174 item_r.font = fontmap[d_font][item_r.font]
24175 end
24176
24177 if new_d then
24178 table.insert(nodes, {nil, (outer == 'l') and 'l' or 'r', nil})
24179 if inmath then
24180 attr_d = 0
24181 else
24182 attr_d = locale_d & 0x3
24183 end
24184 if attr_d == 1 then
24185 outer_first = 'r'
24186 last = 'r'
24187 elseif attr_d == 2 then
24188 outer_first = 'r'
24189 last = 'al'
24190 else
24191 outer_first = 'l'
24192 last = 'l'
24193 end
24194 outer = last
24195 has_en = false
24196 first_et = nil
24197 new_d = false
24198 end
24199
24200 if glue_d then
24201 if (d == 'l' and 'l' or 'r') ~= glue_d then
24202 table.insert(nodes, {glue_i, 'on', nil})
24203 end
24204 glue_d = nil
24205 glue_i = nil
24206 end
24207
24208 elseif item.id == DIR then
24209 if inmath then goto nextnode end
24210 d = nil
24211 new_d = true
24212
24213 elseif item.id == node.id'glue' and item.subtype == 13 then
24214 if inmath then goto nextnode end
24215 glue_d = d
24216 glue_i = item
24217 d = nil
24218
24219 elseif item.id == node.id'math' then
24220 if item.subtype == 0 then -- mathon
24221 inmath = true
24222 d = 'on'
24223 table.insert(nodes, {item, 'on', outer_first})
24224 outer_first = nil
24225 goto nextnode
24226 else -- mathoff
24227 inmath = false
24228 end
24229
24230 elseif item.id == 8 and item.subtype == 19 then
24231 has_hyperlink = true
24232
24233 else
24234 d = nil
24235 end
24236
24237 -- AL <= EN/ET/ES -- W2 + W3 + W6
24238 if last == 'al' and d == 'en' then
24239 d = 'an' -- W3
24240 elseif last == 'al' and (d == 'et' or d == 'es') then
24241 d = 'on' -- W6
24242 end
24243
24244 -- EN + CS/ES + EN -- W4
24245 if d == 'en' and #nodes >= 2 then
24246 if (nodes[#nodes][2] == 'es' or nodes[#nodes][2] == 'cs')
24247 and nodes[#nodes-1][2] == 'en' then
24248 nodes[#nodes][2] = 'en'
24249 end
24250 end
24251
24252 -- AN + CS + AN -- W4 too, because uax9 mixes both cases
24253 if d == 'an' and #nodes >= 2 then
24254 if (nodes[#nodes][2] == 'cs')
24255 and nodes[#nodes-1][2] == 'an' then
24256 nodes[#nodes][2] = 'an'
24257 end
24258 end
24259
24260 -- ET/EN -- W5 + W7->l / W6->on
24261 if d == 'et' then
24262 first_et = first_et or (#nodes + 1)
24263 elseif d == 'en' then
24264 has_en = true
24265 first_et = first_et or (#nodes + 1)
24266 elseif first_et then -- d may be nil here !
24267 if has_en then
24268 if last == 'l' then
24269 temp = 'l' -- W7
24270 else
24271 temp = 'en' -- W5
24272 end
24273 else
24274 temp = 'on' -- W6
24275 end
24276 for e = first_et, #nodes do
24277 if glyph_not_symbol_font(nodes[e][1]) then nodes[e][2] = temp end
24278 end
24279 first_et = nil
24280 has_en = false
24281 end
24282
24283 -- Force mathdir in math if ON (currently works as expected only
24284 -- with 'l')
24285
24286 if inmath and d == 'on' then
24287 d = ('TRT' == tex.mathdir) and 'r' or 'l'
24288 end
24289
24290 if d then
24291 if d == 'al' then
24292 d = 'r'
24293 last = 'al'
24294 elseif d == 'l' or d == 'r' then
24295 last = d
24296 end
24297 prev_d = d
24298 table.insert(nodes, {item, d, outer_first})
24299 end
24300
24301 outer_first = nil
24302
24303 ::nextnode::
24304
24305 end -- for each node
24306
24307 -- TODO -- repeated here in case EN/ET is the last node. Find a
24308 -- better way of doing things:
24309 if first_et then -- dir may be nil here !
24310 if has_en then
24311 if last == 'l' then
24312 temp = 'l' -- W7
24313 else
24314 temp = 'en' -- W5
24315 end
24316 else
24317 temp = 'on' -- W6
24318 end
24319 for e = first_et, #nodes do
24320 if glyph_not_symbol_font(nodes[e][1]) then nodes[e][2] = temp end
24321 end
24322 end
24323
24324 -- dummy node, to close things
24325 table.insert(nodes, {nil, (outer == 'l') and 'l' or 'r', nil})
24326
24327 --------------- NEUTRAL -----------------
24328
24329 outer = save_outer
24330 last = outer
24331
24332 local first_on = nil
24333
24334 for q = 1, #nodes do
24335 local item
24336
24337 local outer_first = nodes[q][3]
24338 outer = outer_first or outer
24339 last = outer_first or last
24340
24341 local d = nodes[q][2]
24342 if d == 'an' or d == 'en' then d = 'r' end
24343 if d == 'cs' or d == 'et' or d == 'es' then d = 'on' end --- W6
24344
24345 if d == 'on' then
24346 first_on = first_on or q
24347 elseif first_on then
24348 if last == d then
24349 temp = d
24350 else
24351 temp = outer
24352 end
24353 for r = first_on, q - 1 do
24354 nodes[r][2] = temp
24355 item = nodes[r][1] -- MIRRORING
24356 if Babel.mirroring_enabled and glyph_not_symbol_font(item)
24357 and temp == 'r' and characters[item.char] then
24358 local font_mode = ''
24359 if item.font > 0 and font.fonts[item.font].properties then
24360 font_mode = font.fonts[item.font].properties.mode
24361 end
24362 if font_mode ~= 'harf' and font_mode ~= 'plug' then
24363 item.char = characters[item.char].m or item.char
24364 end
24365 end
24366 end
24367 first_on = nil
24368 end
24369
24370 if d == 'r' or d == 'l' then last = d end
24371 end
24372
24373 -------------- IMPLICIT, REORDER ----------------
24374
24375 outer = save_outer
24376 last = outer
24377
24378 local state = {}
24379 state.has_r = false
24380
24381 for q = 1, #nodes do
24382
24383 local item = nodes[q][1]
24384
24385 outer = nodes[q][3] or outer
24386
24387 local d = nodes[q][2]
24388
24389 if d == 'nsm' then d = last end -- W1
24390 if d == 'en' then d = 'an' end
24391 local isdir = (d == 'r' or d == 'l')
24392
24393 if outer == 'l' and d == 'an' then
24394 state.san = state.san or item
24395 state.ean = item
24396 elseif state.san then
24397 head, state = insert_numeric(head, state)
24398 end
24399
24400 if outer == 'l' then
24401 if d == 'an' or d == 'r' then -- im -> implicit
24402 if d == 'r' then state.has_r = true end
24403 state.sim = state.sim or item
24404 state.eim = item
24405 elseif d == 'l' and state.sim and state.has_r then
24406 head, state = insert_implicit(head, state, outer)
24407 elseif d == 'l' then
24408 state.sim, state.eim, state.has_r = nil, nil, false
24409 end
24410 else
24411 if d == 'an' or d == 'l' then
24412 if nodes[q][3] then -- nil except after an explicit dir
24413 state.sim = item -- so we move sim 'inside' the group
24414 else
24415 state.sim = state.sim or item
24416 end
24417 state.eim = item
24418 elseif d == 'r' and state.sim then
24419 head, state = insert_implicit(head, state, outer)
24420 elseif d == 'r' then
24421 state.sim, state.eim = nil, nil
24422 end
24423 end
24424
24425 if isdir then
24426 last = d -- Don't search back - best save now
24427 elseif d == 'on' and state.san then
24428 state.san = state.san or item
24429 state.ean = item
24430 end
24431
24432 end
24433
24434 head = node.prev(head) or head
24435 % \end{macrocode}
24436 %
24437 % Now direction nodes has been distributed with relation to characters
24438 % and spaces, we need to take into account \TeX\-specific elements in
24439 % the node list, to move them at an appropriate place. Firstly, with
24440 % hyperlinks. Secondly, we avoid them between penalties and spaces, so
24441 % that the latter are still discardable.
24442 %
24443 % \begin{macrocode}
24444 --- FIXES ---
24445 if has_hyperlink then
24446 local flag, linking = 0, 0
24447 for item in node.traverse(head) do
24448 if item.id == DIR then
24449 if item.dir == '+TRT' or item.dir == '+TLT' then
24450 flag = flag + 1
24451 elseif item.dir == '-TRT' or item.dir == '-TLT' then
24452 flag = flag - 1
24453 end
24454 elseif item.id == 8 and item.subtype == 19 then
24455 linking = flag
24456 elseif item.id == 8 and item.subtype == 20 then
24457 if linking > 0 then
24458 if item.prev.id == DIR and
24459 (item.prev.dir == '-TRT' or item.prev.dir == '-TLT') then
24460 d = node.new(DIR)
24461 d.dir = item.prev.dir
24462 node.remove(head, item.prev)
24463 node.insert_after(head, item, d)
24464 end
24465 end
24466 linking = 0
24467 end
24468 end
24469 end
24470
24471 for item in node.traverse_id(10, head) do
24472 local p = item
24473 local flag = false
24474 while p.prev and p.prev.id == 14 do
24475 flag = true
24476 p = p.prev
24477 end
24478 if flag then
24479 node.insert_before(head, p, node.copy(item))
24480 node.remove(head,item)
24481 end
24482 end
24483
24484 return head
24485 end
24486 % \end{macrocode}
24487 %
24488 % \begin{macrocode}
24489 function Babel.unset_atdir(head)
24490 local ATDIR = Babel.attr_dir
24491 for item in node.traverse(head) do
24492 node.set_attribute(item, ATDIR, 0x80)
24493 end
24494 return head
24495 end
24496 %</basic>
24497 % \end{macrocode}
24498 %
24499 % \section{Data for CJK}
24500 %
24501 % It is a boring file and it is not shown here (see the generated file),
24502 % but here is a sample:
24503 %\begin{verbatim}
24504 % [0x0021]={c='ex'},
24505 % [0x0024]={c='pr'},
24506 % [0x0025]={c='po'},
24507 % [0x0028]={c='op'},
24508 % [0x0029]={c='cp'},
24509 % [0x002B]={c='pr'},
24510 %\end{verbatim}
24511 % For the meaning of these codes, see the Unicode standard.
24512 %
24513 %\iffalse
24514 % \begin{macrocode}
24515 %<*cjkdata>
24516 Babel.cjk_characters = {
24517 [0x0021]={c='ex'},
24518 [0x0022]={c='qu'},
24519 [0x0024]={c='pr'},
24520 [0x0025]={c='po'},
24521 [0x0027]={c='qu'},
24522 [0x0028]={c='op'},
24523 [0x0029]={c='cp'},
24524 [0x002B]={c='pr'},
24525 [0x002C]={c='is'},
24526 [0x002D]={c='hy'},
24527 [0x002E]={c='is'},
24528 [0x002F]={c='sy'},
24529 [0x003A]={c='is'},
24530 [0x003B]={c='is'},
24531 [0x003F]={c='ex'},
24532 [0x005B]={c='op'},
24533 [0x005C]={c='pr'},
24534 [0x005D]={c='cp'},
24535 [0x007B]={c='op'},
24536 [0x007D]={c='cl'},
24537 [0x00A1]={c='op'},
24538 [0x00A2]={c='po'},
24539 [0x00A3]={c='pr'},
24540 [0x00A4]={c='pr'},
24541 [0x00A5]={c='pr'},
24542 [0x00AB]={c='qu'},
24543 [0x00B0]={c='po'},
24544 [0x00B1]={c='pr'},
24545 [0x00BB]={c='qu'},
24546 [0x2018]={c='qu'},
24547 [0x2019]={c='qu'},
24548 [0x201A]={c='op'},
24549 [0x201B]={c='qu'},
24550 [0x201C]={c='qu'},
24551 [0x201D]={c='qu'},
24552 [0x201E]={c='op'},
24553 [0x201F]={c='qu'},
24554 [0x2024]={c='in'},
24555 [0x2025]={c='in'},
24556 [0x2026]={c='in'},
24557 [0x2030]={c='po'},
24558 [0x2031]={c='po'},
24559 [0x2032]={c='po'},
24560 [0x2033]={c='po'},
24561 [0x2034]={c='po'},
24562 [0x2035]={c='po'},
24563 [0x2036]={c='po'},
24564 [0x2037]={c='po'},
24565 [0x2039]={c='qu'},
24566 [0x203A]={c='qu'},
24567 [0x203C]={c='ns'},
24568 [0x203D]={c='ns'},
24569 [0x2044]={c='is'},
24570 [0x2045]={c='op'},
24571 [0x2046]={c='cl'},
24572 [0x2047]={c='ns'},
24573 [0x2048]={c='ns'},
24574 [0x2049]={c='ns'},
24575 [0x207D]={c='op'},
24576 [0x207E]={c='cl'},
24577 [0x208D]={c='op'},
24578 [0x208E]={c='cl'},
24579 [0x20A7]={c='po'},
24580 [0x20B6]={c='po'},
24581 [0x20BB]={c='po'},
24582 [0x20BE]={c='po'},
24583 [0x2103]={c='po'},
24584 [0x2109]={c='po'},
24585 [0x2116]={c='pr'},
24586 [0x2212]={c='pr'},
24587 [0x2213]={c='pr'},
24588 [0x22EF]={c='in'},
24589 [0x2308]={c='op'},
24590 [0x2309]={c='cl'},
24591 [0x230A]={c='op'},
24592 [0x230B]={c='cl'},
24593 [0x2329]={c='op'},
24594 [0x232A]={c='cl'},
24595 [0x2983]={c='op'},
24596 [0x2984]={c='cl'},
24597 [0x2985]={c='op'},
24598 [0x2986]={c='cl'},
24599 [0x2987]={c='op'},
24600 [0x2988]={c='cl'},
24601 [0x2989]={c='op'},
24602 [0x298A]={c='cl'},
24603 [0x298B]={c='op'},
24604 [0x298C]={c='cl'},
24605 [0x298D]={c='op'},
24606 [0x298E]={c='cl'},
24607 [0x298F]={c='op'},
24608 [0x2990]={c='cl'},
24609 [0x2991]={c='op'},
24610 [0x2992]={c='cl'},
24611 [0x2993]={c='op'},
24612 [0x2994]={c='cl'},
24613 [0x2995]={c='op'},
24614 [0x2996]={c='cl'},
24615 [0x2997]={c='op'},
24616 [0x2998]={c='cl'},
24617 [0x29D8]={c='op'},
24618 [0x29D9]={c='cl'},
24619 [0x29DA]={c='op'},
24620 [0x29DB]={c='cl'},
24621 [0x29FC]={c='op'},
24622 [0x29FD]={c='cl'},
24623 [0x2CF9]={c='ex'},
24624 [0x2CFE]={c='ex'},
24625 [0x2E02]={c='qu'},
24626 [0x2E03]={c='qu'},
24627 [0x2E04]={c='qu'},
24628 [0x2E05]={c='qu'},
24629 [0x2E06]={c='qu'},
24630 [0x2E07]={c='qu'},
24631 [0x2E08]={c='qu'},
24632 [0x2E09]={c='qu'},
24633 [0x2E0A]={c='qu'},
24634 [0x2E0B]={c='qu'},
24635 [0x2E0C]={c='qu'},
24636 [0x2E0D]={c='qu'},
24637 [0x2E18]={c='op'},
24638 [0x2E1C]={c='qu'},
24639 [0x2E1D]={c='qu'},
24640 [0x2E20]={c='qu'},
24641 [0x2E21]={c='qu'},
24642 [0x2E22]={c='op'},
24643 [0x2E23]={c='cl'},
24644 [0x2E24]={c='op'},
24645 [0x2E25]={c='cl'},
24646 [0x2E26]={c='op'},
24647 [0x2E27]={c='cl'},
24648 [0x2E28]={c='op'},
24649 [0x2E29]={c='cl'},
24650 [0x2E2E]={c='ex'},
24651 [0x2E42]={c='op'},
24652 [0x3001]={c='cl'},
24653 [0x3002]={c='cl'},
24654 [0x3005]={c='ns'},
24655 [0x3008]={c='op'},
24656 [0x3009]={c='cl'},
24657 [0x300A]={c='op'},
24658 [0x300B]={c='cl'},
24659 [0x300C]={c='op'},
24660 [0x300D]={c='cl'},
24661 [0x300E]={c='op'},
24662 [0x300F]={c='cl'},
24663 [0x3010]={c='op'},
24664 [0x3011]={c='cl'},
24665 [0x3014]={c='op'},
24666 [0x3015]={c='cl'},
24667 [0x3016]={c='op'},
24668 [0x3017]={c='cl'},
24669 [0x3018]={c='op'},
24670 [0x3019]={c='cl'},
24671 [0x301A]={c='op'},
24672 [0x301B]={c='cl'},
24673 [0x301C]={c='ns'},
24674 [0x301D]={c='op'},
24675 [0x301E]={c='cl'},
24676 [0x301F]={c='cl'},
24677 [0x3043]={c='cj'},
24678 [0x3045]={c='cj'},
24679 [0x3047]={c='cj'},
24680 [0x3049]={c='cj'},
24681 [0x3063]={c='cj'},
24682 [0x3083]={c='cj'},
24683 [0x3085]={c='cj'},
24684 [0x3087]={c='cj'},
24685 [0x308E]={c='cj'},
24686 [0x3095]={c='cj'},
24687 [0x3096]={c='cj'},
24688 [0x303B]={c='ns'},
24689 [0x303C]={c='ns'},
24690 [0x3041]={c='cj'},
24691 [0x309B]={c='ns'},
24692 [0x309C]={c='ns'},
24693 [0x309D]={c='ns'},
24694 [0x309E]={c='ns'},
24695 [0x30A0]={c='ns'},
24696 [0x30A1]={c='cj'},
24697 [0x30A3]={c='cj'},
24698 [0x30A5]={c='cj'},
24699 [0x30A7]={c='cj'},
24700 [0x30A9]={c='cj'},
24701 [0x30C3]={c='cj'},
24702 [0x30E3]={c='cj'},
24703 [0x30E5]={c='cj'},
24704 [0x30E7]={c='cj'},
24705 [0x30EE]={c='cj'},
24706 [0x30F5]={c='cj'},
24707 [0x30F6]={c='cj'},
24708 [0x30FB]={c='ns'},
24709 [0x30FC]={c='cj'},
24710 [0x30FD]={c='ns'},
24711 [0x30FE]={c='ns'},
24712 [0xA015]={c='ns'},
24713 [0xA60E]={c='ex'},
24714 [0xA838]={c='po'},
24715 [0xFD3E]={c='cl'},
24716 [0xFD3F]={c='op'},
24717 [0xFDFC]={c='po'},
24718 [0xFE10]={c='is'},
24719 [0xFE11]={c='cl'},
24720 [0xFE12]={c='cl'},
24721 [0xFE13]={c='is'},
24722 [0xFE14]={c='is'},
24723 [0xFE15]={c='ex'},
24724 [0xFE16]={c='ex'},
24725 [0xFE17]={c='op'},
24726 [0xFE18]={c='cl'},
24727 [0xFE19]={c='in'},
24728 [0xFE35]={c='op'},
24729 [0xFE36]={c='cl'},
24730 [0xFE37]={c='op'},
24731 [0xFE38]={c='cl'},
24732 [0xFE39]={c='op'},
24733 [0xFE3A]={c='cl'},
24734 [0xFE3B]={c='op'},
24735 [0xFE3C]={c='cl'},
24736 [0xFE3D]={c='op'},
24737 [0xFE3E]={c='cl'},
24738 [0xFE3F]={c='op'},
24739 [0xFE40]={c='cl'},
24740 [0xFE41]={c='op'},
24741 [0xFE42]={c='cl'},
24742 [0xFE43]={c='op'},
24743 [0xFE44]={c='cl'},
24744 [0xFE47]={c='op'},
24745 [0xFE48]={c='cl'},
24746 [0xFE50]={c='cl'},
24747 [0xFE52]={c='cl'},
24748 [0xFE54]={c='ns'},
24749 [0xFE55]={c='ns'},
24750 [0xFE56]={c='ex'},
24751 [0xFE57]={c='ex'},
24752 [0xFE59]={c='op'},
24753 [0xFE5A]={c='cl'},
24754 [0xFE5B]={c='op'},
24755 [0xFE5C]={c='cl'},
24756 [0xFE5D]={c='op'},
24757 [0xFE5E]={c='cl'},
24758 [0xFE69]={c='pr'},
24759 [0xFE6A]={c='po'},
24760 [0xFF01]={c='ex', w='f'},
24761 [0xFF04]={c='pr', w='f'},
24762 [0xFF05]={c='po', w='f'},
24763 [0xFF08]={c='op', w='f'},
24764 [0xFF09]={c='cl', w='f'},
24765 [0xFF0C]={c='cl', w='f'},
24766 [0xFF0E]={c='cl', w='f'},
24767 [0xFF1A]={c='ns', w='f'},
24768 [0xFF1B]={c='ns', w='f'},
24769 [0xFF1F]={c='ex', w='f'},
24770 [0xFF3B]={c='op', w='f'},
24771 [0xFF3D]={c='cl', w='f'},
24772 [0xFF5B]={c='op', w='f'},
24773 [0xFF5D]={c='cl', w='f'},
24774 [0xFF5F]={c='op', w='f'},
24775 [0xFF60]={c='cl', w='f'},
24776 [0xFF61]={c='cl', w='h'},
24777 [0xFF62]={c='op', w='h'},
24778 [0xFF63]={c='cl', w='h'},
24779 [0xFF64]={c='cl', w='h'},
24780 [0xFF70]={c='cj'}
24781 }
24782
24783 Babel.cjk_class = setmetatable ( Babel.cjk_characters, {
24784 __index = function(_, k)
24785 if (k >= 0xAC00 and k <= 0xD7A3) -- H2/H3
24786 or (k >= 0x2E80 and k <= 0x31E9) -- Skip small
24787 or (k >= 0x3200 and k <= 0x9FFF)
24788 or (k >= 0xA000 and k <= 0xA48F) -- Yi
24789 or (k >= 0xA490 and k <= 0xA4CF) -- Yi
24790 or (k >= 0xF900 and k <= 0xFAFF)
24791 or (k >= 0xFE10 and k <= 0xFE1F)
24792 or (k >= 0xFE30 and k <= 0xFE6F)
24793 or (k >= 0xFF00 and k <= 0xFF66) -- Skip small
24794 or (k >= 0xFF70 and k <= 0xFFEF)
24795 or (k >= 0x1F000 and k <= 0x1FFFD)
24796 or (k >= 0x20000 and k <= 0x2FFFD)
24797 or (k >= 0x30000 and k <= 0x3FFFD) then
24798 return {c='I'}
24799 elseif (k >= 0x20A0 and k <= 0x20CF) then
24800 return {c='pr'}
24801 elseif (k >= 0x31F0 and k <= 0x31FF)
24802 or (k >= 0xFF67 and k <= 0xFF6F)
24803 or (k >= 0x1B150 and k <= 0x1B152)
24804 or (k >= 0x1B164 and k <= 0x1B167) then
24805 return {c='cj'}
24806 else
24807 return {c='O'}
24808 end
24809 end })
24810
24811 -- Note ns = ex = sy = is = po = hy. Here, 'I' and 'O' are
24812 -- pseudo-classes for ideographic-like (id, h2, h3), and 'other',
24813 -- respectively. Jamo is not considered yet, but very likely at least
24814 -- jl must be.
24815
24816 Babel.cjk_breaks = {
24817 ['op'] = { },
24818 ['cl'] = { ['op']=1, ['pr']=1, ['in']=1, ['I']=1 },
24819 ['ns'] = { ['op']=1, ['pr']=1, ['po']=1, ['in']=1, ['I']=1 },
24820 ['ex'] = { ['op']=1, ['pr']=1, ['po']=1, ['in']=1, ['I']=1 },
24821 ['sy'] = { ['op']=1, ['pr']=1, ['po']=1, ['in']=1, ['I']=1 },
24822 ['is'] = { ['op']=1, ['pr']=1, ['po']=1, ['in']=1, ['I']=1 },
24823 ['pr'] = { ['pr']=1, ['po']=1, ['in']=1 },
24824 ['po'] = { ['op']=1, ['pr']=1, ['po']=1, ['in']=1, ['I']=1 },
24825 ['in'] = { ['op']=1, ['pr']=1, ['po']=1, ['I']=1 },
24826 ['hy'] = { ['op']=1, ['pr']=1, ['po']=1, ['in']=1, ['I']=1 },
24827 ['qu'] = { },
24828 --
24829 ['I'] = { ['op']=1, ['pr']=1, ['I']=1, ['O']=1 },
24830 ['O'] = { ['I']=1 }
24831 }
24832 %</cjkdata>
24833 % \end{macrocode}
24834 %\fi
24835 %
24836 % \section{The `nil' language}
24837 %
24838 % This `language' does nothing, except setting the hyphenation patterns
24839 % to nohyphenation. For this language currently no special definitions
24840 % are needed or available.
24841 %
24842 % The macro |\LdfInit| takes care of preventing that this file is
24843 % loaded more than once, checking the category code of the \texttt{@}
24844 % sign, etc.
24845 %
24846 % \begin{macrocode}
24847 %<*nil>
24848 \ProvidesLanguage{nil}[<@date@> v<@version@> Nil language]
24849 \LdfInit{nil}{datenil}
24850 % \end{macrocode}
24851 %
24852 % When this file is read as an option, i.e., by the |\usepackage|
24853 % command, \texttt{nil} could be an `unknown' language in which case we
24854 % have to make it known.
24855 %
24856 % \begin{macrocode}
24857 \ifx\l@nil\@undefined
24858 \newlanguage\l@nil
24859 \@namedef{bbl@hyphendata@\the\l@nil}{{}{}}% Remove warning
24860 \let\bbl@elt\relax
24861 \edef\bbl@languages{% Add it to the list of languages
24862 \bbl@languages\bbl@elt{nil}{\the\l@nil}{}{}}
24863 \fi
24864 % \end{macrocode}
24865 %
24866 % This macro is used to store the values of the hyphenation parameters
24867 % |\lefthyphenmin| and |\righthyphenmin|.
24868 %
24869 % \begin{macrocode}
24870 \providehyphenmins{\CurrentOption}{\m@ne\m@ne}
24871 % \end{macrocode}
24872 %
24873 % The next step consists of defining commands to switch to (and from)
24874 % the `nil' language.
24875 % \macro{\captionnil}
24876 % \macro{\datenil}
24877 %
24878 % \begin{macrocode}
24879 \let\captionsnil\@empty
24880 \let\datenil\@empty
24881 % \end{macrocode}
24882 %
24883 % There is no locale file for this pseudo-language, so the
24884 % corresponding fields are defined here.
24885 %
24886 % \begin{macrocode}
24887 \def\bbl@inidata@nil{%
24888 \bbl@elt{identification}{tag.ini}{und}%
24889 \bbl@elt{identification}{load.level}{0}%
24890 \bbl@elt{identification}{charset}{utf8}%
24891 \bbl@elt{identification}{version}{1.0}%
24892 \bbl@elt{identification}{date}{2022-05-16}%
24893 \bbl@elt{identification}{name.local}{nil}%
24894 \bbl@elt{identification}{name.english}{nil}%
24895 \bbl@elt{identification}{name.babel}{nil}%
24896 \bbl@elt{identification}{tag.bcp47}{und}%
24897 \bbl@elt{identification}{language.tag.bcp47}{und}%
24898 \bbl@elt{identification}{tag.opentype}{dflt}%
24899 \bbl@elt{identification}{script.name}{Latin}%
24900 \bbl@elt{identification}{script.tag.bcp47}{Latn}%
24901 \bbl@elt{identification}{script.tag.opentype}{DFLT}%
24902 \bbl@elt{identification}{level}{1}%
24903 \bbl@elt{identification}{encodings}{}%
24904 \bbl@elt{identification}{derivate}{no}}
24905 \@namedef{bbl@tbcp@nil}{und}
24906 \@namedef{bbl@lbcp@nil}{und}
24907 \@namedef{bbl@casing@nil}{und}
24908 \@namedef{bbl@lotf@nil}{dflt}
24909 \@namedef{bbl@elname@nil}{nil}
24910 \@namedef{bbl@lname@nil}{nil}
24911 \@namedef{bbl@esname@nil}{Latin}
24912 \@namedef{bbl@sname@nil}{Latin}
24913 \@namedef{bbl@sbcp@nil}{Latn}
24914 \@namedef{bbl@sotf@nil}{latn}
24915 % \end{macrocode}
24916 %
24917 % The macro |\ldf@finish| takes care of looking for a configuration
24918 % file, setting the main language to be switched on at
24919 % |\begin{document}| and resetting the category code of \texttt{@} to
24920 % its original value.
24921 %
24922 % \begin{macrocode}
24923 \ldf@finish{nil}
24924 %</nil>
24925 % \end{macrocode}
24926 %
24927 % \section{Calendars}
24928 %
24929 % The code for specific calendars are placed in the
24930 % specific files, loaded when requested by an |ini| file in the
24931 % |identification| section with |require.calendars|.
24932 %
24933 % Start with function to compute the Julian day. It’s based on the
24934 % little library |calendar.js|, by John Walker, in the public domain.
24935 % \begin{macrocode}
24936 %<<*Compute Julian day>>
24937 \def\bbl@fpmod#1#2{(#1-#2*floor(#1/#2))}
24938 \def\bbl@cs@gregleap#1{%
24939 (\bbl@fpmod{#1}{4} == 0) &&
24940 (!((\bbl@fpmod{#1}{100} == 0) && (\bbl@fpmod{#1}{400} != 0)))}
24941 \def\bbl@cs@jd#1#2#3{% year, month, day
24942 \fpeval{ 1721424.5 + (365 * (#1 - 1)) +
24943 floor((#1 - 1) / 4) + (-floor((#1 - 1) / 100)) +
24944 floor((#1 - 1) / 400) + floor((((367 * #2) - 362) / 12) +
24945 ((#2 <= 2) ? 0 : (\bbl@cs@gregleap{#1} ? -1 : -2)) + #3) }}
24946 %<</Compute Julian day>>
24947 % \end{macrocode}
24948 % \subsection{Islamic}
24949 % The code for the Civil calendar is based on it, too.
24950 %
24951 % \begin{macrocode}
24952 %<*ca-islamic>
24953 <@Compute Julian day@>
24954 % == islamic (default)
24955 % Not yet implemented
24956 \def\bbl@ca@islamic#1-#2-#3\@@#4#5#6{}
24957 % \end{macrocode}
24958 %
24959 % The Civil calendar.
24960 %
24961 % \begin{macrocode}
24962 \def\bbl@cs@isltojd#1#2#3{ % year, month, day
24963 ((#3 + ceil(29.5 * (#2 - 1)) +
24964 (#1 - 1) * 354 + floor((3 + (11 * #1)) / 30) +
24965 1948439.5) - 1) }
24966 \@namedef{bbl@ca@islamic-civil++}{\bbl@ca@islamicvl@x{+2}}
24967 \@namedef{bbl@ca@islamic-civil+}{\bbl@ca@islamicvl@x{+1}}
24968 \@namedef{bbl@ca@islamic-civil}{\bbl@ca@islamicvl@x{}}
24969 \@namedef{bbl@ca@islamic-civil-}{\bbl@ca@islamicvl@x{-1}}
24970 \@namedef{bbl@ca@islamic-civil--}{\bbl@ca@islamicvl@x{-2}}
24971 \def\bbl@ca@islamicvl@x#1#2-#3-#4\@@#5#6#7{%
24972 \edef\bbl@tempa{%
24973 \fpeval{ floor(\bbl@cs@jd{#2}{#3}{#4})+0.5 #1}}%
24974 \edef#5{%
24975 \fpeval{ floor(((30*(\[email protected])) + 10646)/10631) }}%
24976 \edef#6{\fpeval{
24977 min(12,ceil((\bbl@tempa-(29+\bbl@cs@isltojd{#5}{1}{1}))/29.5)+1) }}%
24978 \edef#7{\fpeval{ \bbl@tempa - \bbl@cs@isltojd{#5}{#6}{1} + 1} }}
24979 % \end{macrocode}
24980 %
24981 % The Umm al-Qura calendar, used mainly in Saudi Arabia, is based
24982 % on \textsf{moment-hijri}, by Abdullah Alsigar (license MIT).
24983 %
24984 % Since the main aim is to provide a suitable |\today|, and maybe some
24985 % close dates, data just covers Hijri $\sim$1435/$\sim$1460 (Gregorian
24986 % $\sim$2014/$\sim$2038).
24987 %
24988 % \begin{macrocode}
24989 \def\bbl@cs@umalqura@data{56660, 56690,56719,56749,56778,56808,%
24990 56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,%
24991 57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,%
24992 57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,%
24993 57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,%
24994 58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,%
24995 58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,%
24996 58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,%
24997 58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,%
24998 59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,%
24999 59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,%
25000 59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,%
25001 60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,%
25002 60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,%
25003 60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,%
25004 60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,%
25005 61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,%
25006 61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,%
25007 61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,%
25008 62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,%
25009 62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,%
25010 62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,%
25011 63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,%
25012 63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,%
25013 63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,%
25014 63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,%
25015 64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,%
25016 64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,%
25017 64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,%
25018 65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,%
25019 65401,65431,65460,65490,65520}
25020 \@namedef{bbl@ca@islamic-umalqura+}{\bbl@ca@islamcuqr@x{+1}}
25021 \@namedef{bbl@ca@islamic-umalqura}{\bbl@ca@islamcuqr@x{}}
25022 \@namedef{bbl@ca@islamic-umalqura-}{\bbl@ca@islamcuqr@x{-1}}
25023 \def\bbl@ca@islamcuqr@x#1#2-#3-#4\@@#5#6#7{%
25024 \ifnum#2>2014 \ifnum#2<2038
25025 \bbl@afterfi\expandafter\@gobble
25026 \fi\fi
25027 {\bbl@error{year-out-range}{2014-2038}{}{}}%
25028 \edef\bbl@tempd{\fpeval{ % (Julian) day
25029 \bbl@cs@jd{#2}{#3}{#4} + 0.5 - 2400000 #1}}%
25030 \count@\@ne
25031 \bbl@foreach\bbl@cs@umalqura@data{%
25032 \advance\count@\@ne
25033 \ifnum##1>\bbl@tempd\else
25034 \edef\bbl@tempe{\the\count@}%
25035 \edef\bbl@tempb{##1}%
25036 \fi}%
25037 \edef\bbl@templ{\fpeval{ \bbl@tempe + 16260 + 949 }}% month~lunar
25038 \edef\bbl@tempa{\fpeval{ floor((\bbl@templ - 1 ) / 12) }}% annus
25039 \edef#5{\fpeval{ \bbl@tempa + 1 }}%
25040 \edef#6{\fpeval{ \bbl@templ - (12 * \bbl@tempa) }}%
25041 \edef#7{\fpeval{ \bbl@tempd - \bbl@tempb + 1 }}}
25042 \bbl@add\bbl@precalendar{%
25043 \bbl@replace\bbl@ld@calendar{-civil}{}%
25044 \bbl@replace\bbl@ld@calendar{-umalqura}{}%
25045 \bbl@replace\bbl@ld@calendar{+}{}%
25046 \bbl@replace\bbl@ld@calendar{-}{}}
25047 %</ca-islamic>
25048 % \end{macrocode}
25049 %
25050 % \subsection{Hebrew}
25051 %
25052 % This is basically the set of macros written by Michail Rozman in
25053 % 1991, with corrections and adaptions by Rama Porrat, Misha, Dan Haran
25054 % and Boris Lavva. This must be eventually replaced by computations
25055 % with \textsf{l3fp}. An explanation of what’s going on can be found in
25056 % \texttt{hebcal.sty}
25057 %
25058 % \begin{macrocode}
25059 %<*ca-hebrew>
25060 \newcount\bbl@cntcommon
25061 \def\bbl@remainder#1#2#3{%
25062 #3=#1\relax
25063 \divide #3 by #2\relax
25064 \multiply #3 by -#2\relax
25065 \advance #3 by #1\relax}%
25066 \newif\ifbbl@divisible
25067 \def\bbl@checkifdivisible#1#2{%
25068 {\countdef\tmp=0
25069 \bbl@remainder{#1}{#2}{\tmp}%
25070 \ifnum \tmp=0
25071 \global\bbl@divisibletrue
25072 \else
25073 \global\bbl@divisiblefalse
25074 \fi}}
25075 \newif\ifbbl@gregleap
25076 \def\bbl@ifgregleap#1{%
25077 \bbl@checkifdivisible{#1}{4}%
25078 \ifbbl@divisible
25079 \bbl@checkifdivisible{#1}{100}%
25080 \ifbbl@divisible
25081 \bbl@checkifdivisible{#1}{400}%
25082 \ifbbl@divisible
25083 \bbl@gregleaptrue
25084 \else
25085 \bbl@gregleapfalse
25086 \fi
25087 \else
25088 \bbl@gregleaptrue
25089 \fi
25090 \else
25091 \bbl@gregleapfalse
25092 \fi
25093 \ifbbl@gregleap}
25094 \def\bbl@gregdayspriormonths#1#2#3{%
25095 {#3=\ifcase #1 0 \or 0 \or 31 \or 59 \or 90 \or 120 \or 151 \or
25096 181 \or 212 \or 243 \or 273 \or 304 \or 334 \fi
25097 \bbl@ifgregleap{#2}%
25098 \ifnum #1 > 2
25099 \advance #3 by 1
25100 \fi
25101 \fi
25102 \global\bbl@cntcommon=#3}%
25103 #3=\bbl@cntcommon}
25104 \def\bbl@gregdaysprioryears#1#2{%
25105 {\countdef\tmpc=4
25106 \countdef\tmpb=2
25107 \tmpb=#1\relax
25108 \advance \tmpb by -1
25109 \tmpc=\tmpb
25110 \multiply \tmpc by 365
25111 #2=\tmpc
25112 \tmpc=\tmpb
25113 \divide \tmpc by 4
25114 \advance #2 by \tmpc
25115 \tmpc=\tmpb
25116 \divide \tmpc by 100
25117 \advance #2 by -\tmpc
25118 \tmpc=\tmpb
25119 \divide \tmpc by 400
25120 \advance #2 by \tmpc
25121 \global\bbl@cntcommon=#2\relax}%
25122 #2=\bbl@cntcommon}
25123 \def\bbl@absfromgreg#1#2#3#4{%
25124 {\countdef\tmpd=0
25125 #4=#1\relax
25126 \bbl@gregdayspriormonths{#2}{#3}{\tmpd}%
25127 \advance #4 by \tmpd
25128 \bbl@gregdaysprioryears{#3}{\tmpd}%
25129 \advance #4 by \tmpd
25130 \global\bbl@cntcommon=#4\relax}%
25131 #4=\bbl@cntcommon}
25132 \newif\ifbbl@hebrleap
25133 \def\bbl@checkleaphebryear#1{%
25134 {\countdef\tmpa=0
25135 \countdef\tmpb=1
25136 \tmpa=#1\relax
25137 \multiply \tmpa by 7
25138 \advance \tmpa by 1
25139 \bbl@remainder{\tmpa}{19}{\tmpb}%
25140 \ifnum \tmpb < 7
25141 \global\bbl@hebrleaptrue
25142 \else
25143 \global\bbl@hebrleapfalse
25144 \fi}}
25145 \def\bbl@hebrelapsedmonths#1#2{%
25146 {\countdef\tmpa=0
25147 \countdef\tmpb=1
25148 \countdef\tmpc=2
25149 \tmpa=#1\relax
25150 \advance \tmpa by -1
25151 #2=\tmpa
25152 \divide #2 by 19
25153 \multiply #2 by 235
25154 \bbl@remainder{\tmpa}{19}{\tmpb}% \tmpa=years%19-years this cycle
25155 \tmpc=\tmpb
25156 \multiply \tmpb by 12
25157 \advance #2 by \tmpb
25158 \multiply \tmpc by 7
25159 \advance \tmpc by 1
25160 \divide \tmpc by 19
25161 \advance #2 by \tmpc
25162 \global\bbl@cntcommon=#2}%
25163 #2=\bbl@cntcommon}
25164 \def\bbl@hebrelapseddays#1#2{%
25165 {\countdef\tmpa=0
25166 \countdef\tmpb=1
25167 \countdef\tmpc=2
25168 \bbl@hebrelapsedmonths{#1}{#2}%
25169 \tmpa=#2\relax
25170 \multiply \tmpa by 13753
25171 \advance \tmpa by 5604
25172 \bbl@remainder{\tmpa}{25920}{\tmpc}% \tmpc == ConjunctionParts
25173 \divide \tmpa by 25920
25174 \multiply #2 by 29
25175 \advance #2 by 1
25176 \advance #2 by \tmpa
25177 \bbl@remainder{#2}{7}{\tmpa}%
25178 \ifnum \tmpc < 19440
25179 \ifnum \tmpc < 9924
25180 \else
25181 \ifnum \tmpa=2
25182 \bbl@checkleaphebryear{#1}% of a common year
25183 \ifbbl@hebrleap
25184 \else
25185 \advance #2 by 1
25186 \fi
25187 \fi
25188 \fi
25189 \ifnum \tmpc < 16789
25190 \else
25191 \ifnum \tmpa=1
25192 \advance #1 by -1
25193 \bbl@checkleaphebryear{#1}% at the end of leap year
25194 \ifbbl@hebrleap
25195 \advance #2 by 1
25196 \fi
25197 \fi
25198 \fi
25199 \else
25200 \advance #2 by 1
25201 \fi
25202 \bbl@remainder{#2}{7}{\tmpa}%
25203 \ifnum \tmpa=0
25204 \advance #2 by 1
25205 \else
25206 \ifnum \tmpa=3
25207 \advance #2 by 1
25208 \else
25209 \ifnum \tmpa=5
25210 \advance #2 by 1
25211 \fi
25212 \fi
25213 \fi
25214 \global\bbl@cntcommon=#2\relax}%
25215 #2=\bbl@cntcommon}
25216 \def\bbl@daysinhebryear#1#2{%
25217 {\countdef\tmpe=12
25218 \bbl@hebrelapseddays{#1}{\tmpe}%
25219 \advance #1 by 1
25220 \bbl@hebrelapseddays{#1}{#2}%
25221 \advance #2 by -\tmpe
25222 \global\bbl@cntcommon=#2}%
25223 #2=\bbl@cntcommon}
25224 \def\bbl@hebrdayspriormonths#1#2#3{%
25225 {\countdef\tmpf= 14
25226 #3=\ifcase #1
25227 0 \or
25228 0 \or
25229 30 \or
25230 59 \or
25231 89 \or
25232 118 \or
25233 148 \or
25234 148 \or
25235 177 \or
25236 207 \or
25237 236 \or
25238 266 \or
25239 295 \or
25240 325 \or
25241 400
25242 \fi
25243 \bbl@checkleaphebryear{#2}%
25244 \ifbbl@hebrleap
25245 \ifnum #1 > 6
25246 \advance #3 by 30
25247 \fi
25248 \fi
25249 \bbl@daysinhebryear{#2}{\tmpf}%
25250 \ifnum #1 > 3
25251 \ifnum \tmpf=353
25252 \advance #3 by -1
25253 \fi
25254 \ifnum \tmpf=383
25255 \advance #3 by -1
25256 \fi
25257 \fi
25258 \ifnum #1 > 2
25259 \ifnum \tmpf=355
25260 \advance #3 by 1
25261 \fi
25262 \ifnum \tmpf=385
25263 \advance #3 by 1
25264 \fi
25265 \fi
25266 \global\bbl@cntcommon=#3\relax}%
25267 #3=\bbl@cntcommon}
25268 \def\bbl@absfromhebr#1#2#3#4{%
25269 {#4=#1\relax
25270 \bbl@hebrdayspriormonths{#2}{#3}{#1}%
25271 \advance #4 by #1\relax
25272 \bbl@hebrelapseddays{#3}{#1}%
25273 \advance #4 by #1\relax
25274 \advance #4 by -1373429
25275 \global\bbl@cntcommon=#4\relax}%
25276 #4=\bbl@cntcommon}
25277 \def\bbl@hebrfromgreg#1#2#3#4#5#6{%
25278 {\countdef\tmpx= 17
25279 \countdef\tmpy= 18
25280 \countdef\tmpz= 19
25281 #6=#3\relax
25282 \global\advance #6 by 3761
25283 \bbl@absfromgreg{#1}{#2}{#3}{#4}%
25284 \tmpz=1 \tmpy=1
25285 \bbl@absfromhebr{\tmpz}{\tmpy}{#6}{\tmpx}%
25286 \ifnum \tmpx > #4\relax
25287 \global\advance #6 by -1
25288 \bbl@absfromhebr{\tmpz}{\tmpy}{#6}{\tmpx}%
25289 \fi
25290 \advance #4 by -\tmpx
25291 \advance #4 by 1
25292 #5=#4\relax
25293 \divide #5 by 30
25294 \loop
25295 \bbl@hebrdayspriormonths{#5}{#6}{\tmpx}%
25296 \ifnum \tmpx < #4\relax
25297 \advance #5 by 1
25298 \tmpy=\tmpx
25299 \repeat
25300 \global\advance #5 by -1
25301 \global\advance #4 by -\tmpy}}
25302 \newcount\bbl@hebrday \newcount\bbl@hebrmonth \newcount\bbl@hebryear
25303 \newcount\bbl@gregday \newcount\bbl@gregmonth \newcount\bbl@gregyear
25304 \def\bbl@ca@hebrew#1-#2-#3\@@#4#5#6{%
25305 \bbl@gregday=#3\relax \bbl@gregmonth=#2\relax \bbl@gregyear=#1\relax
25306 \bbl@hebrfromgreg
25307 {\bbl@gregday}{\bbl@gregmonth}{\bbl@gregyear}%
25308 {\bbl@hebrday}{\bbl@hebrmonth}{\bbl@hebryear}%
25309 \edef#4{\the\bbl@hebryear}%
25310 \edef#5{\the\bbl@hebrmonth}%
25311 \edef#6{\the\bbl@hebrday}}
25312 %</ca-hebrew>
25313 % \end{macrocode}
25314 %
25315 % \subsection{Persian}
25316 %
25317 % There is an algorithm written in TeX by Jabri, Abolhassani, Pournader
25318 % and Esfahbod, created for the first versions of the FarsiTeX system
25319 % (no longer available), but the original license is GPL, so its use
25320 % with LPPL is problematic. The code here follows loosely that by John
25321 % Walker, which is free and accurate, but sadly very complex, so
25322 % the relevant data for the years 2013-2050 have been pre-calculated
25323 % and stored. Actually, all we need is the first day (either March 20 or
25324 % March 21).
25325 %
25326 % \begin{macrocode}
25327 %<*ca-persian>
25328 <@Compute Julian day@>
25329 \def\bbl@cs@firstjal@xx{2012,2016,2020,2024,2028,2029,% March 20
25330 2032,2033,2036,2037,2040,2041,2044,2045,2048,2049}
25331 \def\bbl@ca@persian#1-#2-#3\@@#4#5#6{%
25332 \edef\bbl@tempa{#1}% 20XX-03-\bbl@tempe = 1 farvardin:
25333 \ifnum\bbl@tempa>2012 \ifnum\bbl@tempa<2051
25334 \bbl@afterfi\expandafter\@gobble
25335 \fi\fi
25336 {\bbl@error{year-out-range}{2013-2050}{}{}}%
25337 \bbl@xin@{\bbl@tempa}{\bbl@cs@firstjal@xx}%
25338 \ifin@\def\bbl@tempe{20}\else\def\bbl@tempe{21}\fi
25339 \edef\bbl@tempc{\fpeval{\bbl@cs@jd{\bbl@tempa}{#2}{#3}+.5}}% current
25340 \edef\bbl@tempb{\fpeval{\bbl@cs@jd{\bbl@tempa}{03}{\bbl@tempe}+.5}}% begin
25341 \ifnum\bbl@tempc<\bbl@tempb
25342 \edef\bbl@tempa{\fpeval{\bbl@tempa-1}}% go back 1 year and redo
25343 \bbl@xin@{\bbl@tempa}{\bbl@cs@firstjal@xx}%
25344 \ifin@\def\bbl@tempe{20}\else\def\bbl@tempe{21}\fi
25345 \edef\bbl@tempb{\fpeval{\bbl@cs@jd{\bbl@tempa}{03}{\bbl@tempe}+.5}}%
25346 \fi
25347 \edef#4{\fpeval{\bbl@tempa-621}}% set Jalali year
25348 \edef#6{\fpeval{\bbl@tempc-\bbl@tempb+1}}% days from 1 farvardin
25349 \edef#5{\fpeval{% set Jalali month
25350 (#6 <= 186) ? ceil(#6 / 31) : ceil((#6 - 6) / 30)}}
25351 \edef#6{\fpeval{% set Jalali day
25352 (#6 - ((#5 <= 7) ? ((#5 - 1) * 31) : (((#5 - 1) * 30) + 6)))}}}
25353 %</ca-persian>
25354 % \end{macrocode}
25355 %
25356 % \subsection{Coptic and Ethiopic}
25357 %
25358 % Adapted from \texttt{jquery.calendars.package-1.1.4}, written by Keith
25359 % Wood, 2010. Dual license: GPL and MIT. The only difference is the
25360 % epoch.
25361 %
25362 % \begin{macrocode}
25363 %<*ca-coptic>
25364 <@Compute Julian day@>
25365 \def\bbl@ca@coptic#1-#2-#3\@@#4#5#6{%
25366 \edef\bbl@tempd{\fpeval{floor(\bbl@cs@jd{#1}{#2}{#3}) + 0.5}}%
25367 \edef\bbl@tempc{\fpeval{\bbl@tempd - 1825029.5}}%
25368 \edef#4{\fpeval{%
25369 floor((\bbl@tempc - floor((\bbl@tempc+366) / 1461)) / 365) + 1}}%
25370 \edef\bbl@tempc{\fpeval{%
25371 \bbl@tempd - (#4-1) * 365 - floor(#4/4) - 1825029.5}}%
25372 \edef#5{\fpeval{floor(\bbl@tempc / 30) + 1}}%
25373 \edef#6{\fpeval{\bbl@tempc - (#5 - 1) * 30 + 1}}}
25374 %</ca-coptic>
25375 %<*ca-ethiopic>
25376 <@Compute Julian day@>
25377 \def\bbl@ca@ethiopic#1-#2-#3\@@#4#5#6{%
25378 \edef\bbl@tempd{\fpeval{floor(\bbl@cs@jd{#1}{#2}{#3}) + 0.5}}%
25379 \edef\bbl@tempc{\fpeval{\bbl@tempd - 1724220.5}}%
25380 \edef#4{\fpeval{%
25381 floor((\bbl@tempc - floor((\bbl@tempc+366) / 1461)) / 365) + 1}}%
25382 \edef\bbl@tempc{\fpeval{%
25383 \bbl@tempd - (#4-1) * 365 - floor(#4/4) - 1724220.5}}%
25384 \edef#5{\fpeval{floor(\bbl@tempc / 30) + 1}}%
25385 \edef#6{\fpeval{\bbl@tempc - (#5 - 1) * 30 + 1}}}
25386 %</ca-ethiopic>
25387 % \end{macrocode}
25388 %
25389 % \subsection{Julian}
25390 %
25391 % Based on [ReinDersh].
25392 %
25393 % \begin{macrocode}
25394 %<*ca-julian>
25395 <@Compute Julian day@>
25396 \def\bbl@ca@julian#1-#2-#3\@@#4#5#6{%
25397 \edef\bbl@tempj{\fpeval{floor(\bbl@cs@jd{#1}{#2}{#3}) + .5}}%
25398 \edef\bbl@tempa{\fpeval{\bbl@tempj + 32082.5}}%
25399 \edef\bbl@tempb{\fpeval{floor((4 * \bbl@tempa + 3) / 1461)}}%
25400 \edef\bbl@tempc{\fpeval{\bbl@tempa - floor(1461*\bbl@tempb/4)}}%
25401 \edef\bbl@tempd{\fpeval{floor((5 * \bbl@tempc + 2) / 153)}}%
25402 \edef#6{\fpeval{\bbl@tempc - floor((153*\bbl@tempd+2) / 5) + 1}}%
25403 \edef#5{\fpeval{\bbl@tempd + 3 - 12 * floor(\bbl@tempd / 10)}}%
25404 \edef#4{\fpeval{\bbl@tempb - 4800 + floor(\bbl@tempd / 10)}}}
25405 %</ca-julian>
25406 % \end{macrocode}
25407 %
25408 % \subsection{Buddhist}
25409 %
25410 % That’s very simple.
25411 %
25412 % \begin{macrocode}
25413 %<*ca-buddhist>
25414 \def\bbl@ca@buddhist#1-#2-#3\@@#4#5#6{%
25415 \edef#4{\number\numexpr#1+543\relax}%
25416 \edef#5{#2}%
25417 \edef#6{#3}}
25418 %</ca-buddhist>
25419 %
25420 % \subsection{Chinese}
25421 %
25422 % Brute force, with the Julian day of first day of each month. The
25423 % table has been computed with the help of \textsf{python-lunardate} by
25424 % Ricky Yeung, GPLv2 (but the code itself has not been used). The range
25425 % is 2015-2044.
25426 %
25427 % \begin{macrocode}
25428 %<*ca-chinese>
25429 \ExplSyntaxOn
25430 <@Compute Julian day@>
25431 \def\bbl@ca@chinese#1-#2-#3\@@#4#5#6{%
25432 \edef\bbl@tempd{\fpeval{%
25433 \bbl@cs@jd{#1}{#2}{#3} - 2457072.5 }}%
25434 \count@\z@
25435 \@tempcnta=2015
25436 \bbl@foreach\bbl@cs@chinese@data{%
25437 \ifnum##1>\bbl@tempd\else
25438 \advance\count@\@ne
25439 \ifnum\count@>12
25440 \count@\@ne
25441 \advance\@tempcnta\@ne\fi
25442 \bbl@xin@{,##1,}{,\bbl@cs@chinese@leap,}%
25443 \ifin@
25444 \advance\count@\m@ne
25445 \edef\bbl@tempe{\the\numexpr\count@+12\relax}%
25446 \else
25447 \edef\bbl@tempe{\the\count@}%
25448 \fi
25449 \edef\bbl@tempb{##1}%
25450 \fi}%
25451 \edef#4{\the\@tempcnta}%
25452 \edef#5{\bbl@tempe}%
25453 \edef#6{\the\numexpr\bbl@tempd-\bbl@tempb+1\relax}}
25454 \def\bbl@cs@chinese@leap{%
25455 885,1920,2953,3809,4873,5906,6881,7825,8889,9893,10778}
25456 \def\bbl@cs@chinese@data{0,29,59,88,117,147,176,206,236,266,295,325,
25457 354,384,413,443,472,501,531,560,590,620,649,679,709,738,%
25458 768,797,827,856,885,915,944,974,1003,1033,1063,1093,1122,%
25459 1152,1181,1211,1240,1269,1299,1328,1358,1387,1417,1447,1477,%
25460 1506,1536,1565,1595,1624,1653,1683,1712,1741,1771,1801,1830,%
25461 1860,1890,1920,1949,1979,2008,2037,2067,2096,2126,2155,2185,%
25462 2214,2244,2274,2303,2333,2362,2392,2421,2451,2480,2510,2539,%
25463 2569,2598,2628,2657,2687,2717,2746,2776,2805,2835,2864,2894,%
25464 2923,2953,2982,3011,3041,3071,3100,3130,3160,3189,3219,3248,%
25465 3278,3307,3337,3366,3395,3425,3454,3484,3514,3543,3573,3603,%
25466 3632,3662,3691,3721,3750,3779,3809,3838,3868,3897,3927,3957,%
25467 3987,4016,4046,4075,4105,4134,4163,4193,4222,4251,4281,4311,%
25468 4341,4370,4400,4430,4459,4489,4518,4547,4577,4606,4635,4665,%
25469 4695,4724,4754,4784,4814,4843,4873,4902,4931,4961,4990,5019,%
25470 5049,5079,5108,5138,5168,5197,5227,5256,5286,5315,5345,5374,%
25471 5403,5433,5463,5492,5522,5551,5581,5611,5640,5670,5699,5729,%
25472 5758,5788,5817,5846,5876,5906,5935,5965,5994,6024,6054,6083,%
25473 6113,6142,6172,6201,6231,6260,6289,6319,6348,6378,6408,6437,%
25474 6467,6497,6526,6556,6585,6615,6644,6673,6703,6732,6762,6791,%
25475 6821,6851,6881,6910,6940,6969,6999,7028,7057,7087,7116,7146,%
25476 7175,7205,7235,7264,7294,7324,7353,7383,7412,7441,7471,7500,%
25477 7529,7559,7589,7618,7648,7678,7708,7737,7767,7796,7825,7855,%
25478 7884,7913,7943,7972,8002,8032,8062,8092,8121,8151,8180,8209,%
25479 8239,8268,8297,8327,8356,8386,8416,8446,8475,8505,8534,8564,%
25480 8593,8623,8652,8681,8711,8740,8770,8800,8829,8859,8889,8918,%
25481 8948,8977,9007,9036,9066,9095,9124,9154,9183,9213,9243,9272,%
25482 9302,9331,9361,9391,9420,9450,9479,9508,9538,9567,9597,9626,%
25483 9656,9686,9715,9745,9775,9804,9834,9863,9893,9922,9951,9981,%
25484 10010,10040,10069,10099,10129,10158,10188,10218,10247,10277,%
25485 10306,10335,10365,10394,10423,10453,10483,10512,10542,10572,%
25486 10602,10631,10661,10690,10719,10749,10778,10807,10837,10866,%
25487 10896,10926,10956,10986,11015,11045,11074,11103}
25488 \ExplSyntaxOff
25489 %</ca-chinese>
25490 % \end{macrocode}
25491 %
25492 % \section{Support for Plain \TeX\ (\texttt{plain.def})}
25493 %
25494 % \subsection{Not renaming \file{hyphen.tex}}
25495 %
25496 % As Don Knuth has declared that the filename \file{hyphen.tex} may
25497 % only be used to designate \emph{his} version of the american
25498 % English hyphenation patterns, a new solution has to be found in
25499 % order to be able to load hyphenation patterns for other languages
25500 % in a plain-based \TeX-format.
25501 % When asked he responded:
25502 % \begin{quote}
25503 % That file name is “sacred”, and if anybody changes it they will
25504 % cause severe upward/downward compatibility headaches.
25505 %
25506 % People can have a file localhyphen.tex or whatever they like,
25507 % but they mustn't diddle with hyphen.tex (or plain.tex except to
25508 % preload additional fonts).
25509 % \end{quote}
25510 %
25511 % The files \file{bplain.tex} and \file{blplain.tex} can be used as
25512 % replacement wrappers around \file{plain.tex} and
25513 % \file{lplain.tex} to achieve the desired effect, based on the
25514 % \pkg{babel} package. If you load each of them with ini\TeX, you
25515 % will get a file called either \file{bplain.fmt} or
25516 % \file{blplain.fmt}, which you can use as replacements for
25517 % \file{plain.fmt} and \file{lplain.fmt}.
25518 %
25519 % As these files are going to be read as the first thing ini\TeX\
25520 % sees, we need to set some category codes just to be able to
25521 % change the definition of |\input|.
25522 %
25523 % \begin{macrocode}
25524 %<*bplain|blplain>
25525 \catcode`\{=1 % left brace is begin-group character
25526 \catcode`\}=2 % right brace is end-group character
25527 \catcode`\#=6 % hash mark is macro parameter character
25528 % \end{macrocode}
25529 %
25530 % If a file called \file{hyphen.cfg} can be found, we make sure that
25531 % \emph{it} will be read instead of the file \file{hyphen.tex}. We
25532 % do this by first saving the original meaning of |\input| (and I
25533 % use a one letter control sequence for that so as not to waste
25534 % multi-letter control sequence on this in the format).
25535 %
25536 % \begin{macrocode}
25537 \openin 0 hyphen.cfg
25538 \ifeof0
25539 \else
25540 \let\a\input
25541 % \end{macrocode}
25542 %
25543 % Then |\input| is defined to forget about its argument and load
25544 % \file{hyphen.cfg} instead. Once that's done the original meaning
25545 % of |\input| can be restored and the definition of |\a| can be
25546 % forgotten.
25547 %
25548 % \begin{macrocode}
25549 \def\input #1 {%
25550 \let\input\a
25551 \a hyphen.cfg
25552 \let\a\undefined
25553 }
25554 \fi
25555 %</bplain|blplain>
25556 % \end{macrocode}
25557 %
25558 % Now that we have made sure that \file{hyphen.cfg} will be loaded
25559 % at the right moment it is time to load \file{plain.tex}.
25560 %
25561 % \begin{macrocode}
25562 %<bplain>\a plain.tex
25563 %<blplain>\a lplain.tex
25564 % \end{macrocode}
25565 %
25566 % Finally we change the contents of |\fmtname| to indicate that
25567 % this is \emph{not} the plain format, but a format based on plain
25568 % with the \pkg{babel} package preloaded.
25569 %
25570 % \begin{macrocode}
25571 %<bplain>\def\fmtname{babel-plain}
25572 %<blplain>\def\fmtname{babel-lplain}
25573 % \end{macrocode}
25574 %
25575 % When you are using a different format, based on plain.tex you can
25576 % make a copy of blplain.tex, rename it and replace \file{plain.tex}
25577 % with the name of your format file.
25578 %
25579 % \subsection{Emulating some \LaTeX{} features}
25580 %
25581 % The file |babel.def| expects some definitions made in the \LaTeXe{}
25582 % style file. So, in Plain{} we must provide at least
25583 % some predefined values as well some tools to set them (even if not
25584 % all options are available). There are no package options, and
25585 % therefore and alternative mechanism is provided. For the moment,
25586 % only |\babeloptionstrings| and |\babeloptionmath| are provided,
25587 % which can be defined before loading \babel. |\BabelModifiers| can be
25588 % set too (but not sure it works).
25589 %
25590 % \begin{macrocode}
25591 %<<*Emulate LaTeX>>
25592 \def\@empty{}
25593 \def\loadlocalcfg#1{%
25594 \openin0#1.cfg
25595 \ifeof0
25596 \closein0
25597 \else
25598 \closein0
25599 {\immediate\write16{*************************************}%
25600 \immediate\write16{* Local config file #1.cfg used}%
25601 \immediate\write16{*}%
25602 }
25603 \input #1.cfg\relax
25604 \fi
25605 \@endofldf}
25606 % \end{macrocode}
25607 %
25608 % \subsection{General tools}
25609 %
25610 % A number of \LaTeX\ macro's that are needed later on.
25611 %
25612 % \begin{macrocode}
25613 \long\def\@firstofone#1{#1}
25614 \long\def\@firstoftwo#1#2{#1}
25615 \long\def\@secondoftwo#1#2{#2}
25616 \def\@nnil{\@nil}
25617 \def\@gobbletwo#1#2{}
25618 \def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}}
25619 \def\@star@or@long#1{%
25620 \@ifstar
25621 {\let\l@ngrel@x\relax#1}%
25622 {\let\l@ngrel@x\long#1}}
25623 \let\l@ngrel@x\relax
25624 \def\@car#1#2\@nil{#1}
25625 \def\@cdr#1#2\@nil{#2}
25626 \let\@typeset@protect\relax
25627 \let\protected@edef\edef
25628 \long\def\@gobble#1{}
25629 \edef\@backslashchar{\expandafter\@gobble\string\\}
25630 \def\strip@prefix#1>{}
25631 \def\g@addto@macro#1#2{{%
25632 \toks@\expandafter{#1#2}%
25633 \xdef#1{\the\toks@}}}
25634 \def\@namedef#1{\expandafter\def\csname #1\endcsname}
25635 \def\@nameuse#1{\csname #1\endcsname}
25636 \def\@ifundefined#1{%
25637 \expandafter\ifx\csname#1\endcsname\relax
25638 \expandafter\@firstoftwo
25639 \else
25640 \expandafter\@secondoftwo
25641 \fi}
25642 \def\@expandtwoargs#1#2#3{%
25643 \edef\reserved@a{\noexpand#1{#2}{#3}}\reserved@a}
25644 \def\zap@space#1 #2{%
25645 #1%
25646 \ifx#2\@empty\else\expandafter\zap@space\fi
25647 #2}
25648 \let\bbl@trace\@gobble
25649 \def\bbl@error#1{% Implicit #2#3#4
25650 \begingroup
25651 \catcode`\\=0 \catcode`\==12 \catcode`\`=12
25652 \catcode`\^^M=5 \catcode`\%=14
25653 \input errbabel.def
25654 \endgroup
25655 \bbl@error{#1}}
25656 \def\bbl@warning#1{%
25657 \begingroup
25658 \newlinechar=`\^^J
25659 \def\\{^^J(babel) }%
25660 \message{\\#1}%
25661 \endgroup}
25662 \let\bbl@infowarn\bbl@warning
25663 \def\bbl@info#1{%
25664 \begingroup
25665 \newlinechar=`\^^J
25666 \def\\{^^J}%
25667 \wlog{#1}%
25668 \endgroup}
25669 % \end{macrocode}
25670 %
25671 % \LaTeXe\ has the command |\@onlypreamble| which adds commands to
25672 % a list of commands that are no longer needed after
25673 % |\begin{document}|.
25674 %
25675 % \begin{macrocode}
25676 \ifx\@preamblecmds\@undefined
25677 \def\@preamblecmds{}
25678 \fi
25679 \def\@onlypreamble#1{%
25680 \expandafter\gdef\expandafter\@preamblecmds\expandafter{%
25681 \@preamblecmds\do#1}}
25682 \@onlypreamble\@onlypreamble
25683 % \end{macrocode}
25684 %
25685 % Mimic \LaTeX's |\AtBeginDocument|; for this to work the user needs to
25686 % add |\begindocument| to his file.
25687 %
25688 % \begin{macrocode}
25689 \def\begindocument{%
25690 \@begindocumenthook
25691 \global\let\@begindocumenthook\@undefined
25692 \def\do##1{\global\let##1\@undefined}%
25693 \@preamblecmds
25694 \global\let\do\noexpand}
25695 % \end{macrocode}
25696 %
25697 % \begin{macrocode}
25698 \ifx\@begindocumenthook\@undefined
25699 \def\@begindocumenthook{}
25700 \fi
25701 \@onlypreamble\@begindocumenthook
25702 \def\AtBeginDocument{\g@addto@macro\@begindocumenthook}
25703 % \end{macrocode}
25704 %
25705 % We also have to mimic \LaTeX's |\AtEndOfPackage|. Our replacement
25706 % macro is much simpler; it stores its argument in |\@endofldf|.
25707 %
25708 % \begin{macrocode}
25709 \def\AtEndOfPackage#1{\g@addto@macro\@endofldf{#1}}
25710 \@onlypreamble\AtEndOfPackage
25711 \def\@endofldf{}
25712 \@onlypreamble\@endofldf
25713 \let\bbl@afterlang\@empty
25714 \chardef\bbl@opt@hyphenmap\z@
25715 % \end{macrocode}
25716 %
25717 % \LaTeX\ needs to be able to switch off writing to its auxiliary
25718 % files; plain doesn't have them by default. There is a trick to hide
25719 % some conditional commands from the outer |\ifx|. The same trick is
25720 % applied below.
25721 %
25722 % \begin{macrocode}
25723 \catcode`\&=\z@
25724 \ifx&if@filesw\@undefined
25725 \expandafter\let\csname if@filesw\expandafter\endcsname
25726 \csname iffalse\endcsname
25727 \fi
25728 \catcode`\&=4
25729 % \end{macrocode}
25730 %
25731 % Mimic \LaTeX's commands to define control sequences.
25732 %
25733 % \begin{macrocode}
25734 \def\newcommand{\@star@or@long\new@command}
25735 \def\new@command#1{%
25736 \@testopt{\@newcommand#1}0}
25737 \def\@newcommand#1[#2]{%
25738 \@ifnextchar [{\@xargdef#1[#2]}%
25739 {\@argdef#1[#2]}}
25740 \long\def\@argdef#1[#2]#3{%
25741 \@yargdef#1\@ne{#2}{#3}}
25742 \long\def\@xargdef#1[#2][#3]#4{%
25743 \expandafter\def\expandafter#1\expandafter{%
25744 \expandafter\@protected@testopt\expandafter #1%
25745 \csname\string#1\expandafter\endcsname{#3}}%
25746 \expandafter\@yargdef \csname\string#1\endcsname
25747 \tw@{#2}{#4}}
25748 \long\def\@yargdef#1#2#3{%
25749 \@tempcnta#3\relax
25750 \advance \@tempcnta \@ne
25751 \let\@hash@\relax
25752 \edef\reserved@a{\ifx#2\tw@ [\@hash@1]\fi}%
25753 \@tempcntb #2%
25754 \@whilenum\@tempcntb <\@tempcnta
25755 \do{%
25756 \edef\reserved@a{\reserved@a\@hash@\the\@tempcntb}%
25757 \advance\@tempcntb \@ne}%
25758 \let\@hash@##%
25759 \l@ngrel@x\expandafter\def\expandafter#1\reserved@a}
25760 \def\providecommand{\@star@or@long\provide@command}
25761 \def\provide@command#1{%
25762 \begingroup
25763 \escapechar\m@ne\xdef\@gtempa{{\string#1}}%
25764 \endgroup
25765 \expandafter\@ifundefined\@gtempa
25766 {\def\reserved@a{\new@command#1}}%
25767 {\let\reserved@a\relax
25768 \def\reserved@a{\new@command\reserved@a}}%
25769 \reserved@a}%
25770 % \end{macrocode}
25771 %
25772 % \begin{macrocode}
25773 \def\DeclareRobustCommand{\@star@or@long\declare@robustcommand}
25774 \def\declare@robustcommand#1{%
25775 \edef\reserved@a{\string#1}%
25776 \def\reserved@b{#1}%
25777 \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}%
25778 \edef#1{%
25779 \ifx\reserved@a\reserved@b
25780 \noexpand\x@protect
25781 \noexpand#1%
25782 \fi
25783 \noexpand\protect
25784 \expandafter\noexpand\csname
25785 \expandafter\@gobble\string#1 \endcsname
25786 }%
25787 \expandafter\new@command\csname
25788 \expandafter\@gobble\string#1 \endcsname
25789 }
25790 \def\x@protect#1{%
25791 \ifx\protect\@typeset@protect\else
25792 \@x@protect#1%
25793 \fi
25794 }
25795 \catcode`\&=\z@ % Trick to hide conditionals
25796 \def\@x@protect#1&fi#2#3{&fi\protect#1}
25797 % \end{macrocode}
25798 %
25799 % The following little macro |\in@| is taken from \file{latex.ltx}; it
25800 % checks whether its first argument is part of its second argument. It
25801 % uses the boolean |\in@|; allocating a new boolean inside
25802 % conditionally executed code is not possible, hence the construct with
25803 % the temporary definition of |\bbl@tempa|.
25804 %
25805 % \begin{macrocode}
25806 \def\bbl@tempa{\csname newif\endcsname&ifin@}
25807 \catcode`\&=4
25808 \ifx\in@\@undefined
25809 \def\in@#1#2{%
25810 \def\in@@##1#1##2##3\in@@{%
25811 \ifx\in@##2\in@false\else\in@true\fi}%
25812 \in@@#2#1\in@\in@@}
25813 \else
25814 \let\bbl@tempa\@empty
25815 \fi
25816 \bbl@tempa
25817 % \end{macrocode}
25818 %
25819 % \LaTeX\ has a macro to check whether a certain package was loaded
25820 % with specific options. The command has two extra arguments which are
25821 % code to be executed in either the true or false case. This is used to
25822 % detect whether the document needs one of the accents to be activated
25823 % (\Lopt{activegrave} and \Lopt{activeacute}). For plain \TeX\ we
25824 % assume that the user wants them to be active by default. Therefore
25825 % the only thing we do is execute the third argument (the code for the
25826 % true case).
25827 %
25828 % \begin{macrocode}
25829 \def\@ifpackagewith#1#2#3#4{#3}
25830 % \end{macrocode}
25831 %
25832 % The \LaTeX\ macro |\@ifl@aded| checks whether a file was loaded. This
25833 % functionality is not needed for plain \TeX\ but we need the macro to
25834 % be defined as a no-op.
25835 %
25836 % \begin{macrocode}
25837 \def\@ifl@aded#1#2#3#4{}
25838 % \end{macrocode}
25839 %
25840 % For the following code we need to make sure that the commands
25841 % |\newcommand| and |\providecommand| exist with some sensible
25842 % definition. They are not fully equivalent to their \LaTeXe\ versions;
25843 % just enough to make things work in plain~\TeX environments.
25844 %
25845 % \begin{macrocode}
25846 \ifx\@tempcnta\@undefined
25847 \csname newcount\endcsname\@tempcnta\relax
25848 \fi
25849 \ifx\@tempcntb\@undefined
25850 \csname newcount\endcsname\@tempcntb\relax
25851 \fi
25852 % \end{macrocode}
25853 %
25854 % To prevent wasting two counters in \LaTeX\ (because counters with the
25855 % same name are allocated later by it) we reset the counter that holds
25856 % the next free counter (|\count10|).
25857 %
25858 % \begin{macrocode}
25859 \ifx\bye\@undefined
25860 \advance\count10 by -2\relax
25861 \fi
25862 \ifx\@ifnextchar\@undefined
25863 \def\@ifnextchar#1#2#3{%
25864 \let\reserved@d=#1%
25865 \def\reserved@a{#2}\def\reserved@b{#3}%
25866 \futurelet\@let@token\@ifnch}
25867 \def\@ifnch{%
25868 \ifx\@let@token\@sptoken
25869 \let\reserved@c\@xifnch
25870 \else
25871 \ifx\@let@token\reserved@d
25872 \let\reserved@c\reserved@a
25873 \else
25874 \let\reserved@c\reserved@b
25875 \fi
25876 \fi
25877 \reserved@c}
25878 \def\:{\let\@sptoken= } \: % this makes \@sptoken a space token
25879 \def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch}
25880 \fi
25881 \def\@testopt#1#2{%
25882 \@ifnextchar[{#1}{#1[#2]}}
25883 \def\@protected@testopt#1{%
25884 \ifx\protect\@typeset@protect
25885 \expandafter\@testopt
25886 \else
25887 \@x@protect#1%
25888 \fi}
25889 \long\def\@whilenum#1\do #2{\ifnum #1\relax #2\relax\@iwhilenum{#1\relax
25890 #2\relax}\fi}
25891 \long\def\@iwhilenum#1{\ifnum #1\expandafter\@iwhilenum
25892 \else\expandafter\@gobble\fi{#1}}
25893 % \end{macrocode}
25894 %
25895 % \subsection{Encoding related macros}
25896 %
25897 % Code from \file{ltoutenc.dtx}, adapted for use in the plain \TeX\
25898 % environment.
25899 %
25900 % \begin{macrocode}
25901 \def\DeclareTextCommand{%
25902 \@dec@text@cmd\providecommand
25903 }
25904 \def\ProvideTextCommand{%
25905 \@dec@text@cmd\providecommand
25906 }
25907 \def\DeclareTextSymbol#1#2#3{%
25908 \@dec@text@cmd\chardef#1{#2}#3\relax
25909 }
25910 \def\@dec@text@cmd#1#2#3{%
25911 \expandafter\def\expandafter#2%
25912 \expandafter{%
25913 \csname#3-cmd\expandafter\endcsname
25914 \expandafter#2%
25915 \csname#3\string#2\endcsname
25916 }%
25917 % \let\@ifdefinable\@rc@ifdefinable
25918 \expandafter#1\csname#3\string#2\endcsname
25919 }
25920 \def\@current@cmd#1{%
25921 \ifx\protect\@typeset@protect\else
25922 \noexpand#1\expandafter\@gobble
25923 \fi
25924 }
25925 \def\@changed@cmd#1#2{%
25926 \ifx\protect\@typeset@protect
25927 \expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax
25928 \expandafter\ifx\csname ?\string#1\endcsname\relax
25929 \expandafter\def\csname ?\string#1\endcsname{%
25930 \@changed@x@err{#1}%
25931 }%
25932 \fi
25933 \global\expandafter\let
25934 \csname\cf@encoding \string#1\expandafter\endcsname
25935 \csname ?\string#1\endcsname
25936 \fi
25937 \csname\cf@encoding\string#1%
25938 \expandafter\endcsname
25939 \else
25940 \noexpand#1%
25941 \fi
25942 }
25943 \def\@changed@x@err#1{%
25944 \errhelp{Your command will be ignored, type <return> to proceed}%
25945 \errmessage{Command \protect#1 undefined in encoding \cf@encoding}}
25946 \def\DeclareTextCommandDefault#1{%
25947 \DeclareTextCommand#1?%
25948 }
25949 \def\ProvideTextCommandDefault#1{%
25950 \ProvideTextCommand#1?%
25951 }
25952 \expandafter\let\csname OT1-cmd\endcsname\@current@cmd
25953 \expandafter\let\csname?-cmd\endcsname\@changed@cmd
25954 \def\DeclareTextAccent#1#2#3{%
25955 \DeclareTextCommand#1{#2}[1]{\accent#3 ##1}
25956 }
25957 \def\DeclareTextCompositeCommand#1#2#3#4{%
25958 \expandafter\let\expandafter\reserved@a\csname#2\string#1\endcsname
25959 \edef\reserved@b{\string##1}%
25960 \edef\reserved@c{%
25961 \expandafter\@strip@args\meaning\reserved@a:-\@strip@args}%
25962 \ifx\reserved@b\reserved@c
25963 \expandafter\expandafter\expandafter\ifx
25964 \expandafter\@car\reserved@a\relax\relax\@nil
25965 \@text@composite
25966 \else
25967 \edef\reserved@b##1{%
25968 \def\expandafter\noexpand
25969 \csname#2\string#1\endcsname####1{%
25970 \noexpand\@text@composite
25971 \expandafter\noexpand\csname#2\string#1\endcsname
25972 ####1\noexpand\@empty\noexpand\@text@composite
25973 {##1}%
25974 }%
25975 }%
25976 \expandafter\reserved@b\expandafter{\reserved@a{##1}}%
25977 \fi
25978 \expandafter\def\csname\expandafter\string\csname
25979 #2\endcsname\string#1-\string#3\endcsname{#4}
25980 \else
25981 \errhelp{Your command will be ignored, type <return> to proceed}%
25982 \errmessage{\string\DeclareTextCompositeCommand\space used on
25983 inappropriate command \protect#1}
25984 \fi
25985 }
25986 \def\@text@composite#1#2#3\@text@composite{%
25987 \expandafter\@text@composite@x
25988 \csname\string#1-\string#2\endcsname
25989 }
25990 \def\@text@composite@x#1#2{%
25991 \ifx#1\relax
25992 #2%
25993 \else
25994 #1%
25995 \fi
25996 }
25997 %
25998 \def\@strip@args#1:#2-#3\@strip@args{#2}
25999 \def\DeclareTextComposite#1#2#3#4{%
26000 \def\reserved@a{\DeclareTextCompositeCommand#1{#2}{#3}}%
26001 \bgroup
26002 \lccode`\@=#4%
26003 \lowercase{%
26004 \egroup
26005 \reserved@a @%
26006 }%
26007 }
26008 %
26009 \def\UseTextSymbol#1#2{#2}
26010 \def\UseTextAccent#1#2#3{}
26011 \def\@use@text@encoding#1{}
26012 \def\DeclareTextSymbolDefault#1#2{%
26013 \DeclareTextCommandDefault#1{\UseTextSymbol{#2}#1}%
26014 }
26015 \def\DeclareTextAccentDefault#1#2{%
26016 \DeclareTextCommandDefault#1{\UseTextAccent{#2}#1}%
26017 }
26018 \def\cf@encoding{OT1}
26019 % \end{macrocode}
26020 %
26021 % Currently we only use the \LaTeXe\ method for accents for those that
26022 % are known to be made active in \emph{some} language definition file.
26023 %
26024 % \begin{macrocode}
26025 \DeclareTextAccent{\"}{OT1}{127}
26026 \DeclareTextAccent{\'}{OT1}{19}
26027 \DeclareTextAccent{\^}{OT1}{94}
26028 \DeclareTextAccent{\`}{OT1}{18}
26029 \DeclareTextAccent{\~}{OT1}{126}
26030 % \end{macrocode}
26031 %
26032 % The following control sequences are used in \file{babel.def} but are
26033 % not defined for \textsc{plain} \TeX.
26034 %
26035 % \begin{macrocode}
26036 \DeclareTextSymbol{\textquotedblleft}{OT1}{92}
26037 \DeclareTextSymbol{\textquotedblright}{OT1}{`\"}
26038 \DeclareTextSymbol{\textquoteleft}{OT1}{`\`}
26039 \DeclareTextSymbol{\textquoteright}{OT1}{`\'}
26040 \DeclareTextSymbol{\i}{OT1}{16}
26041 \DeclareTextSymbol{\ss}{OT1}{25}
26042 % \end{macrocode}
26043 %
26044 % For a couple of languages we need the \LaTeX-control sequence
26045 % |\scriptsize| to be available. Because plain \TeX\ doesn't have such
26046 % a sophisticated font mechanism as \LaTeX\ has, we just |\let| it to
26047 % |\sevenrm|.
26048 %
26049 % \begin{macrocode}
26050 \ifx\scriptsize\@undefined
26051 \let\scriptsize\sevenrm
26052 \fi
26053 % \end{macrocode}
26054 %
26055 % And a few more “dummy” definitions.
26056 %
26057 % \begin{macrocode}
26058 \def\languagename{english}%
26059 \let\bbl@opt@shorthands\@nnil
26060 \def\bbl@ifshorthand#1#2#3{#2}%
26061 \let\bbl@language@opts\@empty
26062 \let\bbl@provide@locale\relax
26063 \ifx\babeloptionstrings\@undefined
26064 \let\bbl@opt@strings\@nnil
26065 \else
26066 \let\bbl@opt@strings\babeloptionstrings
26067 \fi
26068 \def\BabelStringsDefault{generic}
26069 \def\bbl@tempa{normal}
26070 \ifx\babeloptionmath\bbl@tempa
26071 \def\bbl@mathnormal{\noexpand\textormath}
26072 \fi
26073 \def\AfterBabelLanguage#1#2{}
26074 \ifx\BabelModifiers\@undefined\let\BabelModifiers\relax\fi
26075 \let\bbl@afterlang\relax
26076 \def\bbl@opt@safe{BR}
26077 \ifx\@uclclist\@undefined\let\@uclclist\@empty\fi
26078 \ifx\bbl@trace\@undefined\def\bbl@trace#1{}\fi
26079 \expandafter\newif\csname ifbbl@single\endcsname
26080 \chardef\bbl@bidimode\z@
26081 %<</Emulate LaTeX>>
26082 % \end{macrocode}
26083 %
26084 % A proxy file:
26085 %
26086 % \begin{macrocode}
26087 %<*plain>
26088 \input babel.def
26089 %</plain>
26090 % \end{macrocode}
26091 % \Finale
26092 %
26093 \endinput
26094 %
26095 % Local Variables:
26096 % mode: doctex
26097 % coding: utf-8
26098 % TeX-engine: luatex
26099 % End: