[Tex/LaTex] Problem with beamer in persian/farsi

beamerlanguagespersian

I tried to create slides with beamer and the babel package with Farsi option \usepackage[farsi]{babel}. When I run it, I have some errors.

I use this code:

\documentclass[‎ucs‎]{beamer}‎‎
‎\usetheme{Aalborg}‎
  \usepackage[utf8]{luainputenc}‎
‎\usepackage[T1]{fontenc}‎
% ‎Or whatever‎. ‎Note that the encoding and the font should match‎. ‎If T1‎
% ‎does not look nice‎, ‎try deleting the line with the fontenc‎.
‎\usepackage{helvet}‎
‎\usefonttheme[onlylarge]{structurebold}‎
‎\setbeamerfont*{frametitle}{size=\normalsize,series=\bfseries}‎
‎\setbeamertemplate{navigation symbols}{}‎

% ‎Standard packages‎

‎\usepackage[‎fars‎i]{babel}‎
‎\usepackage{fontspec}‎
‎\usepackage{amsmath}‎
‎\setmainfont[Script=Arabic,Numbers=Arabic]{XB Zar}‎‎\setsansfont[Script=Arabic,Numbers=Arabic]{XB Zar}‎
 ‎Setup TikZ‎

‎\usepackage{tikz}‎
‎\usetikzlibrary{arrows}‎
‎\tikzstyle{block}=[draw opacity=0.7,line width=1.4cm]‎
‎‎
% ‎colored hyperlinks‎
‎\newcommand{\chref}[2]{%‎
  ‎\href{#1}{{\usebeamercolor[bg]{Aalborg}#2}}%‎
}

‎\begin{document}‎
% ‎the titlepage‎
%‎{\aauwavesbg‎
‎%\begin{frame}[plain,noframenumbering] % the plain option removes the sidebar and header from the title page‎
  ‎%\titlepage‎
‎%\end{frame}}‎‎
\begin{frame}
‏سلام
\end{frame}
‎\end{document}‎‎

Best Answer

Here is code that works in XeLaTeX, may be able to get you running. Add your tweaks (packages, preferences, etc) to it VERY carefully, line by line, compiling each time to check if you've introduced errors. Remember, all Persian text must live inside {\F } (which means my solution may not be ideal). If you do not have "Geeza Pro" on your system, use the title of another Farsi typeface.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass{beamer}

% PACKAGES

\usepackage{fontspec}

% BEGIN

\begin{document}

% RUNTIME TWEAKS

\newfontfamily{\F}{Geeza Pro} % Farsi

% THE MEAT

\begin{frame}
Persian: {\F سلام}
\end{frame}

\end{document}