點擊目錄不起作用

點擊目錄不起作用

我正在準備我的論文。它由簡介和一些文章組成。我正在使用以下模板。從視覺上看.pdf,一切似乎都很好。但是,按一下目錄時會出現問題。

當我單擊簡介時,它保留在目錄中。除了第 1 節和「引言參考資料」之外,其餘部分效果不佳。關於文章,當我點擊目錄時,我會轉到“介紹參考文獻”,而不是文章。

此外,當我開啟 pdf 時,出現在螢幕左側的目錄工具列無法正確反映目錄的結構。

備註:我希望\clearpage命令不被刪除。

\documentclass[12pt,reqno]{report}

\usepackage{hyperref}
\usepackage[usenames]{color}
\usepackage[latin1]{inputenc} 
\usepackage{float}
\usepackage{bbm}
\usepackage[english]{babel} 
\usepackage{amssymb, amsmath}
\usepackage{geometry,graphicx}
\usepackage[final]{pdfpages}

\addto\captionsenglish{%
  \renewcommand{\bibname}{\centerline{{\Large References for the introduction}}}
}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma} 
\newtheorem{definition}[theorem]{Definition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{example}[theorem]{Example}
\geometry{a4paper,twoside,top=3.5cm,bottom=3.5cm,left=3cm,right=3cm,headsep=1cm}

\setlength{\parskip}{0.5em}

\begin{document}

\includepdf[pages=-]{./coverthesis.pdf}

\newpage\null\thispagestyle{empty}\newpage

\begin{center}
\textbf{Abstract}
\end{center}

This is my abstract.

\tableofcontents

\clearpage

\begin{center}
\Large \textbf{Introduction} \normalsize
\addcontentsline{toc}{chapter}{Introduction}
\end{center}

\clearpage

\begin{center}
\textbf{1. First part introduction} 
\addcontentsline{toc}{section}{1. First part introduction}
\end{center}

Something...

\clearpage

\noindent \textbf{1.1. Subsection 1 in the first part} 
\addcontentsline{toc}{subsection}{1.1. Subsection 1 in the first part}

Something...

\clearpage

\noindent \textbf{1.2. Subsection 2 in the first part} 
\addcontentsline{toc}{subsection}{1.2. Subsection 2 in the first part}

Something...

\clearpage

\begin{center}
\textbf{2. Second part introduction} 
\addcontentsline{toc}{section}{2. Second part introduction}
\end{center}

\clearpage

\noindent \textbf{2.1. Subsection 1 in the second part} 
\addcontentsline{toc}{subsection}{1.1. Subsection 1 in the second part}

Something...

\clearpage

\noindent \textbf{2.2. Subsection 2 in the second part} 
\addcontentsline{toc}{subsection}{1.2. Subsection 2 in the second part}

Something...

\clearpage

\begin{thebibliography}{a}
\addcontentsline{toc}{section}{References for the introduction}

\bibitem{Author}
Author. \textit{Title}. Edition and year.

\end{thebibliography}

\clearpage

\begin{center}
\textbf{Article 1.} 
\addcontentsline{toc}{chapter}{Article 1}
\end{center}

\includepdf[pages=-]{./art1.pdf}

\clearpage

\begin{center}
\textbf{Article 2.} 
\addcontentsline{toc}{chapter}{Article 2}
\end{center}

\includepdf[pages=-]{./art2.pdf}

\end{document}

答案1

我會使用常規的切片指令:

\documentclass[12pt,reqno]{report}

\usepackage[usenames]{color}
\usepackage[latin1]{inputenc} 
\usepackage{float}
\usepackage{bbm}
\usepackage[english]{babel} 
\usepackage{amssymb, amsmath}
\usepackage{geometry,graphicx}
\usepackage[final]{pdfpages}
\usepackage{hyperref}

\addto\captionsenglish{%
  \renewcommand{\bibname}{References for the introduction}
}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma} 
\newtheorem{definition}[theorem]{Definition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{example}[theorem]{Example}
\geometry{a4paper,twoside,top=3.5cm,bottom=3.5cm,left=3cm,right=3cm,headsep=1cm}

\setlength{\parskip}{0.5em}

\renewcommand{\thesection}{\arabic{section}}

\begin{document}

%\includepdf[pages=-]{./coverthesis.pdf}

\newpage\null\thispagestyle{empty}\newpage

\begin{center}
\textbf{Abstract}
\end{center}

This is my abstract.

\tableofcontents

\clearpage


\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}

