3

I have read this link (The best way to write arabic in beamer) and i have used the code proposed by "selumi" there successfully. But i have now a new problem with. How I can write an RTL table of content in that code ???? I have attached the export of my code.

\documentclass[10pt]{beamer}
\usetheme{Warsaw}
\usepackage{enumitem}
\usepackage{fontspec}
\usepackage{polyglossia}
\setbeamertemplate{section in toc}[circle]
\setbeamertemplate{frametitle continuation}{\gdef\beamer@frametitle{}} % framebreaks without numbering
\setbeamertemplate{frametitle}[default][right]% align the frametitle to the right
%\setdefaultlanguage{english}
\setmainlanguage{english}
\setotherlanguage{arabic}
\setmainfont{Times New Roman}
\setotherlanguage[calendar=gregorian,numerals=maghrib]{arabic}
\newfontfamily\arabicfont[Script=Arabic,Scale=1]{B Nazanin}%
\newfontfamily\arabicfontsf[Script=Arabic,Scale=1]{B Nazanin}%
\graphicspath{{pics/}}
%
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\newcommand{\ar}{\textarabic} % to change the laguage in the section and frame title to persian
% This work as: \a{متن فارسی}
%~~~~~~~~~~~~~~~~define bullet for enumerate~~~~~~~~~~~~~
\newcommand{\myenum}[1]
{
\par\vspace{3pt}\LR{\hspace*{3pt}%
\begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
\usebeamercolor[fg]{item projected}
{\pgftransformscale{1.8}\pgftext{\normalsize \pgfuseshading{bigsphere}}}
{\pgftransformshift{\pgfpoint{0pt}{0.5pt}}
\pgftext{\usebeamerfont*{item projected}\textcolor{white}{#1}}}
\end{pgfpicture}%
\hspace{1pt}%
}}
%~~~~~~~~~~~~~~~~~~define bullet for itemize~~~~~~~~~~~~~~~
\newcommand{\myitem}{\par\vspace{3pt}\hspace{5mm}\LR{\hspace*{3pt}%
\begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
\usebeamercolor[fg]{item projected}
{\pgftransformscale{1.1}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
\end{pgfpicture}%
\hspace{1pt}%
}}
%~~~~~~~~~~~~~~~~~~~~~~~~~~
\newcommand{\myitemII}{\par\vspace{3pt}\hspace{5mm}\LR{\hspace*{3pt}%
\begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
\usebeamercolor[fg]{item projected}
{\pgftransformscale{1.8}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
\end{pgfpicture}%
\hspace{1pt}%
}}
%*************************************************************************
%\addtobeamertemplate{block begin}{}{\justifying} %new code
%~~~~~~~~~~~~~~~~~~~~~
\begin{document}
%\selectlanguage{arabic}
\title{\textarabic{بعنوان عنوان نعنوان }}
\author{AUTHOR}
\date{\today}
%
\frame{\titlepage}
%
\frame{
\frametitle{\textarabic{فهرست مطالب}}
\begin{minipage}{1.\textwidth}
\begin{Arabic}
\tableofcontents
\end{Arabic}
\end{minipage}
}
\section{\textarabic{مقدمه}}
\subsection{\textarabic{مایع }}
\subsubsection{\textarabic{مایع }}
\frame{
\frametitle{\textarabic{سیستمهای فرمیونی همبسته:مایع}}
\begin{minipage}{.95\textwidth}
%\begin{Arabic}% ----------------------here must be changed
%
\begin{itemize}[label=\protect\myitemII, rightmargin=0mm]
\item
\ar{متن فارسی .....}
\ar{متن فارسی .....}
\item
\ar{متن فارسی .....}
\item
\ar{متن فارسی .....}
\item
\ar{متن فارسی .....}
\end{itemize}

\ar{متن فارسی .....}

%\end{Arabic}
\end{minipage}
}
\end{document}

enter image description here

  • A little more elaboration will help us all. Further, if you want that others will start your problem from scratch, it is very likely that they are too occupied to do that. Please do not consider this to be rude, we all want to help you. Please provide the code what you have tried so far. And welcome to TeX.SE. – Masroor Jan 15 '15 at 12:12
  • You are right Masroor. Thank you I have edited my post. I need to change the direction of table of contents so that the section direction be RTL – msabet Jan 15 '15 at 15:20
6

You must change format of section , subsection , subsubsection in toc using the command \setRTL from bidi pachage

This can be done with :

\setbeamertemplate{section in toc}{%
\setRTL \myenum{\inserttocsectionnumber}
  \inserttocsection\par
}

\setbeamertemplate{subsection in toc}{%
\setRTL \myitem
  \inserttocsubsection\par%
}

\setbeamertemplate{subsubsection in toc}{%
\setRTL \rightskip=3ex\myitem
  \inserttocsubsection\par%
}

and your final code becomes

    \documentclass[10pt]{beamer}
    \usetheme{Warsaw}
    \usepackage{enumitem}
    \usepackage{fontspec}
    \usepackage{polyglossia}
    \setbeamertemplate{section in toc}[circle]
    \setbeamertemplate{frametitle continuation}{\gdef\beamer@frametitle{}} % framebreaks without numbering
    \setbeamertemplate{frametitle}[default][right]% align the frametitle to the right
    %\setdefaultlanguage{english}
    \setmainlanguage{english}
    \setotherlanguage{arabic}
    \setmainfont{Times New Roman}
    \setotherlanguage[calendar=gregorian,numerals=maghrib]{arabic}
    \newfontfamily\arabicfont[Script=Arabic,Scale=1]{B Nazanin}%
    \newfontfamily\arabicfontsf[Script=Arabic,Scale=1]{B Nazanin}%
    \graphicspath{{pics/}}
    %
    %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \newcommand{\ar}{\textarabic} % to change the laguage in the section and frame title to persian
    % This work as: \a{متن فارسی}
    %~~~~~~~~~~~~~~~~define bullet for enumerate~~~~~~~~~~~~~
    \newcommand{\myenum}[1]
    {
    \par\vspace{3pt}\LR{\hspace*{3pt}%
    \begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
    \usebeamercolor[fg]{item projected}
    {\pgftransformscale{1.8}\pgftext{\normalsize \pgfuseshading{bigsphere}}}
    {\pgftransformshift{\pgfpoint{0pt}{0.5pt}}
    \pgftext{\usebeamerfont*{item projected}\textcolor{white}{#1}}}
    \end{pgfpicture}%
    \hspace{1pt}%
    }}
    %~~~~~~~~~~~~~~~~~~define bullet for itemize~~~~~~~~~~~~~~~
    \newcommand{\myitem}{\par\vspace{3pt}\hspace{5mm}\LR{\hspace*{3pt}%
    \begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
    \usebeamercolor[fg]{item projected}
    {\pgftransformscale{1.1}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
    \end{pgfpicture}%
    \hspace{1pt}%
    }}
    %~~~~~~~~~~~~~~~~~~~~~~~~~~
    \newcommand{\myitemII}{\par\vspace{3pt}\hspace{5mm}\LR{\hspace*{3pt}%
    \begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
    \usebeamercolor[fg]{item projected}
    {\pgftransformscale{1.8}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
    \end{pgfpicture}%
    \hspace{1pt}%
    }}
    %*************************************************************************
    %\addtobeamertemplate{block begin}{}{\justifying} %new code
    %*************************************************************************
    % change toc format ======================================================

    \setbeamertemplate{section in toc}{%
\setRTL \myenum{\inserttocsectionnumber}
  \inserttocsection\par
}

\setbeamertemplate{subsection in toc}{%
\setRTL \myitem
  \inserttocsubsection\par%
}

\setbeamertemplate{subsubsection in toc}{%
\setRTL \rightskip=3ex\myitem
  \inserttocsubsection\par%
}

    %=================================================================

    \begin{document}
    %\selectlanguage{arabic}
    \title{\textarabic{بعنوان عنوان نعنوان }}
    \author{AUTHOR}
    \date{\today}
    %
    \frame{\titlepage}
    %
    \frame{
    \frametitle{\textarabic{فهرست مطالب}}
    \begin{minipage}{1.\textwidth}
    \begin{Arabic}
    \tableofcontents
    \end{Arabic}
    \end{minipage}
    }
    \section{\textarabic{مقدمه}}
    \subsection{\textarabic{مایع }}
    \subsubsection{\textarabic{مایع }}
    \frame{
    \frametitle{\textarabic{سیستمهای فرمیونی همبسته:مایع}}
    \begin{minipage}{.95\textwidth}
    %\begin{Arabic}% ----------------------here must be changed
    %
    \begin{itemize}[label=\protect\myitemII, rightmargin=0mm]
    \item
    \ar{متن فارسی .....}
    \ar{متن فارسی .....}
    \item
    \ar{متن فارسی .....}
    \item
    \ar{متن فارسی .....}
    \item
    \ar{متن فارسی .....}
    \end{itemize}

    \ar{متن فارسی .....}

    %\end{Arabic}
    \end{minipage}
    }
    \end{document}

enter image description here

  • Tank U Seloumi. I have another question. How I can change the – msabet Jan 17 '15 at 16:08
  • 1
    @msabet Besides thanking seloumi, don't forget to accept his answer by clicking the checkmark to its left (that's the best way to thank someone around here). In case of doubt, please see How do you accept an answer?. – Gonzalo Medina Jan 17 '15 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.