ビーマーの見出しのカスタムナビゲーションドット

ビーマーの見出しのカスタムナビゲーションドット

スライドを作成中ですbeamerが、現在のセクション (左) とサブセクション (右) を示すドットをヘッダーに含めたいと思います。セクション/サブセクションの名前は含めないでください。

MWE は次のとおりです。

\documentclass{beamer}

\makeatletter
\setbeamertemplate{headline}
{%
    \leavevmode%
    \hbox{%
        \begin{beamercolorbox}[wd=0.5\paperwidth,ht=2.25ex,dp=1ex,left]{section in head/foot}
            section dots
        \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=0.5\paperwidth,ht=2.25ex,dp=1ex,right]{section in head/foot}
            subsection dots (of current section)
        \end{beamercolorbox}}%
}
\makeatother

\begin{document}    
    \section{Section1}
    \begin{frame}
        \frametitle{Frame11}
    \end{frame}

    \subsection{Subsection1}
    \begin{frame}
        \frametitle{Frame12}
    \end{frame}

    \subsection{Subsection2}
    \begin{frame}
        \frametitle{Frame13}
    \end{frame}


    \section{Section2}
    \begin{frame}
        \frametitle{Frame21}
    \end{frame}

    \subsection{Subsection1}
    \begin{frame}
        \frametitle{Frame22}
    \end{frame}

    \subsection{Subsection2}
    \begin{frame}
        \frametitle{Motivation}
    \end{frame}

    \subsection{Subsection3}
    \begin{frame}
        \frametitle{Frame23}
    \end{frame}
\end{document}

この特定のフレーム数では、左上隅にセクションを示す 2 つのドット、右上隅にセクション 1 とセクション 2 のサブセクションを示す 2 つまたは 3 つのドットが必要です。明らかに、この例に固有ではない一般的なソリューションが必要です。

これは現在の設定で簡単に実行できますか、それともまったく別のものが必要ですか?

答え1

おそらく、これを実行するにはもっと良い方法があるでしょうが、ビーマー ナビゲーションをいじる代わりに、何か新しいことを試してパッケージを操作したいと思いましたxcntperchap

\documentclass{beamer}
\usepackage{tikz}

\usepackage{totcount}
\regtotcounter{section}

\usepackage{xcntperchap}
\RegisterCounters{section}{subsection}

\newcounter{totalsubsection}
\setcounter{totalsubsection}{0}
\usepackage{etoolbox}

\preto\frame{\ifnum\thesection>0\setcounter{totalsubsection}{\ObtainTrackedValueExp[\thesection]{section}{subsection}}\fi}

\setbeamertemplate{headline}{%
\hbox{%
\begin{beamercolorbox}[wd=.48\paperwidth,ht=2.25ex,dp=1ex]{section in head/foot}%
\hfill%
\ifnum\totvalue{section}>0%
\ifnum\thesection>0%
\foreach\x in {1,...,\totvalue{section}}{%
\ifnum\x=\thesection%
\usebeamertemplate{mini frame}~%
\else%
\usebeamertemplate{mini frame in other section}~%
\fi%
}%
\fi%
\fi%
\end{beamercolorbox}%
\qquad%
\begin{beamercolorbox}[wd=.48\paperwidth,ht=2.25ex,dp=1ex]{subsection in head/foot}%
\ifnum\thetotalsubsection>0%
\foreach\x in {1,...,\thetotalsubsection}{%
\ifnum\x=\thesubsection%
\usebeamertemplate{mini frame}~%
\else%
\usebeamertemplate{mini frame in other subsection}~%
\fi%
}%
\fi%
\end{beamercolorbox}%
}}

\title{title}
\author{author}

\begin{document}

    \begin{frame}
        \titlepage
    \end{frame}


\section{Section1}

\frame{}

\subsection{Subsection1}
\begin{frame}
\frametitle{Frame11}
\end{frame}

\subsection{Subsection2}
\begin{frame}
\frametitle{Frame12}
\end{frame}

