Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to reference some parts of my document. At the moment I read that there are several options. When clicking on a cross-reference one should get to the right part of the document.

The first option is to use labels like explained on wikibooks. But I think that won't produce clickable links.

The second option is better in my opinion: the hyperref package, which I am already using. I found an explanation in the manual.

How can I link parts in the easiest way?

I don't want to put for every section a \label I think that could be done automatically. The entries in the table of contents are linked, thus I presume that some labels are already defined. Also the procedure should be resistant to renaming and moving the section through the document. It that possible or do I have to check my document twice after every change?

share|improve this question
    
As for "automatically" labeling it, could you provide an example of how you would like to reference it then? –  Psirus Jan 10 '12 at 10:28
    
Well yes no idea yet. I was expecting that not all parts will be possible. I think the automatic lables are chapter.0, chapter.1 etc. I found that out with Acrobat Pro. –  rekire Jan 10 '12 at 10:37
4  
If you were to reference it by chapter number, then it would not be resistant to moving around. Therefore, when you're writing a section on let's say Fermat's principle, name your label \label{fermat}, not \label{section3}, because you might move it around later. Naming it \label{sec:fermat} is just a "namespace-like" convention to differentiate between section-, figure-, table- and whatnot-references. –  Psirus Jan 10 '12 at 10:42
    
related question about a command that automatically turns the section name into a label: tex.stackexchange.com/questions/26942/… (difference to this question: label name changes if section name changes) –  doncherry Jan 10 '12 at 11:31

2 Answers 2

up vote 5 down vote accepted

Using the labels together with hyperref will produce clickable links, at least it does for me. Here is a short example:

\documentclass{article}
\usepackage{hyperref}

\begin{document}
\tableofcontents

\section{Fermat’s Principle}
    \label{sec:fermat}
    Fermat’s principle states that the path light takes from one point 
    to another is not necessarily the one with the smallest distance,
    but rather the path which can be traversed in the shortest time.
\section{Geometrical Optics}
    Geometrical optics is an approximation for light propagation in 
    cases where the wavelength is very small compared to the
    structures with which the light interacts. Snell’s Law, describing 
    refraction, can be derived from Fermat’s principle 
    (see section~\ref{sec:fermat}).    
\end{document}

enter image description here Naturally, this is resistant to moving and renaming the section, as long as you move the label along with the section and don't rename it.

share|improve this answer
    
I think it would be more obvious what you mean by resistant if you didn't use 'first' and 'second' as lables. Perhaps 'foo' and 'bar'? –  Canageek Jan 11 '12 at 1:49
    
@Canageek I see what you mean, seemed a bit contradictory. I changed it to a more "real-world" example. –  Psirus Jan 11 '12 at 7:14

You can use the commands \hyperlink{chapter.2}{LinkText} or \hyperlink{section.2.1}{LinkText} (as used for the table of contents of the pdf). With this commands you link absolute(!) to the chapter 2 or section 2.1. If you move your chapter the target for the link doesn't move. I think you should use the label-ref-mechanism for your needs.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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