0

I used this answer related to titlebox size, but this causes the TOC be centered or justified if i add \flushright. This code solve the issue partially but suppress numbering bullets (fig1):

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

enter image description here

How to align this RTL properly (fig2):

% !TeX TS-program = xelatex

\documentclass{beamer}


\mode<presentation>

\useinnertheme[shadow=true]{rounded}
%\useoutertheme{shadow}
\usecolortheme{orchid}
\usecolortheme{whale}

\setbeamerfont{block title}{size={}}

\mode
<all>

%
\author{diabonas}
\title{Frame border}
\setbeamertemplate{background canvas}{%
{\color{black}\rule{3pt}{\paperheight}\hspace*{\dimexpr\paperwidth-6pt\relax}\rule{10pt}{\paperheight}}%    
}

\makeatletter
\mode<presentation>
%
\useoutertheme{split}
%
%
\setbeamercolor{frametitle}{parent=subsection in head/foot}
\setbeamercolor{frametitle right}{parent=section in head/foot}


\pgfdeclarehorizontalshading[frametitle.bg,frametitle right.bg]{beamer@frametitleshade}{\paperheight}{%
  color(0pt)=(frametitle right.bg);
  color(\paperwidth)=(frametitle.bg)}

\AtBeginDocument{
 \pgfdeclareverticalshading{beamer@topshade}{.982\paperwidth}{%
    color(0pt)=(bg);
    color(4pt)=(black!50!bg)}
}
%
\addtobeamertemplate{headline}
{}
{%
  \vskip-0.2pt
  \hskip\paperwidth\hskip-0.11cm\pgfuseshading{beamer@topshade}
  \vskip-2pt
}
%
%
\defbeamertemplate*{frametitle}{shadow theme}
{%
    \selectlanguage{english}%
  \nointerlineskip%
  \vskip-2pt%
 \hbox{\leavevmode
    \advance\beamer@leftmargin by -12bp%
    \advance\beamer@rightmargin by -12bp%
   \beamer@tempdim=\textwidth%
    \advance\beamer@tempdim by \beamer@leftmargin%
    \advance\beamer@tempdim by \beamer@rightmargin%
    \hskip-\Gm@lmargin\hbox{%
      \setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{\paperwidth}%
          \vbox{}\vskip-.75ex% <- was 0.75ex
          \leftskip0.3cm%
          \rightskip0.6cm plus1fil\leavevmode
          \usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\strut\hfill\otherlanguage{arabic}{\insertframetitle}\par%
          \ifx\insertframesubtitle\@empty\else%
            {\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
          \fi%
          \nointerlineskip
          \vbox{}%
          \end{minipage}}%
      \beamer@tempdim=\ht\beamer@tempbox%
      \advance\beamer@tempdim by 2pt%
      \begin{pgfpicture}{0pt}{0pt}{\paperwidth}{\beamer@tempdim}
        \usebeamercolor{frametitle right}
        \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
        \pgfusepath{clip}
        \pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
      \end{pgfpicture}
      \hskip-\paperwidth%
      \box\beamer@tempbox%
    }%
    \hskip-\Gm@rmargin%
  }%
  \nointerlineskip
    \vskip-0.2pt
    \hbox to\textwidth{\hskip-0.885cm\pgfuseshading{beamer@topshade}\hskip-\Gm@rmargin}
    \vskip-2pt
}


\mode
<all>

