[Tex/LaTex] Subsection numbering in beamer

beamersectioning

How do I add subsection numbers. It always starts from 1. but I want 1.1 and 1.2, etc. And then for subsubsections 1.2.1 etc.

 \documentclass{beamer}
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \usepackage[mathscr]{eucal}
    \usepackage[utf8]{inputenc} 
    \usepackage[croatian]{babel}
    \usepackage{latexsym}
    \usepackage{tabularx,pstricks,pst-plot,amsfonts,amsmath,tensor,amssymb}
    \usepackage{etoolbox}
    \usepackage{xpatch}
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \usetheme{Warsaw}
    \usecolortheme{seahorse}
    \usefonttheme{professionalfonts} % using non standard fonts for beamer
    \setbeamertemplate{section in head/foot}{\hfill\insertsectionheadnumber.~\insertsectionhead}
    \setbeamertemplate{section in head/foot shaded}{\color{structure!50}\hfill\insertsectionheadnumber.~\insertsectionhead}
    \setbeamertemplate{section in toc}{\inserttocsectionnumber.~\inserttocsection}

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \newcommand{\nN}{\mathbb{N}} % Oznaka za skup prirodnih brojeva
    \newcommand{\zZ}{\mathbb{Z}} % Oznaka za skup cijelih brojeva
    \newcommand{\rR}{\mathbb{R}} % Oznaka za skup realnih brojeva
    \newcommand{\qQ}{\mathbb{Q}} % Oznaka za skup racionalnih brojeva
    \newcommand{\iI}{\mathbb{I}} % Oznaka za skup iracionalnih brojeva
    \newcommand{\cC}{\mathbb{C}} % Oznaka za skup kompleksnih brojeva
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \title{Fibonaccijevi brojevi i zlatni rez. Rekurzije. Fraktali}
    \author{Amar Bapić, Merjem Vikalo, Irma Zenunović}
    \date{}
    \institute{Univerzitet u Tuzli\\Prirodno - matematički fakultet\\ Odsjek Matematika}
    \setbeamertemplate{theorems}[numbered]
    \usepackage{multicol}
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \AtBeginEnvironment{teorem}{%
        \setbeamercolor{block title}{fg=white,bg=red}
        \setbeamercolor{block body}{fg=black,bg=red!40}
    }
    \AtBeginEnvironment{definicija}{%
        \setbeamercolor{block title}{fg=white,bg=blue}
        \setbeamercolor{block body}{fg=black,bg=blue!40}
    }
    \AtBeginEnvironment{primjer}{%
        \setbeamercolor{block title}{fg=white,bg=purple}
        \setbeamercolor{block body}{fg=black,bg=purple!40}
    }

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

    \newtheorem{teorem}{Teorem}[section]
    \newtheorem{definicija}{Definicija}[section]
    \newtheorem{lema}{Lema}[section]
    \newtheorem{primjer}{Primjer}[section]
    \newtheorem{conjecture}{Konjektura}[section]
    \renewcommand{\qedsymbol}{\ensuremath{\clubsuit}}
    \newenvironment{rjesenje}{
    \emph{\textbf{Rješenje:}}}{ 
     $\qed $
    }
    \newenvironment{dokaz}{
    \emph{\textbf{Dokaz:}}}{
     $\spadesuit $
    }

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

    \begin{document}
    \makeatletter
    \patchcmd\beamer@@tmpl@frametitle{\insertframetitle}{\thesection.~\insertframetitle}{}{}
    \makeatother
    \begin{frame}[plain]
    \titlepage
    \end{frame}
    \section{Rekurzije}
    \begin{frame}{Rekurzije}
    \end{frame}
    \subsection{Podjela ravni pravima. Podjela prostora ravnima.}
    \begin{frame}{Podjela ravni pravima. Podjela prostora ravnima.}

    \end{frame}
    \subsection{Hanojski tornjevi}
    \begin{frame}{Hanojski tornjevi}

    \end{frame}

    \end{document} 

Best Answer

A bit ugly, but with three conditionals in the frametitle definition, it gives the desired numbers.

 \documentclass{beamer}

 \usepackage{etoolbox}
 \usepackage{xpatch}

 \usetheme{Warsaw}
 \usecolortheme{seahorse}

 \setbeamertemplate{section in head/foot}{\hfill\insertsectionheadnumber.~\insertsectionhead}
 \setbeamertemplate{section in head/foot shaded}{\color{structure!50}\hfill\insertsectionheadnumber.~\insertsectionhead}
 \setbeamertemplate{section in toc}{\inserttocsectionnumber.~\inserttocsection}


 \title{Fibonaccijevi brojevi i zlatni rez. Rekurzije. Fraktali}
 \author{Amar Bapić, Merjem Vikalo, Irma Zenunović}
 \date{}
 \institute{Univerzitet u Tuzli\\Prirodno - matematički fakultet\\ Odsjek Matematika}


    \makeatletter
    \patchcmd\beamer@@tmpl@frametitle{\insertframetitle}{%
        \ifnumgreater{\arabic{section}}{0}{%
            \thesection.%
                    \ifnumgreater{\arabic{subsection}}{0}{% 
                        \thesubsection.%
                                \ifnumgreater{\arabic{subsubsection}}{0}{%
                                    \thesubsubsection.%
                                }{}%
                    }{}%
        }{}%
        ~\insertframetitle{}{}%
    }%
    \makeatother

 \begin{document}

    \begin{frame}[plain]
        \titlepage
    \end{frame}
    \section{Rekurzije}
    \begin{frame}{Rekurzije}
    \end{frame}
    \subsection{Podjela ravni pravima. Podjela prostora ravnima.}
    \begin{frame}{Podjela ravni pravima. Podjela prostora ravnima.}

    \end{frame}
    \subsection{Hanojski tornjevi}
    \subsubsection{test}
    \begin{frame}{Hanojski tornjevi}

    \end{frame}

 \end{document} 

enter image description here

Related Question