Beamer - 如何使用编号目录来获得子部分缩进?

Beamer - 如何使用编号目录来获得子部分缩进?

我刚开始使用 LaTeX,并试图弄清楚 beamer。我想要一个目录,每个深度都缩进,基本上是子部分列表!这就是我目前得到的!

\documentclass{beamer}
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{lastpage}
\usepackage{alltt}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{atbegshi}
\usepackage{tikz}
%Theme------------------------------------------------------------------
\useoutertheme{shadow}
\useinnertheme{rounded}
\usecolortheme{beaver}
%Custum Footline--------------------------------------------------------
\setbeamertemplate{footline}        %found this on the forum and tweaked it a bit, from here
{
  \leavevmode%
  \hbox{%
   \begin{beamercolorbox}[wd=.25\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertinstitute
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\inserttitle
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.25\paperwidth,ht=2.25ex,dp=1ex,center]{date in head/foot}%
    \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatother                    %to here
%Title frame info-------------------------------------------------------
\title{Conception et fabrication d'une imprimante 3D}
\subtitle{Soutenance de Projet Tuteur\'e semestre deux}
\author{W, Y \\X, Z}
\institute{My Uni}
\date{29 Mai 2017}
%Filigrane--------------------------------------------------------------
\newcommand{\filigrane}{\begin{tikzpicture}[remember picture,overlay]
\node [rotate=0,scale=1,text opacity=0.08]
at (current page.center) {\includegraphics[height=7cm]{FiligranePic.jpg}};
\end{tikzpicture}}[![enter image description here][1]][1]
%Numbered TOC-----------------------------------------------------------
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]
%Document---------------------------------------------------------------
\begin{document}                                                        
\maketitle
\setbeamertemplate{background canvas}{\filigrane}
\begin{frame}\frametitle{Sommaire}
    \tableofcontents
\end{frame}
...
\end{document}

可怕的结果

答案1

默认情况下,编号小节的定义包含\leftskip=2em,因此要缩进编号小节,请增加此值:

\documentclass{beamer}

\useoutertheme{shadow}
\useinnertheme{rounded}
\usecolortheme{beaver}

\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}{\leavevmode\leftskip=3.2em\rlap{\hskip-2em\inserttocsectionnumber.\inserttocsubsectionnumber}\inserttocsubsection\par}

\begin{document}                                                        

\begin{frame}
    \frametitle{Sommaire}
    \tableofcontents
\end{frame}

\section{sec}
\subsection{sub}
\section{sec}

\begin{frame}
    abc
\end{frame}

\end{document}

在此处输入图片描述

相关内容