General ⇒ How to refer to the index in the text?
-
- Posts: 8
- Joined: Sat Oct 16, 2010 1:24 am
How to refer to the index in the text?
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.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
How to refer to the index in the text?
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}
-
- Posts: 8
- Joined: Sat Oct 16, 2010 1:24 am
Re: How to refer to the index in the text?
Thank you, very much!