SlideShare a Scribd company logo
Indian TEX Users Group
: http://www.river-valley.com/tug

Why cross refer . . .
A
Let LTEX do it

12

Pointing to a . . .
Pointing outside . . .
Lost the keys? . . .

Title Page

A
On-line Tutorial on LTEX
The Tutorial Team
Indian TEX Users Group,  Buildings, Cotton Hills
Trivandrum 695014, 
2000
Prof. (Dr.) K. S. S. Nambooripad, Director, Center for Mathematical Sciences, Trivandrum, (Editor); Dr. E. Krishnan, Reader
in Mathematics, University College, Trivandrum; Mohit Agarwal, Department of Aerospace Engineering, Indian Institute of
Science, Bangalore; T. Rishi, Focal Image (India) Pvt. Ltd., Trivandrum; L. A. Ajith, Focal Image (India) Pvt. Ltd.,
Trivandrum; A. M. Shan, Focal Image (India) Pvt. Ltd., Trivandrum; C. V. Radhakrishnan, River Valley Technologies,
Software Technology Park, Trivandrum constitute the Tutorial team

A
A
This document is generated from LTEX sources compiled with pdfLTEX v. 14e in an INTEL
Pentium III 700 MHz system running Linux kernel version 2.2.14-12. The packages used
are hyperref.sty and pdfscreen.sty

A
c 2000, Indian TEX Users Group. This document may be distributed under the terms of the LTEX
A
Project Public License, as described in lppl.txt in the base LTEX distribution, either version 1.0
or, at your option, any later version

Page 1 of 16

Go Back

Full Screen

Close

Quit
A
12 Cross References in LTEX
Why cross refer . . .
A
Let LTEX do it

Pointing to a . . .

12.1.

Why cross references?
Cross reference is the technical term for quoting yourself. This is what you do when you say
something like, “As I said earlier, . . . ”. More seriously, in a written article, you may often have
occasion to refer the reader to something mentioned earlier (or sometimes to something yet to
be said) in the same document. Thus you may have explained a new term in the second section
of your article and when you use this term again in the fourth section, it is a matter of courtesy
to the reader to point to the explanation. Again, in a Mathematics article, you may have to cite
an earlier result in the proof of the current result.
Such references can be done by hand, but if you revise your document and insert some new
sections (or theorems) then changing all cross references manually is no easy task. It is always
better to automate such tedious tasks.(After all what’s a computer for, if not to do such mundane
jobs?)

Pointing outside . . .
Lost the keys? . . .

Title Page

Page 2 of 16

Go Back

12.2.

A
Let LTEX do it

The basic method of using cross references (see Section 12.1 for what we mean by cross referee)
A
in LTEX is quite simple. Suppose that somewhere in the in the second section of you article,
you want to refer to the first section. You assign a key to the first section using the command

Full Screen

Close

Quit
section{ section name }label{ key }

and at the point in the second section where the reference is to be made, you type the command
Why cross refer . . .
A
Let LTEX do it

ref{ key }

Pointing to a . . .
Pointing outside . . .

Thus the reference “see Section 12.1 . . . ” in the first sentence of this section was produced by
including the command label{intro} in the command for the first section as

Lost the keys? . . .

Title Page

section{Why cross references}label{intro}

