%%% BEAMERKA == beamer-style Kurusa Árpád használatába... :-)
%%
% nyomtatás: kétoldalas, lapozás oldalra, 2old/lap, fekvő papír
%
%
\renewcommand{\raggedright}{\leftskip=0pt \rightskip=0pt plus 0cm} 
\documentclass[handout,leqno]{beamer}
% oldalankénti 4 dia, nyomtatáshoz (linux alatt pdftops-el)
\usepackage{pgfpages}
%\pgfpagesuselayout{4 on 1}[a4paper, landscape, border shrink=5mm]
%\pgfpagesuselayout{2 on 1}[a4paper, border shrink=15mm]
\pgfpagesuselayout{resize to}[a4paper, landscape, border shrink=2mm]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{t1enc}
\usepackage{txfonts}
\usepackage{pifont}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% a szöbegszerkesztő miatt kell:
% % % \usepackage[cp1250]{inputenc} % NEM PISZKAFA!
% a texnek kell:
\usepackage[cp1250]{inputenc} %best fit to ISO-8859-2 eastern europe
%\usepackage[utf8]{inputenc}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tikz} %%% !!! Meg kell előzni a babel csomagot !!! %%%
\usetikzlibrary{arrows,automata,backgrounds,decorations.text,calc}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\magyarOptions{defaults=prettiest}
%\usepackage[magyar]{babel}
\usepackage[hungarian]{babel}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{graphics}
\usepackage{amsmath}
\usepackage{relsize}
\usepackage{ifthen}
\usepackage{hyperref}
%\usepackage{pdfpages}
%\usepackage[absolute,overlay]{textpos}

\usepackage{appendixnumberbeamer}


% % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\mode<presentation>
{
  \usetheme{CambridgeUS}
  %theme: AnnArbor Antibes Bergen Berkeley Berlin Boadilla boxes CambridgeUS
  %       Copenhagen Darmstadt default Dresden Frankfurt Goettingen Hannover
  %       Ilmenau JuanLesPins Luebeck Madrid Malmoe
  \setbeamertemplate{navigation symbols}{}
  \setbeamercovered{transparent}
  \setbeamertemplate{theorem}[ams style]
  \setbeamertemplate{theorems}[numbered]
  \setbeamercolor{title}{bg=gray!10!white}
%  \setbeamertemplate{background}    {\includegraphics[width=\paperwidth,height=\paperheight]{background.jpg}}
}
% % % % % % % % % % % % % % % % % % % % % % % % % % %
\usecolortheme{crane}
% color themes: albatross beaver beetle crane default dolphin dove fly lily
%               orchid rose seagull seahorse sidebartab structure whale wolverine
\usefonttheme{structurebold}
% font themes: default professionalfonts serif structurebold structureitalicserif
%              structuresmallcapsserif
%\renewcommand\familydefault{\rmdefault}     % set rm as default
%\renewcommand\mathfamilydefault{\rmdefault} % ditto for math
\usefonttheme[onlymath]{serif}


\newif\ifshowhead\global\showheadfalse
\newif\ifshowfoot\global\showfootfalse


