更正 Beamer 目录中的缩进部分

更正 Beamer 目录中的缩进部分

下列的在 Beamer 的目录中缩进子章节LaTeX Beamer 类 / Bugtracker / 目录中的缩进 - ID:2882539我想纠正这样的行为:如果章节标题超出了当前行,新行就不会正确缩进 - 新行应该与第一行(第一行的文本,而不是项目符号)对齐。

示例结果

示例(结果见上文):

\documentclass[xcolor=x11names,compress]{beamer}


%% Beamer Layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\useoutertheme[subsection=false,shadow]{miniframes}
\setbeamertemplate{footline}[page number]
\useinnertheme{default}
%\usefonttheme{serif}
\usepackage{palatino}

\setbeamerfont{title like}{shape=\scshape}
\setbeamerfont{frametitle}{shape=\scshape}

\setbeamercolor*{lower separation line head}{bg=DeepSkyBlue4} 
\setbeamercolor*{normal text}{fg=black,bg=white} 
\setbeamercolor*{alerted text}{fg=red} 
\setbeamercolor*{example text}{fg=black} 
\setbeamercolor*{structure}{fg=black} 

\setbeamercolor*{palette tertiary}{fg=black,bg=black!10} 
\setbeamercolor*{palette quaternary}{fg=black,bg=black!10} 

\renewcommand{\(}{\begin{columns}}
\renewcommand{\)}{\end{columns}}
\newcommand{\<}[1]{\begin{column}{#1}}
\renewcommand{\>}{\end{column}}
\setbeamertemplate{section in toc}[sections numbered]

%% Document %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\begin{frame}{Agenda}
\setcounter{tocdepth}{1}
\tableofcontents
\end{frame}

\begin{frame}
\section{\scshape This is an example for a very very long Sectiontitle bla bla bla}

\end{frame}

\begin{frame}
\section{\scshape Short Title2}

\end{frame}

\end{document}

答案1

section in toc带有选项的模板的默认定义sections numbered非常简单(在文件中beamerbaseauxtemplates.sty):

\defbeamertemplate{section in toc}{sections numbered}
{\leavevmode\inserttocsectionnumber. \inserttocsection\par}

使用所需的格式定义您自己的变体:

\documentclass[xcolor=x11names,compress]{beamer}


%% Beamer Layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\useoutertheme[subsection=false,shadow]{miniframes}
\setbeamertemplate{footline}[page number]
\useinnertheme{default}
%\usefonttheme{serif}
\usepackage{palatino}

\setbeamerfont{title like}{shape=\scshape}
\setbeamerfont{frametitle}{shape=\scshape}

\setbeamercolor*{lower separation line head}{bg=DeepSkyBlue4} 
\setbeamercolor*{normal text}{fg=black,bg=white} 
\setbeamercolor*{alerted text}{fg=red} 
\setbeamercolor*{example text}{fg=black} 
\setbeamercolor*{structure}{fg=black} 

\setbeamercolor*{palette tertiary}{fg=black,bg=black!10} 
\setbeamercolor*{palette quaternary}{fg=black,bg=black!10} 

\defbeamertemplate{section in toc}{mysections numbered}
{\leavevmode\parbox[t]{2em}{\inserttocsectionnumber.}\parbox[t]{\dimexpr\textwidth-2em\relax}{\inserttocsection}\par}

\renewcommand{\(}{\begin{columns}}
\renewcommand{\)}{\end{columns}}
\newcommand{\<}[1]{\begin{column}{#1}}
\renewcommand{\>}{\end{column}}
\setbeamertemplate{section in toc}[mysections numbered]

%% Document %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\begin{frame}{Agenda}
\setcounter{tocdepth}{1}
\tableofcontents
\end{frame}

\begin{frame}
\section{\scshape This is an example for a very very long Sectiontitle bla bla bla}

\end{frame}

\begin{frame}
\section{\scshape Short Title2}

\end{frame}

\end{document}

在此处输入图片描述

相关内容