GeneralCustom Cross References

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Svartisen
Posts: 2
Joined: Fri Sep 07, 2012 3:01 pm

Custom Cross References

Post by Svartisen »

Hi,

When you use \href command, it's possible to tell LaTeX what text should appear in your PDF in the link (\href{link}{MY_TEXT}). Is the same possible for \ref command?

The most obvious way (\ref{key}{MY_TEXT}) doesn't seem to work properly. MY_TEXT appears, but there is no reference to the desired key.

To put it another way, I want MY_TEXT to appear as a reference to a labelled item, such as f.e. Chapter 1: Introduction, when MY_TEXT is different from Introduction.

Thank you in advance,

Svartisen
Last edited by cgnieder on Fri Sep 07, 2012 5:16 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Custom Cross References

Post by cgnieder »

Hi Svartisen,

Welcome to the LaTeX community!

The hyperref package not only provides \href but also \hyperref which has two different uses. One of them is

Code: Select all

\hyperref[<label>]{<text>}

Code: Select all

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\section{Test}\label{sec:test}
\newpage
This leads to \hyperref[sec:test]{the section named ``Test''}.
\end{document}
Best regards
site moderator & package author
Svartisen
Posts: 2
Joined: Fri Sep 07, 2012 3:01 pm

Re: Custom Cross References

Post by Svartisen »

Hi,

Thanks a lot!
Post Reply