\makeatother
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage[numerals=maghrib, calendar=gregorian]{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
\newfontfamily\arabicfontsf[Script=Arabic]{Amiri}
\newfontfamily\arabicfonttt[Script=Arabic]{Amiri}
\newfontfamily\amiri[Script=Arabic]{Amiri}

%%This solve the issue partially but suppress bullets
%\setbeamertemplate{section in toc}{%
%\setRTL {\inserttocsectionnumber}
% \inserttocsection\par
%}

\begin{document}
%%============multicolumns TOC ==============
%\setbeamertemplate{section in toc}[circle]
\begin{frame}{Outline}%to allow TOC break
\begin{minipage}{.9\textwidth}
\begin{columns}[onlytextwidth]
    \begin{column}{.45\textwidth}
       \begin{Arabic}  
       \flushright                                        
            \tableofcontents[sections=5-, subsubsectionstyle=hide/hide,hideothersubsections]%hideothersubsections                 
       \end{Arabic}
    \end{column}
 %  \flushright 
    \begin{column}{.45\textwidth}
       \begin{Arabic}
           \flushright
            \tableofcontents[sections=-4, subsubsectionstyle=hide/hide, hideothersubsections]%hideothersubsections
        \end{Arabic}
    \end{column}    
\end{columns}
\end{minipage}
\end{frame}
%============End multicolumns TOC ==============

\frame{Content}
\section{Test one and Test Two}
\section{Test o Two}
\begin{frame}
content
\end{frame}
\section{Test Two}
\section{Test one and Test Two}
\begin{frame}{Content}
content
\end{frame}
\section{Test Three}
\section{Test one and Test Two}
\section{Test one and Test Two}
\begin{frame}{Content}
content
\end{frame}
\end{document}

Fig 2

  • 1
    Your problem is not caused by the answer you link to, this would also happen with the default theme in combination with a RTL language – samcarter_is_at_topanswers.xyz Nov 18 '18 at 19:35
0

You could add \raggedleft to the section in toc template:

% !TeX TS-program = xelatex

\documentclass{beamer}

\useinnertheme[shadow=true]{rounded}

\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage[numerals=maghrib, calendar=gregorian]{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic]{Arial}
\newfontfamily\arabicfontsf[Script=Arabic]{Arial}
\newfontfamily\arabicfonttt[Script=Arabic]{Arial}
\newfontfamily\amiri[Script=Arabic]{Arial}

\makeatletter
\defbeamertemplate{section in toc}{myball}{
\leavevmode\leftskip=2.75ex%
  \llap{%
    \normalsize%
    \begin{pgfpicture}{-1ex}{-0.7ex}{1ex}{1ex}
      \pgftext{\beamer@usesphere{section number projected}{tocsphere}}
      \pgftext{%
        \usebeamerfont*{section number projected}%
        \usebeamercolor{section number projected}%
        \color{fg!90!bg}%
        \inserttocsectionnumber}
    \end{pgfpicture}%
    \kern1.25ex}%
    \raggedleft \inserttocsection\par
}
[action]
{\setbeamerfont{section number projected}{size=\scriptsize}}

\defbeamertemplate{subsection in toc}{myball}
{\leavevmode\leftskip=5ex%
  \llap{\raise0.1ex\beamer@usesphere{subsection number projected}{bigsphere}\kern1ex}%
  \raggedleft \inserttocsubsection\par%
}


\setbeamertemplate{sections/subsections in toc}[myball]
\makeatother

\begin{document}
%%============multicolumns TOC ==============
%\setbeamertemplate{section in toc}[circle]
\begin{frame}{Outline}%to allow TOC break
\begin{minipage}{.9\textwidth}
\begin{columns}[onlytextwidth]
    \begin{column}{.45\textwidth}
       \begin{Arabic}             
            \tableofcontents[sections=5-, subsubsectionstyle=hide/hide,hideothersubsections]%hideothersubsections                 
       \end{Arabic}
    \end{column}
    \begin{column}{.45\textwidth}
       \begin{Arabic}
            \tableofcontents[sections=-4, subsubsectionstyle=hide/hide, hideothersubsections]%hideothersubsections
        \end{Arabic}
    \end{column}    
\end{columns}
\end{minipage}
\end{frame}
%============End multicolumns TOC ==============

\frame{Content}
\section{Test one and Test Two}
\section{Test o Two}
\begin{frame}
content
\end{frame}
\section{Test Two}
\section{Test one and Test Two test test}
\begin{frame}{Content}
content
\end{frame}
\section{Test Three}
\section{Test one and Test Two}
\section{Test one and Test Two}
\begin{frame}{Content}
content
\end{frame}
\end{document}

enter image description here

| improve this answer | |
  • It works perfectly,is it possible to add indentation for subsections in the TOC? – Abdelhak Elfengour Nov 22 '18 at 9:45
  • 1
    @AbdelhakElfengour Maybe it would be better to have this as a new question – samcarter_is_at_topanswers.xyz Nov 22 '18 at 10:07

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.