Page LayoutManual Creation of a ToC

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
alexbcg
Posts: 4
Joined: Wed Oct 09, 2013 7:04 pm

Manual Creation of a ToC

Post by alexbcg »

Hi,

I'm a university student and one of my lecturers has given us the course notes as separate PDF documents, very well structured but with no Table of Contents.

I would like to manually create a table of contents with chapters, sections and subsections (as you can see in the attached screenshot of last semester's ToC). I have had trouble finding info on the internet about how to manually create a ToC independent of any latex source code, I don't mind entering the page numbers so it looks all nice like the picture I posted.

Many thanks to anyone who can give me a brief outline of what to do it'll save me a lot of time in the long run! :)
Attachments
How I would like the ToC to look.
How I would like the ToC to look.
ToC.jpg (58.9 KiB) Viewed 10930 times
Last edited by localghost on Tue Feb 25, 2014 12:13 am, edited 1 time in total.
Reason: Image rescaled to a reasonable size for better view on small screens (see Board Rules).

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm

Manual Creation of a ToC

Post by hugovdberg »

If you include the pdf documents with the pdfpages package you can use the addtotoc option to the \includepdf command, see for example this question on tex.se.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
alexbcg
Posts: 4
Joined: Wed Oct 09, 2013 7:04 pm

Manual Creation of a ToC

Post by alexbcg »

hugovdberg wrote:If you include the pdf documents with the pdfpages package you can use the addtotoc option to the \includepdf command, see for example this question on tex.se.
Thanks very much for your answer! I was writing up the ToC for the first chapter and all was going well until I tried to put in the final subsubsection of the aforementioned first chapter - it simply will not show up when I typeset the code if I put 18 as the page number (in reality it's page 19 but the 18th page relative to the ToC - I've noticed I had to put my page number arguments as 1 less than the actual number)!
It will show up if I put 17 as it's page number but this leads to my ToC being wrong....
I have a sneaking suspicion this has something to do with the last subsubsection being on the last page of the document...

I've included my code and 3 screenshots (apologies for not resizing but otherwise the only way I can do it is to make everything illegible!) - any help would be appreciated :)

Code: Select all

\documentclass{article}

\usepackage{pdfpages}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[utf8]{inputenc}


\begin{document}
\tableofcontents    
\includepdf[pages=-,addtotoc={
     1,section,1,L'espace $R^n$,p1,   
     1,subsection,2, L'espace vectoriel $R^n$,p2,
     5,subsection,2,L'espace normé $R^n$,p2,
     7,subsection,2,Sous-ensembles de $R^n$,p2,
     9,subsection,2,Suites dans $R^n$,p2,
     11,subsection,2,Fonctions continues,p2,
     13,subsection,2,Applications linéaires,p2,
     13,subsubsection,3,Applications linéaires $R^n \rightarrow R^n$,p2,
     14,subsubsection,3,Applications linéaires entre des espaces normés,p2,
     14,subsubsection,3,Applications linéaires dans un espace euclidien,p2,
     15,subsection,2,Addendum - Les matrices rechargées,p2,
     15,subsubsection,3,Matrices carrées réelles,p2,
     16,subsubsection,3,Matrices carrées complexes,p2,
     17,subsubsection,3,Notions générales et théorie spectrale,p2,
    18,subsubsection,3,Théorie spectrale des matrices hermitiennes,p2}]{PH2-chap01.pdf}    
\end{document}
Attachments
existence of 19th page.jpg
existence of 19th page.jpg (365.26 KiB) Viewed 10914 times
incorrect page number showing up.jpg
incorrect page number showing up.jpg (388.04 KiB) Viewed 10914 times
correct page number but not showing up.jpg
correct page number but not showing up.jpg (337.28 KiB) Viewed 10914 times
hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm

Manual Creation of a ToC

Post by hugovdberg »

It's difficult to say what's exactly wrong without the original pdf, but my guess is the page numbers as printed in the included pdf are not equal to actual page number (with the first page always number 1, whatever is printed there). Also, the page numbers printed in the table of contents are the page numbers in your new document, so that does not have to correspond with the printed number in the original document, especially when concatenating multiple documents. Therefore you also might want to add some headers to your new document with the new page numbers so you can actually find the correct page in your new document, the pagecommand option of \includepdf can be used to set \thispagestyle to something else than the default empty.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
Post Reply