Background:
I am creating a compilation of multiple IEEE format articles. This compilation will have a single table of contents. Each paper includes a title and \maketitle
command. I would like the TOC to include the title of each paper as the primary level, along with all the sections/subsections etc.
\documentclass[journal]{IEEEtran}
\begin{document}
\onecolumn
\tableofcontents
\twocolumn
% Title and Author information Paper 1
\title{Title 1}
\author{Author 1}
% Make the title area
\maketitle
$ Paper Content
% Title and Author information Paper 2
\title{Title 2}
\author{Author 2}
% Make the title area
\maketitle
$ Paper Content
\end{document}
Should generate a TOC that approximates this:
-
Title 1
I – Section 1
I-A Subsection 1
I-B Subsection 2
II – Section 2
-
Title 2
I – Section 1
I-A Subsection 1
I-B Subsection 2
II – Section 2
Question:
How can I modify the TOC to include titles?
I am open to other suggestions. I realize that the ieeetran or other article/journal classes do not use \chapter
or \part
commands, but if there was a way to force this operation while not changing the class, I would be interested in such a solution as well.
Best Answer
\maketitle
is a command, which 'disables' itself right before the end of the macro (well, it is\relax
ed then). As such, a further call to this macro will provide nothing. By using a patch command, this\let\maketitle\relax
can be catched and a\addcontentsline
command injected instead, which will do the ToC entry then.I further introduced a
titlecounter
counter, which is automatically refstepped, so that\label
should also work. The format of the ToC entry is quite simple at the moment -- change at will.Mico had an important objection: There should be a
\clearpage
right at the start of the\maketitle
command, which will shipout possible floats from the preceeding article. However, I restricted this behaviour to the 2nd etc.\maketitle
.Version with level indentation
Use
\setlength{\articlesectionindent}{10pt}
(or any other appropiate value), in order to get the indentation of levels relative to the title toc entry.The resetting of sections etc. is done with the command
\@addtoreset{section}{titlecounter}
, i.e. each time thetitlecounter
is stepped, the sections are reset (and consecutively the subsections etc. as well)** Warning ** Both versions will fail in conjunction with
hyperref
package. It's some issue with the\footnotemark
command.