\catcode`@=11

% % % % % % % % % % % % % % % % % LAYOUT
\setbeamertemplate{headline}
{\leavevmode\ifthenelse{\equal{\value{section}}{0}}{%
  \ifshowhead\hbox{\def\lbr{ }%
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,center]{section in head/foot}%
    \usebeamerfont{title in head/foot}\inserttitle\ifx\insertsectionhead\empty\else\ :\ %
    \usebeamerfont{subtitle in head/foot}\insertsectionhead\fi%
    \end{beamercolorbox}%
    }\else%
  \phantom{\begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,center]{subsection in head/foot}\end{beamercolorbox}}%
    \fi%
  }{%
  \hbox{\def\lbr{ }%
  \begin{beamercolorbox}[wd=.3\paperwidth,ht=2.25ex,dp=1ex,left]{section in head/foot}%
    \usebeamerfont{section in head/foot}\inserttitle%
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.7\paperwidth,ht=2.25ex,dp=1ex,right]{subsection in head/foot}%
    \usebeamerfont{subsection in head/foot}\thesection.\ \insertsectionhead%
    \ifthenelse{\equal{\value{subsection}}{0}}{}{%
      \hspace*{2ex}\thesubsection.\ \insertsubsectionhead}%
  \end{beamercolorbox}}%
  \vskip0pt%
  }
}

\gdef\one@ne@ne@neone{1}
\setbeamertemplate{footline}
{\leavevmode\ifthenelse{\NOT\equal{\value{section}}{0}\OR\boolean{showfoot}}{%
  \hbox{%
  \begin{beamercolorbox}[wd=.45\paperwidth,ht=2.25ex,dp=1ex,left]{subsection in head/foot}%
    \usebeamerfont{subsection in head/foot}\insertshortauthor\ (\insertshortinstitute) %\hspace*{2ex}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.1\paperwidth,ht=2.25ex,dp=1ex,left]{subsection in head/foot}%
    \usebeamerfont{subsection in head/foot}%
    \ifthenelse{\NOT\equal{\value{framenumber}}{0}}{%
    \ifx\inserttotalframenumber\one@ne@ne@neone\else\insertframenumber%
     \ifx\inserttotalframenumber\empty\else\,/\,\inserttotalframenumber\fi\fi%
    }{}%
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.45\paperwidth,ht=2.25ex,dp=1ex,right]{subsection in head/foot}%
    \usebeamerfont{subsection in head/foot}\insertshortdate
  \end{beamercolorbox}}%
  \vskip0pt%
  }{%
  \phantom{\begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,center]{subsection in head/foot}\end{beamercolorbox}}%
  }
}

\def\remtitle#1{\par\vskip-4mm{\smaller#1}\par\vskip1mm}

% % % % % PARTS 

\newbox\something\newdimen\seged\newread\filein

\renewcommand\thesection{\arabic{section}}
\renewcommand\thesubsection{\arabic{section}.\arabic{subsection}}
\renewcommand\theequation{\arabic{section}.\arabic{equation}}

\newif\iffirstappend\global\firstappendtrue
\edef\append@label{}
%\newcounter{appendixtotalframenumber}

%\makeatletter
\def\append#1\as#2{%
	\def\a@temp{#2}
	\ifx\a@temp\empty\relax\else
		\iffirstappend
			\edef\mainend{\theframenumber}
			\immediate\write\@auxout{\string\global\string\@namedef{mainendframenumber}{\mainend}}
%			\appendixorig
			\global\firstappendfalse
		\else
			\appendatend
		\fi
		\edef\inserttotalframenumber{\csname append#2totalframenumber\endcsname}%
		\setcounter{section}{0}
		\edef\insertsectionhead{#1}%
		\edef\append@label{#2}
	\fi
	\setcounter{framenumber}{0}
}
\def\appendatend{
\ifx\append@label\empty\relax\else
  \edef\appendend{\theframenumber}
   \immediate\write\@auxout{\string\global\string\@namedef{%
         append\append@label totalframenumber}{\appendend}}%
   \immediate\write\@auxout{\string\@writefile{nav}{\noexpand \headcommand {%
         \string\def\string\append\append@label totalframenumber{\appendend}}}}%
\fi
}
\AtEndDocument{\appendatend}
%\makeatother


%\theoremstyle{plain}
\def\inserttheoremblockenv{alertblock}
\newtheorem{thm}{Tétel}[section]

\theoremstyle{definition}
\newtheorem{defi}[thm]{Definíció}

\theoremstyle{remark}
\newtheorem{rem}[thm]{Megjegyzés}

\theoremstyle{example}
\newtheorem{exa}[thm]{Példa}

\def\vpar{}
\def\olabel#1{}
\def\oemph#1{}

\newcounter{procnumber}\setcounter{procnumber}{0}
\renewcommand\theprocnumber{\arabic{section}.\arabic{procnumber}}

\def\proclabel#1{\refstepcounter{procnumber}\olabel{#1}\theprocnumber}
\def\emph#1{{\emphstyle#1}}

%\definecolor{orange}{RGB}{255,0,150}
\def\emphstyle{\color{red!100}\itshape}
\let\oemphstyle\emphstyle
%\def\eempty{\empty}
%\def\eeempty{\eempty}

% % % % % % % % % % % % % % % PROC
\def\proc#1. {\let\execPr@c\proci\def\firstParamOfCall{#1}\futurelet\next\callAsParamsNeed}
\def\dproc#1. {\let\execPr@c\dproci\def\firstParamOfCall{#1}\futurelet\next\callAsParamsNeed}
\def\rproc#1. {\let\execPr@c\rproci\def\firstParamOfCall{#1}\futurelet\next\callAsParamsNeed}

\def\callAsParamsNeed{\begingroup%
  \ifx\next(\aftergroup\callWithParanParam\else%
  \ifx\next[\aftergroup\callWithBrackParam\else%
            \aftergroup\callWithEmptyParam\fi\fi\endgroup}
\def\callWithBrackParam[#1]{\execPr@c{#1}}
\def\callWithParanParam(#1){\execPr@c{#1}}
\def\callWithEmptyParam{\execPr@c{}}

\def\prochead#1{\global\let\oemphstyle\emphstyle\global\let\olabel=\label\relax\global\let\label=\proclabel%
  \def\Par@mNext{#1}\edef\procblockHead{}\edef\procblockName{}%
  \ifx\Par@mNext\empty%
    \ifx\firstParamOfCall\empty\else\def\procblockName{\bfseries\firstParamOfCall. }\fi%
  \else%
    \ifx\firstParamOfCall\empty\def\procblockHead{\Par@mNext}\else%
      \def\procblockHead{\firstParamOfCall. (\Par@mNext). }\fi%
  \fi}
\def\procbody{\global\let\label=\olabel}
\def\procend{}% NEM SZABAD V+?LTOZTATNI

\def\proci#1{\prochead{#1}\def\emphstyle{\color{blue!60}\normalfont}%
  \begin{alertblock}{\procblockHead} {\procblockName}\procbody%
  \gdef\procend{\end{alertblock}}\itshape\ignorespaces}

\def\dproci#1{\prochead{#1}\def\emphstyle{\color{red!100}\itshape}%
  \begin{block}{\procblockHead} {\procblockName}\procbody%
  \gdef\procend{\end{block}}\ignorespaces}

\def\rproci#1{\prochead{#1}\def\emphstyle{\color{orange!100}\itshape}%
  \begin{exampleblock}{\procblockHead} {\procblockName}\procbody%
  \gdef\procend{\end{exampleblock}}\ignorespaces}

\def\vpar{\procend\global\let\emphstyle\oemphstyle}

% % % % % % % % % % % % % % % PROOF
\def\prbeg#1. {\noindent{\def\a{#1}\ifx\a\empty\else{\bf#1.}\fi}\enspace\ignorespaces}

\def\prend{\setbox\something=\hbox{\vrule height5truept width5truept depth0truept}\hfill%
           \kern-\wd\something\lower0.7\baselineskip
           \hbox to0pt{\hss\box\something}\par\vskip11truept}

\def\prendeq{\setbox\something=\hbox{\vrule height5truept width5truept depth0truept}%
           \eqno\lower0.5\baselineskip\box\something$$\vskip11truept}

\def\prendchar{\setbox\something=\hbox{\vrule height5truept width5truept depth0truept}%
            \lower0.5\baselineskip\box\something}

\def\qedsymbol{\prendchar}

\def\felbont#1.#2 {\gdef\filnev{#1}\gdef\kiterj{#2}}
\def\felbon#1{\setbox\something=\hbox{\felbont #1 . }}
\DeclareGraphicsExtensions{.jpg, .pdf, .tif}

\long\def\figin#1(#2,#3)#4:#5\vpar{%
	\felbon{#1}\seged=#2truecm%
	\ifx\filnev\empty\def\filnev{nemures}\else%
	                \openin\filein=\filnev.\kiterj\par\ifeof\filein%
	\def\kiterj{pdf}\openin\filein=\filnev.\kiterj\par\ifeof\filein%
	\def\kiterj{jpg}\openin\filein=\filnev.\kiterj\par\ifeof\filein%
	\def\kiterj{tif}\openin\filein=\filnev.\kiterj\par\ifeof\filein%
	\def\filnev{nemures}\fi\fi\fi\fi\fi%
    \vbox{\parindent=0truemm\hsize=\seged\noindent%
	    %\includegraphics[width=#2truecm, height=#3truecm]{\filnev}%
	    \includegraphics[width=#2truecm]{\filnev}%
	    \def\a{#4}\def\b{#5}\break %\vskip-\baselineskip%2truept%
	    \ifx\b\empty\ifx\a\empty\else\hbox to \hsize{\hss{\bf#4}\hss}\fi%
	    \else\hbox to \hsize{\hss\vbox{\noindent{\bf#4}\itshape#5}\hss}\fi%
	    \vskip-\baselineskip
    }%
 }

%\def\tentimesofthis#1{\pgfmathparse{#1*10}\pgfmathresult}

\long\def\boxat(#1,#2)#3{%
  \begin{picture}(0,0)(0,0)\setlength{\unitlength}{1cm}\put(#1,#2){#3}\end{picture}%
}

\def\monthname{\iffalse%
	\ifcase\number\month ERROR -- NULL%
	\or January\or February\or March\or April\or May\or June%
	\or July\or August\or September\or October\or November\or December%
	\else ERROR - BIG%
	\fi%
\else%
	\ifcase\number\month HIBA -- NULLA%
	\or Január\or Február\or Március\or április\or Május\or Június%
	\or Július\or Augusztus\or Szeptember\or Október\or November\or December%
	\else HIBA -- NAGY%
	\fi%
\fi%
}


\def\AN{ and }
\def\ES{ és }

\def\EN{}

\let\obibitem\bibitem

\def\bibitem#1#2\EN{\def\firstParamOfCall{#1}\def\secondParamOfCall{#2}%
   \futurelet\next\callbibitemWithStyle}
\def\callbibitemWithStyle{\ifx\next\arti\beamertemplatearticlebibitems%
  \else\ifx\next\book\beamertemplatebookbibitems\else NO STYLE\next JJ\fi\fi%
  \obibitem{\firstParamOfCall}\secondParamOfCall\EN}

\def\refonly#1,#2(#3),#4.{{\smaller%
  {\def\a{#1}\ifx\a\empty\else{\it #1}\fi}%
  {\def\a{#2}\ifx\a\empty\else, {\bf#2}\fi}%
  {\def\a{#3}\ifx\a\empty\else\ (#3)\fi}%
  {\def\a{#4}\ifx\a\empty\else, #4\fi}.}%
 }

\def\arti#1,#2,#3(#4),#5.{\newblock%
   #1{\def\a{#2}\ifx\a\empty\else, \fi}\refonly#2,#3(#4),#5.}

%\def\book#1,#2. {\beamertemplatebookbibitems\newblock{\em #1}\newblock#2.}
\def\book#1,#2,#3,#4.{\newblock{\itshape#1}%
{\smaller{\def\a{#2}\ifx\a\empty\else, #2\fi}%
{\def\a{#3}\ifx\a\empty\else, #3\fi}%
{\def\a{#4}\ifx\a\empty\else, #4\fi}.}}

%% small usefull macros

% % % % % % % % % % % % % MY_RENEW_COMMAND % % % % % % %
%\makeatletter
%\def\myrenewcommand{\@ifnextchar<{\beamer@myrenewcom}{\beamer@origrenewcommand}}
%\def\beamer@myrenewcom<>{\@star@or@long\beamer@myrenew@command}
%\def\beamer@myrenew@command#1{%
%  \expandafter\def\expandafter\beamer@name\expandafter{\csname @orig\string#1\endcsname}%
%  \expandafter\let\beamer@name=#1\relax%
%\@ifnextchar[{\beamer@@myrenewcom{#1}}{\beamer@myrenewcomnoopt
%{#1}{0}}}
%\def\beamer@@myrenewcom#1[#2]{\@ifnextchar[{\beamer@myrenewcomopt{#1}{#2}}{\beamer@myrenewcomnoopt{#1}{#2}}}
%\long\def\beamer@myrenewcomnoopt#1#2#3{%
%  \ifnum#2=0\relax%
%    \expandafter\def\expandafter#1\expandafter{\expandafter\beamer@sortzero\expandafter{\csname beamerx@\string#1\endcsname}}%
%  \else
%    \expandafter\def\expandafter#1\expandafter{\expandafter\beamer@sort\expandafter{\csname beamerx@\string#1\endcsname}{#2}}%
%  \fi%
%  \beamer@argscount=#2\relax%
%  \advance\beamer@argscount by 1\relax%
%  \expandafter\renewcommand\csname beamerx@\string#1\endcsname[\beamer@argscount]{#3}%
%}
%\long\def\beamer@myrenewcomopt#1#2[#3]#4{%
%  %\expandafter\def\expandafter#1\expandafter{\expandafter\beamer@presort\expandafter{\csname beamerx@\string#1\endcsname}{#2}{#3}}%
%  \beamer@argscount=#2\relax%
%  \advance\beamer@argscount by 1\relax%
%  \expandafter\renewcommand\csname beamerx@\string#1\endcsname[\beamer@argscount]{#4}%
%}
%\makeatother
% % % % % % % END % % % % % % MY_RENEW_COMMAND % % % % % % %

% Transform by:
% x' = a_11x + a_12y + b_1pt
% y' = a_21x + a_22y + b_2pt
%\affinetransform{a_11}{a_21}{a_12}{a_22}{b_1pt}{b_2pt}
\let\affinetransform=\pgfsys@transformcm%

\catcode`@=12

