목차로 돌아가는 클릭 가능한 링크

목차로 돌아가는 클릭 가능한 링크

만드는 방법에 관한 많은 질문과 답변이 있습니다.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}

관련 문서 클래스를 마음대로 변경합니다.

여기에 이미지 설명을 입력하세요

관련 정보