0

I have a problem with itemize environment, which I did not in the past. I used to produce Persian slides with LuaLaTex in Texlive 2015. Now, I am using XePersian with XeLaTeX engine and Texlive 2019. The problem is that the horizontal spacing of subitems is the same as items, so items and subitems can not be easily distinguished from each other. Because of the problems of beamer compatibility with Persian, I used some codes published in Persian forums, and I am satisfied with the appearance of slides, but the itemize environment problem is still not fixed. Here is the code:

\documentclass[t,compress,xcolor=dvipsnames,professionalfont]{beamer}

\usepackage{xcolor}
\usefonttheme{serif}
\usepackage{multicol}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{pgfpages}
\usepackage[overlay,absolute]{textpos}
\usepackage{ragged2e}

\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}
\textblockorigin{0mm}{0mm} 
\setlength{\parindent}{0pt}

\usetheme{Warsaw}
\setbeamertemplate{navigation symbols}{}

\usepackage{xepersian}
\settextfont{XB Niloofar}%Yas
\setbeamerfont*{frametitle}{size=\large,series=\bfseries}
\defpersianfont\zar{XB Zar}

%%%%%%%%%%%%%%%%%   Background Block    %%%%%%%%%%%%%%%%%
\makeatletter
\newbox\@backgroundblock
\newenvironment{backgroundblock}[2]{%
    \global\setbox\@backgroundblock=\vbox\bgroup%
    \unvbox\@backgroundblock%
    \vbox to0pt\bgroup\vskip#2\hbox to0pt\bgroup\hskip#1\relax%
}{\egroup\egroup\egroup}
\addtobeamertemplate{background}{\box\@backgroundblock}{}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\author[نویسنده]{نویسنده}
\title[عنوان]{عنوان}
\subtitle{زیرعنوان}
\institute[]{}
\date[\today]{\today}

%%%%%%%%%%%%%%%%%   Title Adjustment    %%%%%%%%%%%%%%%%%
\makeatletter
\expandafter\let\csname beamer@@tmpop@frametitle@shadow theme\endcsname\relax

\defbeamertemplate*{frametitle}{shadow theme}
{%
    \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%
                    \rightskip0.3cm
                    \leftskip0.3cm plus1fil\leavevmode
                    \centering{\insertframetitle}%
                    \ifx\insertframesubtitle\@empty%
                    \strut\par%
                    \else
                    \par{\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-\Gm@lmargin\pgfuseshading{beamer@topshade}\hskip-\Gm@rmargin}
    \vskip-2pt
}
\makeatother

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