\section{Section2}
\begin{frame}
\frametitle{Frame2}
\end{frame}

\subsection{Subsection1}
\begin{frame}
\frametitle{Frame21}
\end{frame}

\subsection{Subsection2}
\begin{frame}
\frametitle{Frame22}
\end{frame}

\subsection{Subsection3}
\begin{frame}
\frametitle{Frame23}
\end{frame}

\section{Section3}
\begin{frame}
\frametitle{Frame3}
\end{frame}

\end{document}

ここに画像の説明を入力してください

答え2

私は、受け入れられたソリューションの柔軟性を示すために回答しているだけです。すべての功績は samcarter に帰属します。if/else 内の小さな部分を変更し、コンテンツをヘッダーからフッターに移動することで、次の nMWE 結果が得られました。

最初の4枚のスライド

スライド5-8

nMWE:

\documentclass{beamer}

\beamertemplatenavigationsymbolsempty
\usetheme{rochester}
\usecolortheme{beaver}

\usepackage{tikz}

\usepackage{totcount}
\regtotcounter{section}

\usepackage{xcntperchap}
\RegisterCounters{section}{subsection}

\newcounter{totalsubsection}
\setcounter{totalsubsection}{0}
\usepackage{etoolbox}

\preto\frame{\ifnum\thesection>0\setcounter{totalsubsection}{\ObtainTrackedValueExp[\thesection]{section}{subsection}}\fi}

\setbeamertemplate{footline}{%
    \hbox{%
        \begin{beamercolorbox}[wd=0.2\paperwidth,ht=2.25ex,dp=1ex,left,leftskip=1ex]{subsection in head/foot}%
            \ifnum\totvalue{section}>0%
            \foreach\x in {1,...,\totvalue{section}}{%
                \ifnum\numexpr\x-1<\thesection%
                \usebeamertemplate{mini frame}~%
                \else%
                \usebeamertemplate{mini frame in other section}~%
                \fi%
            }%
            \fi%
        \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=0.6\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}
            \usebeamerfont{title in head/foot} \inserttitle
        \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=0.2\paperwidth,ht=2.25ex,dp=1ex,right,rightskip=1ex]{subsection in head/foot}%
            \ifnum\thetotalsubsection>0%
            \foreach\x in {1,...,\thetotalsubsection}{%
                \ifnum\x>\numexpr\thetotalsubsection-\thesubsection%
                \usebeamertemplate{mini frame}~%
                \else%
                \usebeamertemplate{mini frame in other subsection}~%
                \fi%
            }%
            \fi%
        \end{beamercolorbox}%
    }}


\title{Super fancy long title which will fit in the footer}
\author{The Champion}
\date{\today}


\begin{document}

    \begin{frame}
        \thispagestyle{empty}
        \maketitle
    \end{frame}


    \begin{frame}
        \thispagestyle{empty}
        \frametitle{Outline}
        \tableofcontents
    \end{frame}


    \section{The first section}
    \subsection{The first subsection}
    \begin{frame}
        \frametitle{The first section}
        \framesubtitle{The first subsection}
    \end{frame}

    \subsection{The second subsection}
    \begin{frame}
        \frametitle{The first section}
        \framesubtitle{The second subsection}
    \end{frame}

    \subsection{The third subsection}
    \begin{frame}
        \frametitle{The first section}
        \framesubtitle{The third subsection}
    \end{frame}


    \section{The second section}
    \subsection{The first subsection}
    \begin{frame}
        \frametitle{The second section}
        \framesubtitle{The first subsection}
    \end{frame}

    \subsection{The second subsection}
    \begin{frame}
        \frametitle{The second section}
        \framesubtitle{The second subsection}
    \end{frame}


    \section{The third section}
    \subsection{The first subsection}
    \begin{frame}
        \frametitle{The third section}
        \framesubtitle{The first subsection}
    \end{frame}

\end{document}

関連情報