在目录中手动添加 PDF 页面

在目录中手动添加 PDF 页面

我是该语言的新手,我需要在我的 LaTeX 文档中添加一些 PDF 页面。
我使用命令添加\includepdf[pages=...]{MyFile.pdf}
现在,问题是需要将这些页面添加到目录中。我试过了, \addcontentsline{toc}{subsection}{Subs_name}但它没有增加第一个 PDF 页码。
这是我的代码片段:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{pdfpages}

\title{Reti e Sicurezza}
\author{Luca Polese}
\date{Settembre 2020 - Gennaio 2021}

\begin{document}

\maketitle
\newpage
\tableofcontents
\newpage

\part{Lezione 1: Introduzione}
\addcontentsline{toc}{subsection}{Introduzione}
\includepdf[pages=1]{Reti e Sicurezza.pdf}
\addcontentsline{toc}{subsection}{Introduzione alle Reti/Classificazioni}
\includepdf[pages=2]{Reti e Sicurezza.pdf}
\addcontentsline{toc}{subsection}{Classificazioni 2}
\includepdf[pages=3]{Reti e Sicurezza.pdf}

\part{Lezione 2:}

\end{document}

这里的问题是目录上的输出是: 在此处输入图片描述

子内容的数量应为:

Introduction .................................. 4
Introduction/Classification of networks ....... 5
Classification of networks .................... 6

你能帮帮我吗?谢谢建议

答案1

\includepdf选择addtotoc={page number, section, level, heading, label}

因此你可以这样做:

\documentclass{article}
\usepackage{pdfpages}

\begin{document}
\tableofcontents
\section{Lesson 1: Introduction}
\includepdf[pages=-,addtotoc={
            1, subsection, 1, Introduction, L1:1,
            2, subsection, 1, Introduction/Classification of networks, L1:2,
            3, subsection, 1, Classification of networks2, L1:3}]
{Network.pdf}
\end{document}

在此处输入图片描述

相关内容