[Tex/LaTex] How to merge several tex files so that they have one table of contents/List of tables & figures

document-configurationincludeinputtable of contentsthesis

I have three chapters which I combine into a thesis using pdfpages: as shown in this link

Merging several papers

This gets me 95% of what I need the only thing I still need is a table of contents including all sub-sections for each chapter, and similarly a table listing all the tables and figures across all three chapters.

What is the simplest way to so this? All three chapters compile individually no problem.

I also tried using:

When should I use \input vs. \include?

\input and \include

\documentclass{article}
\begin{document}
\input{Introduction}
\end{document}

but when I tried this it included all the pre-ample from the tex file in the document?

Also some of the equations were displayed larger and hence were off the page! In the file generated using \input, but they appear fine when the tex file is compiled as a stand alone document?

Please note I'm really not good with Latex so the simplest solution please.

Happy to post what ever code you like but the tex files are rather large.

@ Jean

I tired your code it's a step in the right direction.
There is a table of contents.
However only chapter one appears in the output, both in the TOC and as a file, Chapter Two does not appear anywhere.
And all the \usepackage preamble is printed in the document between the contents and the beginning of chapter 1

\documentclass{article}
\begin{document} \tableofcontents
\chapter{Chapter One} \input{Introduction.tex}
\chapter{Chapter Two} \input{rv-NSS.tex}
\end{document} `

Table of Contents with overlapping entry on first line

\documentclass{article}
\usepackage{fancyvrb}
\DefineVerbatimEnvironment{code}{Verbatim}{fontsize=\small}
\DefineVerbatimEnvironment{example}{Verbatim}{fontsize=\small}
\usepackage{natbib}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{bm}
\usepackage{grffile}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{url}
\usepackage{graphics}
\usepackage{titlesec}
\def\UrlBreaks{\do\/\do-}
\usepackage[%
 font=small,
 labelfont=bf,
 figurewithin=section,
 tablewithin=section,
 tableposition=top
]{caption}
 \numberwithin{equation}{section}

\makeatletter
\def\env@matrix{\hskip -\arraycolsep
 \let\@ifnextchar\new@ifnextchar
 \array{*\c@MaxMatrixCols l}}
\makeatother


\begin{document}
\input{title.tex}
\tableofcontents
\clearpage
\chapter\addtocontents{toc}{Chapter One}\input{Introduction.tex}
\end{document}

Best Answer

The method of compiling only one "main" document does not work for you?

Like the mainTexFile.tex...that should have the \begin{document} argument etc....the rest would be simple tex files with sections, chapters, etc...

Like this...

Code for a "Main" tex file.

\begin{document}
\tableofcontents

\chapter{Chapter One}
\input{\...path_to_a_file...\chapterOne.tex}

\chapter{Chapter Two}
\input{\...path_to_a_file...\chapterTwo.tex}

\chapter{Chapter Three}
\input{\...path_to_a_file...\chapterThree.tex}

\end{document}

This should be working...It worked for me.