我遇到了 itemize 环境的问题,以前没有遇到过这个问题。我以前在 Texlive 2015 中用 LuaLaTex 制作波斯语幻灯片。现在,我使用的是 XePersian,带有 XeLaTeX 引擎和 Texlive 2019。问题是子项目的水平间距与项目相同,因此项目和子项目无法轻易区分。由于 beamer 与波斯语的兼容性问题,我使用了波斯语论坛中发布的一些代码,我对幻灯片的外观感到满意,但 itemize 环境问题仍未解决。以下是代码:
\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}
答案1
您可以将以下结构用于子项以及子子项:
\newcommand{\sitem}[1]{\setlength\itemindent{9pt} \item[{\small \color{blue}$\blacktriangleleft$}]#1\setlength\itemindent{2pt}}
\newcommand{\ssitem}[1]{\setlength\itemindent{18pt}\item[{\small \color{blue}$\blacktriangleleft$}]#1\setlength\itemindent{2pt}}
您有以下代码:
\documentclass[t,compress,xcolor=dvipsnames,professionalfont]{beamer}
\usepackage{enumitem}
\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
\raggedleft
\makeatletter
\define@key{beamercolbox}{left}[0pt]{\def\beamer@colbox@rs{0pt}\def\beamer@colbox@ls{#1 pluslfill}}
\makeatletter
\raggedleft
\begin{document}
\setitemize{leftmargin=-.3cm,label=\textcolor{blue}{$\blacktriangleleft$},itemsep=2pt}
\newcommand{\sitem}[1]{\setlength\itemindent{9pt} \item[{\small \color{blue}$\blacktriangleleft$}]#1\setlength\itemindent{2pt}}
\newcommand{\ssitem}[1]{\setlength\itemindent{18pt}\item[{\small \color{blue}$\blacktriangleleft$}]#1\setlength\itemindent{2pt}}
\begin{frame}{عنوان اسلاید}
\begin{itemize}\raggedleft
\item آیتم اول
\item آیتم دوم
\sitem زیر آیتم اول
\sitem زیر آیتم دوم
\ssitem زیر زیر آیتم اول
\ssitem زیر زیر آیتم دوم
\sitem زیرآیتم سوم
\sitem زیرآیتم چهارم
\item آیتم سوم
\item آیتم چهارم
\end{itemize}
\end{frame}
\end{document}
答案2
通过为 itemize 定义一个新的环境。
\documentclass{beamer}
\usepackage{amsmath,ptext}
\usetheme{Warsaw}
\usefonttheme{serif}
\usepackage{xepersian}
\settextfont{Yas}
\raggedleft
\makeatletter
\newenvironment{bitemize}{%
\ifnum\@itemdepth >2\relax\@toodeep\else%
\advance\@itemdepth\@ne%
\beamer@computepref\@itemdepth%
\usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
\usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
\begin{list}
{%
\usebeamertemplate{itemize \beameritemnestingprefix item}%
}%
{ \leftmargin=1.75em \itemindent=0em%
\def\makelabel##1{%
{%
\hss\llap{{%
\usebeamerfont*{itemize \beameritemnestingprefix item}%
\usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
}%
}%
}
\raggedleft
\fi
}
{
\end{list}
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body end}%
}
%
\newenvironment{bbitemize}{%
\ifnum\@itemdepth >2\relax\@toodeep\else%
\advance\@itemdepth\@ne%
\beamer@computepref\@itemdepth%
\usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
\usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
\begin{list}
{%
\usebeamertemplate{itemize \beameritemnestingprefix item}%
}%
{ \leftmargin=1em \itemindent=0em%
\def\makelabel##1{%
{%
\hss\llap{{%
\usebeamerfont*{itemize \beameritemnestingprefix item}%
\usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
}%
}%
}
\raggedleft
\fi
}
{
\end{list}
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body end}%
}
%
\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$}}
\makeatother
\title{یک اسلاید نمونه}
\author{مجتبی احمدی}
\begin{document}
\section{اسلاید نمونه}
\begin{frame}
\ptext[1]
\begin{bitemize}
\item آیتم اول
\item آیتم دوم
\begin{bbitemize}
\item زیرآیتم اول
\item زیرآیتم دوم
\end{bbitemize}
\item آیتم سوم
\item
با تشکر از زحمات جناب دکتر وفا
\begin{center}
\texttt{http://qa.parsilatex.com/14100}
\end{center}
\end{bitemize}
\end{frame}
\end{document}
答案3
您可以使用beamer-rl
修补一些内部投影仪模板和用于从右到左呈现的命令的类,该类使用 babel 和选项bidi=basic
(lualatex 引擎)。
\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}