1

I want know how to use \ref. I don't know why it doesn't work.

\documentclass[11pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\begin{document}
Welcome to the \label{here}reference
\newpage
go to reference~\ref{here} on page 1
\end{document}

Thanks for help me.

Solid
  • 363

1 Answers1

3

I try to make up something from the comments and your answers to them, maybe it's what you want:

\documentclass[11pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\begin{document}
\section{Start}
Welcome to the \label{here}reference
\newpage
\section{Mid}
go to reference in section~\ref{here} on page~\pageref{here}
\end{document}

The result looks like:

page

Basically a \ref is always referencing towards the counter of the chapter/section/subsection/... while a \pageref is referencing to the page the label is on. hyperref also has an \autoref which has some standard names for chapter/section/subsection, so you can leave that part out of writing.

TobiBS
  • 5,240