Page LayoutTable of Contents for set of PDF files

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
deathmagneticx
Posts: 3
Joined: Wed Apr 24, 2013 4:01 am

Table of Contents for set of PDF files

Post by deathmagneticx »

Hi all! I have a set of pdf files which I have merge into a single pdf file.

What I need is a table of contents page which shows the title of each pdf file and have a description below in italic and also dots.

this is my code:

Code: Select all

\documentclass{book}
\usepackage{pdfpages}
\usepackage[pdfauthor={<somename>},pdftitle={<sometitle>},pdftex]{hyperref}
\usepackage{fancyhdr}
\usepackage{tocloft}
\usepackage[margin=0.5in,bottom=0.75in,top=0.75in]{geometry}


\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt}
\fancyhead[L]{X Y Z}
\fancyhead[R]{}
\begin{document}

\tableofcontents
\newpage

\clearpage
\phantomsection
\includepdfset{pages=-,pagecommand=\thispagestyle{fancy}}
\addcontentsline{toc}{chapter}{SAMPLE PDF 1\\ \textit{description}}
\includepdf[pages=-]{template1.pdf}

\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{SAMPLE PDF 2\\ \textit{description}}
\includepdf[pages=-]{template2.pdf}

\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{SAMPLE PDF 3\\ \textit{description}}
\includepdf[pages=-]{template3.pdf}

\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{SAMPLE PDF 4\\ \textit{description}}
\includepdf[pages=-]{template4.pdf}

\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{SAMPLE PDF 5\\ \textit{description}}
\includepdf[pages=-]{template5.pdf}

\end{document}
I need help on how to properly align the page number with its title and put dots

thank you! :)
Attachments
main.pdf
(192.87 KiB) Downloaded 556 times
Untitled.png
Untitled.png (26.93 KiB) Viewed 10289 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
dhawalkpatil
Posts: 1
Joined: Fri Feb 16, 2024 7:44 am

Table of Contents for set of PDF files

Post by dhawalkpatil »

Put the entire section entry into a parbox https://latexref.xyz/_005cparbox.html to settle the alignment of the description and use the position argument to locate the page number.

Code: Select all

\addcontentsline{toc}{section}%
{\parbox[t]{\textwidth}{My section\\\textit{Description of section}\dotfill}}
It will look like this

To adjust the thickness of the dots or the spacing between them, check 19.10 https://latexref.xyz/_005chrulefill-_00 ... tfill.html.
Post Reply