目录显示正确的页面但链接到错误的页面

目录显示正确的页面但链接到错误的页面

目录没有链接到正确的页面,目录中的页码是正确的,但当我单击超链接时,它却带我到了错误的部分

\documentclass[11pt]{report} % Default font size is 12pt, it can be changed here
\usepackage{geometry} % Required to change the page size to A4
\geometry{a4paper} % Set the page size to be A4 as opposed to the default US Letter
\usepackage{graphicx} % Required for including pictures
\usepackage{float} % Allows putting an [H] in \begin{figure} to specify the exact location of the figure
\usepackage{wrapfig} % Allows in-line images
\graphicspath{{../figures/}}  % Specifies the directory where pictures are stored
\usepackage[utf8]{inputenc}
\linespread{1.2} % Line spacing
%\setlength\parindent{0pt} % Uncomment to remove all indentation from paragraphs
\usepackage[colorlinks=true,urlcolor=blue,citecolor=red,linkcolor=black,bookmarks=true]{hyperref} % makes color citations
\usepackage{indentfirst} %indent all the first lines of an sentance
\usepackage[sort&compress,round,semicolon,authoryear]{natbib}
\usepackage{siunitx}
\usepackage{gensymb}
\usepackage{pdfpages}
\usepackage{tabularx}
\usepackage{glossaries}
\usepackage{bookmark}
\setcounter{secnumdepth}{0} % only number chapters 
\usepackage{forest} % to create pretty diagrams
\usepackage[nottoc,numbib]{tocbibind}

\usetikzlibrary{arrows.meta}
\tikzset{
  my rounded corners/.append style={rounded corners=2pt},
}
\colorlet{linecol}{black!75}
\setcounter{tocdepth}{1}

\bookmarksetup{
  numbered,
  open
}

%used to center the chapter headings and decrease the space before and after the heading which is unreasonable in the normal setting
\usepackage{titlesec}
\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries\centering}
  {\chaptertitlename\ \thechapter}{10pt}{\Huge}
  \titlespacing*{\chapter}{0pt}{-50pt}{20pt} 

%\renewcommand*{\thesection}{\arabic{section}}

% document begin
\begin{document}

请随意评论一般代码,我刚刚开始使用乳胶。

答案1

事实证明,是软件包的顺序搞混了。我认为 latex 文档仍然使用默认布局和间距进行编译。我移动了我的布局设置:

  \usepackage{titlesec}
     \titleformat{\chapter}[display]
     {\normalfont\huge\bfseries\centering}
     {\chaptertitlename\ \thechapter}{10pt}{\Huge}
     \titlespacing*{\chapter}{0pt}{-50pt}{20pt}

在我的包裹清单中排名更高,现在很好了。

相关内容