投影机中的特殊圆圈帧号

投影机中的特殊圆圈帧号

是否可以像下图一样自定义帧数?在此处输入图片描述

答案1

下面我提出两个选择:

\documentclass{beamer}
\usepackage{tikz}

\definecolor{color1}{RGB}{173,216,230}
\definecolor{color2}{RGB}{255,140,0}

\newcounter{totavalue}

\def\aux{1}
\def\radius{20pt}

\newcommand\circcounteri{%
\ifnum\inserttotalframenumber<2\relax
\else
  \setcounter{totavalue}{\inserttotalframenumber}%
\fi%
\pgfmathsetmacro{\aux}{360/\thetotavalue}%
\begin{tikzpicture}[overlay]
  \fill[color1] 
    (0,0) -- (0:\radius) arc  (0:360:\radius) -- cycle;
  \fill[color2] 
    (0,0) -- (90:\radius) arc  (90:90-\insertframenumber*\aux:\radius) -- cycle;
  \node[font=\color{white}] at (0,0) {\strut\Large\insertframenumber};
\end{tikzpicture}%
}

\addtobeamertemplate{headline}{}{\vskip1cm\hspace*{15pt}smash\circcounteri\hfill}

\newcommand\TestFr{\begin{frame}
test
\end{frame}}

\begin{document}

\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr
\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr
\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr
\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr

\end{document}

在此处输入图片描述

第二个更奇特的选项(对于包含许多帧的演示文稿,这可能需要更长的时间来处理):

\documentclass{beamer}
\usepackage{tikz}

\definecolor{color1}{RGB}{173,216,230}
\definecolor{color2}{RGB}{255,140,0}

\newcounter{totavalue}
\newcounter{parvalue}

\def\aux{1}
\def\radius{20pt}
\def\step{4pt}

\newcommand\circcounter{%
\ifnum\inserttotalframenumber<2\relax
\else
  \setcounter{totavalue}{\inserttotalframenumber}
  \setcounter{parvalue}{\insertframenumber}
  \ifnum\inserttotalframenumber>45\relax
    \renewcommand\step{0pt}
  \fi%
  \pgfmathsetmacro{\aux}{360/\thetotavalue}
  \begin{tikzpicture}[remember picture,overlay,rotate=90+\aux]
  \foreach \i in {0,1,...,\thetotavalue}
    \fill[color1] 
      (0,0) -- (-\i*\aux:\radius) arc  (-\i*\aux:-(\i+1)*\aux+\step:\radius) -- cycle;
  \foreach \i in {1,...,\insertframenumber}
    \fill[color2] 
      (0,0) -- (-\i*\aux:\radius) arc  (-\i*\aux:-(\i+1)*\aux+\step:\radius) -- cycle;
  \fill[white] circle (\radius/2);
  \node at (0,0) {\large\insertframenumber}; 
  \end{tikzpicture}%
\fi%
}

\addtobeamertemplate{headline}{}{\vskip1cm\hfill\circcounter\hspace*{1cm}}

\newcommand\TestFr{\begin{frame}
test
\end{frame}}

\begin{document}

\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr
\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr
\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr\TestFr

\end{document}

在此处输入图片描述

答案2

基本上,这个答案只是对我之前的答案进行了小幅修改LaTeX 的视觉计数器?我将介绍几个版本,所有版本都可以通过用户友好的键值界面进行定制。

从原始解决方案来看,应该进行一些更改:

  • 删除了beamer无用的选项;
  • 设置radiusthickness选项为相同的值即可得到部门
  • 设置负值以segment distance避免部门之间分离;
  • 通过 添加页码\insertframenumber

以下是一个例子:

\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{calc}

\setbeamertemplate{navigation symbols}{}

