五款 beamer 进度条制作样例

您所在的位置:网站首页 flag进度条怎么制作的 五款 beamer 进度条制作样例

五款 beamer 进度条制作样例

2024-05-21 14:25| 来源: 网络整理| 查看: 265

制作 beamer 进度条,可以指引讲演者或者是听者更加容易了解到整个 beamer 的进展和进度,下面是五个制作的进度条的样例,大家可以通过修改参数来自定义进度条的颜色、宽度、高度等属性。

第一个:3.gif

\documentclass{beamer} \usepackage{tikz} \usetikzlibrary{calc} \definecolor{pbblue}{HTML}{0A75A8}% filling color for the progress bar \definecolor{pbgray}{HTML}{575757}% background color for the progress bar \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@tmpdim % auxiliary dimension \progressbar@pbwd=\linewidth \progressbar@pbht=1.5ex % 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}[rounded corners=2pt,very thin] \shade[top color=pbgray!20,bottom color=pbgray!20,middle color=pbgray!50] (0pt, 0pt) rectangle ++ (\progressbar@pbwd, \progressbar@pbht); \shade[draw=pbblue,top color=pbblue!50,bottom color=pbblue!50,middle color=pbblue] % (0pt, 0pt) rectangle ++ (\progressbar@tmpdim, \progressbar@pbht); \draw[color=normal text.fg!50] (0pt, 0pt) rectangle (\progressbar@pbwd, \progressbar@pbht) node[pos=0.5,color=normal text.fg] {\textnormal{% \pgfmathparse{\insertframenumber*100/\inserttotalframenumber}% \pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,\%% }% }; \end{tikzpicture}% } \addtobeamertemplate{headline}{} {% \begin{beamercolorbox}[wd=\paperwidth,ht=4ex,center,dp=1ex]{white}% \progressbar@progressbar% \end{beamercolorbox}% } \makeatother \begin{document} \begin{frame} test \end{frame} \begin{frame} test \end{frame} \begin{frame} test \end{frame} \begin{frame} test \end{frame} \end{document}

第二款,进度条用的是一个圆球来指示进度:

\documentclass{beamer} \usepackage{tikz} \usetikzlibrary{calc} \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 \begin{document} \begin{frame} test \end{frame} \begin{frame} test \end{frame} \begin{frame} test \end{frame} \begin{frame} test \end{frame} \end{document}

dfd36c2055abeb66deb8ab8ecade28a6.png

指示方式也可以改为三角形如下:processbar1_1.gif

\documentclass{beamer} \usepackage{tikz} \usetikzlibrary{calc} \definecolor{pbgray}{HTML}{575757}% background color for the progress bar \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@tmpdim % auxiliary dimension \progressbar@pbwd=\linewidth \progressbar@pbht=1pt % 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}[very thin] \draw[pbgray!30,line width=\progressbar@pbht] (0pt, 0pt) -- ++ (\progressbar@pbwd,0pt); \draw[draw=none] (\progressbar@pbwd,0pt) -- ++ (2pt,0pt); \draw[fill=pbgray!30,draw=pbgray] % ( $ (\progressbar@tmpdim, \progressbar@pbht) + (0,1.5pt) $ ) -- ++(60:3pt) -- ++(180:3pt) ; \node[draw=pbgray!30,text width=3.5em,align=center,inner sep=1pt, text=pbgray!70,anchor=east] at (0,0) {\insertframenumber/\inserttotalframenumber}; \end{tikzpicture}% } \addtobeamertemplate{headline}{} {% \begin{beamercolorbox}[wd=\paperwidth,ht=5ex,center,dp=1ex]{white}% \progressbar@progressbar% \end{beamercolorbox}% } \makeatother \begin{document} \begin{frame} test \end{frame} \begin{frame} test \end{frame} \begin{frame} test \end{frame} \begin{frame} test \end{frame} \end{document}

第三款,放在 beamer 底部的进度指示,颜色更加清晰:

3osOG.gif

