summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/polski/polski.dtx
blob: b161bde1831183d1027cffad699be66423523d62 (plain)
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
% \iffalse meta-comment -*- doctex -*-
%
% Copyright (C) 1994 by Mariusz Olko.  All rights reserved.
% Copyright (C) 1997,1998 by Mariusz Olko and Marcin Woli\'nski.
% Copyright (C) 2000,2001,2003,2007 by Marcin Woli\'nski.
% All rights reserved.
% 
% This file is part of the package 'Polski'
% ------------------------------------------------------------------
% 
% The file may be distributed under the terms of the LaTeX Project
% Public License, as described in lppl.txt in the base LaTeX
% distribution. Either version 1.2 or, at your option, any later
% version. 
%
% \fi
% \iffalse 
%<*driver>
\documentclass{ltxdoc}
%\errorcontextlines=1000
\usepackage[MeX]{polski}
\makeatletter
\DeclareRobustCommand\PLaTeX{%   after latex.dtx
        P\kern-.08em L\kern-.36em
        {\setbox0\hbox{T}%
         \vbox to\ht0{\hbox{%
                            \csname S@\f@size\endcsname
                            \fontsize\sf@size\z@
                            \math@fontsfalse\selectfont
                            A}
                      \vss}%
        }%
        \kern-.15em
        \TeX\@}%
\makeatother
%<driver>% Comment next line if you want to print the code
%<driver>%\OnlyDescription
\def\parsedate#1/#2/#3.{\day=#3 \month=#2 \year=#1 }
\parsedate 2008/02/24.
\author{\begin{tabular}[t]{c}
  Mariusz Olko\\[4pt]
  Litter\ae\\
  G\'orczewska 94\Slash96\Slash7\\
  01--117 Warszawa\\
  \textsf{M.Olko@Litterae.com.pl}\\
  \end{tabular}
\hskip20pt
\begin{tabular}[t]{c}
  Marcin Woli\'nski\\[4pt]
  \textsf{wolinski@gust.org.pl}\\
\end{tabular}
}%\\[4pt]

\title{Pakiet \textsc{Polski}\\
      wersja 1.3.3}

