1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679
|
% \iffalse meta-comment
%
% Copyright (C) 1997 University of Hamburg. This file may be distributed
% according to the GNU GPL. See file COPYING for details.
%
% The Babel package and the file language.skeleton on which this file
% is based is Copyright (C) 1989 -- 1997 by Johannes Braams
%
% This file is part of the Ethiopian language package.
% ----------------------------------------------------
% This system is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
%
% Please do not request updates from us directly. Primary
% distribution is through the CTAN archives.
% The Ethiopian language style for the Babel system was designed
% by a project team at the University of Hamburg.
%
% Please report errors to ethiop@informatik.uni-hamburg.de by
% email.
%
% Universitaet Hamburg
% FB Informatik, AB TGI
% - Ethiopian Language Project Team -
% Vogt-Koelln-Strasse 30
% 22527 Hamburg
% Germany
%
% \fi
% \CheckSum{1537}
%
% \iffalse
% Tell the \LaTeX\ system who we are and write an entry on the
% transcript.
%<*dtx>
\ProvidesFile{ethiop.dtx}
%</dtx>
%<code>\ProvidesFile{ethiop.ldf}
%<style>\ProvidesFile{ethiop.sty}
%<etha>\ProvidesFile{uetha.fd}
%<ethb>\ProvidesFile{uethb.fd}
%<etho>\ProvidesFile{uetho.fd}
%<arab>\ProvidesFile{etharab.sty}
[1998/03/30 v0.7 Ethiopian support for the babel system]
%
% Ethiopian support for Babel package for LaTeX version 2e
%
%<*filedriver>
\documentclass{ltxdoc}
\usepackage{fontenc}
\newcommand*{\TeXhax}{\TeX hax}
\newcommand*{\babel}{\textsf{babel}}
\newcommand*{\langvar}{$\langle \mathit lang \rangle$}
\newcommand*{\note}[1]{}
\newcommand*{\Lopt}[1]{\textsf{#1}}
\newcommand*{\file}[1]{\texttt{#1}}
\begin{document}
\DocInput{ethiop.dtx}
\end{document}
%</filedriver>
%\fi
% \GetFileInfo{ethiop.dtx}
%
% \changes{v0.2}{1997/02/08}{Update for \babel\ release 3.6}
%
% \changes{v0.7}{1998/03/30}{Complete reordering of the code
% for $\Omega$ compatibility}
%
% \subsubsection{The Ethiopian language}
%
% The file \file{\filename}\footnote{The file described in this
% section has version number \fileversion\ and was last revised on
% \filedate.} defines all the language definition macros for the
% Ethiopian language. For this language the characters |~|, |^|,
% |'|, |_|, |.| and |:| are made active. While this may not be
% the most robust solution, it allows us to use shorthands
% that are sufficiently close to the scientific transcription.
% Especially the activation of~|^| and also~|.|~has some drawbacks.
% \begin{itemize}
% \item We cannot use |^||^| for entering special characters.
% Usually this is done in package files only, so we do not
% get into real trouble, since \babel\ activates the
% characters only at the beginning of the document.
% \item We cannot use |.| in numbers, while Ethiopian text
% is being typeset. This is definitely a problem, because we
% have to use a |,| instead of the |.| when entering numbers
% for \TeX.
% \end{itemize}
% One must also remember that the Ethiopian language
% requires a special font that has been hand-taylored to work
% with this language definition. The font stretches the ligature
% mechanism of \TeX\ to the limit and works only in connection
% with this style.
%
% \StopEventually{}
%
% \subsubsection*{General Setup}
%
% The macro |\LdfInit| takes care of preventing that this file is
% loaded more than once, checking the category code of the
% \texttt{@} sign, etc.
% \begin{macrocode}
%<*code>
\LdfInit{ethiop}{captionsethiop}
% \end{macrocode}
%
% There is no hyphenation in the Ethiopian language, so
% we do not expect a hyphenation table to be loaded.
% For compatibility we add Ethiopian as a dialect of
% language~0 and disable hyphenation later. Just in case,
% we check for the existence of |\l@ethiop|.
%
% \begin{macrocode}
\ifx\undefined\l@ethiop
\adddialect\l@ethiop0\fi
% \end{macrocode}
%
% The next step consists of defining commands to switch to (and
% from) the Ethiopian language.
%
% \begin{macro}{\ethiophyphenmins}
% This macro is used to store the correct values of the hyphenation
% parameters |\lefthyphenmin| and |\righthyphenmin|. But because
% there is no hyphenation, we set it to some arbitrarily high value.
% \begin{macrocode}
\def\ethiophyphenmins{{99}{99}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\eth@doaltchar}
% Since the Ethiopian language has more than 256 characters,
% we need to output characters from an alternate font.
% This is done by temporarily switching to the alternate font family.
% This generates a considerable overhead in macro expansion time,
% but no other possibility is available.
%
% That last space is needed to get the stuff working
% with $\Omega$. This seems to be a bug in $\Omega$.
% But the space is certainly allowed,
% so I will leave it as it is for the moment and
% probably for a long time.
% \begin{macrocode}
\newcommand{\eth@doaltchar}[1]{%
{\fontfamily{\eth@altfamily}\selectfont\char#1 }%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dateethiop}
% \begin{macro}{\eth@modulo}
% The macro |\dateethiop| redefines the command |\today| to
% produce Ethiopian dates.
%
% We define some count registers first. They will hold
% intermediate results when we calculate the Ethiopian date.
% \begin{macrocode}
\newcount\ethcnt@temp
\newcount\ethcnt@modtemp
\newcount\ethcnt@leap
\newcount\ethcnt@yminone
\newcount\ethcnt@days
\newcount\ethcnt@jdn
\newcount\ethcnt@cycle
\newcount\ethcnt@ethdays
\newcount\ethcnt@ethyear
\newcount\ethcnt@ethmonth
\newcount\ethcnt@ethday
% \end{macrocode}
%
% To ease some calculations we define a macro for the
% remainder of a division.
% \begin{macrocode}
\newcommand{\eth@modulo}[2]{%
\ethcnt@modtemp=#1%
\divide\ethcnt@modtemp by #2%
\multiply\ethcnt@modtemp by #2%
\advance#1 by -\ethcnt@modtemp
}
% \end{macrocode}
%
% The Ethiopian calendar is a variant of the Julian calendar.
% First we compute the day number from the Julian epoch, then
% we calculate day, month, and year of the Ethiopian calendar.
% Admittedly, the routine is a bit messy.
% \begin{macrocode}
\def\dateethiop{%
\def\today{{%
% \end{macrocode}
% |\ethcnt@yminone| denotes the current year minus one.
% \[\textit{yminone}=\textit{year}-1\]
% \begin{macrocode}
\ethcnt@yminone=\year
\advance\ethcnt@yminone by -1
% \end{macrocode}
% We set |\ethcnt@leap| to $1$ if the current year in the
% Gregorian calendar is a leap year.
% \[\textit{leap}=
% \Big\lfloor\frac{\textit{year}}{4}\Big\rfloor
% -\Big\lfloor\frac{\textit{year}-1}{4}\Big\rfloor
% -\Big\lfloor\frac{\textit{year}}{100}\Big\rfloor
% +\Big\lfloor\frac{\textit{year}-1}{100}\Big\rfloor
% +\Big\lfloor\frac{\textit{year}}{400}\Big\rfloor
% -\Big\lfloor\frac{\textit{year}-1}{400}\Big\rfloor\]
% \begin{macrocode}
\ethcnt@leap=\year
\divide\ethcnt@leap by 4
\ethcnt@temp=\ethcnt@yminone
\divide\ethcnt@temp by 4
\advance\ethcnt@leap by -\ethcnt@temp
\ethcnt@temp=\year
\divide\ethcnt@temp by 100
\advance\ethcnt@leap by -\ethcnt@temp
\ethcnt@temp=\ethcnt@yminone
\divide\ethcnt@temp by 100
\advance\ethcnt@leap by \ethcnt@temp
\ethcnt@temp=\year
\divide\ethcnt@temp by 400
\advance\ethcnt@leap by \ethcnt@temp
\ethcnt@temp=\ethcnt@yminone
\divide\ethcnt@temp by 400
\advance\ethcnt@leap by -\ethcnt@temp
% \end{macrocode}
% |\ethcnt@days| corresponds to the number of days since
% January 0.
% \[\textit{days}=
% \left\{\begin{array}{l@{\quad}l}
% 31(\textit{month}-1)+\textit{day}-1 &
% \textrm{if }\textit{month}\leq 2\\
% 30(\textit{month}-1)+\textit{day}+\textit{leap}-3+
% \left\lfloor\frac{3 month-2}{5}\right\rfloor &
% \textrm{if }\textit{month}\geq 3
% \end{array}\right.\]
% \begin{macrocode}
\ifnum\month<3
\ethcnt@days=\month
\advance\ethcnt@days by -1
\multiply\ethcnt@days by 31
\advance\ethcnt@days by \day
\advance\ethcnt@days by -1
\else
\ethcnt@days=\month
\advance\ethcnt@days by -1
\multiply\ethcnt@days by 30
\advance\ethcnt@days by \day
\advance\ethcnt@days by \ethcnt@leap
\advance\ethcnt@days by -3
\ethcnt@temp=\month
\multiply\ethcnt@temp by 3
\advance\ethcnt@temp by -2
\divide\ethcnt@temp by 5
\advance\ethcnt@days by \ethcnt@temp
\fi
% \end{macrocode}
% We can now determine the Julian day number, |\ethcnt@jdn|.
% \[\textit{jdn}=1721426+\textit{days}+365(\textit{year}-1)
% +\Big\lfloor\frac{\textit{year}-1}{4}\Big\rfloor
% -\Big\lfloor\frac{\textit{year}-1}{100}\Big\rfloor
% +\Big\lfloor\frac{\textit{year}-1}{400}\Big\rfloor\]
% \begin{macrocode}
\ethcnt@jdn=\ethcnt@days
\advance\ethcnt@jdn by 1721426
\ethcnt@temp=\ethcnt@yminone
\multiply\ethcnt@temp by 365
\advance\ethcnt@jdn by \ethcnt@temp
\ethcnt@temp=\ethcnt@yminone
\divide\ethcnt@temp by 4
\advance\ethcnt@jdn by \ethcnt@temp
\ethcnt@temp=\ethcnt@yminone
\divide\ethcnt@temp by 100
\advance\ethcnt@jdn by -\ethcnt@temp
\ethcnt@temp=\ethcnt@yminone
\divide\ethcnt@temp by 400
\advance\ethcnt@jdn by \ethcnt@temp
% \end{macrocode}
% The first task to determine the Ethiopian date is to
% compute the number of the current day in a four
% year cycle.
% \[\textit{cycle}=(\textit{jdn}-1723856)\bmod 1461\]
% \begin{macrocode}
\ethcnt@cycle=\ethcnt@jdn
\advance\ethcnt@cycle by -1723856
\eth@modulo{\ethcnt@cycle}{1461}%
% \end{macrocode}
% |\ethcnt@ethdays| contains the number of the current day in the
% Ethiopian year.
% \[\textit{ethdays}=
% 365\Big\lfloor\frac{\textit{cycle}}{1460}\Big\rfloor
% +cycle\bmod 365\]
% \begin{macrocode}
\ethcnt@ethdays=\ethcnt@cycle
\eth@modulo{\ethcnt@ethdays}{365}%
\ethcnt@temp=\ethcnt@cycle
\divide\ethcnt@temp by 1460
\multiply\ethcnt@temp by 365
\advance\ethcnt@ethdays by \ethcnt@temp
% \end{macrocode}
% |\ethcnt@ethyear|, |\ethcnt@ethmonth|, and |\ethcnt@ethday| will denote the
% Ethiopian year, month, and day.
% \[\textit{ethyear}=
% 4\Big\lfloor\frac{\textit{jdn}-1723856}{1461}\Big\rfloor
% +\Big\lfloor\frac{\textit{cycle}}{365}\Big\rfloor
% -\Big\lfloor\frac{\textit{cycle}}{1460}\Big\rfloor\]
% \begin{macrocode}
\ethcnt@ethyear=\ethcnt@jdn
\advance\ethcnt@ethyear by -1723856
\divide\ethcnt@ethyear by 1461
\multiply\ethcnt@ethyear by 4
\ethcnt@temp=\ethcnt@cycle
\divide\ethcnt@temp by 365
\advance\ethcnt@ethyear by \ethcnt@temp
\divide\ethcnt@cycle by 1460
\advance\ethcnt@ethyear by -\ethcnt@cycle
% \end{macrocode}
% \[\textit{ethmonth}=
% \Big\lfloor\frac{\textit{ethdays}}{30}\Big\rfloor+1\]
% \begin{macrocode}
\ethcnt@ethmonth=\ethcnt@ethdays
\divide\ethcnt@ethmonth by 30
\advance\ethcnt@ethmonth by 1
% \end{macrocode}
% \[\textit{ethday}=\textit{ethdays}\bmod 30+1\]
% \begin{macrocode}
\ethcnt@ethday=\ethcnt@ethdays
\eth@modulo{\ethcnt@ethday}{30}%
\advance\ethcnt@ethday by 1
% \end{macrocode}
% We are almost finished now. We just need to format
% the date according to Ethiopian conventions.
% \begin{macrocode}
\eth@monthname{\ethcnt@ethmonth}\relax\space
\number\ethcnt@ethday\relax\space
\number\ethcnt@ethyear
}}%
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% We want to be able to switch to the
% correct font by simply issuing the appropriate
% |\selectlanguage| command. The defaults for font encoding and
% family have to be changed, too, in order to get chapter headings
% etc.~with the correct font. And we must remember our way back.
% \begin{macrocode}
\addto\extrasethiop{%
\let\eth@old@encdef\encodingdefault
\let\eth@old@famdef\familydefault
\def\encodingdefault{U}%
\def\familydefault{\eth@defaultfamily}%
\fontencoding{\encodingdefault}%
\fontfamily{\familydefault}%
\selectfont
}
\addto\noextrasethiop{%
\let\encodingdefault\eth@old@encdef
\let\familydefault\eth@old@famdef
\let\eth@old@encdef\relax
\let\eth@old@famdef\relax
\fontencoding{\encodingdefault}%
\fontfamily{\familydefault}%
\selectfont
}
% \end{macrocode}
%
% In order to provide the dollar sign and the curly braces
% we redefine the commands |\textdollar|, |\textbraceleft|, and |\textbraceright|.
% \begin{macrocode}
\addto\extrasethiop{%
\babel@save\textdollar
\def\textdollar{\char`\$}%
\def\textbraceleft{{\fontencoding{OMS}%
\fontfamily{cmr}%
\selectfont\char102 }}%
\def\textbraceright{{\fontencoding{OMS}%
\fontfamily{cmr}%
\selectfont\char103 }}%
}
% \end{macrocode}
%
% When we use |\-|, we want a
% possible breakpoint without the insertion of a hyphen.
% \begin{macrocode}
\addto\extrasethiop{%
\babel@save\-%
\def\-{\ethbreak}%
}
% \end{macrocode}
%
% Sometimes \LaTeX\ uses |\MakeUppercase| and |\MakeLowercase|
% to format text for output. However, there is no
% upper or lower case in the Ethiopian languages,
% so these macros are not needed. Worse still, the use
% of |\MakeUppercase| can make a character unprintable, which
% can lead to black error bars in the output. Hence we simply
% disable the two commands while Ethiopian text is typeset
% by replacing them with a command that outputs its
% single argument without any change.
%
% We cannot redefine the low level commands |\uppercase|
% and |lowercase| directly, because \LaTeX\ uses them for
% some internal conversions. Especially the font selection
% algorithm would be affected by such a change, so we better
% do not touch anything.
%
% \begin{macrocode}
\addto\extrasethiop{%
\babel@save\MakeUppercase
\let\MakeUppercase=\@firstofone
\babel@save\MakeLowercase
\let\MakeLowercase=\@firstofone
}
% \end{macrocode}
%
%
% \changes{v0.3}{1997/04/24}{Added support for Ethiopian
% characters in math mode.}
%
% \begin{macro}{\ethmath}
% In Ethiopia it is common to use Ethiopian characters
% as identifiers in math mode, too. Since our use of
% \TeX\ ligatures is only applicable in text mode, we will
% need a special command to temporarily switch to text mode
% with the proper font size selected with the help of
% a |\mathchoice|.
%
% \begin{macrocode}
\addto\extrasethiop{%
\babel@save\ethmath
\def\ethmath#1{\mathchoice{\hbox{#1}}{\hbox{#1}}%
{\hbox{\footnotesize #1}}{\hbox{\tiny #1}}}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ethnum@err}
% We can only output Ethiopian numbers from 1 to 999999.
% \begin{macrocode}
\newcommand{\ethnum@err}[1]{%
\PackageError{ethiop}{%
Ethiopian number out of range%
}{%
Some Ethiopian number I had to print
was not in the range 1..999999.\MessageBreak
Type <return> and I will use an
Arabic number instead.
}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifethvariantC}
% Since there are two glyph variants for the |^C| series,
% we provide a switch between the two.
% \begin{macrocode}
\newif\ifethvariantC
\ethvariantCfalse
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ethglue}
% The macro |\ethglue| is used to insert a small
% stretchable space before and after certain punctuation marks.
% \begin{macrocode}
\def\ethglue{\hskip 0,16667em plus 0,16667em }%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ethbreak}
% The macro |\ethbreak| is used to insert a feasible
% breakpoint between certain characters.
% \begin{macrocode}
\def\ethbreak{\penalty 5 }%
% \end{macrocode}
% \end{macro}
%
% Now we need to determine if this file is run on an $\Omega$
% system. What follows is a long |\if| statement.
% A \emph{really} long |\if| statement.
% \begin{macrocode}
\ifx\ocp\undefined
% \end{macrocode}
%
% \subsubsection*{\TeX\ Setup}
%
% Ok, so this is an ordinary \TeX\ system. Here we need
% to define lots of macros for the translation of our
% encoding.
%
% \begin{macro}{\eth@altchar}
% \begin{macro}{\eth@altchargobble}
% Whenever a character is output, we put the corresponding code
% into the macro |\eth@res| which will be expanded later
% on.
% \begin{macrocode}
\newcommand{\eth@altchar}[1]{%
\def\eth@res{\eth@doaltchar{#1}}%
}
% \end{macrocode}
%
% Sometimes we must output a character and gobble a token.
% \begin{macrocode}
\newcommand{\eth@altchargobble}[1]{%
\def\eth@res{\eth@doaltchar{#1}\@gobble}%
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\eth@testA}
% \begin{macro}{\eth@ifnextA}
% To do some three and four character shorthands we define the
% following auxiliary macros.
%
% |\eth@ifnextA| checks if the the next character is \texttt{A} or
% \texttt{a}. If yes, then we output the compound character given in
% the first parameter and gobble the \texttt{A}. If no, we output the
% ordinary character (second parameter) and leave the \texttt{A}
% where it is. On the fly, |\eth@ifnextA| gobbles its third
% argument (an already processed character \texttt{u}).
% \begin{macrocode}
\newcommand{\eth@ifnextA}[3]{%
\def\eth@res{\eth@ifnextA@eval{#1}{#2}}%
\futurelet\@let@token\eth@res
}
\newcommand{\eth@ifnextA@eval}[2]{%
\ifx\@let@token a\eth@altchargobble{#1}%
\else\ifx\@let@token A\eth@altchargobble{#1}%
\else\eth@altchar{#2}\fi\fi
\eth@res
}
% \end{macrocode}
%
% Delay the check for the token \texttt{A} until |\eth@res| has been
% expanded.
% \begin{macrocode}
\newcommand{\eth@testA}[2]{%
\def\eth@res{\eth@ifnextA{#1}{#2}}%
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\eth@three@short}
% \begin{macro}{\eth@three@norm}
% \begin{macro}{\eth@three@full}
% \begin{macro}{\eth@three@part}
% Each of the following macros evaluates the token following
% one of the shorthands. The token has already been saved in the
% variable |\@let@token| by the means of a |\futurelet|.
% Depending on the result of the evaluation an appropriate
% character from the alternate font is output.
%
% \begin{macrocode}
\newcommand{\eth@three@short}[7]{%
\ifx\@let@token a\eth@altchargobble{#1}%
\else\ifx\@let@token A\eth@altchargobble{#2}%
\else\ifx\@let@token e\eth@altchargobble{#3}%
\else\ifx\@let@token E\eth@altchargobble{#4}%
\else\ifx\@let@token i\eth@altchargobble{#5}%
\else\ifx\@let@token I\eth@altchargobble{#5}%
\else\ifx\@let@token o\eth@altchargobble{#6}%
\else\ifx\@let@token O\eth@altchargobble{#6}%
\else\ifx\@let@token u\eth@altchargobble{#7}%
\else\ifx\@let@token U\eth@altchargobble{#7}%
\else\eth@altchar{#3}\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\eth@res
}
% \end{macrocode}
%
% Usually we expect a single vowel, but if the vowel is
% \texttt{u} or \texttt{U}, another \texttt{A} might
% follow to indicate a diphtong.
%
% \begin{macrocode}
\newcommand{\eth@three@norm}[8]{%
\ifx\@let@token a\eth@altchargobble{#1}%
\else\ifx\@let@token A\eth@altchargobble{#2}%
\else\ifx\@let@token e\eth@altchargobble{#3}%
\else\ifx\@let@token E\eth@altchargobble{#4}%
\else\ifx\@let@token i\eth@altchargobble{#5}%
\else\ifx\@let@token I\eth@altchargobble{#5}%
\else\ifx\@let@token o\eth@altchargobble{#6}%
\else\ifx\@let@token O\eth@altchargobble{#6}%
\else\ifx\@let@token u\eth@testA{#8}{#7}%
\else\ifx\@let@token U\eth@testA{#8}{#7}%
\else\eth@altchar{#3}\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\eth@res
}
% \end{macrocode}
%
% At last we must deal with the case where
% a \texttt{u} might actually be followed by a
% whole range of different vowels.
%
% \begin{macrocode}
\newcommand{\eth@three@full}[8]{%
\ifx\@let@token a\eth@altchargobble{#1}%
\else\ifx\@let@token A\eth@altchargobble{#2}%
\else\ifx\@let@token e\eth@altchargobble{#3}%
\else\ifx\@let@token E\eth@altchargobble{#4}%
\else\ifx\@let@token i\eth@altchargobble{#5}%
\else\ifx\@let@token I\eth@altchargobble{#5}%
\else\ifx\@let@token o\eth@altchargobble{#6}%
\else\ifx\@let@token O\eth@altchargobble{#6}%
\else\ifx\@let@token u\def\eth@res{\eth@three@help{#8}{#7}}%
\else\ifx\@let@token U\def\eth@res{\eth@three@help{#8}{#7}}%
\else\eth@altchar{#3}\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\eth@res
}
% \end{macrocode}
%
% |\eth@three@help| is called if we need to examine the
% fourth character. The first argument is supposed
% to be a list of five character codes, the second
% is an alternative character code, and the third
% is an already processed character \texttt{u} which
% we will gobble on the fly.
%
% \begin{macrocode}
\newcommand{\eth@three@help}[3]{%
\def\eth@res{\eth@three@part#1{#2}}%
\futurelet\@let@token\eth@res
}
\newcommand{\eth@three@part}[6]{%
\ifx\@let@token a\eth@altchargobble{#1}%
\else\ifx\@let@token A\eth@altchargobble{#2}%
\else\ifx\@let@token e\eth@altchargobble{#3}%
\else\ifx\@let@token E\eth@altchargobble{#4}%
\else\ifx\@let@token i\eth@altchargobble{#5}%
\else\ifx\@let@token I\eth@altchargobble{#5}%
\else\eth@altchar{#6}\fi\fi\fi\fi\fi\fi
\eth@res
}
% \end{macrocode}
%
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\eth@hatc}
% \begin{macro}{\eth@dotc}
% \begin{macro}{\eth@hatC}
% \begin{macro}{\eth@barC}
% \begin{macro}{\eth@dotd}
% \begin{macro}{\eth@hatg}
% \begin{macro}{\eth@accg}
% \begin{macro}{\eth@dotg}
% \begin{macro}{\eth@acch}
% \begin{macro}{\eth@barh}
% \begin{macro}{\eth@doth}
% \begin{macro}{\eth@acck}
% \begin{macro}{\eth@bark}
% \begin{macro}{\eth@tiln}
% \begin{macro}{\eth@dotp}
% \begin{macro}{\eth@accq}
% \begin{macro}{\eth@dotq}
% \begin{macro}{\eth@hats}
% \begin{macro}{\eth@accs}
% \begin{macro}{\eth@dots}
% \begin{macro}{\eth@dott}
% \begin{macro}{\eth@hatz}
% For each of the shorthands |^c|, |.c|, |^C|, |_C|, |.d|,
% |^g|, |'g|, |_h|, |'h|, |.h|, |k'|, |_k|, |~n|,
% |.p|, |'q|, |.q|, |^s|, |'s|, |.s|, |.t|, and |^z|
% we will define macros that
% handle the check for additional characters.
% These macros call |\eth@three@norm| or some of the
% related macros to evaluate the
% characters following the shorthand. We provide the
% character codes for the current consonant as
% arguments to the call of the main macro.
%
% \begin{macrocode}
\DeclareRobustCommand{\eth@hatc}{%
\eth@three@norm{104}{107}{109}%
{108}{106}{110}{105}%
{111}%
}
\DeclareRobustCommand{\eth@dotc}{%
\eth@three@short{216}{219}{221}%
{220}{218}{222}{217}%
}
\DeclareRobustCommand{\eth@hatC}{%
\ifethvariantC
\bbl@afterelse
\eth@three@norm{192}{195}{197}%
{196}{194}{198}{193}%
{199}%
\else
\bbl@afterfi
\eth@three@norm{184}{187}{189}%
{188}{186}{190}{185}%
{191}%
\fi
}
\DeclareRobustCommand{\eth@dotd}{%
\eth@three@norm{152}{155}{157}%
{156}{154}{158}{153}%
{159}%
}
\DeclareRobustCommand{\eth@hatg}{%
\eth@three@norm{160}{163}{165}%
{164}{162}{166}{161}%
{167}%
}
\DeclareRobustCommand{\eth@accg}{%
\eth@three@short{248}{251}{253}%
{252}{250}{254}{249}%
}
\DeclareRobustCommand{\eth@dotg}{%
\eth@three@full{168}{171}{173}%
{172}{170}{174}{169}%
{{24}{27}{29}%
{28}{26}}%
}
\DeclareRobustCommand{\eth@acch}{%
\eth@three@short{240}{243}{245}%
{244}{242}{246}{241}%
}
\DeclareRobustCommand{\eth@barh}{%
\eth@three@full{112}{115}{117}%
{116}{114}{118}{113}%
{{8}{11}{13}%
{12}{10}}%
}
\DeclareRobustCommand{\eth@doth}{%
\eth@three@norm{72}{75}{77}%
{76}{74}{78}{73}%
{79}%
}
\DeclareRobustCommand{\eth@acck}{%
\eth@three@short{232}{235}{237}%
{236}{234}{238}{233}%
}
\DeclareRobustCommand{\eth@bark}{%
\eth@three@full{136}{139}{141}%
{140}{138}{142}{137}%
{{16}{19}{21}%
{20}{18}}%
}
\DeclareRobustCommand{\eth@tiln}{%
\eth@three@norm{120}{123}{125}%
{124}{122}{126}{121}%
{127}%
}
\DeclareRobustCommand{\eth@dotp}{%
\eth@three@norm{200}{203}{205}%
{204}{202}{206}{201}%
{207}%
}
\DeclareRobustCommand{\eth@accq}{%
\eth@three@short{224}{227}{229}%
{228}{226}{230}{225}%
}
\DeclareRobustCommand{\eth@dotq}{%
\eth@three@full{96}{99}{101}%
{100}{98}{102}{97}%
{{0}{3}{5}%
{4}{2}}%
}
\DeclareRobustCommand{\eth@hats}{%
\eth@three@norm{88}{91}{93}%
{92}{90}{94}{89}%
{95}%
}
\DeclareRobustCommand{\eth@accs}{%
\eth@three@norm{80}{83}{85}%
{84}{82}{86}{81}%
{87}%
}
\DeclareRobustCommand{\eth@dots}{%
\eth@three@norm{208}{211}{213}%
{212}{210}{214}{209}%
{215}%
}
\DeclareRobustCommand{\eth@dott}{%
\eth@three@norm{176}{179}{181}%
{180}{178}{182}{177}%
{183}%
}
\DeclareRobustCommand{\eth@hatz}{%
\eth@three@norm{144}{147}{149}%
{148}{146}{150}{145}%
{151}%
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% For Ethiopian the characters |~|, |^|, |'|, |_|, |.| and |:|
% are made active. This is done once, later on their definitions
% may vary.
% \begin{macrocode}
\initiate@active@char{~}
\initiate@active@char{^}
\initiate@active@char{'}
\initiate@active@char{_}
\initiate@active@char{.}
\initiate@active@char{:}
% \end{macrocode}
%
% The macro |\extrasethiop| will perform all the extra
% definitions needed for the Ethiopian language, among them
% the activation of the special characters. The macro
% |\noextrasethiop| is supposed to cancel the actions of
% |\extrasethiop|. However, |'| must \emph{not} be deactivated,
% in order to make it usable in math mode.
% \begin{macrocode}
\addto\extrasethiop{\languageshorthands{ethiop}}
\addto\extrasethiop{%
\bbl@activate{~}%
\bbl@activate{^}%
\bbl@activate{'}%
\bbl@activate{_}%
\bbl@activate{.}%
\bbl@activate{:}}
\addto\noextrasethiop{%
\bbl@deactivate{~}%
\bbl@deactivate{^}%
\bbl@deactivate{_}%
\bbl@deactivate{.}%
\bbl@deactivate{:}}
% \end{macrocode}
%
% When the active characters appear in an environment where their
% special behaviour is not wanted they should give an `expected'
% result. Therefore we define shorthands at system level first.
% If this is not done, \TeX\ goes into an infinite loop
% as soon as an active character is followed by a |{|.
% This is unexpected.
% \begin{macrocode}
\declare@shorthand{system}{^}{\csname normal@char\string^\endcsname}
\declare@shorthand{system}{_}{\csname normal@char\string_\endcsname}
\declare@shorthand{system}{.}{\csname normal@char\string.\endcsname}
% \end{macrocode}
% The |'| must not be replaced by its normal char, because that
% is converted to an active char in math mode. Then the
% shorthand code is again executed and the system goes into an
% infinite loop.
% \begin{macrocode}
\declare@shorthand{system}{'}{\textormath
{\csname normal@char\string'\endcsname}%
{\sp\bgroup\prim@s}%
}
% \end{macrocode}
%
% The shorthand |:| will not simply be replaced by
% an ordinary character, because the associated
% character indicates an interword space. Before and after
% such a space we want to get a little stretchable
% glue, so we have to insert it by hand. A little macro
% will do that for us.
%
% Just in case the user typed the spaces himself, they
% will be automatically removed in order to catch the most
% common typing errors. We have to use two different
% methods: After the |:| we can simply ignore space tokens by
% invoking |\ignorespaces|. Before the |:| we check if the last
% skip in the horizontal list matches the skip generated by a space
% token. We cannot directly check whether the last token was
% indeed a space token, but this heuristic is sufficiently good.
% \begin{macro}{\eth@punctglue}
% \begin{macrocode}
\def\eth@punctglue#1#2{%
\ifmmode
#2%
\else
\ifhmode
\ifdim\lastskip=\fontdimen2\font\relax
\unskip
\fi
\fi
\nobreak
\ethglue
#1%
\allowbreak
\ethglue
\expandafter
\ignorespaces
\fi
}%
% \end{macrocode}
% \end{macro}
%
% We can now define the shorthand.
% \begin{macrocode}
\declare@shorthand{system}{:}{%
\eth@punctglue{\char58 }%
{\char58 }%
}
% \end{macrocode}
%
% The double quote needs some extra treatment in math mode.
%
% \changes{v0.5}{1997/06/18}{Correction for double primes in math mode.}
% \begin{macrocode}
\declare@shorthand{ethiop}{''}{\textormath
{\symbol{34}}{\sp\bgroup\prime\prim@s}}
% \end{macrocode}
%
% Now we can define the shorthands for Ethiopian. Most of the work
% is already done by the macros we met earlier on.
%
% \changes{v0.3}{1997/04/24}{Made the shorthands
% work as expected within mathmode.}
% \begin{macrocode}
\declare@shorthand{ethiop}{^c}{\textormath
{\futurelet\@let@token\eth@hatc}{\sp c}}
\declare@shorthand{ethiop}{^C}{\textormath
{\futurelet\@let@token\eth@hatC}{\sp C}}
\declare@shorthand{ethiop}{.c}{\textormath
{\futurelet\@let@token\eth@dotc}%
{\csname normal@char\string.\endcsname c}}
\declare@shorthand{ethiop}{.d}{\textormath
{\futurelet\@let@token\eth@dotd}%
{\csname normal@char\string.\endcsname d}}
\declare@shorthand{ethiop}{^g}{\textormath
{\futurelet\@let@token\eth@hatg}{\sp g}}
\declare@shorthand{ethiop}{'g}{\textormath
{\futurelet\@let@token\eth@accg}%
{\csname normal@char\string'\endcsname g}}
\declare@shorthand{ethiop}{.g}{\textormath
{\futurelet\@let@token\eth@dotg}%
{\csname normal@char\string.\endcsname g}}
\declare@shorthand{ethiop}{_h}{\textormath
{\futurelet\@let@token\eth@barh}{\sb h}}
\declare@shorthand{ethiop}{'h}{\textormath
{\futurelet\@let@token\eth@acch}%
{\csname normal@char\string'\endcsname h}}
\declare@shorthand{ethiop}{.h}{\textormath
{\futurelet\@let@token\eth@doth}%
{\csname normal@char\string.\endcsname g}}
\declare@shorthand{ethiop}{_k}{\textormath
{\futurelet\@let@token\eth@bark}{\sb k}}
\declare@shorthand{ethiop}{'k}{\textormath
{\futurelet\@let@token\eth@acck}%
{\csname normal@char\string'\endcsname k}}
\declare@shorthand{ethiop}{~n}{\textormath
{\futurelet\@let@token\eth@tiln}%
{\csname normal@char\string~\endcsname n}}
\declare@shorthand{ethiop}{.p}{\textormath
{\futurelet\@let@token\eth@dotp}%
{\csname normal@char\string.\endcsname p}}
\declare@shorthand{ethiop}{'q}{\textormath
{\futurelet\@let@token\eth@accq}%
{\csname normal@char\string'\endcsname q}}
\declare@shorthand{ethiop}{.q}{\textormath
{\futurelet\@let@token\eth@dotq}%
{\csname normal@char\string.\endcsname q}}
\declare@shorthand{ethiop}{^s}{\textormath
{\futurelet\@let@token\eth@hats}{\sp s}}
\declare@shorthand{ethiop}{'s}{\textormath
{\futurelet\@let@token\eth@accs}%
{\csname normal@char\string'\endcsname s}}
\declare@shorthand{ethiop}{.s}{\textormath
{\futurelet\@let@token\eth@dots}%
{\csname normal@char\string.\endcsname s}}
\declare@shorthand{ethiop}{.t}{\textormath
{\futurelet\@let@token\eth@dott}%
{\csname normal@char\string.\endcsname t}}
\declare@shorthand{ethiop}{^z}{\textormath
{\futurelet\@let@token\eth@hatz}{\sp z}}
% \end{macrocode}
%
% \changes{v0.4}{1997/06/12}{Added three letters to
% get the complete Unicode character set.}
%
% Now follow the shorthands |~mA|, |~ri|, and |~fi|.
% Already the first two characters determine the shorthand,
% but we need to gobble the third, if if is there.
% \begin{macrocode}
\declare@shorthand{ethiop}{~m}{%
\textormath{%
\eth@doaltchar{40}%
\@ifnextchar A{\@gobble}{}%
}{\csname normal@char\string~\endcsname m}%
}
\declare@shorthand{ethiop}{~r}{%
\textormath{%
\eth@doaltchar{41}%
\@ifnextchar i{\@gobble}{}%
}{\csname normal@char\string~\endcsname r}%
}
\declare@shorthand{ethiop}{~f}{%
\textormath{%
\eth@doaltchar{42}%
\@ifnextchar i{\@gobble}{}%
}{\csname normal@char\string~\endcsname f}%
}
% \end{macrocode}
%
% The following shorthands do not start syllables, but
% they denote characters in their own right.
%
% \begin{macrocode}
\declare@shorthand{ethiop}{'A}{\textormath
{\eth@doaltchar{131}}{\csname normal@char\string'\endcsname A}}
\declare@shorthand{ethiop}{'a}{\textormath
{\eth@doaltchar{128}}{\csname normal@char\string'\endcsname a}}
\declare@shorthand{ethiop}{'E}{\textormath
{\eth@doaltchar{132}}{\csname normal@char\string'\endcsname E}}
\declare@shorthand{ethiop}{'e}{\textormath
{\eth@doaltchar{133}}{\csname normal@char\string'\endcsname e}}
\declare@shorthand{ethiop}{'I}{\textormath
{\eth@doaltchar{130}}{\csname normal@char\string'\endcsname I}}
\declare@shorthand{ethiop}{'i}{\textormath
{\eth@doaltchar{130}}{\csname normal@char\string'\endcsname i}}
\declare@shorthand{ethiop}{'O}{\textormath
{\eth@doaltchar{134}}{\csname normal@char\string'\endcsname O}}
\declare@shorthand{ethiop}{'o}{\textormath
{\eth@doaltchar{134}}{\csname normal@char\string'\endcsname o}}
\declare@shorthand{ethiop}{'U}{\textormath
{\eth@ifnextA{135}{129}{U}}{\csname normal@char\string'\endcsname U}}
\declare@shorthand{ethiop}{'u}{\textormath
{\eth@ifnextA{135}{129}{U}}{\csname normal@char\string'\endcsname u}}
% \end{macrocode}
%
% There are some punctuation characters that also
% require a shorthand. It would be possible to form
% the characters using ligatures, if |:| were not activated.
% But |:| must be activated to get the spacing effect we
% mentioned above.
% \begin{macrocode}
\declare@shorthand{ethiop}{:=}{%
\eth@punctglue{\char42 }%
{\char58 =}%
}%
\declare@shorthand{ethiop}{:-}{%
\eth@punctglue{\char123 }%
{\char58 -}%
}%
\declare@shorthand{ethiop}{::}{%
\eth@punctglue{\char126 }%
{\char58 \char58 }%
}%
% \end{macrocode}
%
% \changes{v0.4}{1997/06/12}{Added the paragraph delimiter
% character to get the complete Unicode character set.}
%
% The sequence \texttt{:\char124 :} results in a rare seven dot
% paragraph delimiter.
% \begin{macrocode}
\declare@shorthand{ethiop}{:|}{%
\@ifnextchar:{%
\eth@punctglue{\char125 }%
{\char58 |\char58 }%
\@gobble
}{%
\char58 |%
}%
}%
% \end{macrocode}
%
% \begin{macro}{\eth@defaultfamily}
% \begin{macro}{\eth@altfamily}
% For the \TeX\ transliteration we must use
% the font family |etha| as the default. The |ethb|
% family contains the additional characters.
% \begin{macrocode}
\def\eth@defaultfamily{etha}%
\def\eth@altfamily{ethb}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ethiop}
% \begin{macro}{\@ethiop}
% \begin{macro}{\ethnum}
% \begin{macro}{\ethnum@one}
% \begin{macro}{\ethnum@two}
% \begin{macro}{\ethnum@three}
% \begin{macro}{\ethnum@four}
% \begin{macro}{\ethnum@five}
% \begin{macro}{\ethnum@six}
% We provide a special macro that outputs a counter as an
% Ethiopian number, namely |\ethiop|. It is accompanied by some
% auxiliary macros that are called depending on the range of the
% number. |\@ethiop| converts its argument (an ordinary number)
% to the Ethiopian format. The name |\@ethiop| is required
% so that a user can say |\pagenumbering{ethiop}| and get
% Ethiopian page numbers. |\ethnum| is provided as a nickname
% for |\@ethiop|, so that it may be called from user code.
%
% These macros should work even when the Ethiopian
% language is not currently selected, because
% counters might be printed during an output routine
% where we cannot make any assumptions on the
% current enviroment.
% \begin{macrocode}
\def\ethiop#1{\expandafter\@ethiop\csname c@#1\endcsname}
\def\@ethiop#1{{%
\fontencoding{U}%
\fontfamily{\eth@altfamily}\selectfont
\ifnum#1<1\relax\ethnum@err{#1}%
\else\ifnum#1<10\relax\expandafter\ethnum@one\number #1%
\else\ifnum#1<100\relax\expandafter\ethnum@two\number #1%
\else\ifnum#1<1000\relax\expandafter\ethnum@three\number #1%
\else\ifnum#1<10000\relax\expandafter\ethnum@four\number #1%
\else\ifnum#1<100000\relax\expandafter\ethnum@five\number #1%
\else\ifnum#1<1000000\relax\expandafter\ethnum@six\number #1%
\else
\fontfamily{\eth@defaultfamily}\selectfont
\ethnum@err
\number#1%
\fi\fi\fi\fi\fi\fi\fi
}}
\let\ethnum\@ethiop
\newcommand{\ethnum@tens}[1]{%
\ifcase#1\or\char58 \or\char59 \or\char60
\or\char61 \or\char62 \or\char63
\or\char64 \or\char65 \or\char66 \fi
\relax
}
\newcommand{\ethnum@one}[1]{%
\ifnum#1>0\relax#1\fi
}
\newcommand{\ethnum@two}[1]{%
\ethnum@tens#1%
\ethnum@one
}
\newcommand{\ethnum@three}[1]{%
\ifnum#1>1\relax#1\fi
\ifnum#1>0\relax\char67\fi
\ethnum@two
}
\newcommand{\ethnum@four}[1]{%
\ethnum@tens#1%
\ifnum#1>0\relax\char67\fi
\ethnum@three
}
\newcommand{\ethnum@five}[1]{%
\ifnum#1>1\relax#1\fi
\ifnum#1>0\relax\char68\fi
\ethnum@four
}
\newcommand{\ethnum@six}[1]{%
\ethnum@tens#1%
\ifnum#1>0\relax\char68\fi
\ethnum@five
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\captionsethiop}
% The macro |\captionsethiop| defines all strings used in the
% four standard documentclasses provided with \LaTeX. The
% words will probably change in future versions. Hints
% for improvement are invited.
%
% We need to call the macro |\eth@doaltchar| to switch to the
% secondary font for some characters.
% \begin{macrocode}
\addto\captionsethiop{%
\def\prefacename{maqedeme}%
\def\refname{ya\eth@doaltchar{85}na
\eth@doaltchar{209}hUfe
mene\eth@doaltchar{189}}%
\def\abstractname{%
\eth@doaltchar{128}\eth@doaltchar{117}%
\eth@doaltchar{213}rota
\eth@doaltchar{213}huf}%
\def\bibname{wAbI
ma\eth@doaltchar{213}hAfete}%
\def\chaptername{kefele}%
\def\appendixname{madbal}%
\def\contentsname{yezate}%
\def\listfigurename{%
ya\eth@doaltchar{85}`elo\eth@doaltchar{109}
mAwe\eth@doaltchar{187}}%
\def\listtablename{%
yasane\eth@doaltchar{176}ra\eth@doaltchar{149}
mAwe\eth@doaltchar{187}}%
\def\indexname{mehe\eth@doaltchar{211}re
qAle}%
\def\figurename{\eth@doaltchar{85}`ele}%
\def\tablename{%
sane\eth@doaltchar{176}ra\eth@doaltchar{149}}%
\def\partname{ne`Use kefele}%
\def\enclname{%
\eth@doaltchar{128}bArIwO\eth@doaltchar{109}}%
\def\ccname{gelebA\eth@doaltchar{189}}%
\def\headtoname{la}%
\def\pagename{ga\eth@doaltchar{213}}%
\def\seename{yemalekatU}%
\def\alsoname{yeheneme yemalekatU}%
\def\proofname{mAragAga\eth@doaltchar{187}}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\eth@monthname}
% There are 13 months in the Ethiopian calendar. We
% make a list of their names here.
% \begin{macrocode}
\newcommand{\eth@monthname}[1]{\ifcase#1\or
masekarame\or
\eth@doaltchar{181}qemete\or
hedAre\or
tAhesAse\or
\eth@doaltchar{181}re\or
yakAtite\or
magAbite\or
mIyAzeyA\or
genebote\or
sanE\or
\eth@doaltchar{72}melE\or
na\eth@doaltchar{72}sE\or
\eth@doaltchar{200}gUmEne\fi
}
% \end{macrocode}
% \end{macro}
%
% Ok, that's it for the \TeX part. Do you still remember that we are
% inside a \emph{large} |\if| construct? Here comes the |\else|.
% \begin{macrocode}
\else
% \end{macrocode}
%
% \subsubsection*{$\Omega$ Setup}
%
% The setup for the $\Omega$ system is much shorter, because
% we can assume that the actual input is done in Unicode, so we
% can skip the handling of shorthands. But we want to install
% an $\Omega$ translation process that removes unneccessary spaces
% and adds a little stretchable glue around punctuation marks.
% \begin{macrocode}
\ocp\eth@spc=ethospc
% \end{macrocode}
% The translation in threaded into a translation list.
% \begin{macrocode}
\ocplist\eth@cpl=
\addbeforeocplist 10 \eth@spc
\nullocplist
% \end{macrocode}
% The translation list is activated during Ethiopian
% typesetting.
% \begin{macrocode}
\addto\extrasethiop{%
\pushocplist\eth@cpl}
\addto\noextrasethiop{%
\popocplist}
% \end{macrocode}
%
% \begin{macro}{\ethiop}
% \begin{macro}{\@ethiop}
% \begin{macro}{\ethnum}
% \begin{macro}{\ethnum@one}
% \begin{macro}{\ethnum@two}
% \begin{macro}{\ethnum@three}
% \begin{macro}{\ethnum@four}
% \begin{macro}{\ethnum@five}
% \begin{macro}{\ethnum@six}
% The macros for the output of ethiopic numbers
% need to be changed a little, but no big deal here.
%
% \begin{macrocode}
\def\ethiop#1{\expandafter\@ethiop\csname c@#1\endcsname}
\def\@ethiop#1{{%
\fontencoding{U}%
\fontfamily{\eth@altfamily}\selectfont
\ifnum#1<1\relax\ethnum@err{#1}%
\else\ifnum#1<10\relax\expandafter\ethnum@one\number #1%
\else\ifnum#1<100\relax\expandafter\ethnum@two\number #1%
\else\ifnum#1<1000\relax\expandafter\ethnum@three\number #1%
\else\ifnum#1<10000\relax\expandafter\ethnum@four\number #1%
\else\ifnum#1<100000\relax\expandafter\ethnum@five\number #1%
\else\ifnum#1<1000000\relax\expandafter\ethnum@six\number #1%
\else
\fontfamily{\eth@defaultfamily}\selectfont
\ethnum@err
\number#1%
\fi\fi\fi\fi\fi\fi\fi
}}
\let\ethnum\@ethiop
\newcommand{\ethnum@tens}[1]{%
\ifcase#1\or^^^^1372\or^^^^1373\or^^^^1374%
\or^^^^1375\or^^^^1376\or^^^^1377%
\or^^^^1378\or^^^^1379\or^^^^137a\fi
}%
\newcommand{\ethnum@one}[1]{%
\ifcase#1\or^^^^1369\or^^^^136a\or^^^^136b%
\or^^^^136c\or^^^^136d\or^^^^136e%
\or^^^^136f\or^^^^1370\or^^^^1371\fi
}%
\newcommand{\ethnum@two}[1]{%
\ethnum@tens#1%
\ethnum@one
}
\newcommand{\ethnum@three}[1]{%
\ifnum#1>1\relax\ethnum@one#1\fi
\ifnum#1>0\relax^^^^137b\fi
\ethnum@two
}
\newcommand{\ethnum@four}[1]{%
\ethnum@tens#1%
\ifnum#1>0\relax^^^^137b\fi
\ethnum@three
}
\newcommand{\ethnum@five}[1]{%
\ifnum#1>1\relax\ethnum@one#1\fi
\ifnum#1>0\relax^^^^137c\fi
\ethnum@four
}
\newcommand{\ethnum@six}[1]{%
\ethnum@tens#1%
\ifnum#1>0\relax^^^^137c\fi
\ethnum@five
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\eth@defaultfamily}
% \begin{macro}{\eth@altfamily}
% For the Unicode input we must use
% the font family |etho| as the default. We do not
% really need an alternate font, but for compatibility,
% We define the appropriate macro.
% \begin{macrocode}
\def\eth@defaultfamily{etho}
\def\eth@altfamily{etho}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\captionsethiop}
% For $\Omega$ the macro |\captionsethiop| will use |^^^^| escapes
% to specify the various characters.
%
% \begin{macrocode}
\addto\captionsethiop{%
\def\prefacename{^^^^1218^^^^1245^^^^12f5^^^^121d}%
\def\refname{^^^^12e8^^^^1225^^^^1290
^^^^1339^^^^1201^^^^134d ^^^^121d^^^^1295^^^^132d}%
\def\abstractname{^^^^12a0^^^^1285^^^^133d^^^^122e^^^^1270
^^^^133d^^^^1201^^^^134d}%
\def\bibname{^^^^12cb^^^^1262
^^^^1218^^^^133d^^^^1203^^^^134d^^^^1275}%
\def\chaptername{^^^^12ad^^^^134d^^^^120d}%
\def\appendixname{^^^^1218^^^^12f5^^^^1260^^^^120d}%
\def\contentsname{^^^^12ed^^^^12d8^^^^1275}%
\def\listfigurename{^^^^12e8^^^^1225^^^^12d5^^^^120e^^^^127d
^^^^121b^^^^12cd^^^^132b}%
\def\listtablename{^^^^12e8^^^^1230^^^^1295^^^^1320^^^^1228^^^^12e5
^^^^121b^^^^12cd^^^^132b}%
\def\indexname{^^^^121d^^^^1205^^^^133b^^^^122d ^^^^1243^^^^120d}%
\def\figurename{^^^^1225^^^^12d5^^^^120d}%
\def\tablename{^^^^1230^^^^1295^^^^1320^^^^1228^^^^12e5}%
\def\partname{^^^^1295^^^^12d1^^^^1235 ^^^^12ad^^^^134d^^^^120d}%
\def\enclname{^^^^12a0^^^^1263^^^^122a^^^^12ce^^^^127d}%
\def\ccname{^^^^130d^^^^120d^^^^1263^^^^132d}%
\def\headtoname{^^^^1208}%
\def\pagename{^^^^1308^^^^133d}%
\def\seename{^^^^12ed^^^^1218^^^^120d^^^^12a8^^^^1271}%
\def\alsoname{^^^^12ed^^^^1205^^^^1295^^^^121d
^^^^12ed^^^^1218^^^^120d^^^^12a8^^^^1271}%
\def\proofname{^^^^121b^^^^1228^^^^130b^^^^1308^^^^132b}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\eth@monthname}
% Here is the table of months for $\Omega$.
% \begin{macrocode}
\newcommand{\eth@monthname}[1]{\ifcase#1\or
^^^^1218^^^^1235^^^^12a8^^^^1228^^^^121d\or
^^^^1325^^^^1245^^^^121d^^^^1275\or
^^^^1205^^^^12f3^^^^122d\or
^^^^1273^^^^1205^^^^1233^^^^1235\or
^^^^1325^^^^122d\or
^^^^12e8^^^^12ab^^^^1272^^^^1275\or
^^^^1218^^^^130b^^^^1262^^^^1275\or
^^^^121a^^^^12eb^^^^12dd^^^^12eb\or
^^^^130d^^^^1295^^^^1266^^^^1275\or
^^^^1230^^^^1294\or
^^^^1210^^^^121d^^^^120c\or
^^^^1290^^^^1210^^^^1234\or
^^^^1330^^^^1309^^^^121c^^^^1295\fi
}
% \end{macrocode}
% \end{macro}
%
% Now we are finished with the \emph{large} |\if| structure.
% \begin{macrocode}
\fi
% \end{macrocode}
%
%
% \subsubsection*{Final Processing}
%
% It is possible that a site might need to add some extra code to
% the \babel\ macros. To enable this we load a local configuration
% file, \file{ethiop.cfg}, if it is found on \TeX's search path.
% \begin{macrocode}
\loadlocalcfg{ethiop}
% \end{macrocode}
%
% Our last action is to make a note that the commands we have just
% defined, will be executed by calling the macro |\selectlanguage|
% at the beginning of the document.
% \begin{macrocode}
\main@language{ethiop}
% \end{macrocode}
% Finally, the category code of \texttt{@} is reset to its original
% value. The macrospace used by |\atcatcode| is freed.
% \begin{macrocode}
\catcode`\@=\atcatcode \let\atcatcode\relax
%</code>
% \end{macrocode}
%
% The style file \file{ethiop.sty} is provided to allow
% |\usepackage{ethiop}| within a document's preamble.
%
% \changes{v0.7}{1998/03/30}{Removed the use of |\RequirePackage|}
%
% \begin{macrocode}
%<*style>
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ifx\LdfInit\@undefined
\def\LdfInit{%
\chardef\atcatcode=\catcode`\@
\catcode`\@=11\relax
\input babel.def\relax
\catcode`\@=\atcatcode \let\atcatcode\relax
\LdfInit}
\fi
\input ethiop.ldf\relax
%</style>
% \end{macrocode}
%
% We need two new font families for the Ethiopian language,
% because there are more than 256 different characters.
% Luckily we do not need a new font encoding, the existing
% encoding \texttt{U} will do fine.
%
% \changes{v0.3}{1997/04/24}{Added support for 5 point fonts.}
%
% \begin{macrocode}
%<*etha>
\DeclareFontFamily{U}{etha}{}
% Ethiopic A
\DeclareFontShape{U}{etha}{m}{n}{
<5> etha6
<6> <7> <8> gen * etha
<9> <10> <10.95> <12> <14.4> <17.28> <20.74> <24.88> etha10}{}
% Ethiopic A Slanted
\DeclareFontShape{U}{etha}{m}{sl}{
<-> ethas10}{}
% Ethiopic A Italics
\DeclareFontShape{U}{etha}{m}{it}{
<-> ssub * etha/m/sl}{}
% Ethiopic A Bold
\DeclareFontShape{U}{etha}{bx}{n}{
<5> <6> <7> <8> <9> ethab9
<10> ethab10
<10.95> ethab11
<12> ethab12
<14.4> ethab14
<17.28> <20.74> ethab18
<24.88> ethab24
<36> ethab36}{}
% Ethiopic A Slanted Bold
\DeclareFontShape{U}{etha}{bx}{sl}{
<5> <6> <7> <8> <9> ethasb9
<10> ethasb10
<10.95> ethasb11
<12> ethasb12
<14.4> ethasb14
<17.28> <20.74> ethasb18
<24.88> ethasb24
<36> ethasb36}{}
% Ethiopic A Italics Bold
\DeclareFontShape{U}{etha}{bx}{it}{
<-> ssub * etha/bx/sl}{}
%</etha>
% \end{macrocode}
%
% That was \file{uetha.fd}, now we have a look at \file{uethb.fd} where
% only some minor changes are applied.
%
% \begin{macrocode}
%<*ethb>
\DeclareFontFamily{U}{ethb}{}
% Ethiopic B
\DeclareFontShape{U}{ethb}{m}{n}{
<5> ethb6
<6> <7> <8> gen * ethb
<9> <10> <10.95> <12> <14.4> <17.28> <20.74> <24.88> ethb10}{}
% Ethiopic B Slanted
\DeclareFontShape{U}{ethb}{m}{sl}{
<-> ethbs10}{}
% Ethiopic B Italics
\DeclareFontShape{U}{ethb}{m}{it}{
<-> ssub * ethb/m/sl}{}
% Ethiopic B Bold
\DeclareFontShape{U}{ethb}{bx}{n}{
<5> <6> <7> <8> <9> ethbb9
<10> ethbb10
<10.95> ethbb11
<12> ethbb12
<14.4> ethbb14
<17.28> <20.74> ethbb18
<24.88> ethbb24
<36> ethbb36}{}
% Ethiopic B Slanted Bold
\DeclareFontShape{U}{ethb}{bx}{sl}{
<5> <6> <7> <8> <9> ethbsb9
<10> ethbsb10
<10.95> ethbsb11
<12> ethbsb12
<14.4> ethbsb14
<17.28> <20.74> ethbsb18
<24.88> ethbsb24
<36> ethbsb36}{}
% Ethiopic B Italics Bold
\DeclareFontShape{U}{ethb}{bx}{it}{
<-> ssub * ethb/bx/sl}{}
%</ethb>
% \end{macrocode}
%
% If we want to use $\Omega$, we need an additional
% font family for the 16-bit fonts. At the moment
% we will only provide a rudimentary set of fonts.
%
% \changes{v0.7}{1998/03/30}{Added support for $\Omega$.}
%
% \begin{macrocode}
%<*etho>
\DeclareFontFamily{U}{etho}{}
% Ethiopic B
\DeclareFontShape{U}{etho}{m}{n}{
<-> etho10}{}
% Ethiopic B Slanted
\DeclareFontShape{U}{etho}{m}{sl}{
<-> ethos10}{}
% Ethiopic B Italics
\DeclareFontShape{U}{etho}{m}{it}{
<-> ssub * etho/m/sl}{}
% Ethiopic B Bold
\DeclareFontShape{U}{etho}{bx}{n}{
<-> ethob10}{}
% Ethiopic B Slanted Bold
\DeclareFontShape{U}{etho}{bx}{sl}{
<-> ethosb10}{}
% Ethiopic B Italics Bold
\DeclareFontShape{U}{etho}{bx}{it}{
<-> ssub * etho/bx/sl}{}
%</etho>
% \end{macrocode}
%
% We would like compatibility with Arab\TeX, but Arab\TeX\ cannot
% handle our active characters.
% \begin{macrocode}
%<*arab>
\def\noethiop{%
\catcode`\^=7
\catcode`\_=8
\catcode`\.=12
\catcode`\:=12
\catcode`\'=12
}
% \end{macrocode}
% We save the current category codes of the offending
% characters before changing them.
% We might save some time and space by assuming that
% these characters are always active, but we do not take
% any chances.
% \begin{macrocode}
\def\eth@arab@codes{%
\chardef\eth@hat@de=\catcode`\^%
\chardef\eth@bar@de=\catcode`\_%
\chardef\eth@dot@de=\catcode`\.%
\chardef\eth@col@de=\catcode`\:%
\chardef\eth@bkq@de=\catcode`\'%
\noethiop
}
\def\eth@unarab@codes{%
\catcode`\^=\eth@hat@de
\catcode`\_=\eth@bar@de
\catcode`\.=\eth@dot@de
\catcode`\:=\eth@col@de
\catcode`\'=\eth@bkq@de
}
% \end{macrocode}
% We must patch the two internal
% macros |\arab@codes| and |\unarab@codes|.
%
% The original definitions of the redefined macros are
% inserted into the new definition by means of the
% |\expandafter| primitive. This way we are less dependent on
% the actual definition, so that we might survive a few
% version changes of Arab\TeX.
% \begin{macrocode}
\expandafter\def\expandafter\arab@codes\expandafter{%
\expandafter\eth@arab@codes
\arab@codes
}
\expandafter\def\expandafter\unarab@codes\expandafter{%
\unarab@codes
\eth@unarab@codes
}
%</arab>
% \end{macrocode}
% \Finale
%\endinput
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
|