summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pdfpages/pdf-toc.tex
blob: b41a1abb0dd0707fe590555460b88ca5faa5fced (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
%%
%% This is file `pdf-toc.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pdfpages.dtx  (with options: `example3')
%% 
%% This file demonstrates how to use the pdfpages package.
%%
%% Please send error reports and suggestions for improvements to
%%   Andreas MATTHIAS <amat@kabsi.at>.
%%
\documentclass[a4paper]{book}
\usepackage{pdfpages}
\usepackage{verbatim}
\usepackage[plainpages=false, pdfpagelabels,
            bookmarksopen]{hyperref}

\begin{document}
\tableofcontents

\chapter{How to create a toc}

The next pages were inserted using the following command:

\begin{verbatim}
\includepdf[pages=1-6,
            pagecommand={},
            addtotoc={1, chapter, 0, Main chapter,   cha:main,
                      1, section, 1, First section,  sec:first,
                      3, section, 1, Second section, sec:second},
            trim=0 120 0 120, clip]{dummy.pdf}
\end{verbatim}

\noindent
See Chapter \ref{cha:main} (\nameref{cha:main}) on page
\pageref{cha:main}.\par\noindent
See Section \ref{sec:first} (\nameref{sec:first}) on page
\pageref{sec:first}.\par\noindent
See Section \ref{sec:second} (\nameref{sec:second}) on page
\pageref{sec:second}.

\includepdf[pages=1-6,
            pagecommand={},
            addtotoc={1, chapter, 0, Main chapter,   cha:main,
                      1, section, 1, First section,  sec:first,
                      3, section, 1, Second section, sec:second},
            trim=0 120 0 120, clip]{dummy.pdf}

\end{document}
\endinput
%%
%% End of file `pdf-toc.tex'.