\begin{document}
\maketitle
\tableofcontents
\DocInput{polski.dtx}
\end{document}
%
%</driver>
%
% \fi
%
% \CheckSum{1170}
%
% \def\PostScript{\textsc{PostScript}}
% \def\Polski{\textsc{Polski}}
% \def\polski{\textsc{polski}}
% \def\popolsku{Polski}
% \def\Babel{\textsc{Babel}}
% 
% \prefixing
% \section{Informacje dla u/zytkownik/ow}
% \subsection{Kr/otki obraz ca/lo/sci}
%
% Paczka dystrybucyjna pakietu \popolsku\ sk/lada si/e z kilku
% zasadniczych cz/e/sci.
% \begin{itemize}
%
% \item Najwa/zniejsz/a cz/e/sci/a jest sam pakiet |polski.sty|,
%   kt/ory dostarcza wszystkich (?) element/ow potrzebnych do sk/ladu
%   w j/ezyku polskim.  Pozwala na stosowanie w~r/o/znych
%   /srodowiskach, z~polskimi wzorcami przenoszenia i~bez, z~polskimi
%   czcionkami i~bez nich.  Posiada te/z mo/zliwo/s/c upodobnienia
%   si/e na poziomie polece/n w 99\% do \LaMeX{}a.  Szczeg/o/lowy opis
%   pakietu znajduje si/e w nast/epnym rozdziale.
%
% \item Drug/a sk/ladow/a stanowi/a pliki opisu czcionek maj/ace
%   standardowo rozszerzenie |.fd|, a generowane przez program
%   \textsf{DocStrip} z pliku |plfonts.fdd|. Znajduj/a si/e w nich
%   informacje na temat font/ow |PL| czyli polskich wersji font/ow
%   Computer Modern (dystrybuowanych z \LaMeX em) oraz czcionek |PC|
%   czyli polskich wersji czcionek Computer Concrete.  Dzi/eki
%   zawartym tam informacjom czcionki te staj/a si/e dost/epne w Nowym
%   Mechani/xmie Wyboru Font/ow (\emph{ang.} New Font Selection
%   Scheme).  Z pliku |plfonts.fdd| mo/zna wygenerowa/c pliki opisu
%   font/ow zar/owno w Starym Uk/ladzie (OT1) jak i w Uk/ladzie
%   Polskim (OT4).  \iffalse Dodatkowo istnieje mo/zliwo/s/c
%   wygenerowania plik/ow |fd|, kt/ore w miejsce czcionek Computer
%   Modern w Starym Uk/ladzie podstawi/a odpowiednie wersje polskie.
%   Podstawienie takie jest ingerencj/a w cz/e/s/c standardowego
%   \LaTeX{}a i mo/ze, w bardzo rzadkich przypadkach, da/c inne wyniki
%   sk/ladu ni/z przy u/zyciu oryginalnych czcionek Computer Modern.
%   \fi
% \item Ostatni element to dwa dodatkowe pakiety, wspomagaj/ace prac/e
%   w~nietypowych warunkach.  Ich opis mo/zna znale/x/c w~nich samych.
% \end{itemize}
%
% Kod pakietu \polski\ bazuje na rozwi/azaniach zastosowanych w
% formatach \MeX//\LaMeX\ autorstwa Marka Ry/cko i Bogus/lawa
% Jackowskiego.
%
% \subsection{Jak dzia/la pakiet \polski}
%
% Po za/ladowaniu pakietu zmienione zostaj/a wewn/etrzne kody \TeX a
% dla odno/snych liter polskiego alfabetu w Nowym Uk/ladzie (T1).  Te
% zmiany pozwalaj/a na definiowanie makrokomend, kt/ore maj/a w nazwie
% polskie litery, umo/zliwiaj/a prawid/low/a zamian/e liter ma/lych na
% du/ze, a tak/ze pozwalaj/a algorytmowi przenoszenia wyraz/ow
% traktowa/c polskie litery jako litery.  Nast/epnie podj/ete zostaje
% poszukiwanie polskich wzorc/ow przenoszenia i~ich uaktywnienie.
% Je/zeli wzorce przenoszenia nie zostan/a znalezione, pakiet
% \polski{} wypisuje komunikat o~b/l/edzie i~blokuje przenoszenie
% wyraz/ow.
%
% W kolejnym kroku zdefiniowana zostaje notacja /,ciachowa/'.  Notacja
% ta, wprowadzona w \MeX u przez Ry/ck/e i Jackowskiego, pozwala na
% zapisywanie polskich liter w postaci dw/och znak/ow \textit{ciach}
% oraz \textit{litera}.  Taki zapis pozwala na przesy/lanie tekst/ow
% poczt/a elektroniczn/a oraz na prac/e w miejscach gdzie nie ma
% wbudowanego w system wsparcia dla j/ezyka polskiego (wi/ekszo/s/c
% instalacji \texttt{UNIX}owych).  Pakiet \polski\ uzyskuje wszystkie
% polskie litery zdefiniowane w standardowym \TeX u (tj. \textit{/o,
% /z} czy \textit{/l}) przy pomocy standardowych makr \TeX a
% (tzn. np. |\'o|, |\.z| czy te/z |\l|), natomiast litery takie jak
% \textit{/a} czy \textit{/e} za pomoc/a standardowego makra \LaTeX
% owego |\k|.  Ca/la dalsza /l/aczno/s/c pomi/edzy komend/a
% \textit{ciach litera} a wydrukowanym znakiem jest zapewnione poprzez
% definicje uk/lad/ow czcionek.  To w/la/snie w tych plikach jest
% zdefiniowane, /ze np. w Starym Uk/ladzie (OT1) liter/e \textit{/o}
% otrzymuje si/e przez z/lo/zenie akcentu \textit{\symbol{19}} oraz
% litery \textit{o} natomiast w Uk/ladach Nowym (T1) oraz Polskim
% (OT4) przez postawienie znaku o kodzie 161.  Daje to du/z/a
% elastyczno/s/c i pozwala na bardzo /latwe u/zycie czcionek w
% dowolnym sensownym uk/ladzie.  Do korzystania z czcionek |pl|
% zdefiniowany zosta/l nowy uk/lad czcionek nazwany |OT4|.
% Szczeg/o/lowe informacje o funkcjonowania uk/lad/ow czcionek mo/zna
% znale/x/c w plikach standardowej dystrybycji \LaTeX a |ltoutenc.dtx|
% oraz |fntguide.tex|.
%
% \Polski{} pakiet pozwala na sk/lad z r/o/znymi zestawami czcionek w
% r/o/znych uk/ladach.  Pocz/atkowy uk/lad czcionek dokumentu mo/ze
% zosta/c wybrany przez dodanie do wywo/lania pakietu odpowiednich
% opcji (patrz~\ref{uzycie}) lub u/zycie standardowego pakietu
% |fontenc|.
% Je/sli jednak nie zmieniono
% pocz/atkowego uk/ladu, pakiet \polski{} pr/obuje odszuka/c w
% systemie plik |ot4cmr.fd|, zawieraj/acy \LaTeX{}owe opisy czcionek
% |pl|.  Je/zeli taki plik zostanie znaleziony, czynione jest
% za/lo/zenie, /ze w systemie zainstalowane s/a r/ownie/z same
% czcionki |pl| i pakiet zmienia pocz/atkowy uk/lad na |OT4|.
% Je/sli plik nie zostanie odszukany, to uk/lad pozostaje bez zmian.
%
% 
% \Polski{} pakiet przedefiniowuje wszystkie napisy, kt/ore
% mog/a pojawi/c si/e wygenerowane automatycznie przez \LaTeX
% a, takie jak: rozdzia/l, spis tre/sci itp.  Zmieniona zostaje te/z
% definicja makra |\today| tak, aby data by/la drukowana po polsku.
% Poniewa/z w niekt/orych sytuacjach na ko/ncu daty pisze si/e ca/le
% s/lowo ,,roku'', czasami tylko sam/a liter/e ,,r.'', a~czasami nic,
% wprowadzone zosta/lo makro |\PLdateending|, kt/ore rozwija si/e
% zaraz za rokiem i~w~razie potrzeby mo/ze zosta/c /latwo
% przedefiniowane.  Co wi/ecej zachowanie makra |\today| mo/zna
% zmieni/c za pomoc/a nast/epuj/acych opcji pakietu: |roku|, |r.|,
% |noroku| (ta ostatnia jest domy/slna, wi/ec 
% domy/slnie po numerze roku nie jest nic dodawane).
%
% Dodatkowo pakiet definiuje makro |\dywiz|, kt/ore pozwala na
% poprawne przeniesienie wyraz/ow z/lo/zonych zapisanych jako
% |bia/lo\dywiz czerwony| i dzielonych jako
% \begin{quote}
% bia/lo-\\-czerwony.
% \end{quote}
%
% Kolejny problem to pauzy (my/slniki).  Wed/lug polskich zwyczaj/ow
% my/slnik powinien by/c otoczony odst/epami wielko/sci 2pt, oraz nie
% nale/zy rozpoczyna/c wiersza tekstowego my/slnikiem.  Zalecenia te
% realizuje makro |\pauza|.  Makro to zawiera w~sobie potrzebne
% odst/epy, nale/zy wi/ec go u/zywa/c nast/epuj/aco:
% \begin{verbatim}
% By/lo zbyt ciemno\pauza powiedzia/la.
% \end{verbatim}
% Uwaga: definicj/e tego makra traktujemy jako prowizoryczn/a.  Mo/ze
% ulec zmianie!
%
% W polskich zwyczajach typograficznych odst/ep po kropce mi/edzy
% zdaniami powinien by/c taki sam jak pomi/edzy
% wyrazami w /srodku zdania, dlatego pakiet wo/la makro |\frenchspacing|.
%
% Pewne zmiany dotycz/a r/ownie/z matematyki.  Najwa/zniejszymi
% r/o/znicami w~sk/ladzie pomi/edzy matematycznymi wydawnictwami
% polskimi i~angielskoj/ezycznymi jest inny kszta/lt znak/ow
% \textit{mniejsze\dywiz r/owne} i \textit{wi/eksze\dywiz r/owne} oraz
% inne skr/oty stosowane na oznaczenie tangensa, cotangensa i funkcji
% transcendentalnych.  Zmian/a kszta/ltu znak/ow
% \textit{mniejsze\dywiz r/owne} i \textit{wi/eksze\dywiz r/owne} jest
% dokonywana wtedy, je/sli dost/epne s/a matematyczne czcionki |pl|.
% Standardowo pakiet \polski{} definiuje nowe makra |\tg|, |\tgh|,
% |\ctg|, |\ctgh|, |\arc| oraz |\nwd| a nast/epnie\pauza uwaga\pauza
% zmienione zostaj/a symbole drukowane przez standardowe makra \LaTeX
% a |\tan|, |\cot|, |\tanh|, |\coth|, |\arcsin|, |\arccos|, |\arctan|,
% |\gcd|.  Dla pe/lno/sci jest te/z definiowane makro |\arccot|,
% kt/orego z~tajemniczych przyczyn nie ma w~wersji oryginalnej.
% Przedefiniowanie tych makr pozwala na cytowanie tych samych wzor/ow
% w pracy polskiej i~angielskiej bez konieczno/sci zmieniania ich
% zapisu.  Standardowe symbole s/a zmieniane poniewa/z \LaTeX\ (czy
% te/z \TeX) dawno przesta/l by/c tylko systemem sk/ladu.  Sta/l si/e
% obecnie j/ezykiem, w kt/orym zapisywane s/a wzory matematyczne i
% jest bardzo wa/zne jest aby, je/sli jest to mo/zliwe, nie zmienia/c
% ,,standardu'' zapisu tego j/ezyka, lecz co najwy/zej dostosowywa/c
% spos/ob w jaki jest on prezentowany na wydruku.
%
%
% \subsection{Do/l/aczenie \polski{}ego pakietu do dokumentu}
% \label{uzycie}
%
% Pakiet \polski\ jest /ladowany przez
% umieszczenie w preambule dokumentu zlecenia
% \begin{verbatim}
% \usepackage[opcje]{polski}\end{verbatim}
% U/zycie w wywo/laniu pakietu opcji pozwala na dopasowanie jego
% zachowania do istniej/acego /srodowiska i potrzeb.
% \begin{description}
% \item[OT1] /swiadomie nie chcemy zmienia/c uk/ladu czcionek z
% uk/ladu podstawowego wbudowanego w \LaTeX{}a.
% \item[OT4] prze/l/acza uk/lad czcionek na polski (OT4).  Oznacza
% to, /ze w dokumencie b/ed/a wykorzystane czcionki
% |pl|. 
% \item[T1] zmienia uk/lad czcionek na Nowy Uk/lad Czcionek.  Opcja
% jest wygodna np. w po/l/aczeniu z pakietem czcionek
% \PostScript{}owych w uk/ladzie T1.
% \item[QX] zmienia uk/lad czcionek na QX.  U/zyteczna przy sk/ladzie
% fontami produkcji JNS Team: \TeX\ Gyre Termes, \TeX\ Gyre Heros, itd.
% \item[plmath] prze/l/acza czcionki matematyczne na |pl|, tzn.
%  przedefiniowuje alfabety matematyczne i zestawy symboli.  Dodatkowo
%  zmienia \LaTeX ow/a definicj/e symboli wi/eksze\dywiz r/owne oraz
%  mniejsze\dywiz r/owne.
% \item[nomathsymbols] blokuje spolonizowanie przez pakiet znaczenia
%  standardowych \LaTeX{}owych symboli okre/slaj/acych funkcje
%  trygonometryczne oraz relacje wi/eksze\dywiz r/owne i mniejsze\dywiz
%  r/owne
% \item[prefixinginverb] powoduje, /ze notacja prefiksowa nie jest
% wy/l/aczana w~obr/ebie /srodowiska \texttt{verbatim} i~w~argumencie
% polecenia \cs{verb}. (Domy/slnie aktywna).
% \item[noprefixinginverb] powoduje, /ze notacja prefiksowa jest
% wy/l/aczana w~tych kontekstach.
% \item[MeX] jest to tryb 100\% zgodno/sci z \MeX em.  Ta opcja
%  definiuje wszystkie makra, kt/ore s/a normalnie dost/epne dla
%  u/zytkownika w \MeX u.  Pozwala to na kompilacj/e dokument/ow \MeX
%  owych bez dokonywania /zadnych zmian.
% \end{description}
%
% Je/zeli nie u/zyto /zadnej z opcji wyboru uk/ladu font/ow,
% \texttt{polski.sty} pr/obuje w/l/aczy/c fonty PL, je/zeli s/a one
% zainstalowane.  Dotyczy to zar/owno font/ow tekstowych, jak i
% matematycznych.  W~instalacji zawieraj/acej fonty PL wywo/lanie pakietu
% bez opcji jest r/ownowa/zne wywo/laniu
% \begin{verbatim}
% \usepackage[OT4,plmath]{polski}
% \end{verbatim}
%
% Opcja \texttt{OT1} s/lu/zy do powiedzenia pakietowi, /ze u/zytkownik
% /swiadomie u/zywa uk/ladu nie zawieraj/acego kompletu znak/ow potrzebnych
% do sk/ladu po polsku.
%
% \StopEventually{}
%
% Dalsza cz/e/s/c dokumentu opisuje kod samego pakietu oraz plik/ow
% potrzebnych do instalacji czcionek polskich i wzorc/ow przenoszenia
% w \LaTeX u.  Dokumentacja jest w j/ezyku angielskim.
% \nonprefixing
% \selecthyphenation{english}
% 
% \iffalse=============================================================\fi
% \section{Source code of \texttt{polski.sty}}
% \subsection{Writing banners}
% This package should work only with \LaTeXe, so we make sure the
% appropriate message is displayed when another \TeX\ format is used.
%    \begin{macrocode}
%<*style>
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
%    \end{macrocode}
% Announce the name of the package to the world
%    \begin{macrocode}
\ProvidesPackage{polski}[2008/02/24 v1.3.3 Polish language package]
%    \end{macrocode}
% and write its banner on the display
%    \begin{macrocode}
\typeout{Document language package `polski' v1.3.3 <2008/02/24>}
%    \end{macrocode}
% \subsection{Category codes and all that}
% Here we will define the codes for Polish diacritical
% characters.  There are several codes we need to set for each of them.
% The most important one is the category code (|catcode|), which
% identifies the character as a letter to \TeX.  
% Other codes to set are lowercase and
% uppercase equivalents (|lccode| and |uccode|) used to determine the
% proper character when lower and upper casing the string.  These are
% now properly set in the kernel.
%    \begin{macrocode}
\@ifpackageloaded{inputenc}{\typeout{\space\space\space
                      Inputenc package detected. Catcodes not changed.}}{%
\catcode`\^^a1=11 %\lccode`\^^a1=`\^^a1 \uccode`\^^a1=`\^^81  % a ogonek
\catcode`\^^a2=11 %\lccode`\^^a2=`\^^a2 \uccode`\^^a2=`\^^82  % c acute
\catcode`\^^a6=11 %\lccode`\^^a6=`\^^a6 \uccode`\^^a6=`\^^86  % e ogonek
\catcode`\^^aa=11 %\lccode`\^^aa=`\^^aa \uccode`\^^aa=`\^^8a  % l crossed
\catcode`\^^ab=11 %\lccode`\^^ab=`\^^ab \uccode`\^^ab=`\^^8b  % n acute
\catcode`\^^f3=11 %\lccode`\^^f3=`\^^f3 \uccode`\^^f3=`\^^d3  % o acute
\catcode`\^^b1=11 %\lccode`\^^b1=`\^^b1 \uccode`\^^b1=`\^^91  % s acute
\catcode`\^^bb=11 %\lccode`\^^bb=`\^^bb \uccode`\^^bb=`\^^9b  % z dot
\catcode`\^^b9=11 %\lccode`\^^b9=`\^^b9 \uccode`\^^b9=`\^^99  % z acute
%    \end{macrocode}
% Now the same for uppercase letters.
%    \begin{macrocode}
\catcode`\^^81=11 %\lccode`\^^81=`\^^a1 \uccode`\^^81=`\^^81  % A ogonek
\catcode`\^^82=11 %\lccode`\^^82=`\^^a2 \uccode`\^^82=`\^^82  % C accute
\catcode`\^^86=11 %\lccode`\^^86=`\^^a6 \uccode`\^^86=`\^^86  % E ogonek
\catcode`\^^8a=11 %\lccode`\^^8a=`\^^aa \uccode`\^^8a=`\^^8a  % L crossed
\catcode`\^^8b=11 %\lccode`\^^8b=`\^^ab \uccode`\^^8b=`\^^8b  % N accute
\catcode`\^^d3=11 %\lccode`\^^d3=`\^^f3 \uccode`\^^d3=`\^^d3  % O acute
\catcode`\^^91=11 %\lccode`\^^91=`\^^b1 \uccode`\^^91=`\^^91  % S acute
\catcode`\^^9b=11 %\lccode`\^^9b=`\^^bb \uccode`\^^9b=`\^^9b  % Z dot
\catcode`\^^99=11 %\lccode`\^^99=`\^^b9 \uccode`\^^99=`\^^99  % Z acute
}
%    \end{macrocode}
% We finish by setting space factor codes (|sfcode|) for uppercase
% letters.  When French spacing is turned off, \TeX\ treats interword
% spacing after full stop in a special manner.  If the last character before
% the period is lowercase letter then \TeX\ assumes it is the end of the
% sentence, and makes the space wider (and more stretchable).
% However, if the last letter is uppercase, then \TeX\ assumes it is an
% abbreviation and doesn't widen the space. (This is not the whole
% truth.  Consult the \TeX book pages 285--287 for details.)  We set
% |sfcode| for Polish capital letters.
%    \begin{macrocode}
\sfcode`\^^81=999    % A ogonek
\sfcode`\^^82=999    % C acute
\sfcode`\^^86=999    % E ogonek
\sfcode`\^^8a=999    % L crossed
\sfcode`\^^8b=999    % N acute
\sfcode`\^^d3=999    % O acute
\sfcode`\^^91=999    % S acute
\sfcode`\^^9b=999    % Z dot
\sfcode`\^^99=999    % Z acute
%    \end{macrocode}
%  This provides for |\mathit| and friends to work correctly for Polish
%  characters (when used with TCX).
%    \begin{macrocode}
\DeclareMathSymbol{^^a1}{\mathalpha}{letters}{`^^a1}
\DeclareMathSymbol{^^a2}{\mathalpha}{letters}{`^^a2}
\DeclareMathSymbol{^^a6}{\mathalpha}{letters}{`^^a6}
\DeclareMathSymbol{^^aa}{\mathalpha}{letters}{`^^aa}
\DeclareMathSymbol{^^ab}{\mathalpha}{letters}{`^^ab}
\DeclareMathSymbol{^^f3}{\mathalpha}{letters}{`^^f3}
\DeclareMathSymbol{^^b1}{\mathalpha}{letters}{`^^b1}
\DeclareMathSymbol{^^bb}{\mathalpha}{letters}{`^^bb}
\DeclareMathSymbol{^^b9}{\mathalpha}{letters}{`^^b9}
\DeclareMathSymbol{^^81}{\mathalpha}{letters}{`^^81}
\DeclareMathSymbol{^^82}{\mathalpha}{letters}{`^^82}
\DeclareMathSymbol{^^86}{\mathalpha}{letters}{`^^86}
\DeclareMathSymbol{^^8a}{\mathalpha}{letters}{`^^8a}
\DeclareMathSymbol{^^8b}{\mathalpha}{letters}{`^^8b}
\DeclareMathSymbol{^^d3}{\mathalpha}{letters}{`^^d3}
\DeclareMathSymbol{^^91}{\mathalpha}{letters}{`^^91}
\DeclareMathSymbol{^^9b}{\mathalpha}{letters}{`^^9b}
\DeclareMathSymbol{^^99}{\mathalpha}{letters}{`^^99}
%    \end{macrocode}
%
%
% \subsection{Hyphenation}
%
%  \begin{macro}{\selecthyphenation}
% \changes{v1.01}{1998/04/20}{Macro added}
% \changes{v1.02}{2000/05/16}{New langauage allocated only if undefined.
%    Name changed to be Babel compatible.} 
%    Here we define the hyphenation selecting operator.  If a set of
%    hyphenation patterns for a particular language is unavaiable,
%    hyphenation in that language is turned off.  For that we use
%    following trick:  a new language is allocated with no
%    hyphenation patterns.  Then switching to this language
%    effectively switches hyphenation off (many thanks to Marek
%    Ry\'cko). 
%    \begin{macrocode}
\ifx\l@nohyphenation\@undefined
        \newlanguage\l@nohyphenation
\fi
\def\selecthyphenation#1{%
  \expandafter\ifx\csname l@#1\endcsname\relax
    \PackageError{polski}{No hyphenation patterns for language `#1'}
      {Hyphenation in this language will be disabled.}%
    \selecthyphenation{nohyphenation}%
  \else
    \language\csname l@#1\endcsname
  \fi
  }
%    \end{macrocode}
%  \end{macro}
%
% We try to switch to polish hyphenation patterns looking either for
% patterns name used by |hyphen.cfg| from old versions of \popolsku{}
% bundle or for new Babel-like name.
%    \begin{macrocode}
\ifx\polish\undefined
  \selecthyphenation{polish}
\else
    \language\polish
\fi
\lefthyphenmin=2
\righthyphenmin=2
%    \end{macrocode}
% \subsection{Slash notation}
%
% The slash notation was introduced in the macro package 
% {L\kern-.111em\lower.6ex\hbox{E}\kern-.075emX} by
% Bogus\l{}aw Jackowski and Marek Ry\'cko.  It has been used since then in
% many places and became Polish \TeX{} User's Group GUST ``standard''.
% What follows is the implementation of active slash or Polish slash macro.
%
% \DescribeMacro{\Slash} We start by storing slash character
% (catcode 12 meaning |<other>|) in apropriately named macro.
%    \begin{macrocode}
\def\Slash{/}
%    \end{macrocode}
% \DescribeMacro{\PLSlash} Now we define macro |\PLSlash| which will
% actually be used in input files to access polish letters.  It does
% not need to be robust.  If it is, it breaks kerns
% (pointed out by Marcin Woli\'nski).
% \changes{v1.2.3}{2002/03/05}{// caused errors in TOC if used with
% \cs{prefixing}} 
%    \begin{macrocode}
\def\PLSlash#1{%
%    \end{macrocode}
% The first thing we do is to check whether
% the slash character is followed by an allowed character.  The first test
% is for the second slash (or macro |\PLSlash|), in which case we just
% return \emph{slash} character with category code |<other>|.
%    \begin{macrocode}
  \ifx#1\PLSlash
    \ifx\protect\@typeset@protect\else\protect\string\fi\Slash
  \else
%    \end{macrocode}
% If it was not a slash we test for a letter. We
% assume that there are defined macros which expand to the current
% definitions of Polish letters.  We will give them names
% |\PLSlash@<character>|, so now we look if it is defined.
% If comparison with
% |\relax| is true the macro is not defined.  We issue an error
% message with some help.
%    \begin{macrocode}
    \expandafter \ifx \csname PLSlash@\string#1\endcsname \relax
      \PLSlash@error#1%
    \else
%    \end{macrocode}
% If we got here, we can now expand polish character.  However, we
% do that after completing all |\if|s.
%    \begin{macrocode}
      \expandafter\expandafter\expandafter\PLSlash@letter
      \expandafter\expandafter\expandafter#1%
    \fi
  \fi
}

\def\PLSlash@error#1{\PackageError{polski}{%
Illegal pair of characters /\noexpand#1 occurred}{%
Only a character from the set [acelnosxzACELNOSXZ,'<>/-]
                                        can appear after \Slash.\MessageBreak
Proceed, I will omit both \Slash\ and the character following it.\MessageBreak
You can also correct your mistake NOW, typing I followed by\MessageBreak
whatever should be in the place of the offending pair.}}
%    \end{macrocode}
%
%  \begin{macro}{\PlPrIeC}
%    This macro is needed to protect against removing white space in
%    TOC by Polish characters that have definition ending with a macro
%    call (|\l| and |\L|).  The macro is identical to |\IeC| from
%    inputenc package, but we have to define it here not to depend on
%    inputenc.  The name is different not to cause conflict in case
%    inputenc is loaded after plprefix.
%    \begin{macrocode}
\def\PlPrIeC{%
  \ifx\protect\@typeset@protect
    \expandafter\@firstofone
  \else
    \noexpand\PlPrIeC
  \fi
}
%    \end{macrocode}
%  \end{macro}
%
% \DescribeMacro{\PLSlash@letter} This macro is very simple: it just
% invokes another macro with some wild name.
%    \begin{macrocode}
\def\PLSlash@letter#1{\csname PLSlash@#1\endcsname}
%    \end{macrocode}
%
% Next come the definitions of all Polish diacritics and special symbols. 
% For each ``slashed'' character we define a macro expanding to its
% proper definition.
% Polish characters are defined as normal accented
% letters, and we expect that they will expand according to their
% definitions in the current font encoding. This allows us to use the
% same slash notation with any (decent) font encoding.  For example
% T1 and OT4 encodings will use letters, but OT1 will do what it can%
% ---ie.~insert simple accented characters (with |a| and |e| left
% untouched).  For more information on 
% the work of encoding engine consult \LaTeX\ file
% \texttt{ltoutenc.dtx}.
%
% The following macro is just a helper which will be undefined after use.
%    \begin{macrocode}
\def\PL@accent@def#1#2{%
  \expandafter\def \csname PLSlash@\string #1\endcsname{#2}}
%    \end{macrocode}
% The real definition will take place at the beginning of the document.
% This is small optimization.  We assume that the encoding at this
% stage is what will be default for the rest of the document.  If
% document starts in OT1 encoding we warn user that he can loose some
% information from the printout.
%    \begin{macrocode}
\PL@accent@def{a}{\k a}
\PL@accent@def{c}{\@tabacckludge'c}
\PL@accent@def{e}{\k e}
\PL@accent@def{l}{\PlPrIeC{\l}}
\PL@accent@def{n}{\@tabacckludge'n}
\PL@accent@def{o}{\@tabacckludge'o}
\PL@accent@def{s}{\@tabacckludge's}
\PL@accent@def{x}{\@tabacckludge'z}
\PL@accent@def{z}{\.z}
\PL@accent@def{A}{\k A}
\PL@accent@def{C}{\@tabacckludge'C}
\PL@accent@def{E}{\k E}
\PL@accent@def{L}{\PlPrIeC{\L}}
\PL@accent@def{N}{\@tabacckludge'N}
\PL@accent@def{O}{\@tabacckludge'O}
\PL@accent@def{S}{\@tabacckludge'S}
\PL@accent@def{X}{\@tabacckludge'Z}
\PL@accent@def{Z}{\.Z}
\PL@accent@def{<}{\PlPrIeC{\guillemotleft}}
\PL@accent@def{>}{\PlPrIeC{\guillemotright}}
\PL@accent@def{,}{\PlPrIeC{\quotedblbase}}
\PL@accent@def{'}{\PlPrIeC{\textquotedblright}}
\PL@accent@def{-}{\PlPrIeC{\dywiz}}
%
\let \PL@accent@def \undefined
%    \end{macrocode}
%
% \DescribeMacro{\prefixing}  The last touch is the definition of
% the |\prefixing| macro which activates the slash, but only if
% |plprefix| package was't loaded before.  We manage prefixing flag
% |\pr@fix| for compatibility with \MeX.
%    \begin{macrocode}
\@ifpackageloaded{plprefix}{}{%
    \def\prefixing{\catcode`/=\active
        \bgroup \uccode`\~=`/ \uppercase{\egroup \let~\PLSlash}%
        \let\pr@fix=T}
%    \end{macrocode}
% \DescribeMacro{\nonprefixing} and |\nonprefixing| macro which
% deactivates the slash.
%    \begin{macrocode}
    \def\nonprefixing{\catcode`/=12 \let\pr@fix=F}
}
%    \end{macrocode}
%
% \subsection{Maths in Polish}
% \label{redefining-maths}
%
% The next few macros are provided to typeset maths in Polish.
%
% \DescribeMacro{\arc} In Polish, transcendental functions are written
% with a tiny space after |arc| or |ar|.  Here we define macro |\arc| which
% when followed by eg. |\sin| typesets $\arc\sin$.
%    \begin{macrocode}
\def\arc#1{\mathop{\operator@font
     arc\thinspace\escapechar-1 \string#1}\nolimits}
\def\ar#1{\mathop{\operator@font
     ar\thinspace\escapechar-1 \string#1}\nolimits}
%    \end{macrocode}
%
% \DescribeMacro{\tg}\DescribeMacro{\tgh}
% \DescribeMacro{\ctg}\DescribeMacro{\ctgh}
% We also use different abbreviations for tangent and
% cotangent.
%    \begin{macrocode}
\def\tg{\mathop{\operator@font tg}\nolimits}
\def\ctg{\mathop{\operator@font ctg}\nolimits}
\def\tgh{\mathop{\operator@font tgh}\nolimits}
\def\ctgh{\mathop{\operator@font ctgh}\nolimits}
\def\nwd{\mathop{\operator@font nwd}}
%    \end{macrocode}
%
% Finally we take a drastic step and redefine \LaTeX's definitions
% of mathematical functions.  This will allow us to keep the markup 
% independent of the language in which the document is typeset.  We think
% that this is very important, because \TeX\ is today much more than
% just a typesetting tool, it is also a language which is used to exchange
% mathematical formul\ae.  Redefinition will be suppressed when option
% \texttt{nomathsnames} is used.
%    \begin{macrocode}
\def\PL@redef@funcnames{%
  \let\tan=\tg     \let\cot=\ctg
  \let\tanh=\tgh   \let\coth=\ctgh
  \def\arcsin{\arc\sin}
  \def\arccos{\arc\cos}
  \def\arctan{\arc\tg}
  \def\arccot{\arc\ctg}
  \let\gcd\nwd
  }
%    \end{macrocode}
% These redefinitions should be supplemented by appropriate
% greater-than-or-equal and less-than-or-equal symbols.  They are
% introduced by the |plmath| option or autodetection, when we are sure
% we have those symbols available in our fonts.
%
%
% \subsection{Dashes}
%
% \DescribeMacro{\dywiz}
% When a Polish compound word is split at the hyphen, it should be
% typeset with two hyphens: one at the end of line and the second at
% the beginning of the new line.  We provide macro
% |\dywiz| which gives proper hyphenation of compound words.  Kerns
% before and after |\discretionary| allow both parts of the word to be
% considered for hyphenation.
%    \begin{macrocode}
\def\dywiz{\kern0sp\discretionary{-}{-}{-}\penalty10000\hskip0sp\relax}
%    \end{macrocode}
%
%
%  \begin{macro}{\pauza}
%    Polish typographical rules require to put a fixed space of .2em
%    around dashes and forbid breaking a line before a dash.
%    \begin{macrocode}
\newcommand*\pauza{\unskip\kern.2em\textemdash\hskip.2em\ignorespaces}
\newcommand*\ppauza{\unskip\kern.2em\textendash\hskip.2em\ignorespaces}
%    \end{macrocode}
%  \end{macro}
%
% \subsection{Teaching \LaTeX\ to speak Polish}
%
% In early versions of \LaTeX\ there were problems when one wanted to
% customize predefined texts which were inserted automatically by
% \LaTeX\ (such as \emph{Bibliography} or \emph{Chapter}).  They were all
% hidden deep in the definitions of sectioning or other commands.  Now
% they are all defined as simple macros which can easily be redefined
% in language packages.  We will do that here.
%    \begin{macrocode}
\def\prefacename{Przedmowa}
\def\refname{Literatura}
\def\abstractname{Streszczenie}
\def\bibname{Bibliografia}
\def\chaptername{Rozdzia\PLSlash l} % uppercasing in running head must work
\def\appendixname{Dodatek}
\def\contentsname{Spis tre\'sci}
\def\listfigurename{Spis rysunk\'ow}
\def\listtablename{Spis tabel}
\def\indexname{Skorowidz}
\def\figurename{Rysunek}
\def\tablename{Tabela}
\def\partname{Cz\k e\'s\'c}
\def\enclname{Za\l\k aczniki}
\def\ccname{Do wiadomo\'sci}
\def\headtoname{Do}
\def\pagename{Strona}
\def\seename{zob.}
\def\proofname{Dow\'od}
%    \end{macrocode}
% \DescribeMacro{\today}
% Finally we redefine the macro |\today| to print the current date in Polish.
% In Polish documents in some situations it is more appropriate to use 
% the full word \emph{roku}
% (meaning \emph{year}) at the end of the date and sometimes it is more
% natural to use an abbreviation.  The macro |\PLdateending| which expands
% at the end of the date can be easily redefined to suit particular needs.
%    \begin{macrocode}
\def\today{\number\day~\ifcase\month\or
  stycznia\or lutego\or marca\or kwietnia\or maja\or czerwca\or
  lipca\or sierpnia\or wrze\'snia\or pa\'zdziernika\or
  listopada\or grudnia\fi \space\number\year \PLdateending}
%    \end{macrocode}
%
% \subsection{Macros needed later}
% This macro redefines all standard maths fonts.  Now |pl| maths fonts will be
% used instead of |cm| maths fonts.
%    \begin{macrocode}
\def\PL@setmaths{%
%    \end{macrocode}
% We start by leaving sign that we have fonts avaiable to redefine
% |\ge| and |\le| macros.
%    \begin{macrocode}
    \def\PLm@ths{}
%    \end{macrocode}
% We redefine math alphabets for both math versions.  We don't have to
% redefine |\mathrm|, |\mathnormal| or |\mathcal| alphabets, as they
% bound to |operators|, |letters| and |symbols| fonts by default (see
% |fontdef.dtx|.
%
% We must define OT4 encoding if it is not defined yet.
%    \begin{macrocode}
    \@ifundefined{T@OT4}{%
      \input ot4enc.def
    }{}
    \SetMathAlphabet{\mathbf}{normal}{OT4}{cmr}{bx}{n}
    \SetMathAlphabet{\mathsf}{normal}{OT4}{cmss}{m}{n}
    \SetMathAlphabet{\mathit}{normal}{OT4}{cmr}{m}{it}
    \SetMathAlphabet{\mathtt}{normal}{OT4}{cmtt}{m}{n}
%    \end{macrocode}
% We set math alphabets for bold version.
%    \begin{macrocode}
    \SetMathAlphabet{\mathsf}{bold}{OT4}{cmss}{bx}{n}
    \SetMathAlphabet{\mathit}{bold}{OT4}{cmr}{bx}{it}
%    \end{macrocode}
% We redeclare all standard symbol fonts.  We change the definition of
% |\@font@warning| macro to not to scare the user with warning
% messages on the screen about encoding change.
%    \begin{macrocode}
    \bgroup\let\@font@warning\@font@info
    \SetSymbolFont{operators}   {normal}{OT4}{cmr} {m}{n}
    \SetSymbolFont{letters}     {normal}{OML}{plm} {m}{it}
    \SetSymbolFont{symbols}     {normal}{OMS}{plsy}{m}{n}
    \SetSymbolFont{largesymbols}{normal}{OMX}{plex}{m}{n}
    \SetSymbolFont{operators}   {bold}  {OT4}{cmr} {bx}{n}
    \SetSymbolFont{letters}     {bold}  {OML}{plm} {b}{it}
    \SetSymbolFont{symbols}     {bold}  {OMS}{plsy}{b}{n}
    \egroup
%    \end{macrocode}
% As we have just reloaded the maths fonts, we have some new symbols
% available. 
% We redefine greater-than-or-equal and less-than-or-equal 
% signs to conform to Polish typographical conventions.  This is 
% by analogy with that which was done in section~\ref{redefining-maths}.
% Redefinition will be suppressed when option \emph{nomathsnames} is used.
%    \begin{macrocode} 
    \DeclareMathSymbol{\xleq}{3}{symbols}{172} 
    \DeclareMathSymbol{\xgeq}{3}{symbols}{173}
}
%
\def\PL@redef@relations{
    \let\leq=\xleq
    \let\geq=\xgeq
    \let\le=\leq
    \let\ge=\geq
}
%    \end{macrocode}
%
%
% \subsection{Options}
%
% Package \polski\ provides a number of options which customize
% it to the specific environment or needs.  They switch \LaTeX\ to
% different encodings, provide additional macros,~etc.
%
%
% \subsubsection{Option \texttt{plmath}}
% \label{plmath}
% This option redefines all standard maths fonts.  Now |pl| maths fonts will be
% used instead of |cm| maths fonts.
%    \begin{macrocode}
\DeclareOption{plmath}{%
    \PL@setmaths
}
%    \end{macrocode}
%
%
% \subsubsection{Option \texttt{nomathsymbols}}
% \label{nomathsymbols}
% This option supresses redefinition of standard \LaTeX's macros for
% trigonometric functions and for less-or-equal signs.
%    \begin{macrocode}
\DeclareOption{nomathsymbols}{%
    \def\PLn@m@thsn@mes{}
}
%    \end{macrocode}
%
% \subsubsection{Option \texttt{MeX}}
%
% This mode should prepare everything to be \emph{markup} compatible
% with \LaMeX.  This includes macron redefinition.
%    \begin{macrocode}
% \changes{v1.2.2}{2001/08/31}{Redefinition of macron was too early.  OT4
% may be not known yet.} 
\DeclareOption{MeX}{%
  \AtBeginDocument{%
    \@ifundefined{T@OT1}{}{%
    \DeclareTextCommand{\=}{OT1}{\dywiz}%
    \DeclareTextAccent{\macron}{OT1}{22}}%
    \@ifundefined{T@T1}{}{%
    \DeclareTextCommand{\=}{T1}{\dywiz}%
    \DeclareTextAccent{\macron}{T1}{9}}%
    \@ifundefined{T@OT4}{}{%
    \DeclareTextCommand{\=}{OT4}{\dywiz}%
    \DeclareTextAccent{\macron}{OT4}{22}}%
    \@ifundefined{T@QX}{}{%
    \DeclareTextCommand{\=}{QX}{\dywiz}%
    \DeclareTextAccent{\macron}{QX}{9}}%
    }%
    \let\xle\xleq
    \let\xge\xgeq
    \let\polish\l@polish
    \let\english\l@english
    \def\MeX{M\kern-.111em\lower.6ex\hbox{E}\kern-.075emX}
    \DeclareRobustCommand\LaMeX{%   after latex.dtx
        L\kern-.36em
        {\setbox0\hbox{T}%
         \vbox to\ht0{\hbox{%
                            \csname S@\f@size\endcsname
                            \fontsize\sf@size\z@
                            \math@fontsfalse\selectfont
                            A}
                      \vss}%
        }%
        \kern-.15em
        \MeX\@}%
    }
%    \end{macrocode}
%
%
% \subsubsection{Option {\ttfamily T1}}
% This will select T1 encoding for the document.
%    \begin{macrocode}
\DeclareOption{T1}{%
    \@ifundefined{T@T1}{\input{t1enc.def}}{}
    \def\encodingdefault{T1}\fontencoding{T1}%
    \def\PL@ncodingd@fined{}
}
%    \end{macrocode}
%
% \subsubsection{Option {\ttfamily QX}}
% This will select QX encoding for the document.
%    \begin{macrocode}
\DeclareOption{QX}{%
    \@ifundefined{T@QX}{\input{qxenc.def}}{}
    \def\encodingdefault{QX}\fontencoding{QX}%
    \def\PL@ncodingd@fined{}
}
%    \end{macrocode}
%
% \subsubsection{Option {\tt OT1}}
% This will select OT1 encoding for the document.
%    \begin{macrocode}
\DeclareOption{OT1}{%
    \def\encodingdefault{OT1}\fontencoding{OT1}%
    \def\PL@ncodingd@fined{}
}
%    \end{macrocode}
%
%
% \subsubsection{Option {\tt OT4}}
% This will select OT4 encoding for the document.
%    \begin{macrocode}
\DeclareOption{OT4}{%
    \@ifundefined{T@OT4}{\input{ot4enc.def}}{}%
    \def\encodingdefault{OT4}%
    \fontencoding{OT4}%
    \def\PL@ncodingd@fined{}%
}
%    \end{macrocode}
%
% \subsubsection{Options for prefixing in verbatim}
% These decide if prefixing  is active in verbatim:
%    \begin{macrocode}
\DeclareOption{prefixinginverb}{%
        \def\PL@prefixinginverb{1}%
}
\DeclareOption{noprefixinginverb}{%
        \def\PL@prefixinginverb{0}%
}
%    \end{macrocode}
%
% \subsubsection{Options for date ending in \cs{today}}
% 
%    \begin{macrocode}
\DeclareOption{roku}{%
   \def\PLdateending{\nobreakspace roku}
}
\DeclareOption{r.}{%
   \def\PLdateending{\nobreakspace r.}
}
\DeclareOption{noroku}{%
   \def\PLdateending{}
}
%    \end{macrocode}
%
% \subsection{Taking off \dots}
% This is almost the end.  We process all
% the options in the order of their definition and
% switch to french spacing which is also Polish traditional spacing.
%    \begin{macrocode}
\ExecuteOptions{prefixinginverb,noroku}
\ProcessOptions
\frenchspacing
%    \end{macrocode}
%
% We now try to autodetect whether the pl fonts reside on the system.
% We assume, that if there is \verb|OT4cmr.def| file on the system,
% there are also fonts installed.  The autodetection is suppressed if
% any encoding was switched by package options, or redefined before
% the package was loaded.
%    \begin{macrocode}
\def\tempa{OT1}
\ifx\tempa\f@encoding
    \@ifundefined{PL@ncodingd@fined}{%
        \IfFileExists{ot4cmr.fd}{%
            \typeout{\space\space\space
                Switching to Polish text encoding and Polish maths fonts.}
            \@ifundefined{T@OT4}{%
                \input ot4enc.def
            }{}%
            \def\encodingdefault{OT4}
            \fontencoding{OT4}\selectfont
            \PL@setmaths
        }{%
        \typeout{\space\space\space
          Can't locate Polish fonts.  Will use default encoding.}
        }%
%    \end{macrocode}
%
% We set a checkpoint to warn the user if she enters the document in
% OT1 encoding.
%    \begin{macrocode}
        \def\@PL@OT@check{%
            \bgroup
                \def\tempa{OT1}\ifx\tempa\cf@encoding
                    \@ifpackageloaded{ot1patch}{}{%
                        \PackageError{polski}{%
Zaczynasz skladac dokument uzywajac oryginalnych\MessageBreak
czcionek TeXa.  Czcionki te nie maja kompletu polskich\MessageBreak
znakow.  W zwiazku z tym LaTeX bedzie zglaszal bledy.\MessageBreak
\MessageBreak
Zainstaluj czcionki z dystrybucji MeXa dostepne\MessageBreak
na ftp://ftp.gust.org.pl, sprobuj uzyc czcionek EC\MessageBreak
dodajac opcje T1 do wywolania pakietu polski'ego\MessageBreak
lub w ostatecznosci uzyj pakietu ot1patch.}{}}%
                \fi
            \egroup
            \let\@PL@OT@check=\undefined}%
        \AtBeginDocument{\@PL@OT@check}%
    }{%
    \let\PL@ncodingd@fined=\undefined
    }%
\fi
%    \end{macrocode}
% Now we can redefine \LaTeX names for some maths functions and
% relations if it was not suppressed.
%    \begin{macrocode}
\@ifundefined{PLn@m@thsn@mes}{
  \PL@redef@funcnames
  \@ifundefined{PLm@ths}{}{\PL@redef@relations}
  }{}
%    \end{macrocode}
% If prefixing is not to be active in verb, we have to add slash to
% \cs{dospecials}: 
%    \begin{macrocode}
\if 0\PL@prefixinginverb
  \expandafter\def\expandafter\dospecials\expandafter{\dospecials\do\/}
\fi
%    \end{macrocode}
% Cleaning up and undefining some local macros.
%    \begin{macrocode}
\let\PLn@m@thn@mes=\undefined
\let\PLm@ths=\undefined
\let\PL@setmaths=\undefined
\let\PL@redef@relations=\undefined
\let\PL@redef@funcnames=\undefined
\let\PL@prefixinginverb=\undefined
%</style>
%    \end{macrocode}
%
% \section{Configuring \LaTeX's hyphenation patterns}
%
% This section provides code that configures \LaTeX\ kernel to include
% a~selected set of hyphenation patterns.  Nowadays it is not used
% since all distributions provide a~Babel-enabled \LaTeX\ format.
%
% This code will go to file |hyphen.cfg| which, if found, will be read
% by Ini\TeX\ during format generation instead of the standard \LaTeX\
% hyphenation patterns configuration.
%
% First we have to adjust language allocation counter (|\count19|)
% since kernel (incorrectly) causes |\newlanguage| to start allocation
% from 1.
%    \begin{macrocode}
%<*hyphenation>
\global\count19=-1
%    \end{macrocode}
%    The rest of actions is put into a group, so our auxiliary macros
%    will automatically disappear when they are no longer needed.
%    Allocations done by |\newlanguage| are global and so are
%    |\patterns| and |\hyphenation|.
%    \begin{macrocode}
\begingroup
%    \end{macrocode}
%    Here I define a few auxiliary macros needed to process
%    |language.dat|.  Every time \TeX\ sees a new name he puts it into
%    his name pool and it is never freed.  For that reason I don't
%    want to introduce new names for my auxiliary macros.  So my first
%    idea was to use control sequences of length 1 (which are not put
%    into the pool).  But this approach is risky since ``hyphenation
%    files'' commonly contain small pieces of code to adjust their
%    behaviour to format or \TeX\ version used.  So I've decided to
%    redefine locally a few of standard \LaTeX\ macros.
%    This causes code to be less readable, but I'll try to make these
%    names somehow mnemonic.  (I've chosen macros which contribute
%    directly to the current page, which means for sure they're not
%    used by hyphenation files.)
%
%    |\@stopline| will be used as a sentinel delimiting line end.
%    \begin{macrocode}
\def\@stopline{\@stopline}
%    \end{macrocode}
%    |\line| is main macro processing line read from
%    |language.dat|.  The line is passed to |\line| as argument
%    with a space and |\@stopline| appended.  |\line| checks
%    if the line starts with |=| (synonym definition) and based on
%    that passes the line to |\leftline| or |\rightline|.
%    \begin{macrocode}
\def\line#1#2\@stopline{%
  \ifx=#1%
    \leftline#2\@stopline
  \else
    \rightline#1#2\@stopline
  \fi
  }
%    \end{macrocode}
%    |\leftline| is called for synonym lines (with |=| removed).
%    Such lines should contain only a name for the synonym.  So
%    |\leftline| first checks if there is anything after the name
%    and raises and error.
%    \begin{macrocode}
\def\leftline#1 #2\@stopline{%
  \ifx\@stopline#2\@stopline\else
    \errhelp{The line should contain only an equals sign followed by
            the synonym name.}%
    \errmessage{Extra stuff on a synonym line in language.dat:^^J
            =#1 #2}\fi
%    \end{macrocode}
%    Next check if the language name wasn't already used:
%    \begin{macrocode}
  \expandafter\ifx\csname l@#1\endcsname\relax \else
    \errhelp{This probably means your ``language.dat'' contains many
        lines starting with `#1' or `=#1'.  ^^JThe language `#1' will
        be redefined.  This may not be what you want.}%
    \errmessage{Language `#1' already defined}\fi
%    \end{macrocode}
%    Synonyms make no sense when no real language was defined yet.
%    This is checked next. If |\count19| is $-1$ an error is raised
%    and no definition takes place.
%    \begin{macrocode}
  \ifnum\count19=\m@ne
    \errhelp{You cannot put synonyms before first real
        language definition in language.dat.}
    \errmessage{Cannot define `#1' as a language synonym: no language
        defined yet}%
  \else
%    \end{macrocode}
%    Finally the real definition takes place: |l@<language>| is
%    defined with |\chardef| to be last allocated language number. 
%    \begin{macrocode}
    \global\expandafter\chardef\csname l@#1\endcsname\count19
    \wlog{\string\l@#1=\string\language\number\count19}
  \fi
  }
%    \end{macrocode}
%    |\rightline| processes lines that don't start with |=|.  Such
%    lines instruct ini\TeX\ to read one or more hyphenation files.
%
%    The line is split on first space, |#1| being language name, |#2|
%    list of file names.  Note that there is at least one space in
%    input line since we've put one just before |\@stopline|.
%    \begin{macrocode}
\def\rightline#1 #2\@stopline{%
%    \end{macrocode}
%    First check if the language is already defined. If the language
%    name is new it is allocated.
%    \begin{macrocode}
  \expandafter\ifx\csname l@#1\endcsname\relax
    \expandafter\newlanguage\csname l@#1\endcsname
  \else
    \errhelp{This probably means your ``language.dat'' contains many
        lines starting with `#1' or `=#1'.  ^^JThe patterns will be
        merged with the ones already loaded.  This may not be what you
        want.}% 
    \errmessage{Language `#1' already defined}%
  \fi
%    \end{macrocode}
%    Then the language is set as current to begin loading of
%    hyphenation patterns.
%    \begin{macrocode}
  \language\csname l@#1\endcsname
%    \end{macrocode}
%    The language name is added to the list of defined languages kept
%    in |\displaylines|.
%    \begin{macrocode}
  \edef\displaylines{\displaylines, #1}%
%    \end{macrocode}
%    For every language there should be at least one patterns file
%    specified.  So if |#2| is empty we raise an error.
%    \begin{macrocode}
  \ifx\@stopline#2\@stopline
    \errhelp{Hyphenation will be inhibited in language `#1'.}%
    \errmessage{No pattern files specified for language `#1'}%
%    \end{macrocode}
%    Now |\centerline| processes list of file names delimited with
%    |\@stopline|. 
%    \begin{macrocode}
  \else
  \begingroup
  \message{Loading hyphenation patterns for #1.}
  \centerline#2\@stopline
  \endgroup
  \fi
  }
%    \end{macrocode}
%    Macro |\centerline| calls itself recursively until no file name
%    remains on input line.  For each name it tries to load the file.
%    Absence of file is considered to be a fatal error.
%    \begin{macrocode}
\def\centerline#1 #2\@stopline{%
  \InputIfFileExists{#1}{}{%
    \errhelp{Your language.dat file says I should load a file named
    `#1'.^^J  Check whether this name is correct and the file is
    installed. ^^JThe format will not be generated.}%
    \errmessage{Fatal error: patterns file #1 not found}%
    \endgroup\endgroup\@@end}
  \ifx\@stopline#2\@stopline\else \centerline#2\@stopline\fi
  }
%    \end{macrocode}
% 
%  \begin{macro}{\addvspace}
%    This macro is used to ensure that the line from language.dat ends
%    with exactly one space character.
%    \begin{macrocode}
\def\addvspace #1 \*#2\@stopline{%
  \ifx\@stopline#2\@stopline 
    \expandafter\def\expandafter\*\expandafter{\* }%
  \fi
}
%    \end{macrocode}
%  \end{macro}
%
%    With these auxiliaries we can start actual processing.  First the
%    existence of file \texttt{language.dat} is checked and the file
%    is opened.
%    \begin{macrocode}
\openin1 = language.dat
\ifeof1 
  \errhelp{You should have a file named language.dat on your system.
    This file specifies for what languages hyphenation patterns should
    be loaded and where these are kept.  Without this file the format
    will not be generated.}%
  \errmessage{Fatal error: language.dat not found}%
  \endgroup\@@end
\fi
%    \end{macrocode}
%    |\displaylines| is initialized in such a way that language list
%    won't contain starting comma:
%    \begin{macrocode}
\let\displaylines\@gobble
%    \end{macrocode}
%    Now lines from \texttt{language.dat} are read one by one.
%    |\endlinechar| is set to $-1$ to avoid a space that may get on
%    the end of input line.  But after a line is read |\endlinechar|
%    is reset again since code in patterns files may be fragile to
%    such a condition.
%    \begin{macrocode}
\loop
  \endlinechar\m@ne
  \read1 to \*%
  \endlinechar`\^^M
%    \end{macrocode}
%    Empty lines are skipped and others are passed to |\line|
%    with appended single space and the sentinel.  Line is read to
%    |\*|.  This is safe since this macro is only used locally here,
%    and normal value of |\*| is of no use for hyphenation files.
%    \begin{macrocode}
  \ifx\*\empty
  \else
    \expandafter\addvspace\*\* \*\@stopline
    \expandafter\line\*\@stopline
  \fi
%    \end{macrocode}
%    Processing takes place until end of \texttt{language.dat} is
%    found. 
%    \begin{macrocode}
  \ifeof1\else
\repeat
\closein1
%    \end{macrocode}
%    Now another sanity check is made: any reasonable
%    \texttt{language.dat} should contain at least one language
%    definition.  So we refuse to generate format without any
%    hyphenation patterns.
%    \begin{macrocode}
\ifnum\count19=-1
  \errhelp{Your language.dat does not instruct LaTeX to load any
    hyphenation patterns.  Since format with  no hyphenation patterns
    is hardly usable I refuse to generate it.  Check your language.dat
    and try again.}%
  \errmessage{Fatal error: No languages defined in language.dat}%
  \endgroup\@@end
\fi
%    \end{macrocode}
%    Then code to display list of loaded languages is added to
%    |\everyjob| and the group ends.
%    \begin{macrocode}
\edef\displaylines{\the\everyjob
  \noexpand\wlog{Loaded hyphenation patterns for\displaylines.}}
\global\everyjob\expandafter{\displaylines}
\endgroup
\language0
\lefthyphenmin=2 \righthyphenmin=3
%</hyphenation>
%    \end{macrocode}
%
% \section{Font encoding {\tt OT4}}
%
% (This section is not needed any more.  The definition for OT4 is
% present in the \LaTeX\ base.)
%
% Here we define a new encoding.  Its main purpose is to provide the
% link between standard accents such as |\'|,|\.| or |\k| (ogonek),
% and the corresponding characters in the font.  Jackowski's
% fonts will be called |cm|s and |cc|s in this encoding.
%
%    \begin{macrocode}
%<*encoding>
\ProvidesFile{ot4enc.def}[2008/02/24 v1.3.3 Output encoding for polish fonts]
%    \end{macrocode}
%    Declare the encoding.
%    \begin{macrocode}
\DeclareFontEncoding{OT4}{}{}
%    \end{macrocode}
%    Declare the accents.
%    \begin{macrocode}
\DeclareTextAccent{\"}{OT4}{127}
\DeclareTextAccent{\'}{OT4}{19}
\DeclareTextAccent{\.}{OT4}{95}
\DeclareTextAccent{\=}{OT4}{22}
\DeclareTextAccent{\^}{OT4}{94}
\DeclareTextAccent{\`}{OT4}{18}
\DeclareTextAccent{\~}{OT4}{126}
\DeclareTextAccent{\H}{OT4}{125}
\DeclareTextAccent{\u}{OT4}{21}
\DeclareTextAccent{\v}{OT4}{20}
\DeclareTextAccent{\r}{OT4}{23}
%    \end{macrocode}
%    The ogonek accent is available only under a e A \& E.  But we
%    have to provide some definition for \cs{k}. Some accents have to
%    be built by hand as in OT1:
%    \begin{macrocode}
\DeclareTextCommand{\k}{OT4}[1]{%
    \TextSymbolUnavailable{\k{#1}}#1}
\DeclareTextCommand{\b}{OT4}[1]
   {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{29}%
     \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}}}
\DeclareTextCommand{\c}{OT4}[1]
   {\leavevmode\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent24 #1%
    \else{\ooalign{\unhbox\z@\crcr\hidewidth\char24\hidewidth}}\fi}
\DeclareTextCommand{\d}{OT4}[1]
   {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{10}.\hidewidth}}}
%    \end{macrocode}
%    Declare the text symbols.
%    \begin{macrocode}
\DeclareTextSymbol{\AE}{OT4}{29}
\DeclareTextSymbol{\OE}{OT4}{30}
\DeclareTextSymbol{\O}{OT4}{31}
\DeclareTextSymbol{\L}{OT4}{138}
\DeclareTextSymbol{\ae}{OT4}{26}
\DeclareTextSymbol{\guillemotleft}{OT4}{174}
\DeclareTextSymbol{\guillemotright}{OT4}{175}
\DeclareTextSymbol{\i}{OT4}{16}
\DeclareTextSymbol{\j}{OT4}{17}
\DeclareTextSymbol{\l}{OT4}{170}
\DeclareTextSymbol{\o}{OT4}{28}
\DeclareTextSymbol{\oe}{OT4}{27}
\DeclareTextSymbol{\quotedblbase}{OT4}{255}
\DeclareTextSymbol{\ss}{OT4}{25}
\DeclareTextSymbol{\textemdash}{OT4}{124}
\DeclareTextSymbol{\textendash}{OT4}{123}
\DeclareTextSymbol{\textexclamdown}{OT4}{60}
%\DeclareTextSymbol{\texthyphenchar}{OT4}{`\-}
%\DeclareTextSymbol{\texthyphen}{OT4}{`\-}
\DeclareTextSymbol{\textquestiondown}{OT4}{62}
\DeclareTextSymbol{\textquotedblleft}{OT4}{92}
\DeclareTextSymbol{\textquotedblright}{OT4}{`\"}
\DeclareTextSymbol{\textquoteleft}{OT4}{`\`}
\DeclareTextSymbol{\textquoteright}{OT4}{`\'}
%    \end{macrocode}
%    Some symbols are faked from others:
%    \begin{macrocode}
\DeclareTextCommand{\aa}{OT4}
   {{\accent23a}}
\DeclareTextCommand{\AA}{OT4}
   {\leavevmode\setbox0\hbox{h}\dimen@\ht0\advance\dimen@-1ex%
    \rlap{\raise.67\dimen@\hbox{\char'27}}A}
\DeclareTextCommand{\SS}{OT4}
   {SS}
%    \end{macrocode}
%    In the OT4 encoding, \pounds~and \$ share a slot.
%    \begin{macrocode}
\DeclareTextCommand{\textdollar}{OT4}{\nfss@text{%
   \ifdim \fontdimen\@ne\font >\z@
      \slshape
   \else
      \upshape
   \fi
   \char`\$}}
\DeclareTextCommand{\textsterling}{OT4}{\nfss@text{%
   \ifdim \fontdimen\@ne\font >\z@
      \itshape 
   \else 
      \fontshape{ui}\selectfont 
   \fi 
   \char`\$}}
%    \end{macrocode}
%    Declare the composites.
%    \begin{macrocode}
\DeclareTextComposite{\k}{OT4}{A}{129}
\DeclareTextComposite{\'}{OT4}{C}{130}
\DeclareTextComposite{\k}{OT4}{E}{134}
\DeclareTextComposite{\'}{OT4}{N}{139}
\DeclareTextComposite{\'}{OT4}{S}{145}
\DeclareTextComposite{\'}{OT4}{Z}{153}
\DeclareTextComposite{\.}{OT4}{Z}{155}
\DeclareTextComposite{\k}{OT4}{a}{161}
\DeclareTextComposite{\'}{OT4}{c}{162}
\DeclareTextComposite{\k}{OT4}{e}{166}
\DeclareTextComposite{\'}{OT4}{n}{171}
\DeclareTextComposite{\'}{OT4}{s}{177}
\DeclareTextComposite{\'}{OT4}{z}{185}
\DeclareTextComposite{\.}{OT4}{z}{187}
\DeclareTextComposite{\'}{OT4}{O}{211}
\DeclareTextComposite{\'}{OT4}{o}{243}
%</encoding>
%    \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         \~}