“快速通道内容”的格式(附加目录)

“快速通道内容”的格式(附加目录)

这个问题是另一个问题,我询问如何在仅显示部分选定章节的文档中添加附加目录(“快速跟踪目录”)。根据罗伯特的回答,我得到了以下两个目录:

普通目录 + 快速通道目录

这真是太棒了。但是,我意识到这些部分的名称并没有清楚地表明它们属于哪个章节。是否可以使快速通道目录看起来类似于正常目录(相同/相似的格式),在快速通道部分之前显示章节(如果可能的话,没有页码)?像这样的东西会很棒:

带章节名称的快速目录(不带章节页码)

我不太了解 fastrack ToC 的代码,但通过类比,我设法将章节包含在其中。然而,我无法控制它的外观、缩进,也无法让它不显示页码。

以下是目前的代码:

\documentclass[11pt, a4paper, oneside]{report}
\usepackage[left=4cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{hyperref}
\usepackage{tocloft}

\newlistof[chapter]{fasttrack}{ftk}{Fast track contents} % Define the list of fast... 

\newcommand{\fasttracksection}[1]{% This is the special section 
  \section{#1}
  \addcontentsline{ftk}{fasttrack}{\protect\numberline{\thefasttrack}\quad #1}}
  
\newcommand{\fasttrackchapter}[1]{% This is the special section 
  \chapter{#1}
  \addcontentsline{ftk}{fasttrack}{\protect\numberline{\thefasttrack}\quad #1}}

\renewcommand{\thefasttrack}{\thesection}


\begin{document}

\tableofcontents

\listoffasttrack

  \fasttrackchapter{This is Chapter1} 
    \fasttracksection{This is Section1.1} % Fast track
    \fasttracksection{This is Section1.2} % Fast track
    \fasttracksection{This is Section1.3} % Fast track

  \fasttrackchapter{This is Chapter2}
    \section{This is Section2.1}
    \fasttracksection{This is Section2.3} % Fast track
    \section{This is Section2.3}

  \fasttrackchapter{This is Chapter3}
    \section{This is Section3.1}
    \fasttracksection{This is Section3.2} % Fast track
    \section{This is Section3.3}


\end{document}

答案1

有了罗伯特的评论(谢谢!)和一点点乱七八糟的东西,我就可以按预期制作布局。我确信编码很糟糕,但可能会对某些人有所帮助:

\documentclass[11pt, a4paper, oneside]{report}

\usepackage[left=4cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{tocloft} \newlistof[chapter]{fasttrack}{ftk}{Fast track contents} % Define the list of fast... 

\newcommand{\fasttracksection}[1]{% This is the special section
\section{#1}
\addcontentsline{ftk}{fasttrack}{\protect\numberline{~\quad\thefasttrack}~\quad~#1}}

\newcommand{\fasttrackchapter}[1]{% This is the special chapter
\chapter{#1}
\addtocontents{ftk}{\bigskip\textbf{\thechapter~~#1}}}

\renewcommand{\thefasttrack}{\thesection}


\begin{document}

\tableofcontents

\listoffasttrack


  \fasttrackchapter{This is Chapter1} 
    \fasttracksection{This is Section1.1} % Fast track
    \fasttracksection{This is Section1.2} % Fast track
    \fasttracksection{This is Section1.3} % Fast track

  \fasttrackchapter{This is Chapter2}
    \section{This is Section2.1}
    \fasttracksection{This is Section2.3} % Fast track
    \section{This is Section2.3}

  \fasttrackchapter{This is Chapter3}
    \section{This is Section3.1}
    \fasttracksection{This is Section3.2} % Fast track
    \section{This is Section3.3}


\end{document}

最终结果如下:

普通 ToC + 快速通道 ToC


编辑:我设法添加了一个命令以将子部分包含在快速通道目录中(尽管它给出了一个我不理解的警告“LaTeX 错误:命令 \thefasttracksub 未定义”):

\documentclass[11pt, a4paper, oneside]{report}

\usepackage[left=4cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{hyperref}

\usepackage{tocloft}
\newlistof[chapter]{fasttrack}{ftk}{Fast track contents} % Define the list of fast... 

\newcommand{\fasttracksection}[1]{% This is the special section 
  \section{#1}
  \addcontentsline{ftk}{fasttrack}{\protect\numberline{~\quad\thefasttrack}~\quad ~#1}}
  
\newcommand{\fasttrackchapter}[1]{% This is the special section 
  \chapter{#1}
\numberline{\thefasttrack}\quad #1}}
  \addtocontents{ftk}{\bigskip\textbf{\thechapter~~#1}}}
  
  \newcommand{\fasttracksubsection}[1]{% This is the special section 
  \subsection{#1}
  \addcontentsline{ftk}{fasttrack}{\protect\numberline{~\quad~\quad\thefasttracksub}\quad\quad\quad~~#1}}


\renewcommand{\thefasttracksub}{\thesubsection}
\renewcommand{\thefasttrack}{\thesection}



\begin{document}

\tableofcontents

\listoffasttrack


  \fasttrackchapter{This is Chapter1} 
    \fasttracksection{This is Section1.1} % Fast track
    \subsection{This is Subsection1.1.1}
    \fasttracksection{This is Section1.2} % Fast track
    \fasttracksection{This is Section1.3} % Fast track

  \fasttrackchapter{This is Chapter2}
    \section{This is Section2.1}
    \fasttracksection{This is Section2.3} % Fast track
    \fasttracksubsection{This is Subsection2.3.1} % Fast track
    \section{This is Section2.3}

  \fasttrackchapter{This is Chapter3}
    \section{This is Section3.1}
    \fasttracksection{This is Section3.2} % Fast track
    \section{This is Section3.3}


\end{document}

结果如下:

包含快速通道子部分的示例

相关内容