Is there a way to manually create a Table of Contents (by writing each item one by one), instead of using \tableofcontents which automatically generates one?

Here is why I need this. I need to compile several different PDF files into one single one. And those files are written by different document classes and in different settings; it is hard to put them into one single LaTeX file. So, I will put those PDF files together and only change page numbers. But then I need a table of contents page and I need to create this one out of nothing.

  • You can do that, for sure. How are you combining the final PDF? Will it use pdfpages? What \documentclass will you be using? – Werner Dec 14 '16 at 3:00
  • I am kind of low-key. so I am just thinking to use acrobat to compile those pdf files into a single one, and directly revise the page number on that pad file... It is a job application, so basically I need to combine a cover letter, CV, and some other materials together. – H.Hong Dec 14 '16 at 3:05

Assume you have files file1.pdf (3 pages), file2.pdf (6 pages) and file3.pdf (9 pages) that you want to compile into a single PDF containing 19 pages, where the first page is a Table of Contents.

Construct the contents using a set of manual function for (say) \sections and \subsections. The idea would be to write directly to the .toc file the sectional unit number, title and page number:

enter image description here



% file1.pdf: pages  1- 3
% file2.pdf: pages  4- 9
% file3.pdf: pages 10-18



% Construct contents
\addsection{1}{File 1-1}{1}
\addsubsection{1.1}{File 1-1.1}{2}
\addsection{2}{File 1-2}{3}
\addsection{3}{File 2-1}{4}
\addsubsection{3.1}{File 2-1.1}{7}
\addsubsection{3.2}{File 2-1.2}{8}
\addsection{4}{File 2-2}{9}
\addsection{5}{File 3-1}{10}
\addsubsection{5.1}{File 3-1.1}{10}
\addsubsection{5.2}{File 3-1.2}{11}
\addsubsection{5.3}{File 3-1.3}{12}
\addsection{6}{File 3-2}{17}
\addsubsection{6.1}{File 3-2.1}{18}
\addsubsection{6.2}{File 3-2.2}{18}



You can expand the structure to lower levels, if needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.