在 beamer 类中插入计数器

在 beamer 类中插入计数器

我想创建自己的beamer theme,并且我已经获得了它的粗略代码。

\documentclass[serif]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{tikz,blindtext,enumerate,charter}
\usetikzlibrary{fadings,positioning,calc}
\newcommand{\changefont}[3]{\fontfamily{#1}\fontseries{#2}\fontshape{#3}\selectfont}
\definecolor{blau}{RGB}{0,191,255}
%\definecolor{blau}{RGB}{226, 245, 13}
\definecolor{ora}{RGB}{253,111,1}
\setbeamertemplate{navigation symbols}{}
\begin{document}
    \begin{frame}
        \begin{tikzpicture}[remember picture,overlay]
        \fill[inner color=blau] (current page.south west) rectangle (current page.north east);
            \node[opacity=.6] at ([xshift=.05cm,yshift=1.03cm]$(current page.north west)!.5!(current page.south east)$) {\Huge\sc Die Überschrift};
        \node[red] at ([yshift=1cm]$(current page.north west)!.5!(current page.south east)$) {\Huge\sc Die Überschrift};
        \node[ora] at ([yshift=-.5cm]$(current page.north west)!.5!(current page.south east)$) {\changefont{lmr}{m}{it}Der Autor};
        \end{tikzpicture}
    \end{frame}
    \begin{frame}
        \begin{tikzpicture}[overlay,remember picture]
            \fill[path fading=north,fading transform={yshift=-.5cm},fading angle=225,blau] (current page.north west) rectangle (current page.south east);
                \node[yshift=.2cm,above left] at (current page.south east) {\changefont{lmr}{m}{n}Zeichnen mit Ti\emph{\color{blau}k}Z};
                \node[yshift=.15cm,xslant=.6,xshift=-1.75cm,yscale=-1,opacity=.4] at (current page.south east) {\changefont{lmr}{m}{n}Zeichnen mit Ti\emph{\color{blau}k}Z};
                \fill[opacity=.6,black] ([xshift=2.1cm]current page.north west) -- ([xshift=2.1cm,yshift=-1.5cm]current page.north west) -- ([xshift=2.6cm,yshift=-1.2cm]current page.north west) -- ([xshift=3.1cm,yshift=-1.5cm]current page.north west) -- ([xshift=3.1cm]current page.north west);
            \fill[red] ([xshift=2cm]current page.north west) -- ([xshift=2cm,yshift=-1.5cm]current page.north west) -- ([xshift=2.5cm,yshift=-1.2cm]current page.north west) -- ([xshift=3cm,yshift=-1.5cm]current page.north west) -- ([xshift=3cm]current page.north west);
            \node[white,inner sep=0pt] (a) at ([xshift=2.5cm,yshift=-.5cm]current page.north west) {\changefont{pzc}{b}{n}Thema};
            \node[white,below=.2mm of a] {\changefont{lmtt}{m}{b}1};
            \draw[red,thick,yshift=.1cm] (-1,3) -- (7.7,3) node[near end,above,xshift=1cm,red] {\changefont{put}{m}{n}Der Titel};
%           \node[below left,opacity=.3,rotate=-20,xshift=1cm,yshift=-.5cm] at (current page.north east) {\includegraphics[scale=.2]{shot}};
        \end{tikzpicture}
        \vspace{-2cm}\parbox{.7\textwidth}{\color{black!85}\footnotesize\blindtext[1]}
    \end{frame}
    \begin{frame}
            \begin{tikzpicture}[overlay,remember picture]
                \fill[path fading=north,fading transform={yshift=-.5cm},fading angle=225,blau] (current page.north west) rectangle (current page.south east);
                    \node[yshift=.26cm,above left] at (current page.south east) {\changefont{lmr}{m}{n}Die Präsentation};
%                   {Das Arbeiten mit \color{blau}\sc\LaTeX};
                    \node[yshift=.15cm,xslant=.6,xshift=-1.6cm,yscale=-1,opacity=.4] at (current page.south east)  {\changefont{lmr}{m}{n}Die Präsentation};
%                   {Das Arbeiten mit \color{blau}\sc\LaTeX};
                    \fill[opacity=.6,black] ([xshift=2.1cm]current page.north west) -- ([xshift=2.1cm,yshift=-1.5cm]current page.north west) -- ([xshift=2.6cm,yshift=-1.2cm]current page.north west) -- ([xshift=3.1cm,yshift=-1.5cm]current page.north west) -- ([xshift=3.1cm]current page.north west);
                \fill[red] ([xshift=2cm]current page.north west) -- ([xshift=2cm,yshift=-1.5cm]current page.north west) -- ([xshift=2.5cm,yshift=-1.2cm]current page.north west) -- ([xshift=3cm,yshift=-1.5cm]current page.north west) -- ([xshift=3cm]current page.north west);
                \node[white,inner sep=0pt] (a) at ([xshift=2.5cm,yshift=-.5cm]current page.north west) {\changefont{pzc}{b}{n}Thema};
                \node[white,below=.2mm of a] {\changefont{lmtt}{m}{b}2};
                %\node[below left,opacity=.3,rotate=-20,xshift=1cm,yshift=-.5cm] at (current page.north east) {\includegraphics[scale=.2]{shot}};
            \end{tikzpicture}
        \vspace{-2cm}\parbox{.7\textwidth}{
            \begin{enumerate}[\tikz{\fill[white]circle(.13);\fill[red]circle(.1);}]
                \item \color{black!85}Hallo,
                \item Welt!
            \end{enumerate}
            }
    \end{frame}
\end{document}

输出如下:

截屏

截屏

截屏

我的问题是:我怎样才能实现这一目标

  • 无需手动输入section号码,就会出现“正常”号码?

我只知道一些可以将其转变为“主题”的命令,但我对使用该类没有经验beamer,我只知道基础知识。


以下是MWE“部分问题”的一部分(特别是对于萨姆卡特)。

\documentclass[serif]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{tikz,blindtext,enumerate,charter,comment}
\usetikzlibrary{fadings,positioning,calc}
\newcommand{\changefont}[3]{\fontfamily{#1}\fontseries{#2}\fontshape{#3}\selectfont}
\definecolor{blau}{RGB}{0,191,255}
%\definecolor{blau}{RGB}{226, 245, 13}
\definecolor{ora}{RGB}{253,111,1}
\setbeamertemplate{navigation symbols}{}
\begin{document}
    \begin{frame}
        \begin{tikzpicture}[remember picture,overlay]
        \fill[inner color=blau] (current page.south west) rectangle (current page.north east);
            \node[opacity=.6] at ([xshift=.05cm,yshift=1.03cm]$(current page.north west)!.5!(current page.south east)$) {\Huge\sc Die Überschrift};
        \node[red] at ([yshift=1cm]$(current page.north west)!.5!(current page.south east)$) {\Huge\sc Die Überschrift};
        \node[ora] at ([yshift=-.5cm]$(current page.north west)!.5!(current page.south east)$) {\changefont{lmr}{m}{it}Der Autor};
        \end{tikzpicture}
    \end{frame}


    \section{}


    \begin{frame}
        \begin{tikzpicture}[overlay,remember picture]
            \fill[path fading=north,fading transform={yshift=-.5cm},fading angle=225,blau] (current page.north west) rectangle (current page.south east);
                \node[yshift=.2cm,above left] at (current page.south east) {\changefont{lmr}{m}{n}Zeichnen mit Ti\emph{\color{blau}k}Z};
                \node[yshift=.15cm,xslant=.6,xshift=-1.75cm,yscale=-1,opacity=.4] at (current page.south east) {\changefont{lmr}{m}{n}Zeichnen mit Ti\emph{\color{blau}k}Z};
                \fill[opacity=.6,black] ([xshift=2.1cm]current page.north west) -- ([xshift=2.1cm,yshift=-1.5cm]current page.north west) -- ([xshift=2.6cm,yshift=-1.2cm]current page.north west) -- ([xshift=3.1cm,yshift=-1.5cm]current page.north west) -- ([xshift=3.1cm]current page.north west);
            \fill[red] ([xshift=2cm]current page.north west) -- ([xshift=2cm,yshift=-1.5cm]current page.north west) -- ([xshift=2.5cm,yshift=-1.2cm]current page.north west) -- ([xshift=3cm,yshift=-1.5cm]current page.north west) -- ([xshift=3cm]current page.north west);
            \node[white,inner sep=0pt] (a) at ([xshift=2.5cm,yshift=-.5cm]current page.north west) {\changefont{pzc}{b}{n}Thema};
            \node[white,below=.2mm of a] {\changefont{lmtt}{m}{b}\thesection};
            \draw[red,thick,yshift=.1cm] (-1,3) -- (7.7,3) node[near end,above,xshift=1cm,red] {\changefont{put}{m}{n}Der Titel};
%           \node[below left,opacity=.3,rotate=-20,xshift=1cm,yshift=-.5cm] at (current page.north east) {\includegraphics[scale=.2]{shot}};
        \end{tikzpicture}
        \vspace{-2cm}\parbox{.7\textwidth}{\color{black!85}\footnotesize\blindtext[1]}
    \end{frame}


%   \section{}

\begin{comment}
    It only works when:
     - The first and the second section are uncommented and 
     - only the second section is commented.
    When only the first section is uncommented it doesn't work!
    Of course I can put just empty sections but this isn't an elegant solution …
\end{comment}

    \begin{frame}
            \begin{tikzpicture}[overlay,remember picture]
                \fill[path fading=north,fading transform={yshift=-.5cm},fading angle=225,blau] (current page.north west) rectangle (current page.south east);
                    \node[yshift=.26cm,above left] (a) at (current page.south east) {\changefont{lmr}{m}{n}Die Präsentation};
%                   {Das Arbeiten mit \color{blau}\sc\LaTeX};
                    \node[yshift=.15cm,xslant=.6,xshift=-1.6cm,yscale=-1,opacity=.4] at (current page.south east)  {\changefont{lmr}{m}{n}Die Präsentation};
%                   {Das Arbeiten mit \color{blau}\sc\LaTeX};
                    \fill[opacity=.6,black] ([xshift=2.1cm]current page.north west) -- ([xshift=2.1cm,yshift=-1.5cm]current page.north west) -- ([xshift=2.6cm,yshift=-1.2cm]current page.north west) -- ([xshift=3.1cm,yshift=-1.5cm]current page.north west) -- ([xshift=3.1cm]current page.north west);
                \fill[red] ([xshift=2cm]current page.north west) -- ([xshift=2cm,yshift=-1.5cm]current page.north west) -- ([xshift=2.5cm,yshift=-1.2cm]current page.north west) -- ([xshift=3cm,yshift=-1.5cm]current page.north west) -- ([xshift=3cm]current page.north west);
                \node[white,inner sep=0pt] (a) at ([xshift=2.5cm,yshift=-.5cm]current page.north west) {\changefont{pzc}{b}{n}Thema};
                \node[white,below=.2mm of a] {\changefont{lmtt}{m}{b}\thesection};
                %\node[below left,opacity=.3,rotate=-20,xshift=1cm,yshift=-.5cm] at (current page.north east) {\includegraphics[scale=.2]{shot}};
            \end{tikzpicture}
        \vspace{-2cm}\parbox{.7\textwidth}{
            \begin{enumerate}[\tikz{\fill[white]circle(.13);\fill[red]circle(.1);}]
                \item \color{black!85}Hallo,
                \item Welt!
            \end{enumerate}
            }
    \end{frame}
\end{document}

答案1

您可以通过 插入当前节号\thesection。要处理第一节之前的帧,最好测试数字是否大于 0

\documentclass{beamer}

\setbeamertemplate{headline}{%
    \ifnum\thesection>0
        \thesection
    \fi
}

\begin{document}

\begin{frame}
content...
\end{frame}

\section{title}

\begin{frame}
content...
\end{frame}

\end{document}

相关内容