centered section and subsection in Beamer themes with a tree-like navigation bar at top of frames
% !TEX TS-program = XeLaTeX
% !TEX encoding = UTF-8 Unicode
\documentclass[usenames,dvipsnames,t]{beamer}%,dvipsnames
%\numberwithin{equation}{section}
%
% Themes with a Tree-Like Navigation Bar
\usetheme{Antibes}
%\usetheme{JuanLesPins}
%\usetheme{Montpellier}
\usepackage{listings}
\colorlet{bakcolor}{yellow!15}
\usepackage{xepersian}
\settextfont{Yas}
\lstset{
language=Matlab,
backgroundcolor=\color{bakcolor},
linewidth=\textwidth ,
frameround=ttff,
frame=trBL,
basicstyle=\ttfamily\footnotesize,
keywordstyle=\color{blue}\bfseries,
% framexleftmargin=-1mm, frame=shadowbox, rulesepcolor=\color{red},
stringstyle=\ttfamily\color{Magenta}, % typewriter type for strings
commentstyle=\color{Green},
lineskip = .5pt,
numberstyle=\scriptsize,
numbersep=7pt,
numbers=left,
%numbers=none,
captionpos=t,
breaklines=true,
showstringspaces=true,
xleftmargin=30pt,
xrightmargin=30pt}
\author{نویسنده}
\title{تست بیمر با زیپرشین}
\date{\today}
\begin{document}
\maketitle
\begin{frame}{فهرست}
\tableofcontents
\end{frame}
\section{بخش1}
\subsection{زیربخش}
\begin{frame}{\secname}
درود
\begin{theorem}
فیثاغورث
\begin{equation}\label{eq:1}
a^2+b^2 = c^2
\end{equation}
\begin{itemize}
\item یک
\item دو
\item سه
\end{itemize}
\end{theorem}
\begin{enumerate}
\item یک
\item دو
\item سه
\end{enumerate}
\end{frame}
\begin{frame}[fragile]{لیستینگز درون بلوک}%
در اینجا کد متلب وارد می کنیم
\begin{block}{کد متلب رسم تابع سینوسی}
\setLTR
\begin{lstlisting}[captiondirection=RTL,caption={رسم نمودار سینوسی}]
%============================
%=== Test Program ==========
clc
clear
close all
t=0:0.1:2*pi;
y=sin(t);
plot(t,y)
title('sin(t)')
\end{lstlisting}
\end{block}
\end{frame}
\section{بخش2}
\begin{frame}[fragile]{لیستینگز خارج از بلوک}
\setLTR
\begin{lstlisting}[captiondirection=RTL,caption={رسم نمودار سینوسی}]
%============================
%=== Test Program ==========
clc
clear
close all
t=0:0.1:2*pi;
y=sin(t);
plot(t,y)
title('sin(t)')
\end{lstlisting}
\end{frame}
\section{بخش3}
\begin{frame}{تست پانویس و زیرنویس در داخل بلوک}
\begin{block}{\textbf{تست \lr{footnote} در بلوک}}
\begin{itemize}
\item یک
\item دو\footnote{دو}
\end{itemize}
\end{block}
\begin{block}{\textbf{تست \lr{LTRfootnote} در بلوک}}
\begin{itemize}
\item یک
\item دو
\LTRfootnote{two}
\end{itemize}
\end{block}
\end{frame}
\end{document}
Section and subsection in tree-like navigation bar should be right to left.