I have a document in IEEE (conf) format and I want to add a new environment using tocloft. The relevant code looks like this (slightly abbreviated):

\newcommand{\listexampletitle}{List of Examples}
% FIXME: Should be styled as a "normal" subsection
% FIXME: Remove page numbers
\newcommand{\example}[1]{\examplelist{#1}\textbf{Example}: #1}
\section{A section}
\example{A first example}

And the result looks something like this:

Output of the code above

Despite using the titles option with \usepackage[titles]{tocloft} the heading for the list of examples looks like a \section* rather than a \section. This makes sense as a default, usually a table would be generated as part of the front matter of a book. However, I would like that heading to be a normal \section since it will appear in the middle of the document. Is this possible?

Secondly, how can the page numbers against each item in the \listofexamples be removed, so only the examples themselves are listed?

  • 1
    I think minitoc package is of more use here
    – user31729
    Commented Aug 21, 2014 at 16:38
  • Thanks. I had a brief look at the minitoc documentation. I can see how it would work for reformatting a list of figures or a ToC, but I couldn't see how it could be used for a completely new list. Have I missed something obvious here?
    – snim2
    Commented Aug 22, 2014 at 9:53

2 Answers 2


The first part of this question can be resolved by incrementing the section counter automatically and inserting it into the table title manually, like this:

\newcommand{\listexampletitle}{\addtocounter{section}{1}\thesection.~List of Examples}

The second part of this question (how to remove the page numbers) can be answered by using the \cftpagenumbersoff{XXX} macro (where XXX is the long-form name of the new list).

In this case the corrected code looks like this:

\newcommand{\listexampletitle}{\addtocounter{section}{1}\thesection.~List of Examples}



\newcommand{\example}[1]{\examplelist{#1}\textbf{Example \theexamples}: #1}

\cftpagenumbersoff{examples} % Don't print page numbers with examples
\setlength{\cftexamplesnumwidth}{1.5cm} % Add space around example numbers

The result looks like this:

enter image description here


That the first part of the question requires such a hack method to solve is really unfortunate. tocloft is set up to define its very own heading formatting, and titles simply turns that off to use whatever is defined by the class (e.g. \section*). So there's no way within tocloft (yet) to change that to an unstarred section.

I've added an issue in its Github page to address this.

To get this working now, you can redefine the \listofexamples command: (its definition is fairly understandable)


Alternatively, the \patchcmd command from toolbox is really good for this sort of fix:

  • Many thanks for this, Will. The answer here also recommends using etoolbox to resolve what I now realise is the same problem. Great to here that you've added the problem to the package Issues list.
    – snim2
    Commented Aug 30, 2014 at 21:22

You must log in to answer this question.

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