% \iffalse meta-comment
%
% Copyright 1989-2003 Johannes L. Braams and any individual authors
% listed elsewhere in this file.  All rights reserved.
% 
% This file is part of the Babel system release 3.7.
% --------------------------------------------------
% 
% It 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
% \CheckSum{543}
%
% \iffalse
%    Tell the \LaTeX\ system who we are and write an entry on the
%    transcript.
%<*dtx>
\ProvidesFile{polish.dtx}
%</dtx>
%<code>\ProvidesLanguage{polish}
%\fi
%\ProvidesFile{polish.dtx}
        [2003/10/12 v1.2k Polish support from the babel system]
%\iffalse
%% File `polish.dtx'
%% Babel package for LaTeX version 2e
%% Copyright (C) 1989 -- 2003
%%           by Johannes Braams, TeXniek
%
%% Polish Language Definition File
%% Copyright (C) 1989 - 2001
%%           by Elmar Schalueck, Michael Janich
%              Universitaet-Gesamthochschule Paderborn
%              Warburger Strasse 100
%              4790 Paderborn
%              Germany
%              elmar@uni-paderborn.de
%              massa@uni-paderborn.de
%
%% Please report errors to: J.L. Braams
%%                          babel@braams.cistron.nl
%
%    This file is part of the babel system, it provides the source
%    code for the Polish language definition file. It was developped
%    out of Polish.tex, which was written by Elmar Schalueck and
%    Michael Janich. Polish.tex was based on code by Leszek
%    Holenderski, Jerzy Ryll and J. S. Bie\'n from Faculty of
%    Mathematics,Informatics and Mechanics of Warsaw University, exept
%    of Jerzy Ryll (Instytut Informatyki Uniwersytetu Warszawskiego).
%<*filedriver>
\documentclass{ltxdoc}
\newcommand*\TeXhax{\TeX hax}
\newcommand*\babel{\textsf{babel}}
\newcommand*\langvar{$\langle \it lang \rangle$}
\newcommand*\note[1]{}
\newcommand*\Lopt[1]{\textsf{#1}}
\newcommand*\file[1]{\texttt{#1}}
\begin{document}
 \DocInput{polish.dtx}
\end{document}
%</filedriver>
%\fi
% \GetFileInfo{polish.dtx}
%
% \changes{polish-1.1c}{1994/06/26}{Removed the use of \cs{filedate}
%    and moved identification after the loading of babel.def}
% \changes{polish-1.2d}{1996/10/10}{Replaced \cs{undefined} with
%    \cs{@undefined} and \cs{empty} with \cs{@empty} for consistency
%    with \LaTeX, moved the definition of \cs{atcatcode} right to the
%    beginning.}
%
%  \section{The Polish language}
%
%    The file \file{\filename}\footnote{The file described in this
%    section has version number \fileversion\ and was last revised on
%    \filedate.}  defines all the language-specific macros for the
%    Polish language.
%
%    For this language the character |"| is made active. In
%    table~\ref{tab:polish-quote} an overview is given of its purpose.
%    \begin{table}[htb]
%     \begin{center}
%     \begin{tabular}{lp{8cm}}
%      |"a| & or |\aob|, for tailed-a (like \c{a})\\
%      |"A| & or |\Aob|, for tailed-A (like \c{A})\\
%      |"e| & or |\eob|, for tailed-e (like \c{e})\\
%      |"E| & or |\Eob|, for tailed-E (like \c{E})\\
%      |"c| & or |\'c|,  for accented c (like \'c),
%                      same with uppercase letters and n,o,s\\
%      |"l| & or |\lpb{}|, for l with stroke (like \l)\\
%      |"L| & or |\Lpb{}|, for L with stroke (like \L)\\
%      |"r| & or |\zkb{}|, for pointed z (like \.z), cf.
%      pronounciation\\
%      |"R| & or |\Zkb{}|, for pointed Z (like \.Z)\\
%      |"z| & or |\'z|,  for accented z\\
%      |"Z| & or |\'Z|,  for accented Z\\
%      \verb="|= & disable ligature at this position.\\
%      |"-| & an explicit hyphen sign, allowing hyphenation
%                  in the rest of the word.\\
%      |""| & like |"-|, but producing no hyphen sign
%                  (for compund words with hyphen, e.g.\ |x-""y|). \\
%      |"`| & for German left double quotes (looks like ,,).   \\
%      |"'| & for German right double quotes.                  \\
%      |"<| & for French left double quotes (similar to $<<$). \\
%      |">| & for French right double quotes (similar to $>>$).\\
%     \end{tabular}
%     \caption{The extra definitions made by \file{polish.sty}}
%     \label{tab:polish-quote}
%     \end{center}
%    \end{table}
%
% \StopEventually{}
%
%    The macro |\LdfInit| takes care of preventing that this file is
%    loaded more than once, checking the category code of the
%    \texttt{@} sign, etc.
% \changes{polish-1.2d}{1996/11/03}{Now use \cs{LdfInit} to perform
%    initial checks} 
%    \begin{macrocode}
%<*code>
\LdfInit{polish}\captionspolish
%    \end{macrocode}
%
%    When this file is read as an option, i.e. by the |\usepackage|
%    command, \texttt{polish} could be an `unknown' language in which
%    case we have to make it known. So we check for the existence of
%    |\l@polish| to see whether we have to do something here.
%
% \changes{polish-1.1c}{1994/06/26}{Now use \cs{@nopatterns} to
%    produce the warning}
%    \begin{macrocode}
\ifx\l@polish\@undefined
  \@nopatterns{Polish}
  \adddialect\l@polish0\fi
%    \end{macrocode}
%
%    The next step consists of defining commands to switch to (and
%    from) the Polish language.
%
% \begin{macro}{\captionspolish}
%    The macro |\captionspolish| defines all strings used in the four
%    standard documentclasses provided with \LaTeX.
% \changes{polish-1.2b}{1995/07/04}{Added \cs{proofname} for
%    AMS-\LaTeX}
% \changes{polish-1.2f}{1997/09/11}{Added translation for Proof and
%    changed translation of Contents}
% \changes{polish-1.2i}{2000/09/19}{\cs{bibname} and \cs{refname} were
%    swapped}
% \changes{polish-1.2i}{2000/09/19}{Added \cs{glossaryname}}
%    \begin{macrocode}
\addto\captionspolish{%
  \def\prefacename{Przedmowa}%
  \def\refname{Literatura}%
  \def\abstractname{Streszczenie}%
  \def\bibname{Bibliografia}%
  \def\chaptername{Rozdzia\l}%
  \def\appendixname{Dodatek}%
  \def\contentsname{Spis tre\'sci}%
  \def\listfigurename{Spis rysunk\'ow}%
  \def\listtablename{Spis tablic}%
  \def\indexname{Indeks}%
  \def\figurename{Rysunek}%
  \def\tablename{Tablica}%
  \def\partname{Cz\eob{}\'s\'c}%
  \def\enclname{Za\l\aob{}cznik}%
  \def\ccname{Kopie:}%
  \def\headtoname{Do}%
  \def\pagename{Strona}%
  \def\seename{Por\'ownaj}%
  \def\alsoname{Por\'ownaj tak\.ze}%
  \def\proofname{Dow\'od}%
  \def\glossaryname{Glossary}% <-- Needs translation
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\datepolish}
%    The macro |\datepolish| redefines the command |\today| to produce
%    Polish dates.
% \changes{polish-1.2f}{1997/10/01}{Use \cs{edef} to define
%    \cs{today} to save memory}
% \changes{polish-1.2f}{1998/03/28}{use \cs{def} instead of \cs{edef}}
% \changes{polish-1.2i}{2000/01/08}{A missing comment character caused
%    an unwanted space character in the output}
%    \begin{macrocode}
\def\datepolish{%
  \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}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\extraspolish}
% \begin{macro}{\noextraspolish}
%    The macro |\extraspolish| will perform all the extra definitions
%    needed for the Polish language. The macro |\noextraspolish| is
%    used to cancel the actions of |\extraspolish|.
%
%    For Polish the \texttt{"} character is made active. This is
%    done once, later on its definition may vary. Other languages in
%    the same document may also use the \texttt{"} character for
%    shorthands; we specify that the polish group of shorthands
%    should be used.
%
%    \begin{macrocode}
\initiate@active@char{"}
\addto\extraspolish{\languageshorthands{polish}}
\addto\extraspolish{\bbl@activate{"}}
%    \end{macrocode}
%    Don't forget to turn the shorthands off again.
% \changes{polish-1.2h}{1999/12/17}{Deactivate shorthands ouside of
%    Polish}
%    \begin{macrocode}
\addto\noextraspolish{\bbl@deactivate{"}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    The code above is necessary because we need an extra
%    active character. This character is then used as indicated in
%    table~\ref{tab:polish-quote}.
%
%    If you have problems at the end of a word with a linebreak, use
%    the other version without hyphenation tricks. Some TeX wizard may
%    produce a better solution with forcasting another token to decide
%    whether the character after the double quote is the last in a
%    word. Do it and let us know.
%
%    In Polish texts some letters get special diacritical marks.
%    Leszek Holenderski designed the following code to position the
%    diacritics correctly for every font in every size. These macros
%    need a few extra dimension variables.
%
%    \begin{macrocode}
\newdimen\pl@left
\newdimen\pl@down
\newdimen\pl@right
\newdimen\pl@temp
%    \end{macrocode}
%
%  \begin{macro}{\sob}
%    The macro |\sob| is used to put the `ogonek' in the right
%    place.
%
% \changes{polish-1.2d}{1996/08/18}{This macro is meant to be used in
%    horizontal mode; so leave vertical mode if necessary} 
%    \begin{macrocode}
\def\sob#1#2#3#4#5{%parameters: letter and fractions hl,ho,vl,vo
  \setbox0\hbox{#1}\setbox1\hbox{$_\mathchar'454$}\setbox2\hbox{p}%
  \pl@right=#2\wd0 \advance\pl@right by-#3\wd1
  \pl@down=#5\ht1 \advance\pl@down by-#4\ht0
  \pl@left=\pl@right \advance\pl@left by\wd1
  \pl@temp=-\pl@down \advance\pl@temp by\dp2 \dp1=\pl@temp
  \leavevmode
  \kern\pl@right\lower\pl@down\box1\kern-\pl@left #1}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\aob}
%  \begin{macro}{\Aob}
%  \begin{macro}{\eob}
%  \begin{macro}{\Eob}
%    The ogonek is placed with the letters `a', `A', `e', and `E'.
% \changes{polish-1.2d}{1996/08/18}{Use the constructed version of the
%    characters only in OT1; use proper characters in T1.} 
%    \begin{macrocode}
\DeclareTextCommand{\aob}{OT1}{\sob a{.66}{.20}{0}{.90}}
\DeclareTextCommand{\Aob}{OT1}{\sob A{.80}{.50}{0}{.90}}
\DeclareTextCommand{\eob}{OT1}{\sob e{.50}{.35}{0}{.93}}
\DeclareTextCommand{\Eob}{OT1}{\sob E{.60}{.35}{0}{.90}}
%    \end{macrocode}
%    For the 'new' \texttt{T1} encoding we can provide simpler
%    definitions. 
%    \begin{macrocode}
\DeclareTextCommand{\aob}{T1}{\k a}
\DeclareTextCommand{\Aob}{T1}{\k A}
\DeclareTextCommand{\eob}{T1}{\k e}
\DeclareTextCommand{\Eob}{T1}{\k E}
%    \end{macrocode}
%    Construct the characters by default from the OT1 encoding.
%    \begin{macrocode}
\ProvideTextCommandDefault{\aob}{\UseTextSymbol{OT1}{\aob}}
\ProvideTextCommandDefault{\Aob}{\UseTextSymbol{OT1}{\Aob}}
\ProvideTextCommandDefault{\eob}{\UseTextSymbol{OT1}{\eob}}
\ProvideTextCommandDefault{\Eob}{\UseTextSymbol{OT1}{\Eob}}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\spb}
%    The macro |\spb| is used to put the `poprzeczka' in the
%    right place.
%
% \changes{polish-1.2d}{1996/08/18}{\cs{spb} is meant to be used in
%    horizontal mode; so leave vertical mode if necessary} 
%    \begin{macrocode}
\def\spb#1#2#3#4#5{%
  \setbox0\hbox{#1}\setbox1\hbox{\char'023}%
  \pl@right=#2\wd0 \advance\pl@right by-#3\wd1
  \pl@down=#5\ht1 \advance\pl@down by-#4\ht0
  \pl@left=\pl@right \advance\pl@left by\wd1
  \ht1=\pl@down \dp1=-\pl@down
  \leavevmode
  \kern\pl@right\lower\pl@down\box1\kern-\pl@left #1}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\skb}
%    The macro |\skb| is used to put the `kropka' in the
%    right place.
%
% \changes{polish-1.2d}{1996/08/18}{\cs{skb} is meant to be used in
%    horizontal mode; so leave vertical mode if necessary} 
%    \begin{macrocode}
\def\skb#1#2#3#4#5{%
  \setbox0\hbox{#1}\setbox1\hbox{\char'056}%
  \pl@right=#2\wd0 \advance\pl@right by-#3\wd1
  \pl@down=#5\ht1 \advance\pl@down by-#4\ht0
  \pl@left=\pl@right \advance\pl@left by\wd1
  \leavevmode
  \kern\pl@right\lower\pl@down\box1\kern-\pl@left #1}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\textpl}
%    For the `poprzeczka' and the `kropka' in text fonts we don't need
%    any special coding, but we can (almost) use what is already
%    available.
%
%    \begin{macrocode}
\def\textpl{%
  \def\lpb{\plll}%
  \def\Lpb{\pLLL}%
  \def\zkb{\.z}%
  \def\Zkb{\.Z}}
%    \end{macrocode}
%    Initially we assume that typesetting is done with text fonts.
% \changes{polish-1.0a}{1993/11/05}{Initially execute `textpl}
%    \begin{macrocode}
\textpl
%    \end{macrocode}
%
%    \begin{macrocode}
\let\lll=\l \let\LLL=\L
\def\plll{\lll}
\def\pLLL{\LLL}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\telepl}
%    But for the `teletype' font in `OT1' encoding we have to take some
%    special actions, involving the macros defined above.
%
%    \begin{macrocode}
\def\telepl{%
  \def\lpb{\spb l{.45}{.5}{.4}{.8}}%
  \def\Lpb{\spb L{.23}{.5}{.4}{.8}}%
  \def\zkb{\skb z{.5}{.5}{1.2}{0}}%
  \def\Zkb{\skb Z{.5}{.5}{1.1}{0}}}
%    \end{macrocode}
%  \end{macro}
%
%    To activate these codes the font changing commands as they are
%    defined in \LaTeX\ are modified. The same is done for plain
%    \TeX's font changing commands.
%
%    When |\selectfont| is undefined the current format is spposed to be
%    either plain (based) or \LaTeX$\:$2.09.
% \changes{polish-1.2a}{1995/06/06}{Don't modify \cs{rm} and friends for
%    \LaTeXe, take \cs{selectfont } instead}
%    \begin{macrocode}
\ifx\selectfont\@undefined
  \ifx\prm\@undefined \addto\rm{\textpl}\else \addto\prm{\textpl}\fi
  \ifx\pit\@undefined \addto\it{\textpl}\else \addto\pit{\textpl}\fi
  \ifx\pbf\@undefined \addto\bf{\textpl}\else \addto\pbf{\textpl}\fi
  \ifx\psl\@undefined \addto\sl{\textpl}\else \addto\psl{\textpl}\fi
  \ifx\psf\@undefined                   \else \addto\psf{\textpl}\fi
  \ifx\psc\@undefined                   \else \addto\psc{\textpl}\fi
  \ifx\ptt\@undefined \addto\tt{\telepl}\else \addto\ptt{\telepl}\fi
\else
%    \end{macrocode}
%    When |\selectfont| exists we assume \LaTeXe.
%    \begin{macrocode}
  \expandafter\addto\csname selectfont \endcsname{%
    \csname\f@encoding @pl\endcsname}
\fi
%    \end{macrocode}
%    Currently we support the OT1 and T1 encodings. For T1 we don't
%    have to make a difference between typewriter fonts and other
%    fonts, they all have the same glyphs.
%    \begin{macrocode}
\expandafter\let\csname T1@pl\endcsname\textpl
%    \end{macrocode}
%    For OT1 we need to check the current font family, stored in
%    |\f@family|. Unfortunately we need a hack as |\ttdefault| is
%    defined as a |\long| macro, while |\f@family| is not.
%    \begin{macrocode}
\expandafter\def\csname OT1@pl\endcsname{%
  \long\edef\curr@family{\f@family}%
  \ifx\curr@family\ttdefault
    \telepl
  \else
    \textpl
  \fi}
%    \end{macrocode}
%
%  \begin{macro}{\dq}
%    We save the original double quote character in |\dq| to keep
%    it available, the math accent |\"| can now be typed as |"|.
%    \begin{macrocode}
\begingroup \catcode`\"12
\def\x{\endgroup
  \def\dq{"}}
\x
%    \end{macrocode}
%  \end{macro}
%
%    Now we can define the doublequote macros for diacritics,
% \changes{polish-1.1d}{1995/01/31}{The dqmacro for C used \cs{'c}}
%    \begin{macrocode}
\declare@shorthand{polish}{"a}{\textormath{\aob}{\ddot a}}
\declare@shorthand{polish}{"A}{\textormath{\Aob}{\ddot A}}
\declare@shorthand{polish}{"c}{\textormath{\'c}{\acute c}}
\declare@shorthand{polish}{"C}{\textormath{\'C}{\acute C}}
\declare@shorthand{polish}{"e}{\textormath{\eob}{\ddot e}}
\declare@shorthand{polish}{"E}{\textormath{\Eob}{\ddot E}}
\declare@shorthand{polish}{"l}{\textormath{\lpb}{\ddot l}}
\declare@shorthand{polish}{"L}{\textormath{\Lpb}{\ddot L}}
\declare@shorthand{polish}{"n}{\textormath{\'n}{\acute n}}
\declare@shorthand{polish}{"N}{\textormath{\'N}{\acute N}}
\declare@shorthand{polish}{"o}{\textormath{\'o}{\acute o}}
\declare@shorthand{polish}{"O}{\textormath{\'O}{\acute O}}
\declare@shorthand{polish}{"s}{\textormath{\'s}{\acute s}}
\declare@shorthand{polish}{"S}{\textormath{\'S}{\acute S}}
%    \end{macrocode}
%  \begin{macro}{\polishrz}
%  \begin{macro}{\polishzx}
% \changes{polish-1.2j}{2000/11/11}{Added support for two
%    notationstyles for kropka and accented z}
%    The command |\polishrz| defines the shorthands |"r|, |"z| and
%    |"x| to produce pointed z, accented z and |"x|. This is the
%    default as these shorthands were defined by this language
%    definition file for quite some time.
%    \begin{macrocode}
\newcommand*{\polishrz}{%
  \declare@shorthand{polish}{"r}{\textormath{\zkb}{\ddot r}}%
  \declare@shorthand{polish}{"R}{\textormath{\Zkb}{\ddot R}}%
  \declare@shorthand{polish}{"z}{\textormath{\'z}{\acute z}}%
  \declare@shorthand{polish}{"Z}{\textormath{\'Z}{\acute Z}}%
  \declare@shorthand{polish}{"x}{\dq x}%
  \declare@shorthand{polish}{"X}{\dq X}%
  }
\polishrz
%    \end{macrocode}
%    The command |\polishzx| switches to a different set of
%    shorthands, |"z|, |"x| and |"r| to produce pointed z, accented z
%    and |"r|; a different shorthand notation also in use.
% \changes{polish-1.2k}{2003/10/12}{Fixed a typo}
%    \begin{macrocode}
\newcommand*{\polishzx}{%
  \declare@shorthand{polish}{"z}{\textormath{\zkb}{\ddot z}}%
  \declare@shorthand{polish}{"Z}{\textormath{\Zkb}{\ddot Z}}%
  \declare@shorthand{polish}{"x}{\textormath{\'z}{\acute x}}%
  \declare@shorthand{polish}{"X}{\textormath{\'Z}{\acute X}}%
  \declare@shorthand{polish}{"r}{\dq r}%
  \declare@shorthand{polish}{"R}{\dq R}%
  }
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%    Then we define access to two forms of quotation marks, similar
%    to the german and french quotation marks.
% \changes{polish-1.2e}{1997/04/03}{Removed empty groups after
%    double quote and guillemot characters}
%    \begin{macrocode}
\declare@shorthand{polish}{"`}{%
  \textormath{\quotedblbase}{\mbox{\quotedblbase}}}
\declare@shorthand{polish}{"'}{%
  \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
\declare@shorthand{polish}{"<}{%
  \textormath{\guillemotleft}{\mbox{\guillemotleft}}}
\declare@shorthand{polish}{">}{%
  \textormath{\guillemotright}{\mbox{\guillemotright}}}
%    \end{macrocode}
%    then we define two shorthands to be able to specify hyphenation
%    breakpoints that behavew a little different from |\-|.
%    \begin{macrocode}
\declare@shorthand{polish}{"-}{\nobreak-\bbl@allowhyphens}
\declare@shorthand{polish}{""}{\hskip\z@skip}
%    \end{macrocode}
%    And we want to have a shorthand for disabling a ligature.
%    \begin{macrocode}
\declare@shorthand{polish}{"|}{%
  \textormath{\discretionary{-}{}{\kern.03em}}{}}
%    \end{macrocode}
%
%
%  \begin{macro}{\mdqon}
%  \begin{macro}{\mdqoff}
%    All that's left to do now is to  define a couple of commands
%    for reasons of compatibility with \file{polish.tex}.
% \changes{polish-1.2f}{1998/06/07}{Now use \cs{shorthandon} and
%    \cs{shorthandoff}} 
%    \begin{macrocode}
\def\mdqon{\shorthandon{"}}
\def\mdqoff{\shorthandoff{"}}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%    The macro |\ldf@finish| takes care of looking for a
%    configuration file, setting the main language to be switched on
%    at |\begin{document}| and resetting the category code of
%    \texttt{@} to its original value.
% \changes{polish-1.2d}{1996/11/03}{Now use \cs{ldf@finish} to wrap
%    up} 
%    \begin{macrocode}
\ldf@finish{polish}
%</code>
%    \end{macrocode}
%
% \Finale
%
%% \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         \~}
%%
\endinput
