1

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.

4
  • you can use hyperref's hypertarget and hyperlink markup (this is unrelated to sharelatex) Jun 28, 2018 at 18:24
  • @DavidCarlisle can you give me a link to start with?
    – gthanop
    Jun 28, 2018 at 18:30
  • @DavidCarlisle ok I found it here. Shall I delete this question?
    – gthanop
    Jun 28, 2018 at 19:16
  • nah I've answered now:-) Jun 28, 2018 at 19:17

1 Answer 1

1
\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}
2
  • Thanks! It's the answer. Can you tell me what is \phantomsection additionally here?
    – gthanop
    Jun 28, 2018 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 Jun 28, 2018 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.