\pgfkeys{/visual counter/.cd,
 thickness/.store in=\thickness,
 thickness=0.4ex,
 radius/.store in=\radius,
 radius=1.5ex,
 segment distance/.store in=\segdist,
 segment distance=8,
 color current frame/.store in=\colcurrframe,
 color current frame=orange,
 color old frame/.store in=\cololdframe,
 color old frame=blue,
 color next frame/.store in=\colnextframe,
 color next frame=gray!30,
 color page number/.store in=\colpagenum,
 color page number=white,
 current value/.store in=\currentv,
 current value=1,
 total value/.store in=\totalv,
 total value=2,
 circled page number/.code={
    \begin{tikzpicture}[fill color/.style={}]
     \pgfkeys{/visual counter/.cd, 
       current value=\insertframenumber,
       total value=\inserttotalframenumber,
     }
    \pgfmathtruncatemacro\current{\currentv+1}
    \def\tot{\totalv}
    \def\radiusout{\radius}
    \def\radiusin{\radius-\thickness}

    \foreach \s in {1,...,\tot}
    {
      \ifnum\s>\current%
        \tikzset{fill color/.append style={\colnextframe}}%
      \fi%
      \ifnum\s=\current%
        \tikzset{fill color/.append style={\colcurrframe}}%
      \fi%
      \ifnum\s<\current%
        \tikzset{fill color/.append style={\cololdframe}}%
      \fi%
      \fill[fill color]
        ({90-360/\tot * (\s - 1)-\segdist}:\radiusout) arc 
        ({90-360/\tot * (\s - 1)-\segdist}:{90-360/\tot * (\s)+\segdist}:\radiusout) --
        ({90-360/\tot * (\s)+\segdist}:\radiusin) arc 
        ({90-360/\tot * (\s)+\segdist}:{90-360/\tot * (\s - 1)-\segdist}:\radiusin);
        % new addition
        \node[inner sep=0pt,text=\colpagenum] at (0,0){\insertframenumber};
    }
    \end{tikzpicture}
 },
}

% new footline with 
\setbeamertemplate{footline}{
\begin{beamercolorbox}[wd=0.95\textwidth, ht=2ex,dp=1ex,sep=1ex]{footline}
\hfill%
\tikz\node[/visual counter/.cd,
segment distance=-2pt,
radius=0.5cm, thickness=0.5cm,
color old frame=orange!50,
color current frame=cyan!80!gray!50,
color next frame=cyan!80!gray!50,
circled page number,
]{};
\end{beamercolorbox}
}

\begin{document}

\begin{frame}{Title}
bla bla bla

\end{frame}


\begin{frame}{Something else}
bla bla bla

\end{frame}

\begin{frame}{Different title}
bla bla bla
\end{frame}

\begin{frame}{Another one}
bla bla bla

\end{frame}

\begin{frame}{Final}
bla bla bla

\end{frame}

\end{document}

结果:

在此处输入图片描述

footline只是为了演示,将上一个文档中的模板简单改成:

% new footline with 
\setbeamertemplate{footline}{
\begin{beamercolorbox}[wd=0.95\textwidth, ht=2ex,dp=1ex,sep=1ex]{footline}
\hfill%
\tikz\node[/visual counter/.cd, beamer=true,
radius=0.5cm, thickness=0.225cm,
color old frame=orange!80,
color current frame=cyan!80!gray!80,
color next frame=cyan!80!gray!80,
color page number=black,
circled page number,
]{};
\end{beamercolorbox}
}

有可能达到与 Gonzalo 的花式选择相同的结果:

在此处输入图片描述

和:

% new footline with 
\setbeamertemplate{footline}{
\begin{beamercolorbox}[wd=0.95\textwidth, ht=2ex,dp=1ex,sep=1ex]{footline}
\hfill%
\tikz\node[/visual counter/.cd, beamer=true,
radius=0.5cm, thickness=0.175cm,
color old frame=cyan!80!gray!80, %       <= just set a different coloring
color current frame=orange!80,
color next frame=gray!80,
color page number=black,
circled page number,
]{};
\end{beamercolorbox}
}

结果变成:

在此处输入图片描述

另一种可能性是,与当前帧和已经出现的帧相比,出现的帧具有不同的厚度;为此,我们应该只改变circled page number键的厚度值:

