Incompatibilidade entre toc e índice do pdf

Incompatibilidade entre toc e índice do pdf

Isto é umacompanhamento de "Índice numeração incorreta de páginas". O TOC sai bem, mas não é reproduzido corretamente no Índice do Visualizador de Documentos: a hierarquia está quebrada e a página # está ligeiramente errada. O mesmo problema com o Evince (índice chamado Outline).

Plataforma: Linux Mint 19, AucteX v 11.91

CLI

$ evince --version
GNOME Document Viewer 3.28.4
$ latex --version
pdfTeX 3.14159265-2.6-1.40.19 (TeX Live 2018)
kpathsea version 6.3.0
Copyright 2018 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.34; using libpng 1.6.34
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.00

Látex:

\documentclass[
french,
%draft,
%  paper=A4,
%  version=last,
%  NF,
  12pt
 % ,
 % toc=bibnumbered
]{scrreprt}%artcl}
% \usepackage{adjustbox}
\usepackage[french]{babel}
\usepackage{fancyhdr}
\usepackage[T1]{fontenc}
%\usepackage{fontspec}
\usepackage{keyfloat}
\usepackage{lastpage}
\usepackage{mwe}
\usepackage{pdfpages}
\usepackage{refcount}
%%\usepackage{scrpage2}
%\usepackage{scrlayer-scrpage}
\usepackage{textcomp}
\usepackage{tocloft}
\usepackage{ulem}
\usepackage{xparse}
\usepackage{xwatermark}
\PassOptionsToPackage{hyphens}{url}\usepackage{hyperref}

%must come last
\usepackage{hyperref}


%\AtEndDocument{\label{LastPage}}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[c]{\thepage/\pageref{LastPage}}
\pagestyle{fancy}


\begin{document}


  \begin{titlepage}


TITRE

\end{titlepage}

\tableofcontents

\part{A}



  \section{my section}

\clearpage
\phantomsection
\addcontentsline{toc}{subsection}{Foo}
\label{foo}
\includepdf[pages={1}]{example-image-plain.pdf}

\clearpage
\csname phantomsection \endcsname
\addcontentsline{toc}{subsection}{Bar}
\label{bar}
\includepdf[pages={1}]{example-image-plain.pdf}


\clearpage
\csname phantomsection \endcsname
\addcontentsline{toc}{subsection}{Baz}
\label{baz}
\includepdf[pages={1}]{example-image-plain.pdf}


\part{B}

\end{document}

mostrar

Responder1

Não existe \chapterentre \parte \section. Então você recebe o aviso:

A diferença (2) entre os níveis de marcadores é maior que um, nível fixado na entrada...

e a hierarquia errada nos favoritos.

Você pode carregar o pacote bookmarkpara evitar esse problema.

Exemplo (assumindo que você realmente precisa/quer package xwatermark):

\documentclass[
  french,
  12pt
]{scrreprt}
\usepackage[french]{babel}

\usepackage[T1]{fontenc}
\usepackage{lastpage}
\usepackage{mwe}
\usepackage{pdfpages}

\usepackage{xwatermark}% loads fancyhdr

%must come last
\PassOptionsToPackage{hyphens}{url}
\usepackage{hyperref}
\usepackage{bookmark}% <- added

\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[c]{\thepage/\pageref{LastPage}}
\pagestyle{fancy}
\begin{document}
\tableofcontents
\part{A}
\section{my section}
\includepdf[pages={1},addtotoc={1,subsection,\subsectionnumdepth,Foo,foo}]{example-image-plain.pdf}
\includepdf[pages={1},addtotoc={1,subsection,\subsectionnumdepth,Bar,bar}]{example-image-plain.pdf}
\includepdf[pages={1},addtotoc={1,subsection,\subsectionnumdepth,Baz,baz}]{example-image-plain.pdf}
\part{B}
\end{document}

Resultado:

insira a descrição da imagem aqui

informação relacionada