I have inserted several pdf-articles in my document.
Each article has their sections and subsections.
I pretend that each section appears in the TOC with their respective page.
Previous to each article if I add this one,
\addcontentsline{toc}{section}{whatever you want to appear},
these sections appear in the TOC, but all the sections-subsections of the same article appear with the same page.
Is there any way to relate one section with the corresponding page?
How could I paginate the following example:
"Introduction of the chapter... (pp.1-6)
(start of pdf document)
section 1 (p. 7)
subsection 1.1 (p. 7)
subsection 1.2 (p. 8)
Section 2 (p. 8)
(...)"
LyX ⇒ How to paginate sections of an inserted pdf-document
How to paginate sections of an inserted pdf-document
Last edited by Edulis on Mon Jun 06, 2011 6:19 pm, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

-
- Posts: 126
- Joined: Sun Feb 13, 2011 8:36 pm
How to paginate sections of an inserted pdf-document
I don't know exactly about the internals but it seems to me that LaTeX is not aware of the space that the included PDFs need. So one solution is to tell LaTeX about "page breaks" by inserting \clearpage commands.
In the following example, I include pages 2 and 3 from the clsguide into a document with the sections showing up correctly in the TOC. However, usually the page numbering from the included PDF won't match and the result might be distracting.
Best
In the following example, I include pages 2 and 3 from the clsguide into a document with the sections showing up correctly in the TOC. However, usually the page numbering from the included PDF won't match and the result might be distracting.
Code: Select all
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{pdfpages}
\begin{document}
\tableofcontents
\section{Some Stuff of My Own}
Text I have written myself\dots
\subsection{Something Else}
More text I have written myself\dots
\clearpage
\addcontentsline{toc}{section}{Introduction \emph{(from the clsguide)}}
\addcontentsline{toc}{subsection}{Writeing classes and packages for \LaTeXe}
\includepdf[page=2]{clsguide}
\clearpage
\addcontentsline{toc}{subsection}{Overview}
\addcontentsline{toc}{subsection}{Further information}
\includepdf[page=3]{clsguide}
\section{Again my Own Stuff}
And my own text\dots
\end{document}
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
-
- Posts: 126
- Joined: Sun Feb 13, 2011 8:36 pm
How to paginate sections of an inserted pdf-document
Update: Sorry, the correct option to pdfpages is pages rather than page but it seems to be understood as a common misspelling...
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
Re: How to paginate sections of an inserted pdf-document
It works perfectly.
Thanks a lot, 5gon12eder.
Thanks a lot, 5gon12eder.
How to paginate sections of an inserted pdf-document
I would use separate includepdf commands for each section, and put the addtocontents stuff in using the pagecommand* option for includepdf. See the pdfpages manual. Clearpage and \addtocontents before the includepdf command might work too.