\def\tfrac#1#2{{#1/#2}}

\def\lbr{\hfil\break}

\def\down{}\def\rel{}

\def\up#1\rel#2\down#3{\mathrel{\mathop{\kern0pt#2}\limits^{#1}_{#3}}}

%\def\brel#1^#2_#3{\up{#2}\rel{#1}\down{#3}}

\def\ran{\mathop{\rm ran}\nolimits}

\def\spa{\mathop{\rm span}\nolimits}

% % % % % % % % % % % % % % % % %

\def\Cal#1{{\cal #1}}

\def\Open#1{\mathbb{#1}}

\def\Bf#1{{\mathbf #1}}

\def\Goth#1{{\mathfrak #1}}

\def\idez#1{{\ideza}#1''}
\def\ideza{\setbox0=\hbox{\lower1.38ex\hbox{''}}\dp0=0pt\box0}

%% SPECIAL SYMBOLS

\def\sgn{\mathop{\rm sgn}\nolimits}
\def\Int{\mathop{\rm Int}\nolimits}
\def\det{\mathop{\rm det}\nolimits}
\def\map{\mathop{\rm map}\nolimits}
\def\mod{\mathop{\rm mod\,}\nolimits}
\def\gon{\mathop{\rm gon}\nolimits}

\def\notpar{\rlap{\hskip1.3truept\hbox{$\not{}$}}\parallel}

\def\opc{\mathbb{C}}\def\oph{\mathbb{H}}\def\opn{\mathbb{N}}
\def\opo{\mathbb{O}}\def\opp{\mathbb{P}}\def\opq{\mathbb{Q}}
\def\opr{\mathbb{R}}\def\opz{\mathbb{Z}}\def\opd{\mathbb{D}}

%% HUNGARIAN SYMBOLS

%\def\ES{ és }
%\def\cot{\mathop{\rm ctg}\nolimits}
%\def\tan{\mathop{\rm tg}\nolimits}
%\def\acth{\mathop{\rm arccoth}\nolimits}
%\def\atanh{\mathop{\rm arctanh}\nolimits}
%\def\acosh{\mathop{\rm arccosh}\nolimits}
%\def\asinh{\mathop{\rm arcsinh}\nolimits}

% % FRAME NUMBER % %
\setcounter{framenumber}{-1}
