2

I defined some new listofs with the tocloft package and used the provided titles option, but I only want the ToC to look like one of my chapters. My custom listofs should look like sections without numbers (\section*). Is there a way to change the format of certain titles of listofs while using the titles option?

\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}
  • If I understand your question correctly: You want to have a section like ToC header for your \listofsom command? – user31729 Dec 4 '14 at 21:20
  • Yes, I want the header for the \listofsom command to look and work like a normal section. – AstronAUT Dec 4 '14 at 21:25
  • Please have a look on my possible solution – user31729 Dec 4 '14 at 21:29
  • By the way, the twosite option should read twoside ;-) – user31729 Dec 4 '14 at 21:34
  • Hmm, why does it work then? :-) – AstronAUT Dec 4 '14 at 21:37
2

I am not sure about the real question, but this provides a \section* style heading for the custom \listofsom command.

\listof... usually use a \chapter* command when used in conjunction with the book.cls (or scrbook.cls). Using xpatch package and its \xpatchcmd it's easy to replace the \chapter* command in the definition of \listof... by 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}

enter image description here

| improve this answer | |
  • That is exactly what I wanted, thanks for your fast response! – AstronAUT Dec 4 '14 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.