\clearpage



\section{First part introduction} 



Something...

\clearpage

\subsection{Subsection 1 in the first part} 


Something...

\clearpage

\subsection{Subsection 2 in the first part} 


Something...

\clearpage

\section{Second part introduction} 

\clearpage

\subsection{Subsection 1 in the second part} 


Something...

\clearpage

\subsection{Subsection 2 in the second part} 


Something...

\clearpage

\begin{thebibliography}{a}
\addcontentsline{toc}{section}{References for the introduction}

\bibitem{Author}
Author. \textit{Title}. Edition and year.

\end{thebibliography}

\clearpage

\chapter*{Article 1.} 
\addcontentsline{toc}{chapter}{Article 1.}

%\includepdf[pages=-]{./art1.pdf}

\clearpage

\chapter*{Article 2.}
\addcontentsline{toc}{chapter}{Article 2.}

%\includepdf[pages=-]{./art2.pdf}

\end{document}

在此輸入影像描述

答案2

etc.的奇怪用法\textbf{1.1 Subsection}並沒有提供可以被 . 抓住的超錨點\addcontentsline

如果這種用法持續存在,則\phantomsection需要一個巨集來產生超錨點,但我不推薦這種手動且容易出錯的\textbf{...}樣式。

\documentclass[12pt,reqno]{report}

\usepackage[usenames]{color}
\usepackage[latin1]{inputenc} 
\usepackage{float}
\usepackage{bbm}
\usepackage[english]{babel} 
\usepackage{amssymb, amsmath}
\usepackage{geometry,graphicx}
\usepackage[final]{pdfpages}

