在 Beamer 中对齐章节和子章节导航

在 Beamer 中对齐章节和子章节导航

我想在部分幻灯片上包含子部分导航(通过\insertsubsectionnavigation),并将其与当前部分对齐。但是我无法正确对齐它们,请参见下文。

在此处输入图片描述

关于如何使“方法 A”与“方法论”处于同一条线上,您有什么想法吗?

梅威瑟:

\documentclass[aspectratio=43]{beamer}

\usepackage{pbox}
\setbeamercolor{section in head/foot}{fg=white}
\setbeamertemplate{section in head/foot}{%
        \usebeamerfont{sectionpage}\usebeamercolor[fg]{titlepages}\raggedright%
        \huge\insertsectionhead%
      \hspace{0.1\textwidth}%
      \begin{minipage}[b]{0.5\textwidth}
        \large\insertsubsectionnavigation{\linewidth}
      \end{minipage}
}
\setbeamertemplate{section in head/foot shaded}{%
    \pbox[c][4ex][c]{0.2\textwidth}{%
      %
      \color{black!75}\Large\centering\insertsectionhead%
    }\hspace*{1pt}%
}
\setbeamercolor{subsection in head/foot}{fg=white}
\setbeamertemplate{subsection in head/foot}{%
    \footnotesize\hspace*{-1pt}\setlength\fboxsep{0pt}%
    \pbox[c][4ex][c]{\textwidth}{%
            \centering\small\insertsubsectionhead%
    }\hspace*{1pt}%
}
\setbeamertemplate{subsection in head/foot shaded}{%
    \footnotesize \hspace*{-1pt}\setlength\fboxsep{0pt}%
    \pbox[c][4ex][c]{\textwidth}{%
      %
      \color{black!75}\small\insertsubsectionhead%
    }\hspace*{1pt}%
}

\AtBeginSection[]{%
        {\setbeamercolor{background canvas}{bg=blue!50}%
        \frame{%
            \huge\insertsectionnavigation{0.6\linewidth}{}{}%
            \addtocounter{framenumber}{-1}}}%
        }

\AtBeginSubsection[]{{\setbeamercolor{background canvas}{bg=blue!50}\frame{\mbox{}\hspace{0.1\textwidth}Subsection \thesubsection\addtocounter{framenumber}{-1}}}}

\begin{document}

\section*{Overview}

\begin{frame}{Overview}

\end{frame}

\section{Methodology}

\subsection{Method A}

\begin{frame}{Method A is good}

    Total: \inserttotalframenumber

\end{frame}

\subsection*{Method B}

\begin{frame}{Method B is better}

    Because it is better.

\end{frame}

\subsection*{Method C}

\begin{frame}{Method C is the best}

    Because it is the best.

\end{frame}

\section{Results}

\subsection*{Preliminary results}

\begin{frame}{Early results}

    Not good.

\end{frame}

\subsection*{Final results}

\begin{frame}{These results are beautiful.}

    Perfect.

\end{frame}

\end{document}

答案1

快速破解:

\documentclass[aspectratio=43]{beamer}

\usepackage{pbox}
\setbeamercolor{section in head/foot}{fg=white}
\setbeamertemplate{section in head/foot}{%
        \usebeamerfont{sectionpage}\usebeamercolor[fg]{titlepages}\raggedright%
        \huge\insertsectionhead%
      \hspace{0.1\textwidth}%
      \begin{minipage}[b][.5\textheight][t]{0.5\textwidth}
        \vspace*{4.3cm}
        \large\insertsubsectionnavigation{\linewidth}
      \end{minipage}
}
\setbeamertemplate{section in head/foot shaded}{%
    \pbox[c][4ex][c]{0.2\textwidth}{%
      %
      \color{black!75}\Large\centering\insertsectionhead%
    }\hspace*{1pt}%
}
\setbeamercolor{subsection in head/foot}{fg=white}
\setbeamertemplate{subsection in head/foot}{%
    \footnotesize\hspace*{-1pt}\setlength\fboxsep{0pt}%
    \pbox[c][4ex][c]{\textwidth}{%
            \centering\small\insertsubsectionhead%
    }\hspace*{1pt}%
}
\setbeamertemplate{subsection in head/foot shaded}{%
    \footnotesize \hspace*{-1pt}\setlength\fboxsep{0pt}%
    \pbox[c][4ex][c]{\textwidth}{%
      %
      \color{black!75}\small\insertsubsectionhead%
    }\hspace*{1pt}%
}

\AtBeginSection[]{%
        {\setbeamercolor{background canvas}{bg=blue!50}%
        \frame{%
            \huge\insertsectionnavigation{0.6\linewidth}{}{}%
            \addtocounter{framenumber}{-1}}}%
        }

\AtBeginSubsection[]{{\setbeamercolor{background canvas}{bg=blue!50}\frame{\mbox{}\hspace{0.1\textwidth}Subsection \thesubsection\addtocounter{framenumber}{-1}}}}

\begin{document}

\section*{Overview}

\begin{frame}{Overview}

\end{frame}

\section{Methodology} % if this does not have a star, it works.

\subsection{Method A}
    \subsection{Method A}
        \subsection{Method A}
            \subsection{Method A}
                \subsection{Method A}
                    \subsection{Method A}

\begin{frame}{Method A is good}

    Total: \inserttotalframenumber

\end{frame}

\subsection*{Method B}

\begin{frame}{Method B is better}

    Because it is better.

\end{frame}

\subsection*{Method C}

\begin{frame}{Method C is the best}

    Because it is the best.

\end{frame}

\section{Results}

\subsection*{Preliminary results}

\begin{frame}{Early results}

    Not good.

\end{frame}

\subsection*{Final results}

\begin{frame}{These results are beautiful.}

    Perfect.

\end{frame}

\end{document}

在此处输入图片描述

相关内容