%%%%%%%%%%%%%%%%%   Persian Settings    %%%%%%%%%%%%%%%%%
\raggedleft
\makeatletter
\define@key{beamercolbox}{left}[0pt]{\def\beamer@colbox@rs{0pt}\def\beamer@colbox@ls{#1 pluslfill}}
\makeatletter
\raggedleft

\makeatletter
\expandafter\let\csname
beamer@@tmpop@itemize
item@default\endcsname\relax
\expandafter\let\csname
beamer@@tmpop@itemize
subitem@default\endcsname\relax
\expandafter\let\csname
beamer@@tmpop@itemize
subsubitem@default\endcsname\relax

\defbeamertemplate*{itemize
item}{default}{\scriptsize\raise1.25pt\hbox{\donotcoloroutermaths$\blacktriangleleft$}}
\defbeamertemplate*{itemize
subitem}{default}{\tiny\raise1.5pt\hbox{\donotcoloroutermaths$\blacktriangleleft$}}
\defbeamertemplate*{itemize
subsubitem}{default}{\tiny\raise1.5pt\hbox{\donotcoloroutermaths$\blacktriangleleft$}}

\bidi@patchcmd{\@listi}{\leftmargin}{\rightmargin}{}{}
\let\@listI\@listi
\bidi@patchcmd{\@listii}{\leftmargin}{\rightmargin}{}{}
\bidi@patchcmd{\@listiii}{\leftmargin}{\rightmargin}{}{}
\bidi@patchcmd{\beamer@enum@}{\raggedright}{\raggedleft}{}{}
\bidi@patchcmd{\@@description}{\raggedright}{\raggedleft}{}{}
\bidi@patchcmd{\@@description}{\leftmargin}{\rightmargin}{}{}

\renewcommand{\itemize}[1][]{%
    \beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
    \ifnum \@itemdepth 
    >2\relax\@toodeep\else
    \advance\@itemdepth\@ne
    \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
    \usebeamerfont{itemize/enumerate
        \beameritemnestingprefix body}%
    \usebeamercolor[fg]{itemize/enumerate
        \beameritemnestingprefix body}%
    \usebeamertemplate{itemize/enumerate
        \beameritemnestingprefix body}%
    \list
    {\usebeamertemplate{itemize \beameritemnestingprefix item}}
    {\def\makelabel##1{%
            {%
                \hss\llap{{%
                        \usebeamerfont*{itemize \beameritemnestingprefix item}%
                        \usebeamercolor[fg]{itemize
                            \beameritemnestingprefix item}##1}}%
                        }%
                    }%
                }
            \fi%
            \beamer@cramped%
            \raggedleft%
            \beamer@firstlineitemizeunskip%
        }
\makeatother
\raggedleft
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%%%%%%%%%%%%%%%%%       Document        %%%%%%%%%%%%%%%%%
\begin{document}


\begin{frame}{عنوان اسلاید}
    \begin{itemize}
        \item آیتم اول
        \item آیتم دوم
        \begin{itemize}
            \item زیرآیتم اول
            \item زیرآیتم دوم
        \end{itemize}
        \item آیتم سوم
        \item آیتم چهارم
    \end{itemize}
\end{frame}


\end{document}

enter image description here

0

Sorry, my reputation is too low to leave a short comment.

Does something like this help?

\begin{itemize}
    \setlength\itemsep{-.2cm}
    \item item
\end{itemize}
  • Thank you for your comment. But this command just sets the vertical spacing. I have a problem with horizontal spacing. – Yousef Ahmadi Sep 10 at 16:50
0

You can use beamer-rl class which patch some internal beamer templates and commands for right to left presentation, the class use babel implicitly with the option bidi=basic-r (lualatex engine).

\documentclass[t,compress,xcolor=dvipsnames,professionalfont]{beamer-rl}

\usetheme{Warsaw}
\setbeamertemplate{navigation symbols}{}

\babelprovide[import, main]{Persian}
\babelfont{sf}{Amiri}

\author[نویسنده]{نویسنده}
\title[عنوان]{عنوان}
\subtitle{زیرعنوان}
\institute[]{}
\date[\today]{\today}

\setbeamertemplate{itemize item}[default]
\setbeamertemplate{itemize subitem}[default]

\begin{document}

\begin{frame}{}
\maketitle
\end{frame}

\begin{frame}{عنوان اسلاید}
    \begin{itemize}
        \item آیتم اول
        \item آیتم دوم
        \begin{itemize}
            \item زیرآیتم اول
            \item زیرآیتم دوم
        \end{itemize}
        \item آیتم سوم
        \item آیتم چهارم
    \end{itemize}
\end{frame}

\end{document}
  • Thank you for your comment. But this code does not work and ends with errors. I have to use Xepersian package for Persian typesetting. – Yousef Ahmadi Sep 10 at 17:00
  • Can you add the resulting errors – Salim Bou Sep 10 at 17:13
  • babel package also can be used to write Persian. – Salim Bou Sep 10 at 17:16
  • "Undefined control sequence", "Missing \begin{document}", "Undefined control sequence" for \babelprovide and \babelfont and some other "Undefined control sequence" errors – Yousef Ahmadi Sep 10 at 19:05
  • 1
    I don't think your computer is using texlive 2019, you must make sure. – Salim Bou Sep 10 at 19:09

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.