LaTeX forum ⇒ TeXworksInquire 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

Inquire about Labelling

Postby yaozhao » Sun Oct 28, 2018 3:59 am

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?

Many thanks in advance!

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
User avatar
Johannes_B
Site Moderator
Posts: 4183
Joined: Thu Nov 01, 2012 4:08 pm

Inquire about Labelling

Postby Johannes_B » Sun Oct 28, 2018 7:52 am

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.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10067
Joined: Mon Mar 10, 2008 9:44 pm

Inquire about Labelling

Postby Stefan Kottwitz » Sun Oct 28, 2018 12:53 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
LaTeX.org admin


Return to “TeXworks”

Who is online

Users browsing this forum: No registered users and 4 guests