Enlace en el que se puede hacer clic para regresar a la tabla de contenido

Enlace en el que se puede hacer clic para regresar a la tabla de contenido

Hay muchas preguntas y respuestas sobre cómo hacer que Table of Contentsse pueda hacer clic en el contenido. Me pregunto cómo hacer una referencia Table of Contentsy crear un enlace en otra parte del documento para hacer clic y volver a la tabla de contenido.

Intenté darle Table of Contentssu propia etiqueta \tableofcontents\label{toc}y luego usar un enlace de referencia, \ref{toc}pero esto produce el error:./project.tex:133: Package hyperref Warning: Suppressing empty link on input line 133.

Respuesta1

Esto se puede hacer conhiperobjetivoyHipervínculodesde elhiperreferenciapaquete. Vea el ejemplo a continuación:

\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}

Respuesta2

Algo como esto:

\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}

Cambie la clase de documento relevante a voluntad.

ingrese la descripción de la imagen aquí

información relacionada