目录选项

目录选项

我希望目录仅突出显示当前子节,隐藏其他节的子节。我发现解决方案beamer模板中有效,但在其他模板中无效。我该怎么办?

这是我设置目录的风格:

% tableofcontents options
\setcounter{toclevel}{2}
\setcounter{tocncols}{1}
\def\contentsname{Outline}
\def\tocitem{$\bullet$}
\def\tocitemi{\textbf{--}}
\def\tocitemii{\textbf{--}}

% tableofcontents
\setcounter{tocdepth}{3}
\def\tableofcontents{
\begin{frame}[\hypertarget{toc}{\contentsname}]
\raggedright
\ifnum\thetocncols>1 \begin{multicols}{\thetocncols} \fi
\renewcommand {\labelitemi}{\tocitem}
\begin{itemize}\parskip0pt
\@input{\jobname.toc}%
\end{itemize}
\ifnum\thetocncols>1 \end{multicols} \fi
\end{frame}
}
\def\contentsline#1{
\csname l@#1\endcsname
}
\def\l@section#1#2#3{
\ifnum\c@toclevel>0
\item
\ifnum\thepage=#2
\hyperlink{#3}{\textcolor{red}{\bf#1}}
\else
\hyperlink{#3}{#1}
\fi\fi
}
\def\l@subsection#1#2#3{
\ifnum\c@toclevel>1
\ifnum\thepage=#2
\\\hyperlink{#3}{\hspace{1pt}\tocitemi\hspace{10pt}\textcolor{red}{\bf#1}}
\else
\\\hyperlink{#3}{\hspace{1pt}\tocitemi\hspace{10pt}#1}
\fi\fi
}
\def\l@subsubsection#1#2#3{
\ifnum\c@toclevel>2
\ifnum\thepage=#2
\\\hyperlink{#3}{\hspace{24pt}\tocitemii\hspace{10pt}\textcolor{red}{\bf#1}}
\else
\\\hyperlink{#3}{\hspace{24pt}\tocitemii\hspace{10pt}#1}
\fi\fi
}

相关内容