\documentclass{beamer} \usetheme{Darmstadt} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{xifthen} \makeatletter \newcommand{\Progressbar@LabelColor}{black} \newcommand{\Progressbar@LabelText}{Label} \newcommand{\Progressbar@LabelWidth}{5} % Farbe, Text, Breite des Labels \newcommand{\Progressbar@BarWidth}{10} \newcommand{\Progressbar@BarHeight}{1} \newcommand{\Progressbar@BarColor}{yellow} \newcommand{\Progressbar@BarBorder}{black} % Breite, Höhe, Schriftfarbe des Prozentsatzes, Rahmenfarbe des Fortschrittbalkens \newcommand{\Progressbar@TodoA}{gray} \newcommand{\Progressbar@TodoB}{black} % Farbe 1 und 2 für den unerledigten Teil \newcommand{\Progressbar@DoneA}{red} \newcommand{\Progressbar@DoneB}{blue} % Farbe 1 und 2 für den erledigten Teil \newcommand{\Progressbar@Direction}{LTR} % Modus links nach rechts oder umgekehrt; umgekehrt ist buggy (no support yet) \newcommand{\Progressbar@Completion}{50} % Fertigstellung in Prozent \define@key{Progressbar}{LabelColor}[\Progressbar@LabelColor]{\renewcommand{\Progressbar@LabelColor}{#1}} \define@key{Progressbar}{LabelText}[\Progressbar@LabelText]{\renewcommand{\Progressbar@LabelText}{#1}} \define@key{Progressbar}{LabelWidth}[\Progressbar@LabelWidth]{\renewcommand{\Progressbar@LabelWidth}{#1}} \define@key{Progressbar}{BarWidth}[\Progressbar@BarWidth]{\renewcommand{\Progressbar@BarWidth}{#1}} \define@key{Progressbar}{BarHeight}[\Progressbar@BarHeight]{\renewcommand{\Progressbar@BarHeight}{#1}} \define@key{Progressbar}{BarColor}[\Progressbar@BarColor]{\renewcommand{\Progressbar@BarColor}{#1}} \define@key{Progressbar}{BarBorder}[\Progressbar@BarBorder]{\renewcommand{\Progressbar@BarBorder}{#1}} \define@key{Progressbar}{TodoA}[\Progressbar@TodoA]{\renewcommand{\Progressbar@TodoA}{#1}} \define@key{Progressbar}{TodoB}[\Progressbar@TodoB]{\renewcommand{\Progressbar@TodoB}{#1}} \define@key{Progressbar}{DoneA}[\Progressbar@DoneA]{\renewcommand{\Progressbar@DoneA}{#1}} \define@key{Progressbar}{DoneB}[\Progressbar@DoneB]{\renewcommand{\Progressbar@DoneB}{#1}} \define@key{Progressbar}{Direction}[\Progressbar@Direction]{\renewcommand{\Progressbar@Direction}{#1}} \define@key{Progressbar}{Completion}[\Progressbar@Completion]{\renewcommand{\Progressbar@Completion}{#1}} \newcommand{\Progressbar}[1]% { \setkeys{Progressbar}{#1} % Progress Bars -------------------------------------------------- \begin{tikzpicture}[overlay, remember picture,shift={($(current page.south west)+(0.1,0.1)$)}] \ifthenelse{ \( \Progressbar@Completion = 0 \) \or \( \Progressbar@Completion = 100 \) } { \newcommand{\TCA}{\Progressbar@TodoA} \newcommand{\TCB}{\Progressbar@TodoB} \newcommand{\DCA}{\Progressbar@DoneA} \newcommand{\DCB}{\Progressbar@DoneB} } { \newcommand{\TCA}{\Progressbar@TodoB !\Progressbar@Completion !\Progressbar@TodoA} \newcommand{\TCB}{\Progressbar@TodoB} \newcommand{\DCA}{\Progressbar@DoneA} \newcommand{\DCB}{\Progressbar@DoneB !\Progressbar@Completion !\Progressbar@DoneA} } \ifthenelse{\equal{\Progressbar@Direction}{LTR}} { \shade[left color=\DCA,right color=\DCB]% (0,0) rectangle (\Progressbar@Completion * \Progressbar@BarWidth / 100,\Progressbar@BarHeight); \shade[left color=\TCA,right color=\TCB]% (\Progressbar@Completion * \Progressbar@BarWidth / 100,0)% rectangle (\Progressbar@BarWidth,\Progressbar@BarHeight); } { \shade[left color=\TCB,right color=\TCA]% (0,0) rectangle (\Progressbar@Completion * \Progressbar@BarWidth / 100,\Progressbar@BarHeight); \shade[left color=\DCB,right color=\DCA]% (\Progressbar@Completion * \Progressbar@BarWidth / 100,0)% rectangle (\Progressbar@BarWidth,\Progressbar@BarHeight); } \draw (0,0) rectangle (\Progressbar@BarWidth,\Progressbar@BarHeight); \node[color=\Progressbar@BarColor] at% (\Progressbar@BarWidth / 10,\Progressbar@BarHeight / 2) {\Progressbar@Completion \%}; \draw[color=white] (- \Progressbar@LabelWidth,0) -- % node[anchor=west,color=\Progressbar@LabelColor,text width=\Progressbar@LabelWidth]% {\Progressbar@LabelText} (- \Progressbar@LabelWidth,\Progressbar@BarHeight) ; % \typeout{todo c1 = \TCA} % \typeout{todo c2 = \TCB} % \typeout{done c1 = \DCA} % \typeout{done c2 = \DCB} \end{tikzpicture} } \makeatother \logo { \pgfmathsetmacro{\wid}{\the\paperwidth/28.45276-0.2} \pgfmathtruncatemacro{\prog}{100*\insertpagenumber/\insertdocumentendpage} \Progressbar{ LabelColor=yellow,% LabelText=,% LabelWidth=0,% BarWidth=\wid,% BarHeight=0.3,% BarColor=green,% BarBorder=black,% TodoA=orange!20!gray,% TodoB=orange!80!gray,% DoneA=blue!80!cyan,% DoneB=blue!20!cyan,% Completion=\prog% } } \begin{document} \begin{frame} \only{Sha la la.} \only{Shu bi du.} \only{Tri Tra.} \only{Trullala.} page - frame - totalpages : \insertpagenumber\ - \insertframenumber\ - \insertdocumentendpage \end{frame} \begin{frame} \only{One.} \only{Zwei.} \only{Tri.} \only{Quattro.} \only{Cinq.} \only{Seis.} \only{Siedem.} \only{Kahdeksan.} page - frame - totalpages : \insertpagenumber\ - \insertframenumber\ - \insertdocumentendpage \end{frame} \end{document}

第四款,为进度条增加不同几何形状的点缀,显得进度条更加有质感。L3lEW.gif

\makeatletter \AtBeginSection[]{\frame{\sectionpage}} \AtBeginSubsection[]{\frame{\subsectionpage}} \newcommand{\my@bigsize}{9} \newcommand{\my@medsize}{7} \newcommand{\my@smallsize}{5} \newlength{\my@tempsize} \newcounter{my@sectnum} \newcommand{\my@lastdigit}[1]{% \loop\ifnum\value{#1}>9\addtocounter{#1}{-10}\repeat \arabic{#1}% } \newcommand\my@fixedbox[2]{% \makebox[#1]{\rule[-1ex]{0pt}{3.25ex}#2}% } \newcommand\my@colorbox[3]{% {\setlength{\fboxsep}{0pt}\colorbox{#1}{\my@fixedbox{#2}{#3}}}% } \def\my@temptext{} \newcommand{\my@navbox}[1][]{% \if\relax\detokenize{#1}\relax \def\my@tempbox{\my@fixedbox}% \else \def\my@tempbox{\my@colorbox{#1}}% \fi \ifx\my@box\my@bigbox \def\my@temptext{\my@lastdigit{my@sectnum}}% \fi \ifx\my@box\my@medbox \def\my@temptext{$\diamond$}% \fi \ifx\my@box\my@smallbox \def\my@temptext{$-$}% \fi \my@tempbox{\my@tempsize}{\my@temptext}% } \defbeamertemplate{navigation box}{home}{% \setlength{\my@tempsize}{\my@box@size pt}% \my@colorbox{teal!60}{\my@tempsize}{$\equiv$}% } \defbeamertemplate{navigation box}{done}{% \setlength{\my@tempsize}{\my@box@size pt}% \my@navbox[teal!60]% } \defbeamertemplate{navigation box}{todo}{% \setlength{\my@tempsize}{\my@box@size pt}% \my@navbox } \newcommand{\my@bigbox}{\global\let\my@box@size=\my@bigsize\usebeamertemplate{navigation box}} \newcommand{\my@medbox}{\global\let\my@box@size=\my@medsize\usebeamertemplate{navigation box}} \newcommand{\my@smallbox}{\global\let\my@box@size=\my@smallsize\usebeamertemplate{navigation box}} \renewcommand{\sectionentry}[5]{\global\let\my@box=\my@bigbox\setcounter{my@sectnum}{#1}} \renewcommand{\beamer@subsectionentry}[5]{\global\let\my@box=\my@medbox} \renewcommand{\slideentry}[6]{% \def\my@temp@i{1/1}% \def\my@temp@ii{#4}% \ifx\my@temp@i\my@temp@ii % title page \setbeamertemplate{navigation box}[home]% \else \setbeamertemplate{navigation box}[done]% \fi \ifnum\c@section


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3