I am a TEX beginner and I am now learning how to create a reference. I am reading the book "The Not So Short Introduction to LATEX2" by Oetiker, Partl, Hyna, Schlegl; on page 42 section 2.8 Cross Reference, the code is written as
A reference to this section \label{sec:this} looks like:
"see section~\ref{sec:this} on page~\pageref{sec:this}"
And I am using CTex and WinEdt and my questions are:
- I made a pdf file from the above code, but the section and page numbers are not highlighted and I cannot click on them. Why is it so?
- I tried to make a reference to other pages by typing its page number like
{sec:37}
, but it does not work. How can I fix it? - What does the code
sec
actually mean? Is it arbitrary or a predefined syntax? - When I typed
\label{}
, a menu box named Labels (51) appeared, and there is a dropdown menus likec:ISYAC
,c:UNBOUND
,c:UNIFBURN
,… etc… what is that? Do we have to choose from those list or can we write our own like{sec:this}
?
Helps are greatly appreciated! Many many thanks!
Best Answer
The general mechanism is to set an anchor some where in your document with
\label{<name>}
, where<name>
can be a combination of numbers, letters,:
and-
(to be safe). These anchors must be set explicitly by the author, thats why\ref{sec:47}
doesn’t work unless it is not defined by you. After setting up an anchor you can refer to it with\ref{<name>}
(giving the corresponding counter, like chapter or section or equation or … number) or\pageref{<name>}
(giving the corresponding page number).Some author use identifiers like
sec:
,eq:
,thm:
etc. to make anchor names more human readable but this is not necessary for the mechanism to work.packages
LaTeX’s mechanism can be extended by some packages:
hyperref
makes references click-able hyper links (and has some more features).cleveref
finds the right names for labels and prints\ref{anchor5}
assection~5
instead of5
, for instance.varioref
compares the page numbers of anchor and reference and add text likeon previous page
,on page 6
etc. automatically.nameref
can print the actual title of an anchor.MWE