and the command ref{intro} at the place of reference in the second section as
. . . (see Sectionref{intro} for . . .
Page 3 of 16

Okay, the example is a bit silly, since the actual reference here is not really necessary, but you
get the general idea, don’t you? Incidentally, the label{key} for a section need not be given
immediately after the section{section name}. It can be given anywhere within the section.
A
The first time you run LTEX on a file named, say, myfile.tex containing cross references, the
A
reference information in an auxiliary file named myfile.aux and at the end of the run LTEX
prints a warning

Go Back

Full Screen

Close

LaTeX Warning: There were undefined references.
Quit
LaTeX Warning: Label(s) may have changed.
Rerun to get cross-references right.

A second run gets the references right. The same thing happens when you’ve changed the
reference information in any way, say, by adding a new section.
Though the key in label{key} can be any sequence letters, digits or punctuation characters,
it is convenient to use some mnemonic (such as label{limcon} for a section entitled “Limits
and Continuity” rather than label{sec@#*?!}. Also, when you make a reference, it’s better
to type ˜ref{limcon} (notice the tie?) than ref{limcon} to prevent the possibility of the
reference number falling off the edge as in “ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . see Section
12.1 for further details. . . . ”
In addition to sectioning commands such as chapter or section, reference can also be made
to an item entry in an enumerate environment, by attaching a label. For example the input
In the classical emph{syllogism}
begin{enumerate}
item All men are mortal.label{pre1}
item Socrates is a man.label{pre2}
item So Socrates is a mortal.label{con}
end{enumerate}
Statements (ref{pre1}) and (ref{pre2}) are
the emph{premises} and statement (ref{con}) is
the conclusion.

Why cross refer . . .
A
Let LTEX do it

Pointing to a . . .
Pointing outside . . .
Lost the keys? . . .

Title Page

Page 4 of 16

Go Back

Full Screen

gives the following output
Close

Quit
In the classical syllogism
(1) All men are mortal.
(2) Socrates is a man.
(3) So Socrates is a mortal.
Statements (1) and (2) are the premises and statement (3) is the conclusion

Why cross refer . . .
A
Let LTEX do it

You must be a bit careful about references to tables or figures (technically, “floats”). For them,
the label command should be given after the caption command or in its argument, as in the
example below
begin{table}[h]
begin{center}
setlength{extrarowheight}{5pt}
begin{tabular}{|c|c|c|c|}
hline
Value of $x$ & 1 & 2 & 3
hline
Value of $y$ & 1 & 8 & 27
hline
end{tabular}
caption{Observed values of $x$ and $y$}label{tabxy}
end{center}
end{table}
Two possible relations betweeen $x$ and $y$ satisfying
the data in Tableref{tabxy} are $y=xˆ3$ and
$y=6xˆ2-11x+6$

Pointing to a . . .
Pointing outside . . .
Lost the keys? . . .

Title Page

Page 5 of 16

Go Back

Full Screen

Close

produces the following output
Quit
Value of x

1

2

3

Value of y

1

8

27

Table 12.6 Observed values of x and y

Two possible relations between x and y satisfying the data in Table 12.6 are
y = x3 and y = 6x2 − 11x + 6
You can think of a caption command within a figure or table environment as a sort of
sectioning command within the environment. Thus you can have several caption and label
pairs within a single figure or table environment.
You can also make forward references in exactly the same way by refing to the key of some
succeeding label such as “see Subsection 12.2.1 for a discussion of cross references in Mathematics.”

12.2.1.

Why cross refer . . .
A
Let LTEX do it

Pointing to a . . .
Pointing outside . . .
Lost the keys? . . .

Title Page

Cross references in Math
Mathematical documents abounds in cross references. There are references to theorems and
equations and figures and whatnot. The method of reference is exactly as before. Thus if
you’ve defined newtheorem{thm}[subsection], then after typing

Page 6 of 16

Go Back

begin{thm}label{diffcon}
Every differentiable function is continuous
end{thm}

to get

Full Screen

Close

Theorem 12.2.1.1 Every differentiable function is continuous
Quit
and you can type elsewhere in the document
The converse of Theorem˜ref{diffcon} is false.

Why cross refer . . .

to get

A
Let LTEX do it

Pointing to a . . .

The converse of Theorem 12.2.1.1 is false.

Pointing outside . . .
Lost the keys? . . .

References can be made to equations as in the following examples.

Title Page

Input
begin{equation}label{sumsq}
(x+y)ˆ2=xˆ2+2xy+yˆ2
end{equation}
Changing $y$ to $-y$ in
Equation˜(ref{sumsq})
gives the following

Output
(x + y)2 = x2 + 2xy + y2

(12.1)

Changing y to −y in Equation (12.1) gives
the following

Page 7 of 16

If you load the package amsmath, you can use the command eqref instead of ref to make a
reference to an equation. This automatically supplies the parantheses around the equation number and provides an italic correction before the closing parenthesis, if necessary. For example,

Go Back

Full Screen

Equation˜eqref{sumsq} gives the following
Close

produces

Quit
Equation (12.1) gives the following
References can be made to individual equations in multiline displays of equations produced
by such environments as align or gather (defined in the amsmath package). The label
command can be used within such a structure for subnumbering as in the example below
Why cross refer . . .
A
Let LTEX do it

Input
begin{align}
(x+y)ˆ2&=xˆ2+2xy+yˆ2
label{sum}
(x-y)ˆ2&=xˆ2-2xy+yˆ2
tag{ref{sum}a}
end{align}

12.3.

Output
(x + y)2 = x2 + 2xy + y2
(x − y)2 = x2 − 2xy + y2

Pointing to a . . .

(12.2)
(12.2a)

Pointing outside . . .
Lost the keys? . . .

Title Page

Pointing to a page – the package varioref
In making a reference to a table or an equation, it is more to convenient (for the reader, that is)
to give the page number of the reference also. The command

Page 8 of 16

Go Back

pageref{key}
Full Screen

typesets the number of the page where the command label{key} was given. Thus for example
Close

see Table˜ref{tabxy} in page˜pageref{tabxy}
Quit
in this document produces
see Table 12.6 in page 6
To avoid the tedium of typing
Why cross refer . . .

ref{key} on page˜pageref{key}

A
Let LTEX do it

Pointing to a . . .
Pointing outside . . .

every time, you can define the macro
newcommand{fullref}[1]{ref{#1} on page˜pageref{#1}}

and use fullref for such references. But the trouble is that at times the referred abject and
the reference to it fall on the same page (with TEX you never know this till the end) so that
you get a reference to the page number of the very page you are reading, which looks funny.
This can be avoided by using the package varioref. If you load this package by including
usepackage{varioref} in your preamble, then you can use the command

Lost the keys? . . .

Title Page

Page 9 of 16

vref{key}
Go Back

to refer to an object you’ve marked with label{key} elsewhere in the document. The action
of vref varies according to the page(s) where the referred object and the reference are typeset
by TEX in the final output

Full Screen

Close

(1) If the object and the reference are on the same page, vref produces only a ref suppressing pageref so that only the number pointing to the object is typeset, without any

Quit
reference to the page number.
(2) If the object and the reference are on different pages whose numbers differ by more than
1, vref produces both ref and pageref.
(3) If the object and the reference fall on pages whose numbers differ by one (that is, on
successive pages), vref produces ref followed by the phrase “on the preceding page”
or “on the following page” depending on whether the object or the reference occurs first.
Moreover, in the next occurance of vref in a situation of the same type, the phrases are
changed to “on the next page” and the “page before” respectively.

Why cross refer . . .
A
Let LTEX do it

Pointing to a . . .
Pointing outside . . .

This is the default behavior of vref in the article documentclass. If the article class is used with
the twoside option or if the documentclass book is used, then the behavior in Case (3)above is
a bit different.

Lost the keys? . . .

Title Page

(1) If the object and the reference fall on the two sides of the same leaf, the behavior of vref
is as in 3 above.
(2) If the object and the reference fall on pages forming a double spread (that is, a page of even
number followed by the next page), then vref produces ref followed by the phrase “on
the facing page”. Moreover, in the next occurence of vref in a situation of the same type,
the phrases are changed to “on the preceding page” and “on the next page” respectively.
Page 10 of 16

The phrases used in the various case considered above can be customized by redefining the commands generating them. For the article class without the twoside option, reference to the previous page use the command reftextbefore and reference to the next page uses reftextafter.
In the case of the article class with the twoside option or the book class, the commands
reftextfaceafter and reftextfacebefore are used in the case of reference to a page in
a double spread. The default definitions of these commands are given below. In all these, the
two arguments of the command reftextvario are the phrases alternatively used in the repeated
use of the reference as mentioned above.

Go Back

Full Screen

Close

Quit
newcommand{reftextbefore}
{on the reftextvario{preceding page}{page before}}
newcommand{reftextafter}
{on the reftextvario{following}{next} page}
newcommand{reftextfacebefore}
{on the reftextvario{facing}{preceding} page}
newcommand{reftextfaceafter}
{on the reftextvario{facing}{next}{page}}

Why cross refer . . .
A
Let LTEX do it

Pointing to a . . .

You can customize the phrases generated in various situations by redefining these with phrases
of your choice in the arguments of reftextvario.
If you want to refer only to a page number using varioref, you can use the command

Pointing outside . . .
Lost the keys? . . .

Title Page

vpageref{key}

to produce the page number of the object marked with label{key}. The phrases used in the
various special cases are the same as described above, except that when the referred object and
the reference fall on the same page, either the phrase “on this page” or “on the current page” is
produced. The command used to generate these is reftextcurrenr whose default definition is
newcommand{reftextcurrent}
{on reftextvario{this}{the current} page}

You can change the phrases “this” and “the current” globally by redefining this command. You
can also make some local changes by using the two optional arguments that vpageref allows.
Thus you can use the command
vpageref[same page phrase][other page phrase]{key}

Page 11 of 16

Go Back

Full Screen

Close

Quit
to refer to the page number of the object marked with label{key}. The same page phrase will
be used if the object and the reference fall on the same page and the phrase other page phrase
will be used, if they fall on different pages. Thus for example, the command
see the vpageref[above table][table]{tabxy}
Why cross refer . . .
A
Let LTEX do it

Pointing to a . . .

given in this document will produce

Pointing outside . . .

see the above table
if the reference occurs on the same page as Table 12.6 and

Lost the keys? . . .

Title Page

see the tableon page 6
if they fall on different pages.

12.4.

Pointing outside – the package xr

Page 12 of 16

Go Back

Sometimes you may want to refer to something in a document other than the one you are
working on. (This happens, for instance if you keep an article as separate files.) The package xr
allows such external references.

Full Screen

If you want to refer to objects in a file named other.tex in your current document, load the
package xr and set the external document as other.tex using the commands

Close

usepakage{xr}
externaldocument{other}

Quit
in the preamble of the current document. Then you can use the ref and pageref to refer
to anything that has been marked with the label command in either the current document or
other.tex. Any number of such external documents can be specified.
If same key is used to mark different objects in two such documents, there’ll be a conflict. To
get over this, you can use the optional argument available in externaldocument command. If
you say

Why cross refer . . .
A
Let LTEX do it

externaldocument[a-]{other}

Pointing to a . . .
Pointing outside . . .
Lost the keys? . . .

then a reference to label{key} in other.tex could be made by ref{a-key}. The prefix need
not be a-; it can be any convenient string.

12.5.

Title Page

Lost the keys? Use lablst.tex
One of the conveniences of using keys for cross references is that you need not keep track of
the actual numbers, but then you’ll have to remember the keys. You can produce the list of keys
A
used in a document by running LTEX on the file lablst.tex. In my system, I do this by first
typing

Page 13 of 16

Go Back

latex lablst
Full Screen

Close

Quit
A
LTEXresponds as follows

*********************************
* Enter input file name
*
without the .tex extension:
*********************************

Why cross refer . . .
A
Let LTEX do it

lablstfile=

Pointing to a . . .
Pointing outside . . .
Lost the keys? . . .

I type in the file name as cref which is the source of this document. I’m presented with another
query.
Title Page

**********************************************
* Enter document class used in file cref.tex
*
with no options or extension:
**********************************************
lablstclass=
Page 14 of 16

So I type article. I am asked
Go Back

********************************************
* Enter packages used in file cref.tex
*
with no options or extensions:
********************************************

Full Screen

Close

lablstpackages=
Quit
Here I need give only those packages used in the article which define commands used in section
titles etc. need be given. So I type
amsmath,array,enumerate
Why cross refer . . .

This produces a file lablst.dvi which I can view to see a list of keys used in the document.

A
Let LTEX do it

Pointing to a . . .

Finally if your text editor is GNU Emacs, then you can use its RefTeX package to automate generation, insertion and location of keys at the editing stage.

Pointing outside . . .
Lost the keys? . . .

Click here to see lablst output
Title Page

Page 15 of 16

Go Back

Full Screen

Close

Quit
Why cross refer . . .

File tutor.tex — lablst output ()

A
Let LT X do it

E
Using document class: ../tugindia
Pointing to a . . .
and packages: txfonts,varioref,pdfscreen,colortbl,xspace,woodfont,tutorial,longtable,hhline,ifthen,lay
1

Pointing outside . . .
Lost the keys? . . .

Logical labels within sections
A
Cross References in LTEX

2

12.1

Why cross references?

2

12.2

A
Let LTEX do it

12

intro

Page:

2

1
2
3
12.6
12.2.1
12.2.1.1
12.1
12.2

Page:
Page:
Page:
Page:
Page:
Page:
Page:
Page:

5
5
5
6
6
6
7
8

3

Page:
Page:
Page:

10
12
12

2
pre1
pre2
con
tabxy
mathref
diffcon
sumsq
sum

12.3

12.1

Title Page

Pointing to a page – the package varioref

Page 16 of 16

8
diff1
1@xvr
1@vr

Go Back

12.4

Pointing outside – the package xr

12

12.5

Lost the keys? Use lablst.tex

13

Bibliography logical labels

Full Screen

Close

Quit

More Related Content

PDF
Lesson 4 stacks and queues
PDF
PDF
Lesson 5 link list
PDF
Lesson 2.2 abstraction
PDF
Latex Tutorial by Dr. M. C. Hanumantharaju
PDF
The Expression Problem - Part 1
PDF
Introduction to database-Normalisation
PPTX
Lesson 4 stacks and queues
Lesson 5 link list
Lesson 2.2 abstraction
Latex Tutorial by Dr. M. C. Hanumantharaju
The Expression Problem - Part 1
Introduction to database-Normalisation

What's hot (20)

PDF
Introduction to LaTeX - Workshop Day 1
PPTX
single linked list
PPT
Linked list
PDF
IJERD(www.ijerd.com)International Journal of Engineering Research and Develop...
PPT
linked list (c#)
PPTX
Link list presentation slide(Daffodil international university)
PPTX
linked list in data structure
PPTX
Circular link list.ppt
DOCX
PPTX
Lecture3a sorting
PPTX
Deletion from single way linked list and search
PDF
EE6711 Power System Simulation Lab manual
PPT
Data structures using c
PPTX
Linked list
PPTX
Join operation
PPT
DATA STRUCTURES
PPT
Singly link list
PDF
Latex Tutorial
Introduction to LaTeX - Workshop Day 1
single linked list
Linked list
IJERD(www.ijerd.com)International Journal of Engineering Research and Develop...
linked list (c#)
Link list presentation slide(Daffodil international university)
linked list in data structure
Circular link list.ppt
Lecture3a sorting
Deletion from single way linked list and search
EE6711 Power System Simulation Lab manual
Data structures using c
Linked list
Join operation
DATA STRUCTURES
Singly link list
Latex Tutorial
Ad

Viewers also liked (15)

PPTX
Family literacy events made easy 2013
PPT
1010735電子商務
PPTX
Norman Peires
PDF
A STOCHASTIC STATISTICAL APPROACH FOR TRACKING HUMAN ACTIVITY
PDF
CPH snapshot of activities 2015-16 final
PDF
PPTX
Преподавание перевода. Пример презентации: buzzwords, канцелярит, глаголобояз...
PPTX
Teaching: support and advice
PPTX
Strategic Business Planning Development
PDF
Financieringswijzer energiezuinig bouwen
PDF
SUPERVISED LEARNING MODEL FOR KICKSTARTER CAMPAIGNS WITH R MINING
PDF
SUNU - 3 : PROJE ANALİZ
PPTX
Negus
PPS
Az első hó Bene hegyen 2014
PPTX
DISCOVER MIKE
Family literacy events made easy 2013
1010735電子商務
Norman Peires
A STOCHASTIC STATISTICAL APPROACH FOR TRACKING HUMAN ACTIVITY
CPH snapshot of activities 2015-16 final
Преподавание перевода. Пример презентации: buzzwords, канцелярит, глаголобояз...
Teaching: support and advice
Strategic Business Planning Development
Financieringswijzer energiezuinig bouwen
SUPERVISED LEARNING MODEL FOR KICKSTARTER CAMPAIGNS WITH R MINING
SUNU - 3 : PROJE ANALİZ
Negus
Az első hó Bene hegyen 2014
DISCOVER MIKE
Ad

Similar to Chap12 scr (20)

PDF
La tex basics
PDF
Chap03 scr
PDF
Chap11 scr
PPTX
Latex Tuitorial
PPT
Introduction to latex by Rouhollah Nabati
PPTX
LaTex tutorial with Texstudio
PPTX
Introduction to matlab
PDF
Chap16 scr
PDF
Chap17 scr
PDF
Latex_Tutorial.pdf
PPT
LaTeX_tutorial_Syed_Jan09.ppt
PDF
Introduction to Latex
PDF
Matrix Indexing in MATLAB - MATLAB & Simulink.pdf
PDF
A Hitchhiker S Guide To LaTex (Or How I Learned To Stop Worrying And Love Wri...
PDF
Technical writing using LaTeX
PDF
Chap02 scr
PPTX
latex-workshop Dr: Mohamed A. Alrshah
PDF
Learn Latex
PDF
PDF
An Introduction to MATLAB with Worked Examples
La tex basics
Chap03 scr
Chap11 scr
Latex Tuitorial
Introduction to latex by Rouhollah Nabati
LaTex tutorial with Texstudio
Introduction to matlab
Chap16 scr
Chap17 scr
Latex_Tutorial.pdf
LaTeX_tutorial_Syed_Jan09.ppt
Introduction to Latex
Matrix Indexing in MATLAB - MATLAB & Simulink.pdf
A Hitchhiker S Guide To LaTex (Or How I Learned To Stop Worrying And Love Wri...
Technical writing using LaTeX
Chap02 scr
latex-workshop Dr: Mohamed A. Alrshah
Learn Latex
An Introduction to MATLAB with Worked Examples

More from Hirwanto Iwan (20)

PDF
Analisis Butir Soal PAS Matematika Wajib Kelas 12 IPA/IPS 2024-2025
PDF
01. integral fungsi aljabar
PDF
Analisis Butir Soal PG Matematika Wajib Kelas XII IPA-IPS NFBS Serang
PDF
Analisis Butir Soal Pilihan Ganda Matematika Wajib Kelas XII IPA
PDF
Materi Limit Aljabar dan Turunan Aljabar
PDF
Pembahasan Soal Matematika Wajib PTS Kelas XI IPS
PDF
Pembahasan Soal Matematika Wajib PTS Kelas XI IPA
PDF
Fitur Baru WinEdt 9.1
PDF
Pemasangan WinEdt 9.1
PDF
Kumpulan Soal UM UGM
PDF
Membuat Dokumen LaTeX Edisi ke - 33
PDF
LATEX OR INDESIGN
PDF
AGH Beamer
PDF
AFIT Beamer
PDF
Hackd Beamer
PDF
LUH Beamer
PDF
Cambridge Beamer
PDF
ESOP Beamer
PDF
AP Beamer
PDF
Naked Beamer
Analisis Butir Soal PAS Matematika Wajib Kelas 12 IPA/IPS 2024-2025
01. integral fungsi aljabar
Analisis Butir Soal PG Matematika Wajib Kelas XII IPA-IPS NFBS Serang
Analisis Butir Soal Pilihan Ganda Matematika Wajib Kelas XII IPA
Materi Limit Aljabar dan Turunan Aljabar
Pembahasan Soal Matematika Wajib PTS Kelas XI IPS
Pembahasan Soal Matematika Wajib PTS Kelas XI IPA
Fitur Baru WinEdt 9.1
Pemasangan WinEdt 9.1
Kumpulan Soal UM UGM
Membuat Dokumen LaTeX Edisi ke - 33
LATEX OR INDESIGN
AGH Beamer
AFIT Beamer
Hackd Beamer
LUH Beamer
Cambridge Beamer
ESOP Beamer
AP Beamer
Naked Beamer

Recently uploaded (20)

PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PPTX
Modernising the Digital Integration Hub
PPTX
OMC Textile Division Presentation 2021.pptx
PPT
What is a Computer? Input Devices /output devices
PDF
WOOl fibre morphology and structure.pdf for textiles
PPTX
Chapter 5: Probability Theory and Statistics
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
August Patch Tuesday
PDF
Getting Started with Data Integration: FME Form 101
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
Assigned Numbers - 2025 - Bluetooth® Document
cloud_computing_Infrastucture_as_cloud_p
Getting started with AI Agents and Multi-Agent Systems
A contest of sentiment analysis: k-nearest neighbor versus neural network
observCloud-Native Containerability and monitoring.pptx
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Modernising the Digital Integration Hub
OMC Textile Division Presentation 2021.pptx
What is a Computer? Input Devices /output devices
WOOl fibre morphology and structure.pdf for textiles
Chapter 5: Probability Theory and Statistics
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Zenith AI: Advanced Artificial Intelligence
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
August Patch Tuesday
Getting Started with Data Integration: FME Form 101
NewMind AI Weekly Chronicles - August'25-Week II
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...

Chap12 scr

  • 1. Indian TEX Users Group : http://www.river-valley.com/tug Why cross refer . . . A Let LTEX do it 12 Pointing to a . . . Pointing outside . . . Lost the keys? . . . Title Page A On-line Tutorial on LTEX The Tutorial Team Indian TEX Users Group,  Buildings, Cotton Hills Trivandrum 695014,  2000 Prof. (Dr.) K. S. S. Nambooripad, Director, Center for Mathematical Sciences, Trivandrum, (Editor); Dr. E. Krishnan, Reader in Mathematics, University College, Trivandrum; Mohit Agarwal, Department of Aerospace Engineering, Indian Institute of Science, Bangalore; T. Rishi, Focal Image (India) Pvt. Ltd., Trivandrum; L. A. Ajith, Focal Image (India) Pvt. Ltd., Trivandrum; A. M. Shan, Focal Image (India) Pvt. Ltd., Trivandrum; C. V. Radhakrishnan, River Valley Technologies, Software Technology Park, Trivandrum constitute the Tutorial team A A This document is generated from LTEX sources compiled with pdfLTEX v. 14e in an INTEL Pentium III 700 MHz system running Linux kernel version 2.2.14-12. The packages used are hyperref.sty and pdfscreen.sty A c 2000, Indian TEX Users Group. This document may be distributed under the terms of the LTEX A Project Public License, as described in lppl.txt in the base LTEX distribution, either version 1.0 or, at your option, any later version Page 1 of 16 Go Back Full Screen Close Quit
  • 2. A 12 Cross References in LTEX Why cross refer . . . A Let LTEX do it Pointing to a . . . 12.1. Why cross references? Cross reference is the technical term for quoting yourself. This is what you do when you say something like, “As I said earlier, . . . ”. More seriously, in a written article, you may often have occasion to refer the reader to something mentioned earlier (or sometimes to something yet to be said) in the same document. Thus you may have explained a new term in the second section of your article and when you use this term again in the fourth section, it is a matter of courtesy to the reader to point to the explanation. Again, in a Mathematics article, you may have to cite an earlier result in the proof of the current result. Such references can be done by hand, but if you revise your document and insert some new sections (or theorems) then changing all cross references manually is no easy task. It is always better to automate such tedious tasks.(After all what’s a computer for, if not to do such mundane jobs?) Pointing outside . . . Lost the keys? . . . Title Page Page 2 of 16 Go Back 12.2. A Let LTEX do it The basic method of using cross references (see Section 12.1 for what we mean by cross referee) A in LTEX is quite simple. Suppose that somewhere in the in the second section of you article, you want to refer to the first section. You assign a key to the first section using the command Full Screen Close Quit
  • 3. section{ section name }label{ key } and at the point in the second section where the reference is to be made, you type the command Why cross refer . . . A Let LTEX do it ref{ key } Pointing to a . . . Pointing outside . . . Thus the reference “see Section 12.1 . . . ” in the first sentence of this section was produced by including the command label{intro} in the command for the first section as Lost the keys? . . . Title Page section{Why cross references}label{intro} and the command ref{intro} at the place of reference in the second section as . . . (see Sectionref{intro} for . . . Page 3 of 16 Okay, the example is a bit silly, since the actual reference here is not really necessary, but you get the general idea, don’t you? Incidentally, the label{key} for a section need not be given immediately after the section{section name}. It can be given anywhere within the section. A The first time you run LTEX on a file named, say, myfile.tex containing cross references, the A reference information in an auxiliary file named myfile.aux and at the end of the run LTEX prints a warning Go Back Full Screen Close LaTeX Warning: There were undefined references. Quit
  • 4. LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. A second run gets the references right. The same thing happens when you’ve changed the reference information in any way, say, by adding a new section. Though the key in label{key} can be any sequence letters, digits or punctuation characters, it is convenient to use some mnemonic (such as label{limcon} for a section entitled “Limits and Continuity” rather than label{sec@#*?!}. Also, when you make a reference, it’s better to type ˜ref{limcon} (notice the tie?) than ref{limcon} to prevent the possibility of the reference number falling off the edge as in “ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . see Section 12.1 for further details. . . . ” In addition to sectioning commands such as chapter or section, reference can also be made to an item entry in an enumerate environment, by attaching a label. For example the input In the classical emph{syllogism} begin{enumerate} item All men are mortal.label{pre1} item Socrates is a man.label{pre2} item So Socrates is a mortal.label{con} end{enumerate} Statements (ref{pre1}) and (ref{pre2}) are the emph{premises} and statement (ref{con}) is the conclusion. Why cross refer . . . A Let LTEX do it Pointing to a . . . Pointing outside . . . Lost the keys? . . . Title Page Page 4 of 16 Go Back Full Screen gives the following output Close Quit
  • 5. In the classical syllogism (1) All men are mortal. (2) Socrates is a man. (3) So Socrates is a mortal. Statements (1) and (2) are the premises and statement (3) is the conclusion Why cross refer . . . A Let LTEX do it You must be a bit careful about references to tables or figures (technically, “floats”). For them, the label command should be given after the caption command or in its argument, as in the example below begin{table}[h] begin{center} setlength{extrarowheight}{5pt} begin{tabular}{|c|c|c|c|} hline Value of $x$ & 1 & 2 & 3 hline Value of $y$ & 1 & 8 & 27 hline end{tabular} caption{Observed values of $x$ and $y$}label{tabxy} end{center} end{table} Two possible relations betweeen $x$ and $y$ satisfying the data in Tableref{tabxy} are $y=xˆ3$ and $y=6xˆ2-11x+6$ Pointing to a . . . Pointing outside . . . Lost the keys? . . . Title Page Page 5 of 16 Go Back Full Screen Close produces the following output Quit
  • 6. Value of x 1 2 3 Value of y 1 8 27 Table 12.6 Observed values of x and y Two possible relations between x and y satisfying the data in Table 12.6 are y = x3 and y = 6x2 − 11x + 6 You can think of a caption command within a figure or table environment as a sort of sectioning command within the environment. Thus you can have several caption and label pairs within a single figure or table environment. You can also make forward references in exactly the same way by refing to the key of some succeeding label such as “see Subsection 12.2.1 for a discussion of cross references in Mathematics.” 12.2.1. Why cross refer . . . A Let LTEX do it Pointing to a . . . Pointing outside . . . Lost the keys? . . . Title Page Cross references in Math Mathematical documents abounds in cross references. There are references to theorems and equations and figures and whatnot. The method of reference is exactly as before. Thus if you’ve defined newtheorem{thm}[subsection], then after typing Page 6 of 16 Go Back begin{thm}label{diffcon} Every differentiable function is continuous end{thm} to get Full Screen Close Theorem 12.2.1.1 Every differentiable function is continuous Quit
  • 7. and you can type elsewhere in the document The converse of Theorem˜ref{diffcon} is false. Why cross refer . . . to get A Let LTEX do it Pointing to a . . . The converse of Theorem 12.2.1.1 is false. Pointing outside . . . Lost the keys? . . . References can be made to equations as in the following examples. Title Page Input begin{equation}label{sumsq} (x+y)ˆ2=xˆ2+2xy+yˆ2 end{equation} Changing $y$ to $-y$ in Equation˜(ref{sumsq}) gives the following Output (x + y)2 = x2 + 2xy + y2 (12.1) Changing y to −y in Equation (12.1) gives the following Page 7 of 16 If you load the package amsmath, you can use the command eqref instead of ref to make a reference to an equation. This automatically supplies the parantheses around the equation number and provides an italic correction before the closing parenthesis, if necessary. For example, Go Back Full Screen Equation˜eqref{sumsq} gives the following Close produces Quit
  • 8. Equation (12.1) gives the following References can be made to individual equations in multiline displays of equations produced by such environments as align or gather (defined in the amsmath package). The label command can be used within such a structure for subnumbering as in the example below Why cross refer . . . A Let LTEX do it Input begin{align} (x+y)ˆ2&=xˆ2+2xy+yˆ2 label{sum} (x-y)ˆ2&=xˆ2-2xy+yˆ2 tag{ref{sum}a} end{align} 12.3. Output (x + y)2 = x2 + 2xy + y2 (x − y)2 = x2 − 2xy + y2 Pointing to a . . . (12.2) (12.2a) Pointing outside . . . Lost the keys? . . . Title Page Pointing to a page – the package varioref In making a reference to a table or an equation, it is more to convenient (for the reader, that is) to give the page number of the reference also. The command Page 8 of 16 Go Back pageref{key} Full Screen typesets the number of the page where the command label{key} was given. Thus for example Close see Table˜ref{tabxy} in page˜pageref{tabxy} Quit
  • 9. in this document produces see Table 12.6 in page 6 To avoid the tedium of typing Why cross refer . . . ref{key} on page˜pageref{key} A Let LTEX do it Pointing to a . . . Pointing outside . . . every time, you can define the macro newcommand{fullref}[1]{ref{#1} on page˜pageref{#1}} and use fullref for such references. But the trouble is that at times the referred abject and the reference to it fall on the same page (with TEX you never know this till the end) so that you get a reference to the page number of the very page you are reading, which looks funny. This can be avoided by using the package varioref. If you load this package by including usepackage{varioref} in your preamble, then you can use the command Lost the keys? . . . Title Page Page 9 of 16 vref{key} Go Back to refer to an object you’ve marked with label{key} elsewhere in the document. The action of vref varies according to the page(s) where the referred object and the reference are typeset by TEX in the final output Full Screen Close (1) If the object and the reference are on the same page, vref produces only a ref suppressing pageref so that only the number pointing to the object is typeset, without any Quit
  • 10. reference to the page number. (2) If the object and the reference are on different pages whose numbers differ by more than 1, vref produces both ref and pageref. (3) If the object and the reference fall on pages whose numbers differ by one (that is, on successive pages), vref produces ref followed by the phrase “on the preceding page” or “on the following page” depending on whether the object or the reference occurs first. Moreover, in the next occurance of vref in a situation of the same type, the phrases are changed to “on the next page” and the “page before” respectively. Why cross refer . . . A Let LTEX do it Pointing to a . . . Pointing outside . . . This is the default behavior of vref in the article documentclass. If the article class is used with the twoside option or if the documentclass book is used, then the behavior in Case (3)above is a bit different. Lost the keys? . . . Title Page (1) If the object and the reference fall on the two sides of the same leaf, the behavior of vref is as in 3 above. (2) If the object and the reference fall on pages forming a double spread (that is, a page of even number followed by the next page), then vref produces ref followed by the phrase “on the facing page”. Moreover, in the next occurence of vref in a situation of the same type, the phrases are changed to “on the preceding page” and “on the next page” respectively. Page 10 of 16 The phrases used in the various case considered above can be customized by redefining the commands generating them. For the article class without the twoside option, reference to the previous page use the command reftextbefore and reference to the next page uses reftextafter. In the case of the article class with the twoside option or the book class, the commands reftextfaceafter and reftextfacebefore are used in the case of reference to a page in a double spread. The default definitions of these commands are given below. In all these, the two arguments of the command reftextvario are the phrases alternatively used in the repeated use of the reference as mentioned above. Go Back Full Screen Close Quit
  • 11. newcommand{reftextbefore} {on the reftextvario{preceding page}{page before}} newcommand{reftextafter} {on the reftextvario{following}{next} page} newcommand{reftextfacebefore} {on the reftextvario{facing}{preceding} page} newcommand{reftextfaceafter} {on the reftextvario{facing}{next}{page}} Why cross refer . . . A Let LTEX do it Pointing to a . . . You can customize the phrases generated in various situations by redefining these with phrases of your choice in the arguments of reftextvario. If you want to refer only to a page number using varioref, you can use the command Pointing outside . . . Lost the keys? . . . Title Page vpageref{key} to produce the page number of the object marked with label{key}. The phrases used in the various special cases are the same as described above, except that when the referred object and the reference fall on the same page, either the phrase “on this page” or “on the current page” is produced. The command used to generate these is reftextcurrenr whose default definition is newcommand{reftextcurrent} {on reftextvario{this}{the current} page} You can change the phrases “this” and “the current” globally by redefining this command. You can also make some local changes by using the two optional arguments that vpageref allows. Thus you can use the command vpageref[same page phrase][other page phrase]{key} Page 11 of 16 Go Back Full Screen Close Quit
  • 12. to refer to the page number of the object marked with label{key}. The same page phrase will be used if the object and the reference fall on the same page and the phrase other page phrase will be used, if they fall on different pages. Thus for example, the command see the vpageref[above table][table]{tabxy} Why cross refer . . . A Let LTEX do it Pointing to a . . . given in this document will produce Pointing outside . . . see the above table if the reference occurs on the same page as Table 12.6 and Lost the keys? . . . Title Page see the tableon page 6 if they fall on different pages. 12.4. Pointing outside – the package xr Page 12 of 16 Go Back Sometimes you may want to refer to something in a document other than the one you are working on. (This happens, for instance if you keep an article as separate files.) The package xr allows such external references. Full Screen If you want to refer to objects in a file named other.tex in your current document, load the package xr and set the external document as other.tex using the commands Close usepakage{xr} externaldocument{other} Quit
  • 13. in the preamble of the current document. Then you can use the ref and pageref to refer to anything that has been marked with the label command in either the current document or other.tex. Any number of such external documents can be specified. If same key is used to mark different objects in two such documents, there’ll be a conflict. To get over this, you can use the optional argument available in externaldocument command. If you say Why cross refer . . . A Let LTEX do it externaldocument[a-]{other} Pointing to a . . . Pointing outside . . . Lost the keys? . . . then a reference to label{key} in other.tex could be made by ref{a-key}. The prefix need not be a-; it can be any convenient string. 12.5. Title Page Lost the keys? Use lablst.tex One of the conveniences of using keys for cross references is that you need not keep track of the actual numbers, but then you’ll have to remember the keys. You can produce the list of keys A used in a document by running LTEX on the file lablst.tex. In my system, I do this by first typing Page 13 of 16 Go Back latex lablst Full Screen Close Quit
  • 14. A LTEXresponds as follows ********************************* * Enter input file name * without the .tex extension: ********************************* Why cross refer . . . A Let LTEX do it lablstfile= Pointing to a . . . Pointing outside . . . Lost the keys? . . . I type in the file name as cref which is the source of this document. I’m presented with another query. Title Page ********************************************** * Enter document class used in file cref.tex * with no options or extension: ********************************************** lablstclass= Page 14 of 16 So I type article. I am asked Go Back ******************************************** * Enter packages used in file cref.tex * with no options or extensions: ******************************************** Full Screen Close lablstpackages= Quit
  • 15. Here I need give only those packages used in the article which define commands used in section titles etc. need be given. So I type amsmath,array,enumerate Why cross refer . . . This produces a file lablst.dvi which I can view to see a list of keys used in the document. A Let LTEX do it Pointing to a . . . Finally if your text editor is GNU Emacs, then you can use its RefTeX package to automate generation, insertion and location of keys at the editing stage. Pointing outside . . . Lost the keys? . . . Click here to see lablst output Title Page Page 15 of 16 Go Back Full Screen Close Quit
  • 16. Why cross refer . . . File tutor.tex — lablst output () A Let LT X do it E Using document class: ../tugindia Pointing to a . . . and packages: txfonts,varioref,pdfscreen,colortbl,xspace,woodfont,tutorial,longtable,hhline,ifthen,lay 1 Pointing outside . . . Lost the keys? . . . Logical labels within sections A Cross References in LTEX 2 12.1 Why cross references? 2 12.2 A Let LTEX do it 12 intro Page: 2 1 2 3 12.6 12.2.1 12.2.1.1 12.1 12.2 Page: Page: Page: Page: Page: Page: Page: Page: 5 5 5 6 6 6 7 8 3 Page: Page: Page: 10 12 12 2 pre1 pre2 con tabxy mathref diffcon sumsq sum 12.3 12.1 Title Page Pointing to a page – the package varioref Page 16 of 16 8 diff1 1@xvr 1@vr Go Back 12.4 Pointing outside – the package xr 12 12.5 Lost the keys? Use lablst.tex 13 Bibliography logical labels Full Screen Close Quit