%%    Stilus file a
%%    H.Cormen, C.E.Leiserson, R.L.Rivest:
%%    Introduction to Algorithms
%%    cimu konyv forditoi szamara.
%%    8.2. (javitott) TITKOS valtozat.
%%    [1997. oktober 8.]
%%
%%    fejezet baloldalon is kezdodhet
%%    tetel,... kisbetuvel
%%    index:  \begin{alg}{nev}  nev --> index
%%    \idez{ide jon az idezet szovege}
%%
%%    TITOK:
%%    see-->l\'asd      \usepackage{makeidx} utan kell a \usepackage{alg} 
%%    description tabulalas javitva.
%%
%%    Csornyei Zoltan, 1997.
%%    csz@maxi.inf.elte.hu
%%
%% MERETEK BEALLITASA
%%
%%
\setlength\topmargin{24 pt}
\setlength\headheight{28 pt}
\setlength\headsep{6 pt}
\setlength\footskip{25.29 pt}
\setlength\textheight{564 pt}
%%
\setlength\textwidth{140 mm}
\setlength\evensidemargin{16 mm}
\setlength\oddsidemargin{12 mm}
%%
%% MAGYAR EKEZETES BETUK
%%
\catcode`\�=\active \def�{\'I}
\catcode`\�=\active \def�{\'\i}
\catcode`\�=\active \def�{\H U}
\catcode`\�=\active \def�{\H u}
\catcode`\�=\active \def�{\"O}
\catcode`\�=\active \def�{\"o}
\catcode`\�=\active \def�{\'A}
\catcode`\�=\active \def�{\'a}
\catcode`\�=\active \def�{\'E}
\catcode`\�=\active \def�{\'e}
\catcode`\�=\active \def�{\'U}
\catcode`\�=\active \def�{\'u}
\catcode`\�=\active \def�{\H O}
\catcode`\�=\active \def�{\H o}
\catcode`\�=\active \def�{\'O}
\catcode`\�=\active \def�{\'o}
\catcode`\�=\active \def�{\"U}
\catcode`\�=\active \def�{\"u}
%%
%% SZOVEGKIEMELESEK
%%
\setlength\mathindent{0 mm}
\newcommand{\ki}[1]{\textbf{\textsl{#1}}}
\newcommand{\key}[1]{\textbf{#1}}
\def\idez#1{{\ideze}#1''}
\def\ideze{\setbox0=\hbox{\lower1.38ex\hbox{''}}\dp0=0pt\box0}
%%
%% RESZ, FEJEZET, ALFEJEZET
%%
\setcounter{part}{-1}
\setcounter{chapter}{-1}
\setcounter{secnumdepth}{2}
%%
\def\partname{R\'ESZ}
\def\chaptername{FEJEZET}
%%
%%\pagestyle{myheadings}
%%
\renewcommand\part{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \thispagestyle{plain}%
  \if@twocolumn
    \onecolumn
    \@tempswatrue
  \else
    \@tempswafalse
  \fi
  \null
  \secdef\@part\@spart}

%%
\def\@part[#1]#2{%
    \ifnum \c@secnumdepth >-2\relax
      \refstepcounter{part}%
      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
    \else
      \addcontentsline{toc}{part}{#1}%
    \fi
     \markboth{\thepart.\ \ \MakeUppercase{#2}}%
              {\thepart.\ \ \MakeUppercase{#2}}%
    {\centering
     \interlinepenalty \@M
     \normalfont
     \huge \bfseries \thepart.\ \ \MakeUppercase{#2}\par}%
    \@endpart}
%%
\def\@endpart{\vskip 36 pt
              \if@tempswa
                \twocolumn
              \fi}    
%%
%%\newcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
\renewcommand\chapter{\clearpage
                    \thispagestyle{plain}%
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapter}
%%
\def\@makechapterhead#1{%
  \vspace*{56\p@}%   
  {\parindent \z@ \raggedright \normalfont
    \vskip 18 pt
    \interlinepenalty\@M
    \huge \bfseries \thechapter.\ #1\par\nobreak
    \vskip 12\p@%  egy ures sor
  }}
%%
%%
%% FEJLEC
%%
\def\@oddhead{\vbox{\hbox to \hsize{\hbox {}{\sl \rightmark}\hfil% 
      \rm\thepage\hbox {}}%
        \vss\vskip 2pt \hbox to\hsize{\hrulefill}}}
\def\@evenhead{\vbox{\hbox to \hsize{\rm\thepage\hfil{\sl \leftmark}%
    \hbox {}}\vss \vskip 2pt \hbox to \hsize{\hrulefill}}}

\renewcommand\chaptermark[1]{%
      \markboth {%
        \ifnum \c@secnumdepth >\m@ne
          \if@mainmatter
              \thechapter.\ \ %
          \fi
        \fi
      #1}{}}%    
\renewcommand\sectionmark[1]{%
      \markright {%
        \ifnum \c@secnumdepth >\z@
           \thesection \ \ % 
       \fi
        #1}}
%%
\renewcommand{\thesection}{\thechapter.\@arabic\c@section.}
\renewcommand{\thesubsection}{\thesection\@arabic\c@subsection.}
%%
\newcommand\hardsection{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\Large%
                                   \bfseries{\hspace{-5truemm}$*$}}} 
%                                  \bfseries$\hfill\break\hspace*{-20 
%truemm} *$}}
%%
%% TETEL, DEF, ...
%%
\def\@begintheorem#1#2{ \trivlist
   \item[\hskip \labelsep{\bfseries #2.~#1}]\itshape}
\def\@opargbegintheorem#1#2#3{\trivlist
      \item[\hskip \labelsep{\bfseries #2.~#1\ (#3)}]\itshape}
%%                
\def\pref#1{\ref{#1}.}
%%
\newtheorem{tetel}{t\'etel.\ }[chapter]%
\newtheorem{lemma}[tetel]{lemma.\ }%
\newtheorem{defi}[tetel]{defin\'\i ci\'o.\ }
\newtheorem{kov}[tetel]{k\"ovetkezm\'eny.\ }
\newtheorem{megj}[tetel]{megjegyz\'es.\ }
\newtheorem{all}[tetel]{\'all\'\i t\'as}
%%
%% BIZONYITAS
%%
\newenvironment{biz}{\bizo}{\kocka}
\def\bizo{\par\noindent{\textbf{Bizony\'\i t\'as.\ }}}
\def\kocka{\nobreak\hspace*{\fill}\nobreak$\Box$\par\smallskip}
%%
%% ALGORITMUS
%%
\newcommand{\algn}[1]{\textsc{#1}}
\newcommand{\alge}{%
\begin{tabbing}%
99 \= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \+ \kill 
}
\newcommand{\algv}{%
\end{tabbing}
}
\newenvironment{alg}[1]{%
\vspace{5 mm}\vbox\bgroup\noindent\algn{#1}%
\index{\algn{#1}}\alge}{\algv\egroup}
%%
%% GYAKORLATOK
%%
\newcounter{cszx}
\newenvironment{gyak}{\section*{Gyakorlatok}%
\setcounter{cszx}{0}}{}
\def\ujgyak{\refstepcounter{cszx}\medbreak\noindent%
\textbf{\thechapter.\@arabic\c@section-\thecszx.}\ }%
\def\hardgyak{\refstepcounter{cszx}\medbreak\noindent%
\textbf{\thechapter.\@arabic\c@section-\thecszx.$*$}\ }%
%%
%% FELADATOK
%%
\newcounter{cszy}
\newenvironment{fld}{\section*{Feladatok}%
\setcounter{cszy}{0}
     { \markright {%
        \ifnum \c@secnumdepth >\z@
           \thechapter.\ \ % 
       \fi
        Feladatok}}}{}
\def\ujfld#1{\refstepcounter{cszy}\medbreak\noindent%
\textbf{\textsl{\thechapter-\thecszy.\ {#1}}}\par\noindent\ignorespaces}
%%
\renewenvironment{description}
               {\list{}{\setlength\leftmargin{15pt}
                        \labelwidth\z@ \itemindent-\leftmargin
                        \let\makelabel\descriptionlabel}}
               {\endlist}
%%
%% FEJEZET MEGJEGYZES
%%
%\newenvironment{fejmegj}{\section*{Megjegyz\'esek a fejezethez}}{}
\newenvironment{fejmegj}{\section*{Megjegyz\'esek a fejezethez}
     { \markright {%
        \ifnum \c@secnumdepth >\z@
           \thechapter.\ \ % 
       \fi
        Megjegyz\'esek a fejezethez}}}{}
%%
%% ABRA
%%
\renewcommand\figurename{\'abra}
\renewcommand\thefigure
     {\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@figure.}
\def\fnum@figure{\thefigure~\figurename}
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{\textbf{#1.} {\small{#2}}}%
  \ifdim \wd\@tempboxa >\hsize
    {\textbf{#1.}} {\small{#2}}\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
%%
%% INDEX
%%
\renewcommand\indexname{T\'argymutat\'o}
\renewenvironment{theindex}
               {\if@twocolumn
                  \@restonecolfalse
                \else
                  \@restonecoltrue
                \fi
                \columnseprule \z@
                \columnsep 35\p@
                \twocolumn[\@makeschapterhead{\indexname}]%
%%                \@mkboth{\MakeUppercase\indexname}%
%%                        {\MakeUppercase\indexname}%
                \@mkboth{\indexname}%
                        {\indexname}%
                \thispagestyle{plain}\parindent\z@
                \parskip\z@ \@plus .3\p@\relax
                \let\item\@idxitem}
               {\if@restonecol\onecolumn\else\clearpage\fi}
\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}
%%
\renewcommand*\see[2]{\emph{l\'asd} #1}
\newcommand*\lmeg[2]{\emph{l\'asd m\'eg} #1}
%%
%%
