有一些很好的答案这里 和这里关于相同的问题,但代码示例不同,在这种情况下,我使用了一个新的包beamer-rl
加拿大运输安全局随着 Babel 包的最新版本更新,它解决了 beamer 中的 RTL 语言问题,但我遇到了侧边框不完整的问题:
% !TeX TS-program = LualaTex
\documentclass[hyperref=unicode,dvipsnames]{beamer}% compress,
\usepackage{hologo} % pdflatex, xelatex, lualatex logos
\mode<presentation>{\usetheme{Warsaw}}
%====== side border ====
\setbeamertemplate{background canvas}{%
{\color{blue}\rule{3pt}{\paperheight}\hspace*{\dimexpr\paperwidth-6pt\relax}\rule{3pt}{\paperheight}}%
}
\usepackage[nil,bidi=basic-r]{babel}
\babelprovide[import=ar-DZ, main]{arabic}
\babelprovide[import,language=Default]{english}
\babelfont{rm}{Amiri}
\babelfont{sf}{Amiri}
\usepackage{beamer-rl}
\begin{document}
\begin{frame}{here}
\frametitle{Introduction}
Creating beamer presentation for right to left language (like arabic) using \hologo{pdfLaTeX} or \hologo{XeLaTeX}
still poses many problems due to bugs not currently resolved especially for colors and hyperlinks
\end{frame}
\end{document}
答案1
代码来自https://tex.stackexchange.com/a/458518/36296无需任何修改仍可工作:
\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.bg);
color(\paperwidth)=(frametitle right.bg)}
\AtBeginDocument{
\pgfdeclareverticalshading{beamer@topshade}{.982\paperwidth}{%
color(0pt)=(bg);
color(4pt)=(black!50!bg)}
}
\addtobeamertemplate{headline}
{}
{%
\vskip-0.2pt
\hskip0.11cm\pgfuseshading{beamer@topshade}
\vskip-2pt
}
\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%
\leftskip0.3cm%
\rightskip0.3cm plus1fil\leavevmode
\usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\strut\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[nil,bidi=basic-r]{babel}
\babelprovide[import=ar-DZ, main]{arabic}
\babelprovide[import,language=Default]{english}
\babelfont{rm}{Amiri}
\babelfont{sf}{Amiri}
\usepackage{beamer-rl}
\begin{document}
\begin{frame}{content}
content
\end{frame}
\frame{Content}
\begin{frame}
content
\end{frame}
\section{test}
\begin{frame}{Content}
content
\end{frame}
\section{test2}
\end{document}