circled page number/.code={
    \begin{tikzpicture}[fill color/.style={}]
     \pgfkeys{/visual counter/.cd, 
       current value=\insertframenumber-1,
       total value=\inserttotalframenumber,
     }
    \pgfmathtruncatemacro\current{\currentv+1}
    \pgfmathtruncatemacro\tot{\totalv}
    \def\radiusout{\radius}
    \def\radiusin{\radius-\thickness}

    \foreach \s in {1,...,\tot}
    {
      \ifnum\s>\current%
        \tikzset{fill color/.append style={\colnextframe}}%
        \pgfkeys{/visual counter/thickness={0.1cm}}%            <= new addition
      \fi%
      \ifnum\s=\current%
        \tikzset{fill color/.append style={\colcurrframe}}%
      \fi%
      \ifnum\s<\current%
        \tikzset{fill color/.append style={\cololdframe}}%
      \fi%
      \fill[fill color]
        ({90-360/\tot * (\s - 1)-\segdist}:\radiusout) arc 
        ({90-360/\tot * (\s - 1)-\segdist}:{90-360/\tot * (\s)+\segdist}:\radiusout) --
        ({90-360/\tot * (\s)+\segdist}:\radiusin) arc 
        ({90-360/\tot * (\s)+\segdist}:{90-360/\tot * (\s - 1)-\segdist}:\radiusin);
        % new addition
        \node[inner sep=0pt,text=\colpagenum] at (0,0){\insertframenumber};
    }
    \end{tikzpicture}
 },

(当然,引入另一个密钥会更好,但这很容易)。这导致:

在此处输入图片描述

答案3

为了扩展 samcarter 的评论,可以使用以下方式显示此类计数器视觉计数器ConTeXt 中的模块。(全面披露:我是视觉计数器模块的作者)。

首先,我们需要定义一个 Metapost 图形来绘制适当的形状。请参阅文档预定义参数的含义:

\usemodule[visualcounter]

\unprotect
\definevisualcounter
  [clock]
  [      \c!mp=visualcounter::clock,
     \c!offset=0.5EmWidth,
  ]

\startuseMPgraphic{visualcounter::clock}
  begingroup ;

  \includeMPgraphic{visualcounter::initialization}

  draw fullcircle scaled 10pt;

  if (last_counter > 0) and (current_counter > 0) :
      % label
      newpicture countertext     ; countertext     := textext("\visualcounterparameter\c!text");
      newpicture max_countertext ; max_countertext := textext("\visualcounterparameter{\c!max\c!text}");

      newnumeric diameter;
      diameter := max(bbwidth(max_countertext), bbheight(max_countertext)) 
                   + 2*\visualcounterparameter\c!offset;

      newpath circle ; circle := reverse (fullcircle scaled diameter) rotated 90;

      newnumeric timescale; timescale := arclength (circle)/last_counter ;
      newpair current; current := point (current_counter*timescale) on circle;
      newpath slice;   slice := origin -- (circle cutafter current) -- cycle ;

      fill circle withcolor future_color;
      fill slice withcolor past_color;
      label (countertext, origin) withcolor \visualcounterparameter\c!color ;

  fi;
  endgroup ;

\stopuseMPgraphic
\protect

然后,可以直接将其与任何 ConTeXt 计数器联系起来。例如:

\definecounter[test]

\definevisualcounter
  [test]
  [clock]
  [
    style=bold,
    color=white,
    counter=test,
  ]


\starttext

\dontleavehmode
\dorecurse{10}{\incrementcounter[test]\usevisualcounter{test}\quad}

\stoptext

这使:

在此处输入图片描述

标签是根据计数器指定的数字转换绘制的。因此,如果您更改:

\definecounter[test][numberconversion=Characters]

你会得到

在此处输入图片描述

要将其与页码一起使用,请使用:

\definevisualcounter
      [page] % use any identifier
      [clock]
      [....
       counter=userpage,
       ....]

然后使用

 \usevisualcounter{page}

无论您想要页码在哪里。

相关内容