3

So we can refer to sections with counter via \label{…} and \ref{…}.

We can refer to sections with custom text via package hyperref like so:
https://tex.stackexchange.com/a/70153

We can refer to arbitrary text with counter like so:
https://tex.stackexchange.com/a/4024
https://tex.stackexchange.com/a/179008
https://stackoverflow.com/a/3914144
https://tex.stackexchange.com/a/150061

But how can we refer to arbitrary text with custom text ? I.e. refer to an arbitrary location in the document with our custom text.

For example, let's say I want to refer to the previous paragraph using the word "previous" (no counters).

Can this be done? (I'm new to LaTeX).
Thanks.

I've also read the Sharelatex's documentation on cross-referencing but did not find an answer.

gthanop
  • 133

1 Answers1

4
\documentclass{article}

\usepackage{hyperref}

\begin{document}

one two three

\phantomsection\label{zzz}four five six

\clearpage

see \hyperref[zzz]{previous} paragraph on a different page so the link jump is clearer.

\end{document}
David Carlisle
  • 757,742
  • Thanks! It's the answer. Can you tell me what is \phantomsection additionally here? – gthanop Jun 28 '18 at 19:23
  • 1
    it leaves the invisible anchor at that point, like a section heading would so the \label and \hyperref can make a link back (the older \hypertarget would also set a target but only at the pag elevel, see texdoc hyperref, section 4 @thanopi57 – David Carlisle Jun 28 '18 at 19:43