## LaTeX forum ⇒ TeXworks ⇒ Inquire about Labelling

Information and discussion about TeXworks, an integrated LaTeX environment for several platforms
yaozhao
Posts: 57
Joined: Sat Oct 27, 2018 10:38 pm

I am reading a \LaTeX{} tutorial for beginners. It mentions "Labelling".

Type \label{sec1} on a new line directly below \subsection{Stage 1}Type Referring to section \ref{sec1} on page \pageref{sec1} in the Results section.

I can see the difference. But I can't understand what's unique intention of labelling? Because I can also type directly "Referring to section 2.1 on page 1".

I believe labelling does have some power. Can anyone give me an example?

LaTeXguide.org • LaTeX-Cookbook.net

Johannes_B
Site Moderator
Posts: 4183
Joined: Thu Nov 01, 2012 4:08 pm

You do know the number right now at this moment, but it can change later.

LaTeX keeps care of that for you using the aux file. It's a nice feature.

Think about your table of contents at the very beginning of the document. If your document gets longer, so that the table of contents needs more vertical space, your first section could be pushed to the next page. If you would have numbered by hand, you would need to change every instance where you referred to a page number by hand.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Stefan Kottwitz
Posts: 9880
Joined: Mon Mar 10, 2008 9:44 pm

Using \label{somename}, you can give things a name, such as sections, equations, theorems, list items, pages, figures and tables. Using \ref{somename} you can refer to it at any time, and LaTeX gives you the number for it (figure number or equation number or page number, etc.)

So when you start writing a thesis with many pages, even a hundred pages, and many sections and figures and tables you never have to worry about numbering and stating numbers as references. Numbers change anyway while writing, when the document gets bigger, sections are inserted, figures added or inserted, etc.

Stefan