投影机上的 RTL 框架标题

投影机上的 RTL 框架标题

根据此处的这个问题如何在特殊情况下减小框架标题框的大小 frametitle 是,\flushright但文本方向是 LTR 而不是 RTL,尽管我添加了\textarabic{test}

% !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]{Arial}
\newfontfamily\arabicfontsf[Script=Arabic]{Arial}
\newfontfamily\arabicfonttt[Script=Arabic]{Arial}
\newfontfamily\amiri[Script=Arabic]{Arial}

\begin{document}
\begin{frame}{This frametitle should be right to left}
frame
\end{frame}
\frame{Content}
\begin{frame}
content
\end{frame}
\section{test}
\begin{frame}{Content}
content
\end{frame}
\section{test2}
\end{document} 

从右到左 frametitle

答案1

尝试这样的操作:

% !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.3cm 
%          \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{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}

\begin{document}

\section{section name}

\begin{frame}
\frametitle{This frametitle should be right to left}
frame
\end{frame}

\end{document} 

在此处输入图片描述

相关内容