% \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 by Marcin Woli\'nski.
% All rights reserved.
% 
% This file is part of the package `PLaTeX'
% ------------------------------------------------------------------
% 
% 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 2000/10/09.
\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@mimuw.edu.pl}\\
\end{tabular}
}%\\[4pt]

\title{\LaTeXe\ po polsku czyli \PLaTeX\\
      wersja 1.2}

\begin{document}
\maketitle
\tableofcontents
\DocInput{polski.dtx}
\end{document}
%
%</driver>
%
% \fi
%
% \CheckSum{1043}
%
% \def\PostScript{\textsc{PostScript}}
% \def\Polski{\textsc{Polski}}
% \def\polski{\textsc{polski}}
% \def\popolsku{P\LaTeX}
% \def\Babel{\textsc{Babel}}
% 
% \prefixing
% \section{Informacje dla u/zytkownik/ow}
% \subsection{Kr/otki obraz ca/lo/sci}
%
% Pakiet \popolsku\ sk/lada si/e z kilku zasadniczych cz/e/sci.
% \begin{itemize}
%
% \item
% Pierwsz/a z nich 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 czcionek
% |pl| czyli polskich wersji czcionek 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
% Czcionek (\emph{ang.} New Font Selection Scheme).
% Z pliku |plfonts.fdd| mo/zna wygenerowa/c pliki opisu
% czcionek 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 
% Druga cz/e/s/c plik/ow zwi/azana jest z konfiguracj/a \LaTeX{}a.
% Na razie w sk/lad pakietu wchodzi jedynie cz/e/s/c pozwalaj/aca
% na do/l/aczenie do standardowego \LaTeX{}a polskich wzorc/ow
% przenoszenia wyraz/ow.  Do tego celu zosta/l przewidziany w \LaTeX u
% plik o nazwie |hyphen.cfg|.  Je/zeli podczas generowania formatu
% \LaTeX\ ma dost/ep do tego pliku, to u/zyje go zamiast swojego
% standardowego pliku /laduj/acego wzorce przenoszenia.
% W pakiecie dostarczony jest plik |hyphen.cfg| wzorowany na podobnym
% pliku z pakietu \Babel.  Wczytuje on informacje o wzorcach, kt/ore
% maj/a by/c za/ladowane do formatu, z pliku |language.dat|.  Na
% pocz/atku tego pliku znajduje si/e szczeg/o/lowy opis jego formatu.
%
% Wzorce przenoszenia, kt/ore znajduj/a si/e w pliku |plhyph.pl| s/a
% tymi samymi wzorcami przenoszenia, kt/ore znajduj/a si/e w ostatnich
% wersjach \MeX a.
%
% \item
% Ostatni/a cz/e/sci/a sk/ladow/a pakietu jest styl |polski.sty|,
% kt/ory dostarcza wszystkie (?) elementy  potrzebne 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.  Posiada te/z mo/zliwo/s/c upodobnienia si/e na
% poziomie komend w 99\% do \LaMeX{}a.  Jego szczeg/o/lowy opis znajduje
% si/e w nast/epnym rozdziale.
%
% \end{itemize}
%
% W pakiecie \popolsku\ wykorzystane zosta/ly wzorce przenoszenia
% wyraz/ow, kt/orych autorami s/a Hanna Ko/lodziejska, Marek Ry/cko i
% Bogus/law Jackowski.  Sam kod stylu \polski ego bazuje na kodzie
% zawartym w pakiecie \MeX//\LaMeX\ autorstwa Marka Ry/cko i Bogus/lawa
% Jackowskiego.
%
% \subsection{Jak dzia/la styl \polski}
%
% Po za/ladowaniu stylu 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, kt/ore
% sprowadza si/e do sprawdzenia czy jest zdefiniowane makro |\polish|
% lub |\l@polish|.  Pierwsze z nich jest definiowane w pliku
% |hyphen.cfg| dostarczonym z pakietem (a'la \MeX), drugie za/s jest
% definiowane standardowo dla j/ezyka polskiego przez format \Babel.
% Je/zeli makra (wzorce przenoszenia) nie zostan/a znalezione, \polski{}
% styl wypisuje na ekranie stosowne ostrze/zenie, je/zeli zostan/a to
% s/a u/zyte do prze/l/aczenia wzorc/ow przenoszenia na polskie.
%
% 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).  Styl \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{} styl 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 stylu
% |fontenc|.
% Je/sli jednak nie zmieniono
% pocz/atkowego uk/ladu, \polski{} styl 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 styl sam zmienia pocz/atkowy uk/lad na |OT4|.
% Je/sli plik nie zostanie odszukany, to uk/lad pozostaje bez zmian.
%
% 
% \Polski{} styl przedefiniowuje wszystkie napisy, kt/ore
% mog/a pojawi/c si/e wygenerowane \emph{automatycznie} przez \LaTeX
% a, takie jak: rozdzia/l, spis tre/sci itp.  Zmieniona zostaje te/z
% definicja makra |\date| 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'' a czasami tylko sam/a liter/e ,,r.'', wprowadzone
% zosta/lo makro |\dateending|, kt/ore rozwija si/e zaraz za rokiem i
% w razie potrzeby mo/ze zosta/c /latwo przedefiniowane.
%
% Dodatkowo styl 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, 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 styl 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 styl \polski{} definiuje nowe makra |\tg|, |\tgh|,
% |\ctg|, |\ctgh| oraz |\arc| a nast/epnie\pauza uwaga\pauza zmienione
% zostaj/a
% symbole drukowane przez standardowe makra \LaTeX a |\tan|, |\ctan|,
% |\tanh|, |\ctanh|, |\arcsin|, |\arccos|, |\arctan| oraz |\arcctan|.
%  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 stylu do dokumentu}
% \label{uzycie}
%
% Styl \polski\ jest /ladowany przez
% umieszczenie w preambule dokumentu zlecenia
% \begin{verbatim}
% \usepackage[opcje]{polski}\end{verbatim}
% U/zycie w wywo/laniu stylu 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[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 styl znaczenia
%  standardowych \LaTeX{}owych symboli okre/slaj/acych funkcje
%  trygonometryczne oraz relacje wi/eksze\dywiz r/owne i mniejsze\dywiz
%  r/owne
% \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}
%
% \StopEventually{}
%
% Dalsza cz/e/s/c dokumentu opisuje kod samego stylu 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}[2000/10/09 v1.2 Polish language package]
%    \end{macrocode}
% and write its banner on the display
%    \begin{macrocode}
\typeout{Document Language Style `polski' v1.2 <2000/10/09>}
%    \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}
%
%
% \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).
%    \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 \expandafter\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}
%
% \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}{\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}{\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{<}{\guillemotleft}
\PL@accent@def{>}{\guillemotright}
\PL@accent@def{,}{\quotedblbase}
\PL@accent@def{'}{\textquotedblright}
\PL@accent@def{-}{\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}
%    \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\ctan=\ctg
  \let\tanh=\tgh   \let\ctanh=\ctgh
  \def\arcsin{\arc\sin}
  \def\arccos{\arc\cos}
  \def\arctan{\arc\tg}
  \def\arcctan{\arc\ctg}
  }
%    \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.}
%    \end{macrocode}
% \DescribeMacro{\dateending}
% 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\PLdateending{\space roku}
\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}
%
% Style \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}
\DeclareOption{MeX}{%
    \DeclareTextCommand{\=}{OT4}{\dywiz}
    \DeclareTextAccent{\macron}{OT4}{22}
    \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}{%
    \def\encodingdefault{T1}\fontencoding{T1}\selectfont
    \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}\selectfont
    \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}\selectfont
    \def\PL@ncodingd@fined{}
}
%    \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}
\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 stylu polski'ego\MessageBreak
lub w ostatecznosci uzyj stylu 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}
% 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
%</style>
%    \end{macrocode}
%
% \section{Configuring \LaTeX's hyphenation patterns}
%
%    (This section was written by Marcin Woli\'nski. He is to be
%    blamed for errors.) 
%    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}}
%
% 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}[2000/10/09 v1.2 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         \~}
