| 1 |
\ifx\initiate@active@char\@undefined |
| 2 |
\else |
| 3 |
\bbl@afterfi\endinput |
| 4 |
\fi |
| 5 |
\ProvidesFile{babelsh.def} |
| 6 |
[2022/06/21 % |
| 7 |
Babel common definitions for shorthands^^J |
| 8 |
Taken verbatim from babel files (2022/06/06 v3.76)] |
| 9 |
% |
| 10 |
% ------------------------------------------------------------------------------ |
| 11 |
% |
| 12 |
% lines 52 to 56 from babel.sty |
| 13 |
% |
| 14 |
% ------------------------------------------------------------------------------ |
| 15 |
% |
| 16 |
\def\bbl@error#1#2{% |
| 17 |
\begingroup |
| 18 |
\def\\{\MessageBreak}% |
| 19 |
\PackageError{babel}{#1}{#2}% |
| 20 |
\endgroup} |
| 21 |
% |
| 22 |
% ------------------------------------------------------------------------------ |
| 23 |
% |
| 24 |
% lines 69 to 73 from babel.sty |
| 25 |
% |
| 26 |
% ------------------------------------------------------------------------------ |
| 27 |
% |
| 28 |
\def\bbl@info#1{% |
| 29 |
\begingroup |
| 30 |
\def\\{\MessageBreak}% |
| 31 |
\PackageInfo{babel}{#1}% |
| 32 |
\endgroup} |
| 33 |
% |
| 34 |
% ------------------------------------------------------------------------------ |
| 35 |
% |
| 36 |
% lines 75 to 80 from babel.sty |
| 37 |
% |
| 38 |
% ------------------------------------------------------------------------------ |
| 39 |
% |
| 40 |
\def\bbl@stripslash{\expandafter\@gobble\string} |
| 41 |
\def\bbl@add#1#2{% |
| 42 |
\bbl@ifunset{\bbl@stripslash#1}% |
| 43 |
{\def#1{#2}}% |
| 44 |
{\expandafter\def\expandafter#1\expandafter{#1#2}}} |
| 45 |
\def\bbl@xin@{\@expandtwoargs\in@} |
| 46 |
% |
| 47 |
% ------------------------------------------------------------------------------ |
| 48 |
% |
| 49 |
% line 97 to 98 from babel.sty |
| 50 |
% |
| 51 |
% ------------------------------------------------------------------------------ |
| 52 |
% |
| 53 |
\long\def\bbl@afterelse#1\else#2\fi{\fi#1} |
| 54 |
\long\def\bbl@afterfi#1\fi{\fi#1} |
| 55 |
% |
| 56 |
% ------------------------------------------------------------------------------ |
| 57 |
% |
| 58 |
% line 376 from babel.sty |
| 59 |
% |
| 60 |
% ------------------------------------------------------------------------------ |
| 61 |
% |
| 62 |
\let\bbl@opt@shorthands\@nnil |
| 63 |
% |
| 64 |
% ------------------------------------------------------------------------------ |
| 65 |
% |
| 66 |
% lines 414 to 435 from babel.sty |
| 67 |
% |
| 68 |
% ------------------------------------------------------------------------------ |
| 69 |
% |
| 70 |
\def\bbl@sh@string#1{% |
| 71 |
\ifx#1\@empty\else |
| 72 |
\ifx#1t\string~% |
| 73 |
\else\ifx#1c\string,% |
| 74 |
\else\string#1% |
| 75 |
\fi\fi |
| 76 |
\expandafter\bbl@sh@string |
| 77 |
\fi} |
| 78 |
\ifx\bbl@opt@shorthands\@nnil |
| 79 |
\def\bbl@ifshorthand#1#2#3{#2}% |
| 80 |
\else\ifx\bbl@opt@shorthands\@empty |
| 81 |
\def\bbl@ifshorthand#1#2#3{#3}% |
| 82 |
\else |
| 83 |
\def\bbl@ifshorthand#1{% |
| 84 |
\bbl@xin@{\string#1}{\bbl@opt@shorthands}% |
| 85 |
\ifin@ |
| 86 |
\expandafter\@firstoftwo |
| 87 |
\else |
| 88 |
\expandafter\@secondoftwo |
| 89 |
\fi} |
| 90 |
\edef\bbl@opt@shorthands{% |
| 91 |
\expandafter\bbl@sh@string\bbl@opt@shorthands\@empty}% |
| 92 |
% |
| 93 |
% ------------------------------------------------------------------------------ |
| 94 |
% |
| 95 |
% line 440 from babel.sty |
| 96 |
% |
| 97 |
% ------------------------------------------------------------------------------ |
| 98 |
% |
| 99 |
\fi\fi |
| 100 |
% |
| 101 |
% ------------------------------------------------------------------------------ |
| 102 |
% |
| 103 |
% lines 387 to 406 from babel.def |
| 104 |
% |
| 105 |
% ------------------------------------------------------------------------------ |
| 106 |
% |
| 107 |
\let\bbl@opt@shorthands\@nnil |
| 108 |
\def\bbl@ifshorthand#1#2#3{#2}% |
| 109 |
\let\bbl@language@opts\@empty |
| 110 |
\ifx\babeloptionstrings\@undefined |
| 111 |
\let\bbl@opt@strings\@nnil |
| 112 |
\else |
| 113 |
\let\bbl@opt@strings\babeloptionstrings |
| 114 |
\fi |
| 115 |
\def\BabelStringsDefault{generic} |
| 116 |
\def\bbl@tempa{normal} |
| 117 |
\ifx\babeloptionmath\bbl@tempa |
| 118 |
\def\bbl@mathnormal{\noexpand\textormath} |
| 119 |
\fi |
| 120 |
\def\AfterBabelLanguage#1#2{} |
| 121 |
\ifx\BabelModifiers\@undefined\let\BabelModifiers\relax\fi |
| 122 |
\let\bbl@afterlang\relax |
| 123 |
\def\bbl@opt@safe{BR} |
| 124 |
\ifx\@uclclist\@undefined\let\@uclclist\@empty\fi |
| 125 |
\ifx\bbl@trace\@undefined\def\bbl@trace#1{}\fi |
| 126 |
\expandafter\newif\csname ifbbl@single\endcsname |
| 127 |
% |
| 128 |
% ------------------------------------------------------------------------------ |
| 129 |
% |
| 130 |
% line 938 from babel.def |
| 131 |
% |
| 132 |
% ------------------------------------------------------------------------------ |
| 133 |
% |
| 134 |
\def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}% |
| 135 |
% |
| 136 |
% ------------------------------------------------------------------------------ |
| 137 |
% |
| 138 |
% lines 941 to 947 from babel.def |
| 139 |
% |
| 140 |
% ------------------------------------------------------------------------------ |
| 141 |
% |
| 142 |
\def\bbl@loop#1#2#3{\bbl@@loop#1{#3}#2,\@nnil,} |
| 143 |
\def\bbl@loopx#1#2{\expandafter\bbl@loop\expandafter#1\expandafter{#2}} |
| 144 |
\def\bbl@@loop#1#2#3,{% |
| 145 |
\ifx\@nnil#3\relax\else |
| 146 |
\def#1{#3}#2\bbl@afterfi\bbl@@loop#1{#2}% |
| 147 |
\fi} |
| 148 |
\def\bbl@for#1#2#3{\bbl@loopx#1{#2}{\ifx#1\@empty\else#3\fi}} |
| 149 |
% |
| 150 |
% ------------------------------------------------------------------------------ |
| 151 |
% |
| 152 |
% lines 956 to 965 from babel.def |
| 153 |
% |
| 154 |
% ------------------------------------------------------------------------------ |
| 155 |
% |
| 156 |
\def\bbl@exp#1{% |
| 157 |
\begingroup |
| 158 |
\let\\\noexpand |
| 159 |
\let\<\bbl@exp@en |
| 160 |
\let\[\bbl@exp@ue |
| 161 |
\edef\bbl@exp@aux{\endgroup#1}% |
| 162 |
\bbl@exp@aux} |
| 163 |
\def\bbl@exp@en#1>{\expandafter\noexpand\csname#1\endcsname}% |
| 164 |
\def\bbl@exp@ue#1]{% |
| 165 |
\unexpanded\expandafter\expandafter\expandafter{\csname#1\endcsname}}% |
| 166 |
% |
| 167 |
% ------------------------------------------------------------------------------ |
| 168 |
% |
| 169 |
% lines 979 to 998 from babel.def |
| 170 |
% |
| 171 |
% ------------------------------------------------------------------------------ |
| 172 |
% |
| 173 |
\begingroup |
| 174 |
\gdef\bbl@ifunset#1{% |
| 175 |
\expandafter\ifx\csname#1\endcsname\relax |
| 176 |
\expandafter\@firstoftwo |
| 177 |
\else |
| 178 |
\expandafter\@secondoftwo |
| 179 |
\fi} |
| 180 |
\bbl@ifunset{ifcsname}% TODO. A better test? |
| 181 |
{}% |
| 182 |
{\gdef\bbl@ifunset#1{% |
| 183 |
\ifcsname#1\endcsname |
| 184 |
\expandafter\ifx\csname#1\endcsname\relax |
| 185 |
\bbl@afterelse\expandafter\@firstoftwo |
| 186 |
\else |
| 187 |
\bbl@afterfi\expandafter\@secondoftwo |
| 188 |
\fi |
| 189 |
\else |
| 190 |
\expandafter\@firstoftwo |
| 191 |
\fi}} |
| 192 |
\endgroup |
| 193 |
% |
| 194 |
% ------------------------------------------------------------------------------ |
| 195 |
% |
| 196 |
% lines 1075 to 1084 from babel.def |
| 197 |
% |
| 198 |
% ------------------------------------------------------------------------------ |
| 199 |
% |
| 200 |
\chardef\bbl@engine=% |
| 201 |
\ifx\directlua\@undefined |
| 202 |
\ifx\XeTeXinputencoding\@undefined |
| 203 |
\z@ |
| 204 |
\else |
| 205 |
\tw@ |
| 206 |
\fi |
| 207 |
\else |
| 208 |
\@ne |
| 209 |
\fi |
| 210 |
% |
| 211 |
% ------------------------------------------------------------------------------ |
| 212 |
% |
| 213 |
% lines 1152 to 1155 from babel.def |
| 214 |
% |
| 215 |
% ------------------------------------------------------------------------------ |
| 216 |
% |
| 217 |
\def\bbl@withactive#1#2{% |
| 218 |
\begingroup |
| 219 |
\lccode`~=`#2\relax |
| 220 |
\lowercase{\endgroup#1~}} |
| 221 |
% |
| 222 |
% ------------------------------------------------------------------------------ |
| 223 |
% |
| 224 |
% line 1185 from babel.def |
| 225 |
% |
| 226 |
% NOTE: In order to avoid importing more unneeded definitions, this macro |
| 227 |
% does nothing for us. |
| 228 |
% |
| 229 |
% ------------------------------------------------------------------------------ |
| 230 |
% |
| 231 |
\def\bbl@usehooks#1#2{} |
| 232 |
% |
| 233 |
% ------------------------------------------------------------------------------ |
| 234 |
% |
| 235 |
% lines 1348 to 1463 from babel.def |
| 236 |
% |
| 237 |
% ------------------------------------------------------------------------------ |
| 238 |
% |
| 239 |
\def\bbl@add@special#1{% 1:a macro like \", \?, etc. |
| 240 |
\bbl@add\dospecials{\do#1}% test @sanitize = \relax, for back. compat. |
| 241 |
\bbl@ifunset{@sanitize}{}{\bbl@add\@sanitize{\@makeother#1}}% |
| 242 |
\ifx\nfss@catcodes\@undefined\else % TODO - same for above |
| 243 |
\begingroup |
| 244 |
\catcode`#1\active |
| 245 |
\nfss@catcodes |
| 246 |
\ifnum\catcode`#1=\active |
| 247 |
\endgroup |
| 248 |
\bbl@add\nfss@catcodes{\@makeother#1}% |
| 249 |
\else |
| 250 |
\endgroup |
| 251 |
\fi |
| 252 |
\fi} |
| 253 |
\def\bbl@remove@special#1{% |
| 254 |
\begingroup |
| 255 |
\def\x##1##2{\ifnum`#1=`##2\noexpand\@empty |
| 256 |
\else\noexpand##1\noexpand##2\fi}% |
| 257 |
\def\do{\x\do}% |
| 258 |
\def\@makeother{\x\@makeother}% |
| 259 |
\edef\x{\endgroup |
| 260 |
\def\noexpand\dospecials{\dospecials}% |
| 261 |
\expandafter\ifx\csname @sanitize\endcsname\relax\else |
| 262 |
\def\noexpand\@sanitize{\@sanitize}% |
| 263 |
\fi}% |
| 264 |
\x} |
| 265 |
\def\bbl@active@def#1#2#3#4{% |
| 266 |
\@namedef{#3#1}{% |
| 267 |
\expandafter\ifx\csname#2@sh@#1@\endcsname\relax |
| 268 |
\bbl@afterelse\bbl@sh@select#2#1{#3@arg#1}{#4#1}% |
| 269 |
\else |
| 270 |
\bbl@afterfi\csname#2@sh@#1@\endcsname |
| 271 |
\fi}% |
| 272 |
\long\@namedef{#3@arg#1}##1{% |
| 273 |
\expandafter\ifx\csname#2@sh@#1@\string##1@\endcsname\relax |
| 274 |
\bbl@afterelse\csname#4#1\endcsname##1% |
| 275 |
\else |
| 276 |
\bbl@afterfi\csname#2@sh@#1@\string##1@\endcsname |
| 277 |
\fi}}% |
| 278 |
\def\initiate@active@char#1{% |
| 279 |
\bbl@ifunset{active@char\string#1}% |
| 280 |
{\bbl@withactive |
| 281 |
{\expandafter\@initiate@active@char\expandafter}#1\string#1#1}% |
| 282 |
{}} |
| 283 |
\def\@initiate@active@char#1#2#3{% |
| 284 |
\bbl@csarg\edef{oricat@#2}{\catcode`#2=\the\catcode`#2\relax}% |
| 285 |
\ifx#1\@undefined |
| 286 |
\bbl@csarg\def{oridef@#2}{\def#1{\active@prefix#1\@undefined}}% |
| 287 |
\else |
| 288 |
\bbl@csarg\let{oridef@@#2}#1% |
| 289 |
\bbl@csarg\edef{oridef@#2}{% |
| 290 |
\let\noexpand#1% |
| 291 |
\expandafter\noexpand\csname bbl@oridef@@#2\endcsname}% |
| 292 |
\fi |
| 293 |
\ifx#1#3\relax |
| 294 |
\expandafter\let\csname normal@char#2\endcsname#3% |
| 295 |
\else |
| 296 |
\bbl@info{Making #2 an active character}% |
| 297 |
\ifnum\mathcode`#2=\ifodd\bbl@engine"1000000 \else"8000 \fi |
| 298 |
\@namedef{normal@char#2}{% |
| 299 |
\textormath{#3}{\csname bbl@oridef@@#2\endcsname}}% |
| 300 |
\else |
| 301 |
\@namedef{normal@char#2}{#3}% |
| 302 |
\fi |
| 303 |
\bbl@restoreactive{#2}% |
| 304 |
\AtBeginDocument{% |
| 305 |
\catcode`#2\active |
| 306 |
\if@filesw |
| 307 |
\immediate\write\@mainaux{\catcode`\string#2\active}% |
| 308 |
\fi}% |
| 309 |
\expandafter\bbl@add@special\csname#2\endcsname |
| 310 |
\catcode`#2\active |
| 311 |
\fi |
| 312 |
\let\bbl@tempa\@firstoftwo |
| 313 |
\if\string^#2% |
| 314 |
\def\bbl@tempa{\noexpand\textormath}% |
| 315 |
\else |
| 316 |
\ifx\bbl@mathnormal\@undefined\else |
| 317 |
\let\bbl@tempa\bbl@mathnormal |
| 318 |
\fi |
| 319 |
\fi |
| 320 |
\expandafter\edef\csname active@char#2\endcsname{% |
| 321 |
\bbl@tempa |
| 322 |
{\noexpand\if@safe@actives |
| 323 |
\noexpand\expandafter |
| 324 |
\expandafter\noexpand\csname normal@char#2\endcsname |
| 325 |
\noexpand\else |
| 326 |
\noexpand\expandafter |
| 327 |
\expandafter\noexpand\csname bbl@doactive#2\endcsname |
| 328 |
\noexpand\fi}% |
| 329 |
{\expandafter\noexpand\csname normal@char#2\endcsname}}% |
| 330 |
\bbl@csarg\edef{doactive#2}{% |
| 331 |
\expandafter\noexpand\csname user@active#2\endcsname}% |
| 332 |
\bbl@csarg\edef{active@#2}{% |
| 333 |
\noexpand\active@prefix\noexpand#1% |
| 334 |
\expandafter\noexpand\csname active@char#2\endcsname}% |
| 335 |
\bbl@csarg\edef{normal@#2}{% |
| 336 |
\noexpand\active@prefix\noexpand#1% |
| 337 |
\expandafter\noexpand\csname normal@char#2\endcsname}% |
| 338 |
\expandafter\let\expandafter#1\csname bbl@normal@#2\endcsname |
| 339 |
\bbl@active@def#2\user@group{user@active}{language@active}% |
| 340 |
\bbl@active@def#2\language@group{language@active}{system@active}% |
| 341 |
\bbl@active@def#2\system@group{system@active}{normal@char}% |
| 342 |
\expandafter\edef\csname\user@group @sh@#2@@\endcsname |
| 343 |
{\expandafter\noexpand\csname normal@char#2\endcsname}% |
| 344 |
\expandafter\edef\csname\user@group @sh@#2@\string\protect@\endcsname |
| 345 |
{\expandafter\noexpand\csname user@active#2\endcsname}% |
| 346 |
\if\string'#2% |
| 347 |
\let\prim@s\bbl@prim@s |
| 348 |
\let\active@math@prime#1% |
| 349 |
\fi |
| 350 |
\bbl@usehooks{initiateactive}{{#1}{#2}{#3}}} |
| 351 |
\@ifpackagewith{babel}{KeepShorthandsActive}% |
| 352 |
{\let\bbl@restoreactive\@gobble}% |
| 353 |
{\def\bbl@restoreactive#1{% |
| 354 |
\bbl@exp{% |
| 355 |
% |
| 356 |
% ------------------------------------------------------------------------------ |
| 357 |
% |
| 358 |
% lines 1466 to 1516 from babel.def |
| 359 |
% |
| 360 |
% ------------------------------------------------------------------------------ |
| 361 |
% |
| 362 |
\\\AtEndOfPackage |
| 363 |
{\catcode`#1=\the\catcode`#1\relax}}}% |
| 364 |
\AtEndOfPackage{\let\bbl@restoreactive\@gobble}} |
| 365 |
\def\bbl@sh@select#1#2{% |
| 366 |
\expandafter\ifx\csname#1@sh@#2@sel\endcsname\relax |
| 367 |
\bbl@afterelse\bbl@scndcs |
| 368 |
\else |
| 369 |
\bbl@afterfi\csname#1@sh@#2@sel\endcsname |
| 370 |
\fi} |
| 371 |
\begingroup |
| 372 |
\bbl@ifunset{ifincsname}% TODO. Ugly. Correct? Only Plain? |
| 373 |
{\gdef\active@prefix#1{% |
| 374 |
\ifx\protect\@typeset@protect |
| 375 |
\else |
| 376 |
\ifx\protect\@unexpandable@protect |
| 377 |
\noexpand#1% |
| 378 |
\else |
| 379 |
\protect#1% |
| 380 |
\fi |
| 381 |
\expandafter\@gobble |
| 382 |
\fi}} |
| 383 |
{\gdef\active@prefix#1{% |
| 384 |
\ifincsname |
| 385 |
\string#1% |
| 386 |
\expandafter\@gobble |
| 387 |
\else |
| 388 |
\ifx\protect\@typeset@protect |
| 389 |
\else |
| 390 |
\ifx\protect\@unexpandable@protect |
| 391 |
\noexpand#1% |
| 392 |
\else |
| 393 |
\protect#1% |
| 394 |
\fi |
| 395 |
\expandafter\expandafter\expandafter\@gobble |
| 396 |
\fi |
| 397 |
\fi}} |
| 398 |
\endgroup |
| 399 |
\newif\if@safe@actives |
| 400 |
\@safe@activesfalse |
| 401 |
\def\bbl@restore@actives{\if@safe@actives\@safe@activesfalse\fi} |
| 402 |
\chardef\bbl@activated\z@ |
| 403 |
\def\bbl@activate#1{% |
| 404 |
\chardef\bbl@activated\@ne |
| 405 |
\bbl@withactive{\expandafter\let\expandafter}#1% |
| 406 |
\csname bbl@active@\string#1\endcsname} |
| 407 |
\def\bbl@deactivate#1{% |
| 408 |
\chardef\bbl@activated\tw@ |
| 409 |
\bbl@withactive{\expandafter\let\expandafter}#1% |
| 410 |
\csname bbl@normal@\string#1\endcsname} |
| 411 |
\def\bbl@firstcs#1#2{\csname#1\endcsname} |
| 412 |
\def\bbl@scndcs#1#2{\csname#2\endcsname} |
| 413 |
% |
| 414 |
% ------------------------------------------------------------------------------ |
| 415 |
% |
| 416 |
% lines 1525 to 1702 from babel.def |
| 417 |
% |
| 418 |
% ------------------------------------------------------------------------------ |
| 419 |
% |
| 420 |
\def\declare@shorthand#1#2{\@decl@short{#1}#2\@nil} |
| 421 |
\def\@decl@short#1#2#3\@nil#4{% |
| 422 |
\def\bbl@tempa{#3}% |
| 423 |
\ifx\bbl@tempa\@empty |
| 424 |
\expandafter\let\csname #1@sh@\string#2@sel\endcsname\bbl@scndcs |
| 425 |
\bbl@ifunset{#1@sh@\string#2@}{}% |
| 426 |
{\def\bbl@tempa{#4}% |
| 427 |
\expandafter\ifx\csname#1@sh@\string#2@\endcsname\bbl@tempa |
| 428 |
\else |
| 429 |
\bbl@info |
| 430 |
{Redefining #1 shorthand \string#2\\% |
| 431 |
in language \CurrentOption}% |
| 432 |
\fi}% |
| 433 |
\@namedef{#1@sh@\string#2@}{#4}% |
| 434 |
\else |
| 435 |
\expandafter\let\csname #1@sh@\string#2@sel\endcsname\bbl@firstcs |
| 436 |
\bbl@ifunset{#1@sh@\string#2@\string#3@}{}% |
| 437 |
{\def\bbl@tempa{#4}% |
| 438 |
\expandafter\ifx\csname#1@sh@\string#2@\string#3@\endcsname\bbl@tempa |
| 439 |
\else |
| 440 |
\bbl@info |
| 441 |
{Redefining #1 shorthand \string#2\string#3\\% |
| 442 |
in language \CurrentOption}% |
| 443 |
\fi}% |
| 444 |
\@namedef{#1@sh@\string#2@\string#3@}{#4}% |
| 445 |
\fi} |
| 446 |
\def\textormath{% |
| 447 |
\ifmmode |
| 448 |
\expandafter\@secondoftwo |
| 449 |
\else |
| 450 |
\expandafter\@firstoftwo |
| 451 |
\fi} |
| 452 |
\def\user@group{user} |
| 453 |
\def\language@group{english} % TODO. I don't like defaults |
| 454 |
\def\system@group{system} |
| 455 |
\def\useshorthands{% |
| 456 |
\@ifstar\bbl@usesh@s{\bbl@usesh@x{}}} |
| 457 |
\def\bbl@usesh@s#1{% |
| 458 |
\bbl@usesh@x |
| 459 |
{\AddBabelHook{babel-sh-\string#1}{afterextras}{\bbl@activate{#1}}}% |
| 460 |
{#1}} |
| 461 |
\def\bbl@usesh@x#1#2{% |
| 462 |
\bbl@ifshorthand{#2}% |
| 463 |
{\def\user@group{user}% |
| 464 |
\initiate@active@char{#2}% |
| 465 |
#1% |
| 466 |
\bbl@activate{#2}}% |
| 467 |
{\bbl@error |
| 468 |
{I can't declare a shorthand turned off (\string#2)} |
| 469 |
{Sorry, but you can't use shorthands which have been\\% |
| 470 |
turned off in the package options}}} |
| 471 |
\def\user@language@group{user@\language@group} |
| 472 |
\def\bbl@set@user@generic#1#2{% |
| 473 |
\bbl@ifunset{user@generic@active#1}% |
| 474 |
{\bbl@active@def#1\user@language@group{user@active}{user@generic@active}% |
| 475 |
\bbl@active@def#1\user@group{user@generic@active}{language@active}% |
| 476 |
\expandafter\edef\csname#2@sh@#1@@\endcsname{% |
| 477 |
\expandafter\noexpand\csname normal@char#1\endcsname}% |
| 478 |
\expandafter\edef\csname#2@sh@#1@\string\protect@\endcsname{% |
| 479 |
\expandafter\noexpand\csname user@active#1\endcsname}}% |
| 480 |
\@empty} |
| 481 |
\newcommand\defineshorthand[3][user]{% |
| 482 |
\edef\bbl@tempa{\zap@space#1 \@empty}% |
| 483 |
\bbl@for\bbl@tempb\bbl@tempa{% |
| 484 |
\if*\expandafter\@car\bbl@tempb\@nil |
| 485 |
\edef\bbl@tempb{user@\expandafter\@gobble\bbl@tempb}% |
| 486 |
\@expandtwoargs |
| 487 |
\bbl@set@user@generic{\expandafter\string\@car#2\@nil}\bbl@tempb |
| 488 |
\fi |
| 489 |
\declare@shorthand{\bbl@tempb}{#2}{#3}}} |
| 490 |
\def\languageshorthands#1{\def\language@group{#1}} |
| 491 |
\def\aliasshorthand#1#2{% |
| 492 |
\bbl@ifshorthand{#2}% |
| 493 |
{\expandafter\ifx\csname active@char\string#2\endcsname\relax |
| 494 |
\ifx\document\@notprerr |
| 495 |
\@notshorthand{#2}% |
| 496 |
\else |
| 497 |
\initiate@active@char{#2}% |
| 498 |
\expandafter\let\csname active@char\string#2\expandafter\endcsname |
| 499 |
\csname active@char\string#1\endcsname |
| 500 |
\expandafter\let\csname normal@char\string#2\expandafter\endcsname |
| 501 |
\csname normal@char\string#1\endcsname |
| 502 |
\bbl@activate{#2}% |
| 503 |
\fi |
| 504 |
\fi}% |
| 505 |
{\bbl@error |
| 506 |
{Cannot declare a shorthand turned off (\string#2)} |
| 507 |
{Sorry, but you cannot use shorthands which have been\\% |
| 508 |
turned off in the package options}}} |
| 509 |
\def\@notshorthand#1{% |
| 510 |
\bbl@error{% |
| 511 |
The character '\string #1' should be made a shorthand character;\\% |
| 512 |
add the command \string\useshorthands\string{#1\string} to |
| 513 |
the preamble.\\% |
| 514 |
I will ignore your instruction}% |
| 515 |
{You may proceed, but expect unexpected results}} |
| 516 |
\newcommand*\shorthandon[1]{\bbl@switch@sh\@ne#1\@nnil} |
| 517 |
\DeclareRobustCommand*\shorthandoff{% |
| 518 |
\@ifstar{\bbl@shorthandoff\tw@}{\bbl@shorthandoff\z@}} |
| 519 |
\def\bbl@shorthandoff#1#2{\bbl@switch@sh#1#2\@nnil} |
| 520 |
\def\bbl@switch@sh#1#2{% |
| 521 |
\ifx#2\@nnil\else |
| 522 |
\bbl@ifunset{bbl@active@\string#2}% |
| 523 |
{\bbl@error |
| 524 |
{I can't switch '\string#2' on or off--not a shorthand}% |
| 525 |
{This character is not a shorthand. Maybe you made\\% |
| 526 |
a typing mistake? I will ignore your instruction.}}% |
| 527 |
{\ifcase#1% off, on, off* |
| 528 |
\catcode`#212\relax |
| 529 |
\or |
| 530 |
\catcode`#2\active |
| 531 |
\bbl@ifunset{bbl@shdef@\string#2}% |
| 532 |
{}% |
| 533 |
{\bbl@withactive{\expandafter\let\expandafter}#2% |
| 534 |
\csname bbl@shdef@\string#2\endcsname |
| 535 |
\bbl@csarg\let{shdef@\string#2}\relax}% |
| 536 |
\ifcase\bbl@activated\or |
| 537 |
\bbl@activate{#2}% |
| 538 |
\else |
| 539 |
\bbl@deactivate{#2}% |
| 540 |
\fi |
| 541 |
\or |
| 542 |
\bbl@ifunset{bbl@shdef@\string#2}% |
| 543 |
{\bbl@withactive{\bbl@csarg\let{shdef@\string#2}}#2}% |
| 544 |
{}% |
| 545 |
\csname bbl@oricat@\string#2\endcsname |
| 546 |
\csname bbl@oridef@\string#2\endcsname |
| 547 |
\fi}% |
| 548 |
\bbl@afterfi\bbl@switch@sh#1% |
| 549 |
\fi} |
| 550 |
\def\babelshorthand{\active@prefix\babelshorthand\bbl@putsh} |
| 551 |
\def\bbl@putsh#1{% |
| 552 |
\bbl@ifunset{bbl@active@\string#1}% |
| 553 |
{\bbl@putsh@i#1\@empty\@nnil}% |
| 554 |
{\csname bbl@active@\string#1\endcsname}} |
| 555 |
\def\bbl@putsh@i#1#2\@nnil{% |
| 556 |
\csname\language@group @sh@\string#1@% |
| 557 |
\ifx\@empty#2\else\string#2@\fi\endcsname} |
| 558 |
\ifx\bbl@opt@shorthands\@nnil\else |
| 559 |
\let\bbl@s@initiate@active@char\initiate@active@char |
| 560 |
\def\initiate@active@char#1{% |
| 561 |
\bbl@ifshorthand{#1}{\bbl@s@initiate@active@char{#1}}{}} |
| 562 |
\let\bbl@s@switch@sh\bbl@switch@sh |
| 563 |
\def\bbl@switch@sh#1#2{% |
| 564 |
\ifx#2\@nnil\else |
| 565 |
\bbl@afterfi |
| 566 |
\bbl@ifshorthand{#2}{\bbl@s@switch@sh#1{#2}}{\bbl@switch@sh#1}% |
| 567 |
\fi} |
| 568 |
\let\bbl@s@activate\bbl@activate |
| 569 |
\def\bbl@activate#1{% |
| 570 |
\bbl@ifshorthand{#1}{\bbl@s@activate{#1}}{}} |
| 571 |
\let\bbl@s@deactivate\bbl@deactivate |
| 572 |
\def\bbl@deactivate#1{% |
| 573 |
\bbl@ifshorthand{#1}{\bbl@s@deactivate{#1}}{}} |
| 574 |
\fi |
| 575 |
\newcommand\ifbabelshorthand[3]{\bbl@ifunset{bbl@active@\string#1}{#3}{#2}} |
| 576 |
\def\bbl@prim@s{% |
| 577 |
\prime\futurelet\@let@token\bbl@pr@m@s} |
| 578 |
\def\bbl@if@primes#1#2{% |
| 579 |
\ifx#1\@let@token |
| 580 |
\expandafter\@firstoftwo |
| 581 |
\else\ifx#2\@let@token |
| 582 |
\bbl@afterelse\expandafter\@firstoftwo |
| 583 |
\else |
| 584 |
\bbl@afterfi\expandafter\@secondoftwo |
| 585 |
\fi\fi} |
| 586 |
\begingroup |
| 587 |
\catcode`\^=7 \catcode`\*=\active \lccode`\*=`\^ |
| 588 |
\catcode`\'=12 \catcode`\"=\active \lccode`\"=`\' |
| 589 |
\lowercase{% |
| 590 |
\gdef\bbl@pr@m@s{% |
| 591 |
\bbl@if@primes"'% |
| 592 |
\pr@@@s |
| 593 |
{\bbl@if@primes*^\pr@@@t\egroup}}} |
| 594 |
\endgroup |
| 595 |
\initiate@active@char{~} |
| 596 |
\declare@shorthand{system}{~}{\leavevmode\nobreak\ } |
| 597 |
\bbl@activate{~} |
| 598 |
% |
| 599 |
% ------------------------------------------------------------------------------ |
| 600 |
% |
| 601 |
% lines 1863 to 1900 from babel.def |
| 602 |
% |
| 603 |
% ------------------------------------------------------------------------------ |
| 604 |
% |
| 605 |
\def\bbl@allowhyphens{\ifvmode\else\nobreak\hskip\z@skip\fi} |
| 606 |
\def\bbl@t@one{T1} |
| 607 |
\def\allowhyphens{\ifx\cf@encoding\bbl@t@one\else\bbl@allowhyphens\fi} |
| 608 |
\newcommand\babelnullhyphen{\char\hyphenchar\font} |
| 609 |
\def\babelhyphen{\active@prefix\babelhyphen\bbl@hyphen} |
| 610 |
\def\bbl@hyphen{% |
| 611 |
\@ifstar{\bbl@hyphen@i @}{\bbl@hyphen@i\@empty}} |
| 612 |
\def\bbl@hyphen@i#1#2{% |
| 613 |
\bbl@ifunset{bbl@hy@#1#2\@empty}% |
| 614 |
{\csname bbl@#1usehyphen\endcsname{\discretionary{#2}{}{#2}}}% |
| 615 |
{\csname bbl@hy@#1#2\@empty\endcsname}} |
| 616 |
\def\bbl@usehyphen#1{% |
| 617 |
\leavevmode |
| 618 |
\ifdim\lastskip>\z@\mbox{#1}\else\nobreak#1\fi |
| 619 |
\nobreak\hskip\z@skip} |
| 620 |
\def\bbl@@usehyphen#1{% |
| 621 |
\leavevmode\ifdim\lastskip>\z@\mbox{#1}\else#1\fi} |
| 622 |
\def\bbl@hyphenchar{% |
| 623 |
\ifnum\hyphenchar\font=\m@ne |
| 624 |
\babelnullhyphen |
| 625 |
\else |
| 626 |
\char\hyphenchar\font |
| 627 |
\fi} |
| 628 |
\def\bbl@hy@soft{\bbl@usehyphen{\discretionary{\bbl@hyphenchar}{}{}}} |
| 629 |
\def\bbl@hy@@soft{\bbl@@usehyphen{\discretionary{\bbl@hyphenchar}{}{}}} |
| 630 |
\def\bbl@hy@hard{\bbl@usehyphen\bbl@hyphenchar} |
| 631 |
\def\bbl@hy@@hard{\bbl@@usehyphen\bbl@hyphenchar} |
| 632 |
\def\bbl@hy@nobreak{\bbl@usehyphen{\mbox{\bbl@hyphenchar}}} |
| 633 |
\def\bbl@hy@@nobreak{\mbox{\bbl@hyphenchar}} |
| 634 |
\def\bbl@hy@repeat{% |
| 635 |
\bbl@usehyphen{% |
| 636 |
\discretionary{\bbl@hyphenchar}{\bbl@hyphenchar}{\bbl@hyphenchar}}} |
| 637 |
\def\bbl@hy@@repeat{% |
| 638 |
\bbl@@usehyphen{% |
| 639 |
\discretionary{\bbl@hyphenchar}{\bbl@hyphenchar}{\bbl@hyphenchar}}} |
| 640 |
\def\bbl@hy@empty{\hskip\z@skip} |
| 641 |
\def\bbl@hy@@empty{\discretionary{}{}{}} |
| 642 |
\def\bbl@disc#1#2{\nobreak\discretionary{#2-}{}{#1}\bbl@allowhyphens} |
| 643 |
% |
| 644 |
% ------------------------------------------------------------------------------ |
| 645 |
% |
| 646 |
% end of the code copied from babel files |
| 647 |
% |
| 648 |
% ------------------------------------------------------------------------------ |
| 649 |
% |
| 650 |
% |
| 651 |
% ------------------------------------------------------------------------------ |
| 652 |
% |
| 653 |
% some additional functions related to babel shorthands |
| 654 |
% |
| 655 |
% ------------------------------------------------------------------------------ |
| 656 |
% |
| 657 |
% Helpers |
| 658 |
\def\xpg@allowhyphenationbefore{\ifvmode\else\nobreak\fi} |
| 659 |
\def\xpg@allowhyphenationafter{\nobreak\hskip\z@skip} |
| 660 |
% |
| 661 |
% Some common shorthand definitions |
| 662 |
\def\xpg@add@hyphenation@point{% |
| 663 |
\xpg@allowhyphenationbefore\-\xpg@allowhyphenationafter |
| 664 |
} |
| 665 |
\def\xpg@ligature@break{% |
| 666 |
\texorpdfstring{% |
| 667 |
\textormath{% text |
| 668 |
\xpg@allowhyphenationbefore\discretionary{-}{}{\kern.03em}% |
| 669 |
\xpg@allowhyphenationafter |
| 670 |
}{}% math |
| 671 |
}{}% PDF String |
| 672 |
} |
| 673 |
\def\xpg@invisible@break{% |
| 674 |
\xpg@allowhyphenationbefore\discretionary{}{}{}% |
| 675 |
\xpg@allowhyphenationafter |
| 676 |
} |
| 677 |
\def\xpg@nobreak@hyphen{% |
| 678 |
\textormath{% text |
| 679 |
\xpg@allowhyphenationbefore\mbox{-}\xpg@allowhyphenationafter |
| 680 |
}{-}% math |
| 681 |
} |
| 682 |
\def\xpg@breakable@hyphen{% |
| 683 |
\xpg@allowhyphenationbefore-\xpg@allowhyphenationafter |
| 684 |
} |
| 685 |
\def\xpg@breakable@slash{% |
| 686 |
\xpg@allowhyphenationbefore/\discretionary{}{}{}% |
| 687 |
\xpg@allowhyphenationafter |
| 688 |
} |
| 689 |
\def\xpg@thinspace@allow@hyphenation@after{% |
| 690 |
\leavevmode\nobreak\hskip.2em\ignorespaces |
| 691 |
} |
| 692 |
\def\xpg@cyrillic@dash{% |
| 693 |
\texorpdfstring{% |
| 694 |
\def\xpg@cyrillic@dash@sh@tmp{% |
| 695 |
\if\xpg@cyrillic@dash@sh@next-% |
| 696 |
\expandafter\xpg@cyrillic@dash@sh@emdash% |
| 697 |
\else% |
| 698 |
\expandafter\xpg@add@hyphenation@point% |
| 699 |
\fi% |
| 700 |
}% |
| 701 |
\futurelet\xpg@cyrillic@dash@sh@next\xpg@cyrillic@dash@sh@tmp% |
| 702 |
}{-}% |
| 703 |
} |
| 704 |
\def\xpg@cyrillic@dash@sh@emdash#1#2{\cdash-#1#2}% |
| 705 |
\def\cdash#1#2#3{% |
| 706 |
\def\xpg@tempa@{#3}% |
| 707 |
\def\xpg@tempb@{-}% |
| 708 |
\ifx\xpg@tempa@\xpg@tempb@ |
| 709 |
\xpg@cyrillic@normal@dash% |
| 710 |
\else |
| 711 |
\def\xpg@tempb@{~}% |
| 712 |
\ifx\xpg@tempa@\xpg@tempb@% |
| 713 |
\xpg@cyrillic@surname@dash% |
| 714 |
\else |
| 715 |
\def\xpg@tempb@{*}% |
| 716 |
\ifx\xpg@tempa@\xpg@tempb@% |
| 717 |
\xpg@cyrillic@quotation@dash% |
| 718 |
\else |
| 719 |
\errmessage{Wrong usage of cdash}% |
| 720 |
\fi% |
| 721 |
\fi% |
| 722 |
\fi% |
| 723 |
}% |
| 724 |
\def\xpg@cyrillic@normal@dash{% |
| 725 |
\ifdim\lastskip>\z@\unskip\nobreak\hskip.2em\fi |
| 726 |
\cyrdash\hskip.2em\ignorespaces% |
| 727 |
}% |
| 728 |
\def\xpg@cyrillic@surname@dash{% |
| 729 |
\leavevmode\ifdim\lastskip>\z@\unskip\fi |
| 730 |
\nobreak\cyrdash\penalty\exhyphenpenalty\hskip\z@skip\ignorespaces% |
| 731 |
}% |
| 732 |
\def\xpg@cyrillic@quotation@dash{% |
| 733 |
\leavevmode\nobreak\cyrdash\nobreak\hskip.35em\ignorespaces% |
| 734 |
}% |
| 735 |
% |
| 736 |
\endinput |