目录中的简短章节名称

目录中的简短章节名称

如何在目录中显示简短的章节名称?

\documentclass{beamer}

\begin{document}

    \begin{frame}
        \tableofcontents
    \end{frame}

    \section[short title]{long title}
    \frame{}

\end{document}

在此处输入图片描述

根据https://tex.stackexchange.com/a/200141/36296从理论上来说这应该可行,还是我读错了答案?

答案1

现在,beamer插入目录和导航条目以匹配强制分段命令。您必须分别修补每个分段单元才能“修复”此问题:

在此处输入图片描述

\documentclass{beamer}
\usepackage{etoolbox}
\makeatletter
% Insert [short title] for \section in ToC
\patchcmd{\beamer@section}{{#2}{\the\c@page}}{{#1}{\the\c@page}}{}{}
% Insert [short title] for \section in Navigation
\patchcmd{\beamer@section}{{\the\c@section}{\secname}}{{\the\c@section}{#1}}{}{}
% Insert [short title] for \subsection in ToC
\patchcmd{\beamer@subsection}{{#2}{\the\c@page}}{{#1}{\the\c@page}}{}{}
% Insert [short title] for \subsection  in Navigation
\patchcmd{\beamer@subsection}{{\the\c@subsection}{#2}}{{\the\c@subsection}{#1}}{}{}
\makeatother
\begin{document}

\begin{frame}
  \tableofcontents
\end{frame}

\section[short section]{long section}
\subsection[short subsection]{long subsection}
\frame{}

\end{document}

\beamer@section[#1]{#2}和的作用与常规和\beamer@subsection[#1]{#2}非常相似,分别写入和辅助文件。上述操作在写入辅助文件时将强制文件切换为可选文件。\section[#1]{#2}\subsection[#1]{#2}#2.toc.nav\patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}

相关内容