新加坡的 Beamer Miniframes 和子部分

新加坡的 Beamer Miniframes 和子部分

我使用的是新加坡主题,subsections=true。部分和导航点的位置都正常。

但是,我希望小节标题出现在其对应的节和节点下方,而不是左对齐。

在下面的 MWE 中,我希望“小节 2.1”与“节 2”下方对齐,而不是“节 1”下方。

有什么想法吗?谢谢你的帮助!

梅威瑟:

\documentclass[compress]{beamer}
\usetheme{Singapore}

\makeatletter
\beamer@theme@subsectiontrue
\makeatother

%------------------------------------%
\begin{document}

\section{Section 1}
\subsection{Subsection 1.1}
\begin{frame}
\begin{itemize}
    \item Text
\end{itemize}
\end{frame}

\subsection{Subsection 1.2}
\begin{frame}
\begin{itemize}
    \item Text
\end{itemize}
\end{frame}


\section{Section 2}
\subsection{Subsection 2.1}
\begin{frame}
\begin{itemize}
    \item Text
\end{itemize}
\end{frame}

\subsection{Subsection 2.2}
\begin{frame}
\begin{itemize}
    \item Text
\end{itemize}
\end{frame}


\section{Section 3}
\subsection{Subsection 3.1}
\begin{frame}
\begin{itemize}
    \item Text
\end{itemize}
\end{frame}

\subsection{Subsection 3.2}
\begin{frame}
\begin{itemize}
    \item Text
\end{itemize}
\end{frame}



\end{document}

前任:

答案1

虽然不是完美的对齐,但是如果您的章节/小节标题的长度差别不是太大,则应该将小节放置在章节的大致下方:

\documentclass[compress]{beamer}

\usepackage{pgffor}
\makeatletter
\setbeamercolor{section in head/foot}{use=structure,bg=structure.fg!25!bg}

\useoutertheme[subsection=true]{miniframes}

% total number of sections %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{totcount}
\newcounter{totalsection}
\regtotcounter{totalsection}

\AtBeginDocument{%
  \pretocmd{\section}{\refstepcounter{totalsection}}{}{}%
}%

\setbeamertemplate{headline}{%
  \begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
  \end{beamercolorbox}
  \begin{beamercolorbox}{section in head/foot}
    \vskip2pt\insertnavigation{\paperwidth}\vskip2pt
  \end{beamercolorbox}%
  \ifbeamer@theme@subsection%
    \begin{beamercolorbox}[colsep=1.5pt]{middle separation line head}
    \end{beamercolorbox}
    \begin{beamercolorbox}[ht=5pt]{subsection in head/foot}
    \makebox[\paperwidth]{    
      \usebeamercolor[fg]{subsection in head/foot}
      \usebeamerfont{subsection in head/foot}%
      \mbox{}\hfilneg\hfilneg\foreach \x in {1,...,\thesection}{\hfil}%
      \insertsubsectionhead
      \foreach \x in {\thesection,...,\totvalue{totalsection}}{\hfil}\hfilneg\hfilneg\mbox{}%
    }%
    \end{beamercolorbox}
  \fi%
  \begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
  \end{beamercolorbox}
}


\setbeamertemplate{frametitle}[default][center]

\AtBeginDocument{%
  {
    \usebeamercolor{section in head/foot}
  }
  
  \pgfdeclareverticalshading{beamer@headfade}{\paperwidth}
  {%
    color(0cm)=(bg);
    color(1.25cm)=(section in head/foot.bg)%
  }

  \setbeamercolor{section in head/foot}{bg=}
}

\addtoheadtemplate{\pgfuseshading{beamer@headfade}\vskip-1.25cm}{}

\beamertemplatedotitem

\makeatother

%------------------------------------%
\begin{document}

\section{Section 1}
\subsection{Subsection 1.1}
\begin{frame}
\begin{itemize}
    \item Text
\end{itemize}
\end{frame}

\subsection{Subsection 1.2}
\begin{frame}
\begin{itemize}
    \item Text
\end{itemize}
\end{frame}


\section{Section 2}
\subsection{Subsection 2.1}
\begin{frame}
\begin{itemize}
    \item Text
\end{itemize}
\end{frame}

\subsection{Subsection 2.2}
\begin{frame}
\begin{itemize}
    \item Text
\end{itemize}
\end{frame}


\section{Section 3}
\subsection{Subsection 3.1}
\begin{frame}
\begin{itemize}
    \item Text
\end{itemize}
\end{frame}

\subsection{Subsection 3.2}
\begin{frame}
\begin{itemize}
    \item Text
\end{itemize}
\end{frame}

\end{document}

在此处输入图片描述

相关内容