## 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:

1. Title 1

I - Section 1

I-A Subsection 1

I-B Subsection 2

II - Section 2

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.

• Welcome to TeX.SX!. Please turn your example into a compilable one! – user31729 Sep 25 '14 at 20:13

\maketitle is a command, which 'disables' itself right before the end of the macro (well, it is \relaxed 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.

\documentclass[journal]{IEEEtran}

\usepackage{etoolbox}%
\usepackage{xpatch}
\usepackage{blindtext}

\makeatletter
\newcounter{titlecounter}
\xpretocmd{\maketitle}{\ifnumgreater{\value{titlecounter}}{1}}{\clearpage}{}{} % Well, this is lazy at the end ;-)

\makeatother
\begin{document}
\onecolumn
\tableofcontents
\twocolumn

% Title and Author information  Paper 1
\title{Title 1}
\author{Author 1}
% Make the title area
\maketitle
\blindtext[10]
%$Paper Content % Title and Author information Paper 2 \title{Title 2} \author{Author 2} % Make the title area \maketitle \blindtext[20] %$ Paper Content

\end{document}


## 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 the titlecounter is stepped, the sections are reset (and consecutively the subsections etc. as well)

\documentclass[journal]{IEEEtran}

\usepackage{etoolbox}%
\usepackage{xpatch}
\usepackage{blindtext}
\usepackage{tocloft}%

\newlength{\articlesectionshift}%
\setlength{\articlesectionshift}{10pt}%

\makeatletter
\newcounter{titlecounter}
\xpretocmd{\maketitle}{\ifnumgreater{\value{titlecounter}}{1}}{\clearpage}{}{} % Well, this is lazy at the end ;-)
\xpatchcmd{\maketitle}{\let\maketitle\relax\let\@maketitle\relax}{\refstepcounter{titlecounter}\begingroup

\makeatother
\begin{document}
\onecolumn
\tableofcontents
\twocolumn

% Title and Author information  Paper 1
\title{Title 1}
\author{Author 1}
% Make the title area
\maketitle

\section{First}
\subsection{First subsection of 1st section}%
\subsection{2nd subsection of 1st section}%
\subsection{3rd subsection of 1st section}%
\subsection{4th subsection of 1st section}%

\blindtext[10]
\section{Two}
\subsection{First subsection of 2nd section}%

% Title and Author information  Paper 2
\title{Title 2}
\author{Author 2}
% Make the title area
\maketitle
\section{First from second paper}
\subsection{First subsection of 2nd section of 2nd article}%

\blindtext[20]

%\$ Paper Content

\end{document}


** Warning ** Both versions will fail in conjunction with hyperref package. It's some issue with the \footnotemark command.

• Should you maybe also provide \clearpage (or \cleardoublepage) instructions just ahead of the \maketitle instructions? – Mico Sep 25 '14 at 20:27
• @Mico: To get the correct pagenumbering? – user31729 Sep 25 '14 at 20:29
• I'm guessing that every article should start on a new page. However, I'll concede that the OP didn't actually say so. – Mico Sep 25 '14 at 20:31
• @Mico: There are \newpage instructions in the IEEEtran version of \maketitle. But \clearpage would be better, perhaps, yes. Currently, each article starts with a new page – user31729 Sep 25 '14 at 20:34
• Perfect! This works great! Yes, I ran into the footnote problem too, but placing your code before hyperref is ever loaded fixed it. – Dweeberkitty Sep 25 '14 at 22:04