クリック可能な目次へのリンク

クリック可能な目次へのリンク

コンテンツをクリック可能にする方法については、多くの質問と回答がありますTable of Contents。 ドキュメント内の他の場所に参照を作成しTable of Contents、クリックして目次に戻るためのリンクを作成する方法を知りたいです。

Table of Contents独自のラベルを指定してから\tableofcontents\label{toc}参照リンクを使用しようとしました\ref{toc}が、次のエラーが発生します。./project.tex:133: Package hyperref Warning: Suppressing empty link on input line 133.

答え1

これは次のように行うことができますハイパーターゲットそしてハイパーリンクからハイパーリファレンスパッケージ。以下の例を参照してください。

\documentclass{article}
\usepackage{hyperref}

\begin{document}
Title Page\newpage

% Add a link target to the TOC itself
\addtocontents{toc}{\protect\hypertarget{toc}{}}

% Print the TOC
\tableofcontents
\newpage

% Sections with a hyperlink to TOC
\section[One]{One. Go to \hyperlink{toc}{TOC}}
Text that points to \hyperlink{toc}{Table of Contents}.

\end{document}

答え2

このようなもの:

\documentclass{book}


\usepackage{hyperref}

\begin{document}

\phantomsection 
\hypertarget{MyToc}{}  % Make an anchor to the toc
\tableofcontents

\chapter{Dummy}


\chapter{Yet another Dummy}

Jump to my incredible \hyperlink{MyToc}{Table of contents}

\end{document}

関連するドキュメントクラスを任意に変更します。

ここに画像の説明を入力してください

関連情報