Tocloft - 使用標題選項時單獨變更標題格式列表

Tocloft - 使用標題選項時單獨變更標題格式列表

我使用套件定義了一些新的清單tocloft並使用了提供的titles選項,但我只希望目錄看起來像我的章節之一。我的自訂清單應該看起來像是沒有數字的部分 ( \section*)。有沒有辦法在使用該titles選項時更改清單中某些標題的格式?

\documentclass[twosite]{scrbook}
\usepackage[titles]{tocloft}
\newlistof[chapter]{som}{exp}{List of Something}
\newcommand{\something}[1]{%
\refstepcounter{som}
   \par\noindent{Som.\hspace{1ex}\thesom:\hspace{1em}#1}
   \addcontentsline{exp}{som}{\textbf{Som.\hspace{1ex}\protect\numberline{\thesom}:} #1}\par
}
\begin{document}
   \something{Something is more than nothing}
   \listofsom
\end{document}

答案1

我不確定真正的問題,但這提供了\section*自訂\listofsom 命令的樣式標題。

\listof...通常與( 或)\chapter*一起使用命令。使用package 和它可以輕鬆地替換by定義中的命令。book.clsscrbook.clsxpatch\xpatchcmd\chapter*\listof...section*

\documentclass[twoside]{scrbook}
\usepackage[titles]{tocloft}
\usepackage{xpatch}
\newlistof[chapter]{som}{exp}{List of Something}

\newcommand{\something}[1]{%
\refstepcounter{som}
   \par\noindent{Som.\hspace{1ex}\thesom:\hspace{1em}#1}
   \addcontentsline{exp}{som}{\textbf{Som.\hspace{1ex}\protect\numberline{\thesom}:} #1}\par
}


\xpatchcmd{\listofsom}{\chapter*}{\section*}{}{}

\begin{document}
   \tableofcontents
   \chapter{First}

   \something{Something is more than nothing}
   \noindent Now the list of somethings 
   \listofsom
\end{document}

在此輸入影像描述

相關內容