我有一个在 Beamer 中从右到左编写列表的例子
\documentclass{beamer}
\usefonttheme{serif}
\usepackage{bidi}
\setbeamertemplate{enumerate item}[circle]
\setbeamertemplate{itemize subitem}[circle]
\begin{document}
\begin{frame}{Frame title}
\setRTL
\raggedleft
\begin{enumerate}\raggedleft
\item Data may be missing
\begin{itemize}\raggedleft
\item This makes the problem complete
\item even for very restricted cases
\end{itemize} % \par solve the problem but add extra space
this text from right to left % <-- problem here
\end{enumerate}
\end{frame}
\end{document}
第二级列表之后的文本是从左到右,而它应该是从右到左。其他类没有出现此问题
\documentclass{article}
\usepackage{bidi}
\renewcommand{\labelenumi}{\arabic{enumi}\null-}
\begin{document}
\setRTL
\begin{enumerate}
\item Data may be missing
\begin{itemize}
\item This makes the problem complete
\item even for very restricted cases
\end{itemize}
this text from right to left
\end{enumerate}
\end{document}
答案1
如何使用您已经找到的解决方案,开始一个新段落并撤消额外的空间?
% !TeX TS-program = xelatex
\documentclass{beamer}
\usefonttheme{serif}
\usepackage{bidi}
\setbeamertemplate{enumerate item}[circle]
\setbeamertemplate{itemize subitem}[circle]
\begin{document}
\begin{frame}{Frame title}
\setRTL
\raggedleft
\begin{enumerate}\raggedleft
\item Data may be missing
\begin{itemize}\raggedleft
\item This makes the problem complete
\item even for very restricted cases
\end{itemize} % \par solve the problem but add extra space
\vspace{-\baselineskip}
this text from right to left % <-- problem here
\end{enumerate}
\end{frame}
\end{document}
答案2
解决:
\let\olditemize=\itemize
\def\itemize{\vskip0pt\olditemize}
% 或者
\AtBeginEnvironment{itemize}{\vskip0pt}
代码:
\documentclass{beamer}
\usefonttheme{serif}
\usepackage{bidi}
\setbeamertemplate{enumerate item}[circle]
\setbeamertemplate{itemize subitem}[circle]
\let\olditemize=\itemize
\def\itemize{\vskip0pt\olditemize}
% Or
%\AtBeginEnvironment{itemize}{\vskip0pt}
\begin{document}
\begin{frame}{Frame title}
\setRTL
\raggedleft
\begin{enumerate}\raggedleft
\item Data may be missing
\begin{itemize}\raggedleft
\item This makes the problem complete
\item even for very restricted cases
\end{itemize} % \par solve the problem but add extra space
this text from right to left % <-- problem here
\end{enumerate}
\end{frame}
\end{document}
输出:
或者:\vskip0pt
添加
\makeatletter
\renewcommand{\itemize}[1][]{\vskip0pt% <--- add
\ifblank{#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 begin}%
\list
{\usebeamertemplate{itemize \beameritemnestingprefix item}}
{\def\makelabel##1{%
{%
\hss\llap{{%
\usebeamerfont*{itemize \beameritemnestingprefix item}%
\usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
}%
}%
}
\fi%
\beamer@cramped%
\raggedright%
\beamer@firstlineitemizeunskip%
}
\makeatother
代码:
\documentclass{beamer}
\usefonttheme{serif}
\usepackage[RTLdocument=on]{bidi}
\raggedleft
\setbeamertemplate{enumerate item}[circle]
\setbeamertemplate{itemize item}[circle]
\setbeamertemplate{itemize subitem}[circle]
\makeatletter
\renewcommand{\itemize}[1][]{\vskip0pt% <--- add
\ifblank{#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 begin}%
\list
{\usebeamertemplate{itemize \beameritemnestingprefix item}}
{\def\makelabel##1{%
{%
\hss\llap{{%
\usebeamerfont*{itemize \beameritemnestingprefix item}%
\usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
}%
}%
}
\fi%
\beamer@cramped%
\raggedright%
\beamer@firstlineitemizeunskip%
}
\makeatother
\begin{document}
\begin{frame}
\begin{enumerate}\raggedleft
\item Data may be missing
\begin{itemize}\raggedleft
\item This makes the problem complete
\item even for very restricted cases
\end{itemize} % \par solve the problem but add extra space
this text from right to left % <-- problem here
\end{enumerate}
\end{frame}
\end{document}
类似地,对于列表环境的其余部分,请参见下面的代码。
\documentclass{beamer}
\usefonttheme{serif}
\usepackage[RTLdocument=on]{bidi}
\raggedleft
\setbeamertemplate{enumerate item}[circle]
\setbeamertemplate{itemize item}[circle]
\setbeamertemplate{itemize subitem}[circle]
%+++++++++++++++++++++++++++++++
\let\olditemize=\itemize
\def\itemize{\vskip0pt\olditemize}
\let\oldenumerate=\enumerate
\def\enumerate{\vskip0pt\oldenumerate}
\let\olddescription=\description
\def\description{\vskip0pt\olddescription}
% or
%\AtBeginEnvironment{itemize}{\vskip0pt}
%\AtBeginEnvironment{enumerate}{\vskip0pt}
%\AtBeginEnvironment{description}{\vskip0pt}
%++++++++++++++++++++++
\begin{document}
\begin{frame}
\begin{itemize}\raggedleft
\item one two
\end{itemize}
test right
\end{frame}
\begin{frame}
test right
\begin{description}\raggedleft
\item[right]
test right
\end{description}
test right
\end{frame}
\begin{frame}
test right
\begin{itemize}\raggedleft
\item one two
\end{itemize}
test right
\end{frame}
\begin{frame}
test right
\begin{enumerate}\raggedleft
\item one two
\begin{itemize}\raggedleft
\item one two
\end{itemize}
\end{enumerate}
test right
\end{frame}
\begin{frame}
\begin{enumerate}\raggedleft
\item Data may be missing
\begin{itemize}\raggedleft
\item This makes the problem complete
\item even for very restricted cases
\end{itemize} % \par solve the problem but add extra space
this text from right to left % <-- problem here
\end{enumerate}
\end{frame}
\end{document}
答案3
我希望我理解你的问题是正确的。我的思路如下:
“问题文本”可以理解为\item
,只是省略了“项目符号”(文本前的符号)。
可以按照如下方式完成:
\documentclass{beamer}
\usefonttheme{serif}
\usepackage{bidi}
\setbeamertemplate{enumerate item}[circle]
\setbeamertemplate{itemize subitem}[circle]
\begin{document}
\begin{frame}{Frame title}
\setRTL
\raggedleft
\begin{enumerate}\raggedleft
\item Data may be missing
\begin{itemize}\raggedleft
\item This makes the problem complete
\item even for very restricted cases
\end{itemize} % \par solve the problem but add extra space
\vspace{-.6cm}
\item[] \hspace{2cm} this text from right to left % <-- problem was here
\end{enumerate}
\end{frame}
\end{document}
(该\hspace{2cm}
命令只是为了表明您可以在水平方向上移动文本到任何位置 - 类似于 \vspace{-.6cm}
命令。)
答案4
已在版本 37 中解决比迪烟。
\documentclass{beamer}
\usefonttheme{serif}
\usepackage{bidi}
\setbeamertemplate{enumerate item}[circle]
\setbeamertemplate{itemize subitem}[circle]
\begin{document}
\begin{frame}{Frame title}
\setRTL
%\raggedleft
\begin{enumerate}%\raggedleft
\item Data may be missing
\begin{itemize}%\raggedleft
\item This makes the problem complete
\item even for very restricted cases
\end{itemize} % \par solve the problem but add extra space
this text from right to left % <-- problem here
\end{enumerate}
\end{frame}
\end{document}