我想在我的演示文稿中添加一个进度条(我的想法来自这个问题),但我相信有某种东西阻止它出现在输出中,而且我似乎无法弄清楚。
这是我的 MWE:
\documentclass[xcolor=dvipsnames]{beamer}
\usepackage[danish]{babel}
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{url}
\usepackage{graphics,epsfig, subfigure}
\usepackage{fancybox}
\usepackage{extarrows}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{mathtools}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{picture}
\usepackage{fancybox}
\usepackage{xcolor}
\mode<presentation> {
\usetheme{CambridgeUS}
\setbeamertemplate{headline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,center]{section in head/foot}%
\usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,center]{subsection in head/foot}%
\usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertsubsectionhead
\end{beamercolorbox}}%
\vskip0pt%
}
}
\useinnertheme{circles}
\usefonttheme[onlymath]{serif}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{pbblue}{HTML}{0A75A8}% color for the progress bar and the circle
\makeatletter
\def\progressbar@progressbar{} % the progress bar
\newcount\progressbar@tmpcounta% auxiliary counter
\newcount\progressbar@tmpcountb% auxiliary counter
\newdimen\progressbar@pbht %progressbar height
\newdimen\progressbar@pbwd %progressbar width
\newdimen\progressbar@rcircle % radius for the circle
\newdimen\progressbar@tmpdim % auxiliary dimension
\progressbar@pbwd=\linewidth
\progressbar@pbht=1pt
\progressbar@rcircle=2.5pt
% the progress bar
\def\progressbar@progressbar{%
\progressbar@tmpcounta=\insertframenumber
\progressbar@tmpcountb=\inserttotalframenumber
\progressbar@tmpdim=\progressbar@pbwd
\multiply\progressbar@tmpdim by \progressbar@tmpcounta
\divide\progressbar@tmpdim by \progressbar@tmpcountb
\begin{tikzpicture}
\draw[pbblue!30,line width=\progressbar@pbht]
(0pt, 0pt) -- ++ (\progressbar@pbwd,0pt);
\filldraw[pbblue!30] %
(\the\dimexpr\progressbar@tmpdim-\progressbar@rcircle\relax, .5\progressbar@pbht) circle (\progressbar@rcircle);
\node[draw=pbblue!30,text width=3.5em,align=center,inner sep=1pt,
text=pbblue!70,anchor=east] at (0,0) {\insertframenumber/\inserttotalframenumber};
\end{tikzpicture}%
}
\addtobeamertemplate{headline}{}
{%
\begin{beamercolorbox}[wd=\paperwidth,ht=4ex,center,dp=1ex]{white}%
\progressbar@progressbar%
\end{beamercolorbox}%
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamertemplate{frametitle}[default][right]% align the frametitle to the right
\setdefaultlanguage{english}
\setotherlanguage[calendar=gregorian,numerals=maghrib]{arabic}
\setbeamercolor{block title}{bg=green,fg=black}
\AtBeginEnvironment{exampleblock}{\setbeamercolor{item projected}{bg=gray}}
\newfontfamily\arabicfont[Script=Arabic,Scale=0.8]{IRNazli}
\newfontfamily\latinfontsf[Script=Latin,Scale=0.3]{Calibri}
\newfontfamily\arabicfontsf[Script=Arabic,Scale=0.8]{IRNazli}
\newfontfamily\digitfont[Script=Arabic,Scale=0.8]{IRNazli}
\newfontfamily{\F}{IRNazli} % Farsi
\newfontfamily{\I}{IranNastaliq} % Farsi
\newfontfamily{\C}{Calibri}
\setbeamercovered{transparent}
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\newcommand{\myitemII}{\par\vspace{3pt}\hspace{5mm}\LR{\hspace*{3pt}%
\begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
\usebeamercolor[fg]{item projected}
{\pgftransformscale{2}\pgftext{\normalsize\pgfuseshading{\setbeamertemplate{enumerate items}[circle]}}}
\end{pgfpicture}%
\hspace{1pt}%
}}
% ======================================================
\makeatletter
\DeclareMathSizes{\f@size}{10}{7}{7}
\makeatother
\makeatletter
\defbeamertemplate*{headline}{arabic split theme}
{
\leavevmode%
\@tempdimb=2.4375ex%
\ifnum\beamer@subsectionmax<\beamer@sectionmax%
\multiply\@tempdimb by\beamer@sectionmax%
\else%
\multiply\@tempdimb by\beamer@subsectionmax%
\fi%
\ifdim\@tempdimb>0pt%
\advance\@tempdimb by 1.825ex%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=\@tempdimb]{subsection in head/foot}%
\vbox to\@tempdimb{\vfil\insertsubsectionnavigation{.5\paperwidth}\vfil}%
\usebeamerfont{subsection in head/foot}\hspace*{4ex}\insertsubsectionhead
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfil\insertsectionnavigation{.5\paperwidth}\vfil}%
\usebeamerfont{section in head/foot}\insertsectionhead\vfil%
\end{beamercolorbox}%
\fi%
}
\makeatother
%----------------------------------------------------------------------------------------
% TITLE PAGE
%----------------------------------------------------------------------------------------
\title{\F \RL{\textbf{مسئله یادگیری دیکشنری }}}
\author{{\setRTL \F \RL{\textbf{فلان الدین فلانی}}} }
\institute[]
{
\F \RL{\textbf{\normalsize{ دانشگاه فلان}}}
\medskip
}
\date{\F \RL{شهریور ۱۲۹۱}}
\begin{document}
\begin{frame}
\end{frame}
\begin{frame}
\end{frame}
\begin{frame}
\end{frame}
\end{document}
但输出中没有显示任何进度条。我想知道是什么阻止了它显示。
编辑:我想我找到了原因;当我从代码中删除这部分时,进度条就会出现在输出文档中。
\makeatletter
\DeclareMathSizes{\f@size}{10}{7}{7}
\makeatother
\makeatletter
\defbeamertemplate*{headline}{arabic split theme}
{
\leavevmode%
\@tempdimb=2.4375ex%
\ifnum\beamer@subsectionmax<\beamer@sectionmax%
\multiply\@tempdimb by\beamer@sectionmax%
\else%
\multiply\@tempdimb by\beamer@subsectionmax%
\fi%
\ifdim\@tempdimb>0pt%
\advance\@tempdimb by 1.825ex%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=\@tempdimb]{subsection in head/foot}%
\vbox to\@tempdimb{\vfil\insertsubsectionnavigation{.5\paperwidth}\vfil}%
\usebeamerfont{subsection in head/foot}\hspace*{4ex}\insertsubsectionhead
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfil\insertsectionnavigation{.5\paperwidth}\vfil}%
\usebeamerfont{section in head/foot}\insertsectionhead\vfil%
\end{beamercolorbox}%
\fi%
}
\makeatother
但我真的不知道这部分代码是做什么的,因为该模板是大学推荐使用的现成的投影仪演示模板。那么你建议怎么做?
答案1
对于评论来说这太长了。
实际上@samcarter 已经找到了问题所在:事情就是这样出错的
headline
您可以通过以下方式将进度条插入模板:\addtobeamertemplate
- 您定义一个名为 的新
headline
模板。arabic split theme
\defbeamertemplate*
- 由于您正在调用带星号的版本,BEAMER 将定义进而安装此模板。
- 进度条被删除。
更准确的说,官方的描述是\addtobeamertemplate
这样的:
此命令在当前安装为模板 ⟨元素名称⟩ 的文本前添加 ⟨pre-text⟩,在其后添加 ⟨post-text⟩。这允许您以有限的形式修改现有模板。...
如果
安装了新模板,则任何添加的内容都将被删除。另一方面,您可以重复使用此命令来添加多个内容。
官方的描述\defbeamertemplate
如下:
此命令为模板 ⟨元素名称⟩ 安装预定义选项。使用此命令后,用户可以使用命令访问预定义模板
\setbeamertemplate
。... 带星号的命令版本安装预定义模板选项,但随后立即调用此选项。这对于默认模板很有用。\setbeamertemplate
因此您有几种选择:
*
从 中删除\def...
,因此新定义的样式将不会被安装并且进度条将保留。- 交换顺序
\add...
,\def...
这样就没有什么可以抹去进度条了。 - 在新模板的定义中包含进度条。
答案2
用我的一些技巧回答从右到左编写投影仪演示文稿,尤其是列表和文本对齐。
您可能需要更新软件包 比迪烟 确保在从右到左的语言中改变文本的方向
\documentclass{beamer}
\usepackage{tikz}
\usepackage{polyglossia}
\usetheme{CambridgeUS}
\usefonttheme[onlymath]{serif}
\setdefaultlanguage[numerals=eastern]{farsi}
\setotherlanguage{english}
\newfontfamily\farsifont[Script=Arabic,Scale=0.8]{Amiri}
\newfontfamily\farsifontsf[Script=Arabic,Scale=0.8]{Amiri}
\newfontfamily\digitfont[Script=Arabic,Scale=0.8]{Amiri}
\newfontfamily{\F}[Script=Arabic]{Amiri} % Farsi
\newfontfamily{\I}[Script=Arabic]{Amiri} % Farsi
\newfontfamily{\C}{Amiri}
% right to left list
\makeatletter
\newcommand{\RTList}{\raggedleft\rightskip\@totalleftmargin}
\makeatother
% right to left triangle for label item
\setbeamertemplate{itemize item}{\scriptsize\raise1.25pt%
\hbox{\donotcoloroutermaths$\blacktriangleleft$}}
\setbeamertemplate{enumerate items}[ball] % or circle
\definecolor{pbblue}{HTML}{0A75A8}% color for the progress bar and the circle
\makeatletter
\def\progressbar@progressbar{} % the progress bar
\newcount\progressbar@tmpcounta% auxiliary counter
\newcount\progressbar@tmpcountb% auxiliary counter
\newdimen\progressbar@pbht %progressbar height
\newdimen\progressbar@pbwd %progressbar width
\newdimen\progressbar@rcircle % radius for the circle
\newdimen\progressbar@tmpdim % auxiliary dimension
\progressbar@pbwd=\linewidth
\progressbar@pbht=1pt
\progressbar@rcircle=2.5pt
% the progress bar
\def\progressbar@progressbar{%
\progressbar@tmpcounta=\orig@arabic\c@framenumber
\progressbar@tmpcountb=\inserttotalframenumber
\progressbar@tmpdim=\progressbar@pbwd
\multiply\progressbar@tmpdim by \progressbar@tmpcounta
\divide\progressbar@tmpdim by \progressbar@tmpcountb
\begin{tikzpicture}
\draw[pbblue!30,line width=\progressbar@pbht]
(0pt, 0pt) -- ++ (\progressbar@pbwd,0pt);
\filldraw[pbblue!30] %
(\the\dimexpr\progressbar@tmpdim-\progressbar@rcircle\relax, .5\progressbar@pbht) circle (\progressbar@rcircle);
\node[draw=pbblue!30,text width=3.5em,align=center,inner sep=1pt,
text=pbblue!70,anchor=east] at (0,0) {\@arabic\inserttotalframenumber/\insertframenumber};
\end{tikzpicture}%
}
\addtobeamertemplate{headline}{}
{%
\begin{beamercolorbox}[wd=\paperwidth,ht=4ex,center,dp=1ex]{white}%
\progressbar@progressbar%
\end{beamercolorbox}%
}
\addtobeamertemplate{footline}
{\let\old\inserttotalframenumber%
\def\inserttotalframenumber{\@arabic\old}%
}{}
\makeatother
\title{\F\bfseries مسئله یادگیری دیکشنری }
\author{\F\bfseries فلان الدین فلانی
\and
دانشگاه فلان }
\date{\F شهریور ۱۲۹۱ }
\begin{document}
\everypar{\rightskip\rightmargin}
\begin{frame}
\everypar{}
\maketitle
\end{frame}
\section{فصل أول}
\subsection{عنوان أول}
\begin{frame}{}
متن نمونه
\begin{itemize}\RTList
\item مورد اول
\end{itemize}
\begin{enumerate}\RTList
\item مورد اول
\begin{enumerate}\RTList
\item مورد اول
\item مورد ثان
\end{enumerate}
\end{enumerate}
\end{frame}
\end{document}