3

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

1 Answer 1

3

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

1
  • That is exactly what I wanted, thanks for your fast response!
    – AstronAUT
    Dec 4, 2014 at 21:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .