%% czmsty.sty
\ProvidesPackage{czmformat}
\RequirePackage{ifthen}

%%%%%%%%%%%%%%%%%%%  warning in layouts
\renewcommand*{\setlayoutscale}[1]{\setlength{\l@youtunitlength}{1pt}
  \l@youtunitlength= #1\l@youtunitlength
  \renewcommand*{\l@youtscale}{#1}}

 \renewcommand\@seccntformat[1]{\csname the#1\endcsname.\quad}
 \renewcommand\numberline[1]{#1.\hskip1em}
 \renewcommand\cftchapteraftersnum{.}
 \renewcommand{\@tocrmarg}{2.55em \parfillskip -\rightskip}

%%%%%%%%%%%%%%%%%%  plainmarkruled
\makepagestyle{plainmarkruled}
  \makeheadrule{plainmarkruled}{\textwidth}{\normalrulethickness}
  \makeoddhead{plainmarkruled}{\scshape\leftmark}{}{}
  \makeevenhead{plainmarkruled}{}{}{\scshape \chapterauthor}
  \makeevenfoot{plainmarkruled}{\thepage}{}{}
  \makeoddfoot{plainmarkruled}{}{}{\thepage}
\makepsmarks{plainmarkruled}{\@ruledmarks}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% set up the page layout
\isopage[12]
\setlrmargins{*}{*}{1}
\checkandfixthelayout

\bibliographystyle{alpha}
\setbiblabel{\hfill[#1]}
\setcounter{secnumdepth}{2}
%%%%%%%%%%%%%%%% ROZDZIALY Z AUTORAMI %%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\aut}{}
\newcommand{\chapterauthor}{}
\makechapterstyle{demm}{%
\renewcommand*{\printchaptername}{\raggedleft}
\renewcommand*{\chapnumfont}{\normalfont\Large\sffamily}
\renewcommand*{\printchapternum}{\chapnumfont
\ifanappendix \thechapter \else {Artyku�}\fi}
\renewcommand*{\chaptitlefont}{\huge\sffamily\bfseries} %Huge
\renewcommand*{\printchaptertitle}[1]{%
\hrule\vskip\baselineskip  \raggedleft \chaptitlefont ##1}
\renewcommand*{\afterchaptertitle}{%
\vskip\onelineskip \raggedright \chapnumfont \normalsize \itshape \chapterauthor \vskip 0.2\onelineskip\hrule\vskip \afterchapskip}
\setlength{\beforechapskip}{1\baselineskip}%{2\baselineskip}
\renewcommand*{\printchapternonum}{%
\vphantom{\chapnumfont One}
\afterchapternum%
\vskip\topskip}
\setlength{\beforechapskip}{2\onelineskip}
}% end{demm}
\chapterstyle{demm}

%%%%%%%%%%%%%% DEFINICJE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\chaptername{Rozdzia�}
\renewcommand\abstractname{Abstrakt}
\newtheorem{theorem}{Twierdzenie}[section]
\newtheorem{lemma}[theorem]{Lemat}
%\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{definition}{Definicja}
\newtheorem{corollary}[theorem]{Wniosek}
\newtheorem{corollary*}[theorem]{Wniosek}
\newtheorem{cor}[theorem]{Wniosek}
\newtheorem{example}[theorem]{Przyk�ad}
\let\oldexample\example
\renewcommand{\example}{\oldexample\normalfont}
\newtheorem{remark}[theorem]{Uwaga}
%\newtheorem{proof}{Dow�d}
\newtheorem{assumption*}{Za�o�enie}
\renewcommand\contentsname{Spis tre\'sci}

\newenvironment{proof}[1][]{\par\noindent\textbf{Dow�d%
\ifthenelse{\equal{#1}{}{}}{.}{ #1:}} }{\hfill\rule{1.3ex}{1.3ex}\par}


%%%%%%%%%% BIBLIOGRAFIA %%%%%%%%%%%%%%%%%%%%%%
\usepackage[sectionbib]{chapterbib}
\makeatletter
\renewenvironment{thebibliography}[1]
     {\section*{\bibname}% <-- this line was changed from \chapter* to \section*
      \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
      \addcontentsline{toc}{section}{\bibname}
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \setlength{\itemsep}{0mm}
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\makeatother
\renewcommand\bibname{Bibliografia}






\typeout{End czmformat.sty}
\endinput