\addto\captionsenglish{%
  \renewcommand{\bibname}{\centerline{{\Large References for the introduction}}}
}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma} 
\newtheorem{definition}[theorem]{Definition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{example}[theorem]{Example}
\geometry{a4paper,twoside,top=3.5cm,bottom=3.5cm,left=3cm,right=3cm,headsep=1cm}

\setlength{\parskip}{0.5em}


\usepackage{hyperref}

\begin{document}

%\includepdf[pages=-]{./coverthesis.pdf}

\newpage\null\thispagestyle{empty}\newpage

\begin{center}
\textbf{Abstract}
\end{center}

This is my abstract.

\tableofcontents

\clearpage

\begin{center}
\Large \textbf{Introduction} \normalsize
\phantomsection
\addcontentsline{toc}{chapter}{Introduction}
\end{center}

\clearpage

\begin{center}
\textbf{1. First part introduction} 
\phantomsection
\addcontentsline{toc}{section}{1. First part introduction}
\end{center}

Something...

\clearpage

\noindent \textbf{1.1. Subsection 1 in the first part} 
\addcontentsline{toc}{subsection}{1.1. Subsection 1 in the first part}

Something...

\clearpage

\noindent \textbf{1.2. Subsection 2 in the first part} 
\addcontentsline{toc}{subsection}{1.2. Subsection 2 in the first part}

Something...

\clearpage

\begin{center}
\textbf{2. Second part introduction} 
\addcontentsline{toc}{section}{2. Second part introduction}
\end{center}

\clearpage

\noindent \textbf{2.1. Subsection 1 in the second part} 
\addcontentsline{toc}{subsection}{1.1. Subsection 1 in the second part}

Something...

\clearpage

\noindent \textbf{2.2. Subsection 2 in the second part} 
\addcontentsline{toc}{subsection}{1.2. Subsection 2 in the second part}

Something...

\clearpage

\begin{thebibliography}{a}
\addcontentsline{toc}{section}{References for the introduction}

\bibitem{Author}
Author. \textit{Title}. Edition and year.

\end{thebibliography}

\clearpage

\begin{center}
\textbf{Article 1.} 
\addcontentsline{toc}{chapter}{Article 1}
\end{center}

%\includepdf[pages=-]{./art1.pdf}

\clearpage

\begin{center}
\textbf{Article 2.} 
\addcontentsline{toc}{chapter}{Article 2}
\end{center}

%\includepdf[pages=-]{./art2.pdf}

\end{document}

對居中部分(僅部分,不)等\subsections進行改進。bookmarks

\documentclass[12pt,reqno]{report}

\usepackage[usenames]{color}
\usepackage[latin1]{inputenc} 
\usepackage{float}
\usepackage{bbm}
\usepackage[english]{babel} 
\usepackage{amssymb, amsmath}
\usepackage{geometry,graphicx}
\usepackage[final]{pdfpages}

%\addto\captionsenglish{%
%  \renewcommand{\bibname}{\begingroup\protect\centering \protect\Large References for the introduction\endgroup}
%}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma} 
\newtheorem{definition}[theorem]{Definition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{example}[theorem]{Example}
\geometry{a4paper,twoside,top=3.5cm,bottom=3.5cm,left=3cm,right=3cm,headsep=1cm}

\setlength{\parskip}{0.5em}


\usepackage[nottoc]{tocbibind}
\usepackage{xpatch}


\renewcommand{\thesection}{\arabic{section}}

\makeatletter


%\AtBeginDocument{%


  \xpatchcmd{\@sect}{%
    \def\@svsechd{%
      #6{\hskip #3\relax
        \@svsec #8}}%
  }{%
    \def\@svsechd{%
      #6{\hskip #3\relax
        \begingroup\centering \@svsec #8 \endgroup}}%
  }{\typeout{Patch success}}{\typeout{first patch failed}}
  \xpatchcmd{\@sect}{%
    \begingroup
    #6{%
      \@hangfrom{\hskip #3\relax\@svsec}%
      \interlinepenalty \@M #8\@@par}%
    \endgroup%
  }{\begingroup
    #6{%
      \@hangfrom{\hskip #3\relax\@svsec}%
      \ifnum0=\pdfstrcmp{#1}{section}%
         \begingroup\centering
         \interlinepenalty \@M #8 \@@par\endgroup
         \else
         \interlinepenalty \@M #8 \@@par% Non - section types
      \fi
    }%
    \endgroup%
  }{}{\typeout{Second patch failed}}%
\makeatother

\usepackage{hyperref}

\begin{document}

%\includepdf[pages=-]{./coverthesis.pdf}

\newpage\null\thispagestyle{empty}\newpage

\begin{center}
\textbf{Abstract}
\end{center}

This is my abstract.

\tableofcontents

\clearpage



\phantomsection
\chapter*{\centering Introduction}
\addcontentsline{toc}{chapter}{Introduction}

\clearpage

\section{First part introduction} 
%\addcontentsline{toc}{section}{1. First part introduction}

Something...

\clearpage

\subsection{Subsection 1 in the first part} 
%\addcontentsline{toc}{subsection}{1.1. Subsection 1 in the first part}

Something...

\clearpage

\subsection{Subsection 2 in the first part}

Something...

\clearpage


\section{Second part introduction}

\clearpage

\subsection{Subsection 1 in the second part} 

Something...

\clearpage

\subsection{Subsection 2 in the second part} 

Something...

\clearpage

\begin{thebibliography}{a}
%\addcontentsline{toc}{section}{References for the introduction}

\bibitem{Author}
Author. \textit{Title}. Edition and year.

\end{thebibliography}

\clearpage

\chapter*{\centering Article 1}
\addcontentsline{toc}{chapter}{Article 1}

%\includepdf[pages=-]{./art1.pdf}

\clearpage

\chapter*{\centering Article 2}
\addcontentsline{toc}{chapter}{Article 2}

%\includepdf[pages=-]{./art2.pdf}

\end{document}

相關內容