8

Here is some latex which sets up a hyperlink/hypertarget pair so that I can quickly navigate a large document:

\documentclass{article}
\usepackage{hyperref}

\begin{document}

    \section{I am a section}
    I am some content with a hyperlink to some other  \hyperlink{new_link}{content}

    \section{another section}
    More content

    \section{Another section}
    Here is some content that I want to link to \hypertarget{new_link}{content}

\end{document}

This code correctly configures a hyperlink to go from the content in section 1 to the content 3. How do I configure latex to make this link two way, i.e. when I click content in section 1 I go to content in section 3 and when I click on the content in section 3 I am taken to the content in section 1.

Here is the output for the code above:

enter image description here

2 Answers2

10

The second arguments of the existing \hyperlink/\hypertarget pair can be made into a corresponding \hypertarget/\hyperlink pair.

\documentclass{article}
\usepackage[colorlinks]{hyperref}
\begin{document}
\section{A section}
Content with a hyperlink to some later \hyperlink{linkB}{\hypertarget{linkA}{content}}.

\clearpage
\section{Another section}
Content with a hyperlink to some earlier \hypertarget{linkB}{\hyperlink{linkA}{content}}.  
\end{document}

After compiling, set your pdf browser to view an entire page at a time, and then enjoy jumping back and forth between the two hypertargets.

Mico
  • 506,678
0
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\begin{document}

\hypertarget{link1}{\textbf{Exercice 1}} (\hyperlink{link2}{\textbf{Solution}})

    Démontrer que l'on définit une distribution $T \in D'(R)$ en posant\\

\begin{enumerate}
\item $$\forall \varphi \in D(R) :\left\langle T,\varphi \right\rangle = \lim_{n \rightarrow \infty} \left\{\sum_{j=0}^{n} \left(\frac{1}{j}\right) - n \varphi(0) - \varphi'(0) logn \right\}$$

\item $$\forall \varphi \in D(R) :\left\langle pf\frac{1}{x^2},\varphi \right\rangle = \lim_{\epsilon \rightarrow  0}\left\{ \int_{\left| x \right| \geq \epsilon} \frac{\varphi(x)}{x^2} dx - 2\frac{\varphi(0)}{\epsilon} \right\}$$

\item $$\forall \varphi \in D(R) :\left\langle pf\frac{H}{x^2},\varphi \right\rangle = \lim_{\epsilon \rightarrow  0}\left\{ \int_{\left| x \right| \geq \epsilon} \frac{\varphi(x)}{x^2} dx - \frac{\varphi(0)}{\epsilon} + \varphi '(0) \log \epsilon \right\}$$

\end{enumerate}

\hypertarget{link3}{\textbf{Exercice 2}} (\hyperlink{link4}{\textbf{Solution}})

    Pour $\varphi \in D(R)$ on pose\\
    $$\left\langle x_+^{-1},\varphi \right\rangle = \lim_{\epsilon \rightarrow  0_+}\left\{ \int_{\epsilon}^\infty \frac{\varphi(x)}{x} dx + \varphi(0)\log \epsilon \right\}$$.\\
    Prouver que cette limite existeest définit une distribution sur $R$.

\hypertarget{link5}{\textbf{Exercice 3}} (\hyperlink{link6}{\textbf{Solution}})

    Montrer que la fonction définie p.p. sur $R$.\\
    $$f(x)=\chi_{]0,\frac{\pi}{2}[} (x) \left(\frac{1}{sinx}-\frac{1}{x}\right) \in L^1(R)$$

\newpage

\hypertarget{link2}{\textbf{Solution}} (\hyperlink{link1}{\textbf{Exercice 1}})

    The solution is here.....

\newpage
\hypertarget{link4}{\textbf{Solution}} (\hyperlink{link3}{\textbf{Exercice 2}})

    The solution is here.....

\newpage
\hypertarget{link6}{\textbf{Solution}} (\hyperlink{link5}{\textbf{Exercice 3}})

    The solution is here.....
\end{document}
Leucippus
  • 1,636