TeX - LaTeX Asked by Cosmo on December 13, 2020
I am trying to build a simple texfile, which holds just pdf’s in it and has a table of contents, which refers to the specific page. The title of the section / subsection shall not be shown and the pdf’s shall stay in original size. So it is supposed to be a simple TOC for navigating through the pdf’s.
The problem is, that the TOC does not hyperref to the proper page.
documentclass[11pt,a4paper]{report}
usepackage[german]{babel}
usepackage[utf8]{inputenc}
usepackage[left=2.5cm,right=2.5cm,top=2cm,bottom=4cm]{geometry}
usepackage{tocbasic}
usepackage{pdfpages}
usepackage{hyperref}
hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
begin{document}
% --- FIRST PDF ---
addcontentsline{toc}{section}{PDF1}
includepdf[noautoscale=true]{path/pdf1.pdf}
% --- TOC ---
tableofcontents
newpage
% --- PDF2 ---
addcontentsline{toc}{section}{pdf2}
includepdf[pages={1-2}, noautoscale=true]{path/pdf2.pdf}
% --- PDF3+4 ---
addcontentsline{toc}{section}{Title}
% --- PDF3 ---
addcontentsline{toc}{subsection}{pdf3}
includepdf[pages={1}, noautoscale=true]{path/pdf3.pdf}
% --- PDF4 ---
addcontentsline{toc}{subsection}{pdf4}
includepdf[pages={1}, noautoscale=true]{path/pdf4.pdf}
end{document}
When i compile the code, TOC hyperrefs the first pdf right, the other TOC hyperrefs are linked to wrong pages.
Pagenumbers in the TOC are given properly though.
Hope my problem is understandable.
Any help appreciated!
I solved the problem by adding phantomsection
before I used addcontentsline
.
Answered by Cosmo on December 13, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP