%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Contents: Special Commands (LShort2e Introduction)
% File: lshort2e.sty (Polish translation)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% By Tobias Oetiker
% Dopasowanie do potrzeb polskiego t�umaczenia:  TP
% Ostatnie modyfikacje: kwiecie� 2000 ** TP **
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\errorcontextlines=10

%save pageref an label
\let\lsspageref=\pageref
\ProvidesPackage{lshort2e}
\RequirePackage{verbatim}
\RequirePackage{fancyhdr}
\RequirePackage{calc}
\RequirePackage{amsmath}

% Lets have some nice headings
\pagestyle{fancyplain}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
%\renewcommand{\sectionmark}[1]{\markright{\thesection{} #1}}
\renewcommand{\sectionmark}[1]{\markright{\thesection{.} #1}} %% kwiecie/n 2000 ** TP **
\lhead[\fancyplain{}{\renewcommand\familydefault{\rmdefault}%
      \normalfont \small\bfseries\thepage}]
     {\fancyplain{}{\renewcommand\familydefault{\rmdefault}%
      \normalfont \small\bfseries\rightmark}}
\rhead[\fancyplain{}{\renewcommand\familydefault{\rmdefault}%
     \normalfont
     \small\bfseries\leftmark}]
    {\fancyplain{}{\renewcommand\familydefault{\rmdefault}%
     \normalfont \small\bfseries\thepage}}
\cfoot[]{}
\addtolength{\headheight}{1.6pt}
%
%
% Earlier paragraphs were separated by some space
%
%\setlength{\parindent}{0pt}
%\setlength{\parskip}{1.5ex plus 0.7ex minus 0.6ex}

\newcommand{\manual}{\emph{\LaTeX{} Manual}~\cite{manual}} 
\newcommand{\companion}{\emph{The \LaTeX{} Companion}~\cite{companion}} 
\newcommand{\guide}{\emph{Local Guide}~\cite{local}}
\newcommand{\contrib}[3]{#1\quad$<$\texttt{#2}$>${\small
   \\\quad\textit{#3}}\par \vskip1ex}
\newcommand{\xcontrib}[2]{#1\par\vskip1ex}
\newenvironment{PLtrans}{\par \bigskip\begingroup \leftskip\parindent 
  \parindent0pt}{\par\endgroup\bigskip}
%
% Some commands for helping with INDEX creation
%
%\newcommand{\bs}{\symbol{'134}}%Print backslash
\providecommand{\bs}{\symbol{'134}}%Print backslash
%
%\newcommand{\bs}{\ensuremath{\mathtt{\backslash}}}%Print backslash
% Index entry for a command (\cih for hidden command index
\newcommand{\cih}[1]{%
\index{instrukcja!#1@\texttt{\bs#1}}%
\index{#1@\texttt{\hspace*{-1.2ex}\bs #1}}}
\newcommand{\ci}[1]{\cih{#1}\texttt{\bs#1}}
%Package
\newcommand{\pai}[1]{%
\index{pakiet!#1@\textsf{#1}}%
\index{#1@\textsf{#1}}%
\textsf{#1}}
% Index entry for an environment
\newcommand{\ei}[1]{%
\index{�rodowisko!\texttt{#1}}%
\index{#1@\texttt{#1}}%
\texttt{#1}}
% Indexentry for a word (Word inserted into the text)
\newcommand{\wi}[1]{\index{#1}#1}
%
% Typesetting Commands
%
\newenvironment{command}%
    {\nopagebreak\par\small\addvspace{3.2ex plus 0.8ex minus 0.2ex}%
     \vskip -\parskip
     \noindent%
     \begin{tabular}{|l|}\hline\rule{0pt}{1em}\ignorespaces}%
    {\\\hline\end{tabular}\par\nopagebreak\addvspace{3.2ex plus 0.8ex
        minus 0.2ex}%
     \vskip -\parskip}
%
% Type setting Code Fragments
%
\newenvironment{code}{%%\smallskip %% *** TP ** has commented it out
   \begin{quote}}
  {\end{quote}
  %%\smallskip %% *** ditto
 }
%
% Intro Environment
\newenvironment{intro}{\sffamily}{\vspace*{2ex minus 1.5ex}}

%
%
% Symbol Entry for Math Symbol Tables
%
\newcommand{\X}[1]{$#1$&\texttt{\string#1}\hspace*{1ex}}
% normal text .... 
\newcommand{\SC}[1]{#1&\texttt{\string#1}\hspace*{1ex}}
% for accents in text mode
\newcommand{\A}[1]{#1&\texttt{\string#1}\hspace*{1ex}}
\newcommand{\B}[2]{#1#2&\texttt{\string#1{} #2}\hspace*{1ex}}

\newcommand{\W}[2]{$#1{#2}$&
  \texttt{\string#1}\texttt{\string{\string#2\string}}\hspace*{1ex}}
\newcommand{\Y}[1]{$\big#1$ &\texttt{\string#1}}  %
% Mathsymbol Table
\newsavebox{\symbbox}
\newenvironment{symbols}[1]%
{\par\vspace*{2ex}
\renewcommand{\arraystretch}{1.1}
\begin{lrbox}{\symbbox}
\hspace*{4ex}\begin{tabular}{@{}#1@{}}}%
{\end{tabular}\end{lrbox}\makebox[\textwidth]{\usebox{\symbbox}}\par\medskip}
%
% Special Prep for AMS Symbols Printout
% Should work if AMS is not available
%

% we have no PS versions of the rsfs fonts ... so this is a nogo for pdf
%\ifx\pdfoutput\undefined % We're not running pdftex
\IfFileExists{mathrsfs.sty}
  {\RequirePackage{mathrsfs}\let\MathRSFS\mathscr\let\mathscr\relax}{}
%\fi
%% **// koniec \pdfoutput //
\IfFileExists{amssymb.sty}
  {\let\noAMS\relax \RequirePackage{amssymb}}
  {\def\noAMS{\endinput}\RequirePackage{latexsym}}
\IfFileExists{eucal.sty}
  {\RequirePackage[mathscr]{eucal}}
  {\IfFileExists{euscript.sty}
  {\RequirePackage{euscript}}{}}
%\IfFileExists{eufrak.sty}
%  {\RequirePackage{eufrak}}{}
\IfFileExists{amsbsy.sty}
  {\RequirePackage{amsbsy}}{}
%
% Print |--| to show a distance
%
\newcommand{\demowidth}[1]{\rule{0.3pt}{1.3ex}\rule{#1}{0.3pt}\rule{0.3pt}{1.3ex}}
%
%
% --- example ----
% This is an environment to set LaTeX examples.
% On the left side the source text and on the
% right side the typeset text.
%
% \begin{example}
% \Large This is Large
% \end{example}
%
% This Part is stolen from the verbatim.sty by FMi
% 
\newwrite\example@out
\newcounter{exacnt}
\setcounter{exacnt}{1}

\newlength{\savefboxrule}
\newlength{\savefboxsep}
\newlength{\outdent}
\setlength{\outdent}{2cm}
\addtolength{\headwidth}{\outdent}
 %%
\newenvironment{example}{\begingroup
  \FormatChapterHeadinsideExample %% *** TP ***
  \begingroup %% Lets Keep the Changes Local
  \hfuzz 9.0pt %% ** TP **
  \@bsphack
  \immediate\openout \example@out \jobname.exa
  \let\do\@makeother\dospecials\catcode`\^^M\active
  \def\verbatim@processline{%
    \immediate\write\example@out{\the\verbatim@line}}%
  \verbatim@start}%
{\immediate\closeout\example@out\@esphack\endgroup%
  \stepcounter{exacnt}%
  \setlength{\parindent}{0pt}%
  \par %%\nobreak
  \addvspace{1.0ex plus 0.5ex minus 0.5ex}\vskip -\parskip 
  %%\nobreak
  \noindent
  \@ifundefined{r@exa:\theexacnt}{\hspace*{0pt}}{%
    \ifx\pdfoutput\undefined % We're not running pdftex
      \ifodd\pageref{exa:\theexacnt}%
         \hspace*{0pt}\else\hspace*{-\outdent}\fi%
    \else
       \ifx\realpageref\undefined
         % HyPsd@pageref jest wewn�trznym poleceniem pakietu hyperref v 6.69c;
         % natomiast we wcze�niejszych wersjach pakietu dzia�a�o polecenie `realpageref'
         % dok�adnie nie wiem kiedy przesta�o -- st�d kulawe rozwi�zanie poprzez 
         % \undefined *** TP *** kwiecie� ** 2000
         \ifodd\HyPsd@pageref{exa:\theexacnt}\hspace*{0pt}\else\hspace*{-\outdent}\fi%
       \else
         \ifodd\realpageref{exa:\theexacnt}\hspace*{0pt}\else\hspace*{-\outdent}\fi%
       \fi
    \fi
}%
%\fi
   \makebox[\textwidth][l]{%
    \raisebox{-\height}[0pt][\totalheight]{%
      \begin{minipage}[t]{0.5\outdent+0.46\textwidth-3mm}%
        \hfuzz\ExampleHFuzz%% *** TP ***
        \small\verbatiminput{\jobname.exa}
      \end{minipage}}%
    \hspace{5mm}%
    \setlength{\savefboxrule}{\fboxrule}%
    \setlength{\fboxrule}{0.1pt}%
    \setlength{\savefboxsep}{\fboxsep}%
    \setlength{\fboxsep}{3mm}%
    \raisebox{-\height}[0pt][\totalheight]{%
      \fbox{%
        \begin{minipage}[t]{%
               0.5\outdent+0.54\textwidth-2mm-2\fboxrule-2\fboxsep-0.7ex}%
          \setlength{\fboxrule}{\savefboxrule}%
          \setlength{\fboxsep}{\savefboxsep}%
          \setlength{\fboxrule}{0.5pt}%
          \setlength{\parskip}{1ex plus 0.4ex minus 0.2ex}%
          \begin{trivlist}\item\small
            \abovedisplayskip=0pt plus 1pt minus 1pt %% *** TP ***
            \abovedisplayshortskip=3pt plus 1pt minus 1pt %%
            \input{\jobname.exa}
          \end{trivlist}
        \end{minipage}
        }%
      }%
    }\label{exa:\theexacnt}%
  \par
  \endgroup %% *** TP ***
  \addvspace{2.0ex plus 1.0ex minus 1.0ex}\vskip -\parskip
  }

\newenvironment{lined}[1]%
 {\begin{center}\begin{minipage}{#1}\hrule\medskip}
 %{\vspace{-1ex}\hrule \end{minipage}\end{center}} %%% *** TP **
 {\smallskip \hrule \end{minipage}\end{center}}

%
% =========================================================================!
\newcommand{\TextVert}{\texttt{\char124}} % *** ? TP ****

\newenvironment{TPexample}{%% 
\begingroup % ** TP ***
 \FormatChapterHeadinsideExample %% *** TP ***     
 \begingroup
 \@bsphack %%% Dok�adnie nie wiem po co to jest
 \parindent0pt
 \par
 \addvspace{1.0ex plus 0.5ex minus 0.5ex}\vskip -\parskip
 %% left-right margin positioning---
 %%
 \leavevmode \hbox to\textwidth \bgroup 
   %\refstepcounter{exacnt}% <-- niepotrzebne a dodatkowo
   % podwoduje b��d w~punkcie `2.6 Odsy�acze', prawid�owo:
   \stepcounter{exacnt}%
   % %%
\@ifundefined{r@exa:\theexacnt}{\hss}{%
  \ifx\pdfoutput\undefined % We're not running pdftex
     \ifodd\pageref{exa:\theexacnt}\relax \else\hss\fi 
  \else
     \ifx\realpageref\undefined
       % \undefined *** TP *** kwiecie� ** 2000
       \ifodd\HyPsd@pageref{exa:\theexacnt}\relax \else\hss\fi
     \else
       \ifodd\realpageref{exa:\theexacnt}\relax \else\hss\fi 
     \fi
  \fi 
}%
 %===+===+===+=== TP ===+===+===+===
 \hfuzz 9pt }%
{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %\unskip
  \@ifundefined{r@exa:\theexacnt}{}{%
  \ifx\pdfoutput\undefined % We're not running pdftex
    \ifodd\pageref{exa:\theexacnt}\hss\else\relax\fi 
  \else
     \ifx\realpageref\undefined
       % \undefined *** TP *** kwiecie� ** 2000
       \ifodd\HyPsd@pageref{exa:\theexacnt}\hss \else\relax \fi
     \else
       \ifodd\realpageref{exa:\theexacnt}\hss\else\relax\fi 
     \fi
  \fi 
}% ===+===+===+=== TP ===+===+===+===
     \egroup\label{exa:\theexacnt}%
     %\Red{\hrule}%% <--- TP 4 diagnosing nasty error!
     \par \endgroup \endgroup
     \addvspace{2.0ex plus 1.0ex minus 1.0ex}%
     %\Blue{\hrule}%% <--- TP 4 diagnosing nasty error!
     \vskip -\parskip
 }
\newenvironment{excode}{\begingroup\small
    \Sbox
    \minipage[t]{0.5\outdent+0.46\textwidth-3mm}%
    \hfuzz9pt \verbatim}%
  {\endverbatim\unskip
   \nointerlineskip
   \nointerlineskip
   %\Green{\hrule}%% <--- TP 4 diagnosing nasty error!
   \endminipage 
   \endSbox 
     %%% TU JEST JAKI� PROBLEM----
    %\raisebox{-\height}[0pt][\totalheight]{\TheSbox}%
    \raisebox{-\height}[0pt][\totalheight]{\TheSbox}%
   \endgroup \hspace{5mm}}
\newenvironment{exshow}{\begingroup
    \setlength{\savefboxrule}{\fboxrule}%
    \setlength{\fboxrule}{0.1pt}%
    \setlength{\savefboxsep}{\fboxsep}%
    \setlength{\fboxsep}{3mm}%
    \small \hfuzz6pt
    \begin{Sbox}%
    \begin{minipage}[t]{%
      0.5\outdent+0.54\textwidth-2mm-2\fboxrule-2\fboxsep-0.7ex}%
      \setlength{\parskip}{0pt plus 0.4ex minus 0.2ex}%
      % %\hfuzz6pt
          \setlength{\fboxrule}{\savefboxrule}%
          \setlength{\fboxsep}{\savefboxsep}%
          \setlength{\fboxrule}{0.5pt}%
          %\showthe \abovedisplayskip
          \setlength{\parskip}{1ex plus 0.4ex minus 0.2ex}%
          \begin{trivlist}\item\small
            \abovedisplayskip=0pt plus 1pt minus 1pt %% *** TP ***
            \abovedisplayshortskip=3pt plus 1pt minus 1pt
  }%
  {\end{trivlist}\end{minipage}\end{Sbox}
   \raisebox{-\height}[0pt][\totalheight]{\fbox{\TheSbox}}\endgroup}

%
% I want no headers on pages created by clearpage
\renewcommand{\cleardoublepage}
    {\clearpage\if@twoside \ifodd\c@page\else
    \hbox{}\thispagestyle{empty}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}

%% **************************** TP *************************************
%%
%% Redefinujemy wyliczenia usuwaj�c odst�py mi�dzy punktami
%% oraz przed i po wyliczeniach (bo takie s� w Polsce zwyczaje)
%%
%%
\def\@listi{\leftmargin\leftmargini
            \parsep 0\p@ \@plus1\p@ \@minus\p@
            \topsep 3\p@ \@plus1\p@ \@minus\p@
            \itemsep0\p@ \@plus1\p@ \@minus\p@}
\let\@listI\@listi

\renewcommand\small{%
   \@setfontsize\small\@xpt\@xiipt
   \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
   \abovedisplayshortskip \z@ \@plus3\p@
   \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
   \def\@listi{\leftmargin\leftmargini
               \topsep 3\p@ \@plus1\p@ \@minus\p@
               \parsep 0\p@ \@plus1\p@ \@minus\p@
               \itemsep \parsep}%
   \belowdisplayskip \abovedisplayskip
}
\renewcommand\footnotesize{%
   \@setfontsize\footnotesize\@ixpt{11}%
   \abovedisplayskip 8\p@ \@plus2\p@ \@minus4\p@
   \abovedisplayshortskip \z@ \@plus\p@
   \belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@
   \def\@listi{\leftmargin\leftmargini
               \topsep 3\p@ \@plus1\p@ \@minus0\p@
               \parsep 0\p@ \@plus\p@  \@minus\p@
               \itemsep \parsep}%
   \belowdisplayskip \abovedisplayskip
}


% Definiujemy oryginalne angielskie funkcje trygonometryczne
% (pakiet polski z opcj� plmath i MeX przedefiniowuje je)
%
\def\EnglishTrygFunctions{%
\def\arcsin{\mathop{\operator@font arcsin}\nolimits}%
\def\arccos{\mathop{\operator@font arccos}\nolimits}%
\def\tan{\mathop{\operator@font tan}\nolimits}%
\def\tanh{\mathop{\operator@font tanh}\nolimits}%
\def\coth{\mathop{\operator@font coth}\nolimits}%
 }

%
% zmiana oryginalnego �rodowiska *** TP ***
\renewenvironment{command}%
    {\unskip %% *** TP ***
     \nopagebreak %%
     \par
     \small
     \addvspace{3.2ex plus 0.8ex minus 1.2ex}%
     \vskip -\parskip
     \noindent%
     \begin{tabular}{|l|}\hline\rule{0pt}{1em}\ignorespaces}%
    {\\\hline\end{tabular}\par
       %\nopagebreak %% *** TP ***
       \addvspace{3.2ex plus 0.8ex  minus 1.2ex}%
     \vskip -\parskip}

%% Zmieniamy formatowanie �r�dtytu��w je�eli s� u�yte
%% jako przyk�ady (mniejsze odst�pny, mniejszy stopie� pisma)
\def\FormatChapterHeadinsideExample{%
\def\@makeschapterhead##1{%
  %\vspace*{50\p@}%
  \vspace*{18\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    %\Huge 
     \large
     \bfseries  ##1\par\nobreak
    %\vskip 40\p@
    \vskip 12\p@
  }}
}

% *** TP **
\newenvironment{NoVSpace}{\def\addvspace##1{\par}}{}

% Definicje dotycz�ce sk�adania adres�w internetowych
% szczeg�lnie w kontek�cie formatu PDF
\newcommand{\MyCTANSite}{ftp://ftp.dante.de/tex-archive}
\newcommand{\CTAN}[1]{%\url{ftp://ftp.dante.de/tex-archive/}
  \begingroup
  %
  % BELOW we redefine low level hyperref command (which is risky)!
  % In hyperref package
  % \hyper@linkurl macro defined inside \url command has two arguments
  %  --  #1 is the printed text
  %  --  #2 is the url
  %  the idea is to print CTAN://xxxxxx
  %  but put an address of someting real, i.e. ftp.dante.de
  %
  \def\url@##1{\hyper@linkurl{\Hurl{CTAN://#1}}{\MyCTANSite/#1}}%
  \url{CTAN://tex-archive/#1}%
  \endgroup 
}
\newcommand{\GUST}[1]{\url{ftp://ftp.gust.org.pl/TeX/#1}}
\newcommand{\GUSThp}[1]{\url{http://www.gust.org.pl/#1}}

%
% To co poni�ej dotyczy wersji w formacie PDF
%
\ifx\pdfoutput\undefined
 \def\TPFrontMatter{\relax}%
 \def\pdfbookmark#1#2{\relax}%
 \def\NoHyper{}
 \def\endNoHyper{}
\else
%\def\@writetorep#1#2#3{%
%\ifx\WriteBookmarks\relax\else
%    \@tempcnta#3
%    \expandafter\edef\csname Parent#3\endcsname{#2}%
%    \advance\@tempcnta by -1
%    \protected@write\@outlinefile%
%       {\let~\space\let\ \space%
%        \TPDePolonizeDiacritics% 
%        \def\texttt##1{##1}%% *** TP *****
%        \def\LaTeX{LaTeX}%
%        \def\eTeX{e-TeX}%
%        \def\TeX{TeX}%
%        \let\label\@gobble
%        \let\index\@gobble
%        \let\glossary\@gobble}%
%       {%
%  \protect\BOOKMARK{#2}{#1}{\csname Parent\the\@tempcnta\endcsname}}%
%\fi
%}

%\@ifpackageloaded{hyperref}{}{\newenvironment{NoHyper}{}{}}

%% There is an error in the definition of \NoHyper
%% we change one \gdef to \def, otherwise some links
%% tends to dissapear *** TP ***
%\def\NoHyper{%
%    \def\hyper@link@[##1]##2##3##4{##4}%
%    \def\hyper@@anchor##1{}%
%    %\gdef\hyper@link##1##2##3{##3}%%% *** TP ***
%    \def\hyper@link##1##2##3{##3}%
%    \def\hyper@anchorstart##1{}%
%    \let\hyper@anchorend\@empty
%    \def\hyper@linkstart##1##2{}%
%    \let\hyper@linkend\@empty
%    \def\hyper@linkurl##1##2{##1}%
%    \def\hyper@linkfile##1##2##3{##1}%
%    \let\hy@backout\@gobble
%}

%% 
\def\TPFrontMatter{%
 % Zmieniamy definicj� rozdzia�u (zmienion� przez pakiet hyperref)
 % ale tak, �eby to dotyczy�o tylko wst�pu, tj. wszystkiego przed
 % deklaracj� mainmatter.
   \def\hyper@warn##1{\relax}% ***
 %  \def\@chapter[##1]##2{%
 %  \H@old@chapter[{##1}]{##2}%
 %    \if@mainmatter %%
 %     \@writetorep{##1}{chapter.\theHchapter}{0}%
 %  \else \fi
 % }%
}

%% Extra information to PDF general info *** TP ***
\def\@pdftitle{Nie za krotkie wprowadzenie do systemu LaTeXe}%
\def\@pdfauthor{tlumaczenie: Janusz Goldasz, Ryszard Kubiak, 
  Tomasz Przechlewski}%
%\def\@pdfproducer{pdftex}%
\def\@pdfcreator{LaTeX with hyperref package}%
\def\@pdfsubject{LaTeX}%
\def\@pdfkeywords{Zobacz takze: http://www.GUST.org.pl}%

\fi

%%===koniec zmian===
%% Uzupe/lnienia z kwietnia 2000 *** tp ***
%% Dodanie kropki po numerach punkt/ow i podpunkt/ow
\renewcommand*\@seccntformat[1]{\csname the#1\endcsname.\enspace}
%% dodanie kropki w spisach tre/sci, tabel i rysunk/ow
\def\numberline#1{\hb@xt@\@tempdima{#1.\hfil}} % !!!
%%
\endinput
