Hi. I'm new in this community.
I hope to be posting in the right section.
Does anyone know how to refer to index in the text?
I mean... I want to write something like this: "as stated before in item XX". And instead of "XX" I want that LaTeX show the corresponding item number showed in the index.
The point is: When I change the document putting in a new section or subsection, the number in index will change. I want that change to be followed in the text too.
Thank you all.
General ⇒ How to refer to the index in the text?
NEW: TikZ book now 40% off at Amazon.com for a short time.

How to refer to the index in the text?
Hi,
if by "index" you mean the Table of Contents (ToC) of your document, then the simplest approach would be to use the \label{<key>}, \ref{<key>} mechanism; a little example:
You must compile your document twice.
if by "index" you mean the Table of Contents (ToC) of your document, then the simplest approach would be to use the \label{<key>}, \ref{<key>} mechanism; a little example:
Code: Select all
\documentclass{book}
\begin{document}
\tableofcontents
\clearpage
In Chapter~\ref{cha:one} we present... and in Chapter~\ref{cha:two} we discuss...
\chapter{Test chpater one}\label{cha:one}
\section{Test section one one}\label{sec:oneone}
\section{Test section one two}\label{sec:onetwo}
\chapter{Test chpater two}\label{cha:two}
\section{Test section two one}\label{sec:twoone}
\section{Test section two two}\label{sec:twotwo}
As we see in Sections~\ref{sec:oneone} and~\ref{sec:twotwo}...
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
-
- Posts: 8
- Joined: Sat Oct 16, 2010 1:24 am
Re: How to refer to the index in the text?
Yes. Thats is exact what I wanted.
Thank you, very much!
Thank you, very much!