Labels and cross-references
이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
Never write "see Section 3" by hand
- If you write a number by hand and later add a section, every number is wrong.
- LaTeX solves this with labels. Tag something:
\section{Methods}\label{sec:methods}
- The name
sec:methodsis just a nickname you choose.

English
Refer to it anywhere
- Then point at it with
\ref— LaTeX inserts the current number:
As shown in Section~\ref{sec:methods}, ...
- The
~is a space that never breaks across lines, so "Section" and its number stay together.
English
It needs two passes
- On the first compile LaTeX learns the numbers; on the second it fills them in.
- Our Run does this for you automatically. (The same trick powers a table of contents.)
English
Common mistakes
- A typo in the key.
\ref{sec:b}when you wrote\label{sec:a}prints??, and the log saysLaTeX Warning: Reference 'sec:b' on page 1 undefined. It is a warning, so the PDF still builds: look for??. \labelbefore the thing it names. Put it after\section{...}(or after\caption{...}in a figure), or it picks up the wrong number.- One compile only. The first run writes the numbers down; the second uses them.
??after one run is normal.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
Label the Methods section with \label{sec:methods}, then refer to it from the last line with \ref{sec:methods}. LaTeX fills in the correct number for you.
PDF를 컴파일하고 미리보기하려면 '실행'을 클릭하세요.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
The same numbering machinery builds a table of contents. Add \tableofcontents as the first line of the body — LaTeX lists every section automatically.
PDF를 컴파일하고 미리보기하려면 '실행'을 클릭하세요.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
Equations can be labelled too. Put the formula in an equation environment with \label{eq:area} inside it, then refer to it in the last sentence with \eqref{eq:area}, which prints the number in brackets.
PDF를 컴파일하고 미리보기하려면 '실행'을 클릭하세요.