设置标题第一行对面的投影仪部分编号

设置标题第一行对面的投影仪部分编号

我希望我的章节页码位于章节名称的第一行,就像这样。 我怎样才能做到这一点?

我的文档代码:

\documentclass[10pt, aspectratio=43]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}

\usetheme{metropolis}

\newcounter{sectionpage}

\makeatletter
\long\def\beamer@section[#1]#2{%
  \beamer@savemode%
  \mode<all>%
  \ifbeamer@inlecture
    \refstepcounter{section}%
    \beamer@ifempty{#2}%
    {\long\def\secname{#1}\long\def\lastsection{#1}}%
    {\global\advance\beamer@tocsectionnumber by 1\relax%
      \long\def\secname{#2}%
      \long\def\lastsection{#1}%
    \setcounter{sectionpage}{\insertframenumber}\stepcounter{sectionpage}%
      \addtocontents{toc}{\protect\beamer@sectionintoc{\the\c@section}{#2\hfill\thesectionpage}{\the\c@page}{\the\c@part}%
        {\the\beamer@tocsectionnumber}}}%
    {\let\\=\relax\xdef\sectionlink{{Navigation\the\c@page}{\noexpand\secname}}}%
    \beamer@tempcount=\c@page\advance\beamer@tempcount by -1%
    \beamer@ifempty{#1}{}{%
      \addtocontents{nav}{\protect\headcommand{\protect\sectionentry{\the\c@section}{#1}{\the\c@page}{\secname}{\the\c@part}}}%
      \addtocontents{nav}{\protect\headcommand{\protect\beamer@sectionpages{\the\beamer@sectionstartpage}{\the\beamer@tempcount}}}%
      \addtocontents{nav}{\protect\headcommand{\protect\beamer@subsectionpages{\the\beamer@subsectionstartpage}{\the\beamer@tempcount}}}%
    }%
    \beamer@sectionstartpage=\c@page%
    \beamer@subsectionstartpage=\c@page%
    \def\insertsection{\expandafter\hyperlink\sectionlink}%
    \def\insertsubsection{}%
    \def\insertsubsubsection{}%
    \def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}%
    \def\insertsubsectionhead{}%
    \def\insertsubsubsectionhead{}%
    \def\lastsubsection{}%
    \Hy@writebookmark{\the\c@section}{\secname}{Outline\the\c@part.\the\c@section}{2}{toc}%
    \hyper@anchorstart{Outline\the\c@part.\the\c@section}\hyper@anchorend%
    \beamer@ifempty{#2}{\beamer@atbeginsections}{\beamer@atbeginsection}%
  \fi%
  \beamer@resumemode}%

\AtBeginSection[]
{
    \begin{frame}<beamer>
        \frametitle{\LARGE{TOC}}
        \tableofcontents[currentsection,currentsubsection]
    \end{frame}
}

\begin{document}
\section{Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name}
\end{document}

答案1

您可以将页码放在表格的单独单元格中:

\documentclass{beamer}

\usetheme{moloch}% modern fork of the metropolis theme
\usepackage{tabularx}

\AtBeginSection[]{%
    \begin{frame}<beamer>
    \setbeamerfont{frametitle}{size=\LARGE}
    \frametitle{TOC}
    \begin{tabularx}{\textwidth}{X r}
        \insertsectionhead & \insertsectionstartpage\\  
    \end{tabularx}
    \end{frame}
}

\begin{document}
\section{Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name Section name}

\end{document}

enter image description here

相关内容