<<

. 2
( 7)



>>

sort
appear in the list of references
as sort but in addition multiple numerical citations are
sort&compress
compressed if possible (as 3“6, 15)
makes the ¬rst citation of any reference the equivalent
longnamesfirst
of the starred variant (full author list) and subsequent
citations normal (abbreviated list)
rede¬nes \thebibliography to issue \section* instead of
sectionbib
\chapter*; valid only for classes with a \chapter com-
mand; to be used with the chapterbib package
keeps all the authors™ names in a citation on one line;
nonamebreak
causes overfull hboxes but helps with some hyperref
problems.
You can set references in the Nature style of citations (superscripts) as follows
\documentclass{article}
\usepackage{natbib}
\citestyle{nature}
\begin{document}
.......
.......
\end{document}


Basic commands
III.2.2.

The natbib package has two basic citation commands, \citet and \citep for textual
and parenthetical citations, respectively. There also exist the starred versions \citet*
and \citep* that print the full author list, and not just the abbreviated one. All of these
may take one or two optional arguments to add some text before and after the citation.
Normally we use author name and year for labeling the bibliography.
\begin{thebibliography}{widest-label}
\bibitem{Leslie(1985)}{les85}Leslie Lamport, 1985.
\emph{\LaTeX---A Document Preparation}...
\bibitem{Donale(00)}{don89}Donald E. Knuth, 1989.
\emph{Typesetting Concrete Mathematics},...
\bibitem{Ronald, Donald and Ore(1989)}{rondon89}Ronald L. Graham, ...
\end{thebibliography}

Year in parentheses is mandatory in optional argument for bibitem. If year is missing
in any of the bibitem, the whole author“year citation will be changed to numerical cita-
tion. To avoid this, give ˜(0000)™ for year in optional argument and use partial citations
(\citeauthor) in text.
30 BIBLIOGRAPHY
III.


Don™t put ˜space character™ before opening bracket of year in optional argument.

Alex et al. (1991)

\citet{ale91}
Alex et al. (1991, chap. 4)

\citet[chap.˜4]{ale91}
(Alex et al., 1991)

\citep{ale91}
(Alex et al., 1991, chap. 4)

\citep[chap.˜4]{ale91}
(see Alex et al., 1991)

\citep[see][]{ale91}
(see Alex et al., 1991, chap. 4)
\citep[see][chap.˜4]{jon91} ’
Alex, Mathew, and Ravi (1991)

\citet*{ale91}
(Alex, Mathew, and Ravi, 1991)

\citep*{ale91}


Multiple citations
III.2.3.

Multiple citations may be made as usual, by including more than one citation key in the
\cite command argument.


Alex et al. (1991); Ravi et al. (1992)

\citet{ale91,rav92}
(Alex et al., 1991; Ravi et al. 1992)

\citep{ale91,rav92}
(Alex et al., 1991, 1992)

\citep{ale91,ale92}
(Alex et al., 1991a,b)

\citep{ale91a,ale91b}


Numerical mode
III.2.4.

These examples are for author“year citation mode. In numerical mode, the results are
different.

Alex et al. [5]

\citet{ale91}
Alex et al. [5, chap. 4]

\citet[chap.˜4]{ale91}
[5]

\citep{ale91}
[5, chap. 4]

\citep[chap.˜4]{ale91}
[see 5]

\citep[see][]{ale91}
[see 5, chap. 4]
\citep[see][chap.˜4]{ale91} ’
[5, 12]

\citep{ale91a,ale91b}




Suppressed parentheses
III.2.5.

As an alternative form of citation, \citealt is the same as \citet but without any paren-
theses. Similarly, \citealp is \citep with the parentheses turned off. Multiple references,
notes, and the starred variants also exist.

Alex et al. 1991

\citealt{ale91}
Alex, Mathew, and Ravi 1991

\citealt*{ale91}
Alex., 1991

\citealp{ale91}
Alex, Mathew, and Ravi, 1991

\citealp*{ale91}
Alex et al., 1991; Alex et al., 1992

\citealp{ale91,ale92}
Alex., 1991, pg. 7

\citealp[pg.˜7]{ale91}
(short comm.)

\citetext{short comm.}


The \citetext command allows arbitrary text to be placed in the current citation paren-
theses. This may be used in combination with \citealp.
31
III.2. NATBIB


Partial citations
III.2.6.

In author“year schemes, it is sometimes desirable to be able to refer to the authors with-
out the year, or vice versa. This is provided with the extra commands

Alex et al.

\citeauthor{ale91}
Alex, Mathew, and Ravi

\citeauthor*{ale91}

\citeyear{ale91} 1991
(1991)

\citeyearpar{ale91}




Citations aliasing
III.2.7.

Sometimes one wants to refer to a reference with a special designation, rather than by the
authors, i.e. as Paper I, Paper II. Such aliases can be de¬ned and used, textually and/or
parenthetically with:
\defcitealias{jon90}{Paper˜I}



’ Paper I
\citetalias{ale91}
’ (Paper I)
\citepalias{ale91}


These citation commands function much like \citet and \citep: they may take multiple
keys in the argument, may contain notes, and are marked as hyperlinks.

Selecting citation style and punctuation
III.2.8.

Use the command \bibpunct with one optional and six mandatory arguments:
The opening bracket symbol, default = (
1.
The closing bracket symbol, default = )
2.
The punctuation between multiple citations, default = ;
3.
The letter ˜n™ for numerical style, or ˜s™ for numerical superscript style, any other letter
4.
for author“year, default = author--year;
5. The punctuation that comes between the author names and the year
6. The punctuation that comes between years or numbers when common author lists are
suppressed (default = ,);
The optional argument is the character preceding a post-note, default is a comma
plus space. In rede¬ning this character, one must include a space if that is what one
wants.

Example 1
\bibpunct{[}{]}{,}{a}{}{;}

changes the output of
\citep{jon90,jon91,jam92}

into

[Jones et al. 1990; 1991, James et al. 1992].
32 BIBLIOGRAPHY
III.


Example 2
\bibpunct[;]{(}{)}{,}{a}{}{;}

changes the output of
\citep[and references therein]{jon90}

into

(Jones et al. 1990; and references therein).
TUTORIAL IV


BIBLIOGRAPHIC DATABASES


Bibliographic database is a database in which all the useful bibliographic entries can be
stored. The information about the various publications is stored in one or more ¬les with
the extension .bib. For each publication, there is a key that identi¬es it and which may
be used in the text document to refer to it. And this is available for all documents with
a list of reference in the ¬eld. This database is useful for the authors/researchers who
are constantly referring to the same publications in most of their works. This database
system is possible with the BIBTEX program supplied with the LTEX package.
A


THE BIBTEX
IV.1. PROGRAM

BIBTEX is an auxiliary program to LTEX that automatically constructs a bibliography for
A

a LTEX document from one or more databases. To use BIBTEX, you must include in your
A

LTEX input ¬le a \bibliography command whose argument speci¬es one or more ¬les
A

that contain the database. For example
\bibliography{database1,database2}

The above command speci¬es that the bibliographic entries are obtained from database1.bib
and database2.bib. To use BIBTEX, your LTEX input ¬le must contain a \bibliographystyle
A

command. This command speci¬es the bibliography style, which determines the format
of the source list. For example, the command
\bibliographystyle{plain}

speci¬es that entries should be formatted as speci¬ed by the plain bibliography style
(plain.bst). We can put \bibliographystyle command anywhere in the document after
the \begin{document} command.

BIBTEX
IV.2. STYLE FILES

Standard BIBTEX style. Entries sorted alphabetically with numeric labels.
plain
Standard BIBTEX style. Similar to plain, but entries are printed in order of
unsrt
citation, rather than sorted. Numeric labels are used.
Standard BIBTEX style. Similar to plain, but the labels of the entries are formed
alpha
from the author™s name and the year of publication.
Standard BIBTEX style. Similar to plain, but entries are more compact, since
abbrv
¬rst names, month, and journal names are abbreviated.
Alternative BIBTEX style, used for the journals of the Association for Comput-
acm
ing Machinery. It has the author name (surname and ¬rst name) in small caps,
and numbers as labels.

33
34 BIBLIOGRAPHIC DATABASES
IV.


Alternative BIBTEX style, used by the journals of the American Psychology As-
apalike
sociation. It should be used together with the LTEX apalike package. The
A

bibliography entries are formatted alphabetically, last name ¬rst, each entry
having a hanging indentation and no label.

Examples of some other style ¬les are:

abbrv.bst, abstract.bst, acm.bst, agsm.bst, kluwer.bst, named.bst, named.sty, nat-
alpha.bst, amsalpha.bst, authordatei.bst, bib.sty, natbib.bst, nature.sty, nature.bst,
authordate1-4.sty, bbs.bst, cbe.bst, cell.bst, phcpc.bst, phiaea.bst, phjcp.bst, phrmp.bst
dcu.bst, harvard.sty, ieeetr.bst, jtb.bst, plainyr.bst, siam.bst

Various organisations or individuals have developed style ¬les that correspond to the
house style of particular journals or editing houses. We can also customise a bibliography
style, by making small changes to any of the .bst ¬le, or else generate our own using the
makebst program.

Steps for running BIBTEX with LTEX
A
IV.2.1.

1. Run LTEX, which generates a list of \cite references in its auxiliary ¬le, .aux.
A

2. Run BIBTEX, which reads the auxiliary ¬le, looks up the references in a database
(one or more .bib ¬les, and then writes a ¬le (the .bbl ¬le) containing the formatted
references according to the format speci¬ed in the style ¬le (the .bst ¬le). Warning
and error messages are written to the log ¬le (the .blg ¬le). It should be noted that
BIBTEX never reads the original LTEX source ¬le.
A

3. Run LTEX again, which now reads the .bbl reference ¬le.
A

4. Run LTEX a third time, resolving all references.
A


Occasionally the bibliography is to include publications that were not referenced in
the text. These may be added with the command
\nocite{key}

given anywhere within the main document. It produces no text at all but simply informs
BIBTEX that this reference is also to be put into the bibliography. With \nocite{*}, every
entry in all the databases will be included, something that is useful when producing a list
of all entries and their keys.
After running BIBTEX to make up the .bbl ¬le, it is necessary to process LTEX at least
A

twice to establish both the bibliography and the in-text reference labels. The bibliography
will be printed where the \bibliography command is issued; it infact inputs the .bbl ¬le.

CREATING
IV.3. A BIBLIOGRAPHIC DATABASE

Though bibliographic database creation demands more work than typing up a list of
references with the thebibliography environment; it has a great advantage that, the en-
tries need to be included in the database only once and are then available for all future
publications even if a different bibliography style is demanded in later works, all the in-
formation is already on hand in the database for BIBTEX to write a new thebibliography
environment in another format. Given below is a specimen of an entry in bibliographic
database:

@BOOK{knuth:86a,
AUTHOR ="Donald E. Knuth",
35
CREATING
IV.3. A BIBLIOGRAPHIC DATABASE


TITLE ={The \TeX{}book},
EDITION ="third"
PUBLISHER ="Addison-Wesley",
ADDRESS ={Reading, MA},
YEAR =1986 }

The ¬rst word, pre¬xed @, determines the entry type. The entry type is followed by
the reference information for that entry enclosed in curly braces { }. The very ¬rst entry
is the key for the whole reference by which it is referred to in the \cite command. In the
above example it is knuth:86a. The actual reference information is then entered in various
¬elds, separated from one another by commas. Each ¬eld consists of a ¬eld name, an =
sign, with optional spaces on either side, and the ¬eld text. The ¬eld names shows above
are AUTHOR, TITLE, PUBLISHER, ADDRESS, and YEAR. The ¬eld text must be enclosed either
in curly braces or in double quotation marks. However, if the text consists solely of a
number, as for YEAR above, the braces or quotation marks may be left off.
For each entry type, certain ¬elds are required, others are optional, and the rest
are ignored. These are listed with the description of the various entry types below. If a
required ¬eld is omitted, an error message will appear during the BIBTEX run. Optional
¬elds will have their information included in the bibliography if they are present, but
they need not be there. Ignored ¬elds are useful for including extra information in the
database that will not be output, such as a comment or an abstract of a paper. Ignored
¬elds might also be ones that are used by other database programs.
The general syntax for entries in the bibliographic database reads

@entry_type{key,
field_name = {field text},
....
field_name = {field text} }

The names of the entry types as well as the ¬eld names may be written in capitals
or lower case letters, or in a combination of both. Thus @BOOK, @book, and @bOOk are all
acceptable variations.
The outermost pair of braces for the entire entry may be either curly braces { }, as
illustrated, or parentheses ( ). In the latter case, the general syntax reads

@entry_type(key, ... ..)

However, the ¬eld text may only be enclosed within curly braces {...} or double quotation
marks ... as shown in the example above.
The following is a list of the standard entry types in alphabetical order, with a brief
description of the types of works for which they are applicable, together with the required
and optional ¬elds that they take.
Entry for an article from a journal or magazine.
@article:
author, title, journal, year.
required ¬elds:
volume, number, pages, month, note.
optional ¬elds:
Entry for a book with a de¬nite publisher.
@book:
author or editor, title, publisher, year.
required ¬elds:
volume or number, series, address, edition, month, note.
optional ¬elds:
Entry for a printed and bound work without the name of a publisher
@booklet:
or sponsoring organisation.
title.
required ¬elds:
author, howpublished, address, month, year, note.
optional ¬elds:
36 BIBLIOGRAPHIC DATABASES
IV.


Entry for an article in conference proceedings.
@conference:
required ¬elds: author, title, booktitle, year.
optional ¬elds: editor, volume or number, series, pages, address, month, organisa-
tion, publisher, note.
Entry for a part (chapter, section, certain pages) of a book.
@inbook:
required ¬elds: author or editor, title, chapter and/or pages, publisher, year.
optional ¬elds: volume or number, series, type, address, edition, month, note.
@incollection: Entry for part of a book that has its own title.
required ¬elds: author, title, booktitle, publisher, year.
optional ¬elds: editor, volume or number, series, type, chapter, pages, address, edi-
tion, month, note.
@inproceedings: Entry for an article in conference proceedings.
required ¬elds: author, title, booktitle, year.
optional ¬elds: editor, volume or number, series, pages, address, month, organisa-
tion, publisher, note.
Entry for technical documentation.
@manual:
required ¬elds: title.
optional ¬elds: author, organisation, address, edition, month, year, note.
@masterthesis: Entry for a Master™s thesis.
required ¬elds: author, title, school, year.
optional ¬elds: type, address, month, note.
Entry for a work that does not ¬t under any of the others.
@misc:
required ¬elds: none.
optional ¬elds: author, title, howpublished, month, year, note.
Entry for a PhD thesis.
@phdthesis:
required ¬elds: author, title, school, year.
optional ¬elds: type, address, month, note.
Entry for conference proceedings.
@proceedings:
required ¬elds: title, year.
optional ¬elds: editor, volume or number, series, address, month, organisation,
publisher, note.
Entry for an unpublished work with an author and title.
@unpublished:
required ¬elds: author, title, note.
optional ¬elds: month, year.

Example of a LTEX ¬le (sample.tex) using bibliographical database (bsample.bib)
A
IV.3.1.

\documentclass{article}
\pagestyle{empty}
\begin{document}

\section*{Example of Citations of Kind \texttt{plain}}
Citation of a normal book˜\cite{Eijkhout:1991} and an edited
book˜\cite{Roth:postscript}. Now we cite an article written by a
single˜\cite{Felici:1991} and by multiple
authors˜\cite{Mittlebatch/Schoepf:1990}. A reference to an
article inside proceedings˜\cite{Yannis:1991}.
We refer to a manual˜\cite{Dynatext} and a technical
report˜\cite{Knuth:WEB}. A citation of an unpublished
work˜\cite{EVH:Office}. A reference to a chapter in a
book˜\cite{Wood:color} and to a PhD thesis˜\cite{Liang:1983}.
37
CREATING
IV.3. A BIBLIOGRAPHIC DATABASE


An example of multiple
citations˜\cite{Eijkhout:1991,Roth:postscript}.

\bibliographystyle{plain} %% plain.bst
\bibliography{bsample} %% bsample.bib
\end{document}

Procedure for producing references for the above ¬le sample.tex which uses bib-
IV.3.2.
liographic data base bsample.bib
$ latex sample % 1st run of LaTeX


$ bibtex sample % BibTeX run
% Then sample.bbl file will
% be produced


$ latex sample % 2nd run of LaTeX

If still unresolved citation references
$ latex sample % 3rd run of LaTeX
38
TUTORIAL V


TABLE OF CONTENTS, INDEX AND GLOSSARY


TABLE
V.1. OF CONTENTS

A table of contents is a special list which contains the section numbers and corresponding
headings as given in the standard form of the sectioning commands, together with the
page numbers on which they begin. Similar lists exist containing reference information
about the ¬‚oating elements in a document, namely, the list of tables and list of ¬gures.
The structure of these lists is simpler, since their contents, the captions of the ¬‚oating
elements, all are on the same level.
Standard LTEX can automatically create these three contents lists. By default, LTEX
A A

enters text generated by one of the arguments of the sectioning commands into the .toc
¬le. Similarly, LTEX maintains two more ¬les, one for the list of ¬gures (.lof) and one for
A

the list of tables (.lot), which contain the text speci¬ed as the argument of the \caption
command for ¬gures and tables.
\tableofcontents produces a table of contents. \listoffigures and \listoftables
produce a list of ¬gures and list of tables respectively. These lists are printed at the
point where these commands are issued. Occasionally, you may ¬nd that you do not
like the way LTEX prints a table of contents or a list of ¬gures or tables. You can ¬ne-
A

tune an individual entry by using the optional arguments to the sectioning command or
\caption command that generates it. Formatting commands can also be introduced with
the \addtocontents. If all else fails, you can edit the .toc, lof, lot ¬les yourself. Edit
these ¬les only when preparing the ¬nal version of your document, and use a \nofiles
command to suppress the writing of new versions of the ¬les.

Additional entries
V.1.1.

The *-form sectioning commands are not entered automatically in the table of contents.
LTEX offers two commands to insert such information directly into a contents ¬le:
A


\addtocontents{¬le}{text} \addcontentsline{¬le}{type}{text}

The extension of the contents ¬le, usually toc, lof or lot.
¬le
The type of the entry. For the toc ¬le the type is normally the same as
type
the heading according to the format of which an entry must be typeset.
For the lof or lot ¬les, figure or table is speci¬ed.
The actual information to be written to the ¬le mentioned. LTEX com-
A
text
mands should be protected by \protect to delay expansion
The \addtocontents command does not contain a type parameter and is intended to
enter user-speci¬c formatting information. For example, if you want to generate addi-
tional spacing in the middle of a table of contents, the following command can be issued:

\addtocontents{toc}{\protect\vspace{2ex}}


39
40 TABLE INDEX GLOSSARY
V. OF CONTENTS, AND


The \addcontentsline instruction is usually invoked automatically by the document
sectioning commands, or by the \caption commands. If the entry contains numbered
text, then \numberline must be used to separate the section number (number) from the
rest of the text for the entry (heading) in the text parameter:
\protect\numberline{number}{heading}

For example, a \caption command inside a figure environment saves the text an-
notating the ¬gure as follows:
\addcontentsline{lof}{¬gure}{\protect\numberline{\thefigure}captioned text}

Sometimes \addcontentsline is used in the source to complement the actions of
standard LTEX. For instance, in the case of the starred form of the section commands, no
A

information is written to the .toc ¬le. So if you do not want a heading number (starred
form) but an entry in the .toc ¬le you can write something like:

\chapter*{Forward}
\addcontentsline{toc}{chapter}{\numberline{}Forward}

This produces an indented “chapter” entry in the table of contents, leaving the space
where the chapter number would go free. Omitting the \numberline command would
typeset the word “Forward” ¬‚ush left instead.

Typesetting a contents list
V.1.2.

As discussed above, contents lists consist of entries of different types, corresponding to
the structural units that they represent. Apart from these standard entries, these lists may
contain any commands. A standard entry is speci¬ed by the command:
\contentsline{type}{text}{page}

Type of the entry, e.g. section, or figure.
type
Actual text as speci¬ed in the argument of the sectioning or \caption
text
commands.
Pagenumber.
page
Note that section numbers are entered as a parameter of the \numberline command
to allow formatting with the proper indentation. It is also possible for the user to create
a table of contents by hand with the help of the command \contentsline. For example:

\contentsline {section}
{\numberline {2.4}Structure of the Table of Contents}{31}

To format an entry in the table of contents ¬les, standard LTEX makes use of the
A

following command:
\@dottedtocline{level}{indent}{numwidth}{text}{page}

The last two parameters coincide with those of \contentsline, since the latter usu-
ally invokes \@dottedtocline command. The other parameters are the following:
The nesting level of an entry. This parameter allows the user to control
level
how many nesting levels will be displayed. Levels greater than the value
of counter tocdepth will not appear in the table of contents.
This is total indentation from the left margin.
indent
numwidth The width of the box that contains the number if text has a \numberline
command. This is also the amount of extra indentation added to the
second and later lines of a multiple line entry.
41
INDEX
V.2.


Additionally, the command \@dottedtocline uses the following formatting parame-
ters, which specify the visual appearance of all entries:
\@pnumwidth The width of the box in which the page number is set.
The indentation of the right margin for all but the last line of multiple
\@tocmarg
line entries. Dimension, but changed with \renewcommand.
The separation between dots, in mu (math units). It is a pure number
\@dotsep
(like 1.7 or 2). By making this number large enough you can get rid of
the dots altogether. Changed with \renewcommand as well.

Multiple tables of contents
V.1.3.

The minitoc package, initially written by Nigel Ward and Dan Jurafsky and completely
redesigned by Jean-Pierre Drucbert, creates a mini-table of contents (a “minitoc”) at the
beginning of each chapter when you use the book or report classes.
The mini-table of contents will appear at the beginning of a chapter, after the \chapter
command. The parameters that govern the use of this package are discussed below:

Table V.1: Summary of the minitoc parameters

Must be put just in front of \tableofcontents, to initialize
\dominitoc
the minitoc system (Mandatory).
This command replaces \tableofcontents when you want
\faketableofcontents
minitocs but not table of contents.
This command must be put right after each \chapter com-
\minitoc
mand where a minitoc is desired.
A LTEX counter that indicates how many levels of head-
A
\minitocdepth
ings will be displayed in the minitoc (default value is 2).
The length of the left/right indentation of the minitoc (de-
\mtcindent
fault value is 24pt).
Command de¬ning the font that is used for the minitoc
\mtcfont
entries (The default de¬nition is a small roman font).


For each mini-table, an auxiliary ¬le with extension .mtc<N> where <N> is the chap-
ter number, will be created.
By default, these mini-tables contain only references to sections and subsections. The
minitocdepth counter, similar to tocdepth, allows the user to modify this behaviour.
As the minitoc takes up room on the ¬rst page(s) of a chapter, it will alter the page
numbering. Therefore, three runs normally are needed to get correct information in the
mini-table of contents.
To turn off the \minitoc commands, merely replace the package minitoc with mini-
tocoff on your \usepackage command. This assures that all \minitoc commands will be
ignored.

INDEX
V.2.

To ¬nd a topic of interest in a large document, book, or reference work, you usually
turn to the table of contents or, more often, to the index. Therefore, an index is a very
important part of a document, and most users™ entry point to a source of information
is precisely through a pointer in the index. The most generally used index preparation
program is MakeIndex.
42 TABLE INDEX GLOSSARY
V. OF CONTENTS, AND




\indexentry{animal}{vi}
Page vi: \index{animal}
\indexentry{animal}{5}
Page 5: \index{animal}
Page 6: \index{animal} \indexentry{animal}{6}
Page 7: \index{animal} \indexentry{animal}{7}
Page 11: \index{animalism|see{animal}}
\indexentry{animalism|seeanimal}{11}
Page 17: \index{animal@\emph{animal}}
\indexentry{animal@\emph{animal}}{17}
\index{mammal|textbf}
\indexentry{mammal|textbf}{17}
Page 26: \index{animal!mammal!cat}
\indexentry{animal!mammal!cat}{26}
Page 32: \index{animal!insect}
\indexentry{animal!insect}{32}
(a) The input ¬le (b) The .idx ¬le


animal, vi 5“7
\begin{theindex}
\item animal, vi, 5“7 insect, 32
\subitem insect, 32 mammal
\subitem mammal cat, 26
\subsubitem cat, 26 animal, 17
animalism, see animal
\item \emph{animal}, 17
\item animalism, \see{animal}{11}
mammal, 17
\indexspace
\item mammal, \textbf{17}
\end{theindex}

(c) The .ind ¬le (d) The typeset output



Figure V.1: Stepwise development of index processing


Each \index command causes LTEX to write an entry in the .idx ¬le. This command
A

writes the text given as an argument, in the .idx ¬le. This .idx will be generated only if
we give \makeindex command in the preamble otherwise it will produce nothing.
\index{index entry}

To generate index follow the procedure given below:
1. Tag the words inside the document, which needs to come as index, as an argument of
\index command.
2. Include the makeidx package with an \usepackage command and put \makeindex com-
mand at the preamble.
3. Put a \printindex command where the index is to appear, normally before \end{document}
command.
4. LTEX ¬le. Then a raw index (file.idx) will be generated.
A

5. Then run makeindex. (makeindex ¬le.idx or makeindex ¬le). Then two more ¬les will
be generated, ¬le.ind which contains the index entries and ¬le.ilg, a transcript ¬le.
6. Then run LTEX again. Now you can see in the dvi that the index has been generated
A

in a new page.

Simple index entries
V.2.1.

Each \index command causes LTEX to write an entry in the .idx ¬le. For example
A

\index{index entry}
43
INDEX
V.2.




fonts Page ii: \index{table|(}
Computer Modern, 13“25 Page xi: \index{table|)}
math, see math, fonts Page 5: \index{fonts!PostScript|(}
PostScript, 5 \index{fonts!PostScript|)}
table, ii“xi, 14 Page 13 \index{fonts!Computer Modern |(}
Page 14: \index{table}
Page 17: \index{fonts!math|see{math, fonts}}
Page 21: \index{fonts!Computer Modern}
Page 25: \index{fonts!Computer Modern|)}



Figure V.2: Page range and cross-referencing


Sub entries
V.2.2.

Up to three levels of index entries (main, sub, and subsub entries) are available with
LTEX-MakeIndex. To produce such entries, the argument of the \index command should
A

contain both the main and subentries, separated by ! character.
Page 5: \index{dimensions!rule!width}
This will come out as
dimensions
rule
width, 5


Page ranges and cross-references
V.2.3.

You can specify a page range by putting the command \index{...|(} at the beginning of
the range and \index{...|)} at the end of the range. Page ranges should span a homoge-
neous numbering scheme (e.g., Roman and Arabic page numbers cannot fall within the
same range).
You can also generate cross-reference index entries without page numbers by using
the see encapsulator. Since “see” entry does not print any page number, the commands
\index{...|see{...}} can be placed anywhere in the input ¬le after the \begin{document}
command. For practical reasons, it is convenient to group all such cross-referencing
commands in one place.

Controlling the presentation form
V.2.4.

Sometimes you may want to sort an entry according to a key, while using a different
visual representation for the typesetting, such as Greek letters, mathematical symbols, or
speci¬c typographic forms. This function is available with the syntax: key@visual, where
key determines the alphabetical position and the string value produces the typeset text of
the entry.
For some indexes certain page numbers should be formatted specially, with an italic
page number (for example) indicating a primary reference, and an n after a page number
denoting that the item appears in a footnote on that page. MakeIndex allows you to
format an individual page number in any way you want by using the encapsulator syntax
speci¬ed | character. What follows the | sign will “encapsulate” or enclose the page num-
ber associated with the index entry. For instance, the command \index{keyword|xxx}
will produce a page number of the form \xxx{n}, where n is the page number in question.
44 TABLE INDEX GLOSSARY
V. OF CONTENTS, AND




delta, 14 Page ii: \index{tabular|textbf}
δ, 23 Page 5: \index{ninety-¬ve}
delta wing, 16 Page 7: \index{tabbing}
Page 14:
¬‚ower, 19 \index{delta}
ninety, 26 Page 16: \index{delta wing}
xc, 28 Page 19: \index{¬‚ower@\textbf{¬‚ower}}
ninety-¬ve, 5 Page 21: \index{tabular|textit}
tabbing, 7, 34“37 Page 22: \index{tabular|nn}
tabular, ii, 21, 22n Page 23: \index{delta@δ}
tabular environment, 23 \index{tabular@\texttt{tabular}
environment}
Page 26: \index{ninety}
Page 28: \index{ninety@xc}
Page 34: \index{tabbing|(textit}
Page 36: \index{tabbing|)}



Figure V.3: Controlling the presentation form


@ sign, 2 \index{bar@\texttt{"|}|see{vertical bar}}
|, see vertical bar Page 1: \index{quote (\verb+""+)}
exclamation (!), 4 \index{quote@\texttt{""} sign}
Ah!, 5 Page 2: \index{atsign@\texttt{"@} sign}
¨
Madchen, 3 Page 3: \index{maedchen@M\"{a}dchen}
quote ("), 1 Page 4: \index{exclamation ("!)}
" sign, 1 Page 5: \index{exclamation ("!)!Ah"!}




Figure V.4: Printing those special characters


Similarly, the command \index{keyword|(xxx)} will generate a page range of the form
\xxx{n-m}
\newcommand{\nn}[1]{#1n}

Printing those special characters
V.2.5.

To typeset one of the characters having a special meaning to MakeIndex (!, ", @, or |)
in the index, precede it with a " character. More precisely, any character is said to be
quoted if it follows an unquoted " that is not part of a \" command. The latter case is for
allowing umlaut characters. Quoted !, @, ", or | characters are treated like ordinary
characters, losing their special meaning. The " preceding a quoted character is deleted
before the entries are alphabetised.

GLOSSARY
V.3.

A ˜glossary™ is a special index of terms and phrases alphabetically ordered together with
their explanations. To help set up a glossary, LTEX offers the commands
A

in the preamble and
\makeglossary
in the text part
\glossary{glossary-entry}
45
GLOSSARY
V.3.


which function just like the commands for making up an index register. The entries are
written to a ¬le with extension .glo after the command \makeglossary has been given in
the preamble. The form of these ¬le entries from each \glossary command is
\glossaryentry\textit{glossary-entry}{pagenumber}

The information in the .glo ¬le can be used to establish a glossary. However, there is no
equivalent to the theindex environment for a glossary, but a recommended structure is
the description environment or a special list environment.
46
TUTORIAL VI


DISPLAYED TEXT


There are many instances in a document when we want to visually separate a portion
of text from its surrounding material. One method of doing this is to typeset the distin-
guished text with added indentation. It is called displaying. LTEX has various constructs
A

for displaying text depending the nature of the displayed text.

BORROWED
VI.1. WORDS

Quotations are often used in a document, either to add weight to our arguments by
referring to a higher authority or because we ¬nd that we cannot improve on the way
an idea has been expressed by someone else. If the quote is a one-liner, we can simply
include it within double-quotes and be done with it (remember how to use quotes in
TEX?) But if the quotation is several lines long, it is better to display it. Look at the
following example:

Some mathematicians elevate the spirit of Mathematics to a kind of intellectual aesthetics. It
is best voiced by Bertrand Russell in the following lines.
The true spirit of delight, the exaltation, the sense of being more than man, which
is the touchstone of the highest excellence, is to be found in Mathematics as surely
as in poetry.. . . Real life is, to most men, a long second best, a perpetual compro-
mise between the ideal and the possible; but the world of pure reason knows no
compromise, no practical limitations, no barriers to the creative activity embody-
ing in splendid edi¬ces the passionate aspiration after the perfect, from which all
great work springs.
Yes, to men like Russell, Mathematics is more of an art than science.


This was type set as shown below
Some mathematicians elevate the spirit of Mathematics to a kind of
intellectual aesthetics. It is best voiced by Bertrand Russell in the
following lines.
\begin{quote}
The true spirit of ................................from which
all great work springs.
\end{quote}

Note that here we give instructions to TEX to typeset some material in a separate
paragraph with additional indentation on either side and indicate the start and end of
material requiring special treatment, by means of the commands
\begin{quote} ... \end{quote}


47
48 DISPLAYED TEXT
VI.


This is an example of what is known in LTEX parlance as an environment. Environ-
A

ments are used to delimit passages requiring special typographic treatments and to give
instructions to LTEX on how to typeset it. The general form of an environment is of the
A

form
\begin{name} ... \end{name}
where name is the name of the environment and signi¬es to LTEX the type of typographic
A

treatment required (deliberate attempt at a pun, that).
The quoted part in this example is a single paragraph. If the quotation runs into
several paragraphs, we must use the quotation environment, by enclosing the quotation
within \begin{quotation} and \end{quotation}. As usual, paragraphs are separated by
blank lines while typing the source ¬le.

POETRY
VI.2. IN TYPESETTING

LTEX can write poetry...well almost; if you write poems, TEX can nicely typeset it for
A

you. (I have also heard some TEX wizards saying Knuth™s code is sheer poetry!) Look at
the passage below:

Contrary to popular belief, limericks are not always ribald. Some of them contain mathemati-
cal concepts:
A mathematician once con¬ded
¨
That a Mobius band is one sided
You™ll get quite a laugh
If you cut it in half
For it stays in one piece when divided
There is an extension of this to Klein™s bottle also.

This was typeset as follows:
Contrary to popular belief, ... tried their hands at it:
\begin{verse}
A mathematician confided\\
A M\"obius band is one sided\\
You™ll get quite a laugh\\
If you cut it in half\\
For it stays in one piece when divided
\end{verse}
There is an extension of this to Klein™s bottle also.


Note that line breaks are forced by the symbol \\. Different stanzas are separated
in the input by one (or more) blank lines. If you do not want TEX to start a new page at
a particular line break (if you want to keep rhyming couplets together in one page, for
example), then use \\* instead of plain \\. Again, if you want more space between lines
than what LTEX deems ¬t, then use \\ with an optional length as in \\[5pt] which adds
A

an extra vertical space of 5 points between the lines. You can also type \\*[5pt], whose
intention should be obvious by now.

MAKING
VI.3. LISTS

Lists are needed to keep some semblance of order in a chaotic world and LTEX helps us
A

to typeset them nicely. Also, there are different kinds of lists available by default and if
49
MAKING
VI.3. LISTS


none of them suits your need, there are facilities to tweak these or even design your own.
Let us ¬rst have a look at the types of lists LTEX provides.
A


Saying it with bullets
VI.3.1.

The itemize environment gives us a bullet-list. For example it produces something like
this:

One should keep the following in mind when using TEX
• TEX is a typesetting language and not a word processor
• TEX is a program and and not an application
• Theres is no meaning in comparing TEX to a word processor, since the design purposes
are different
Being a program, TEX offers a high degree of ¬‚exibility.


The input which produces this is given below:
One should keep the following in mind when using \TeX
\begin{itemize}
\item \TeX\ is a typesetting language and not a word processor
\item \TeX\ is a program and and not an application
\item Theres is no meaning in comparing \teX\ to a word processor, since the design
purposes are different
\end{itemize}
Being a program, \TeX\ offers a high degree of flexibility.

The \begin{itemize} ... \end{itemize} pair signi¬es we want a bullet-list of the
enclosed material. Each item of the list is speci¬ed by (what else?) an \item command.
We can have lists within lists. For example:

One should keep the following in mind when using TEX
• TEX is a typesetting language and not a word processor
• TEX is a program and and not an application
• Theres is no meaning in comparing TEX to a word processor, since the design purposes
are different
• TEX is the natural choice in one of these situations
“ If we want to typeset a document containing lot of Mathematics
“ If we want our typed document to look beautiful
Being a program, TEX offers a high degree of ¬‚exibility.

It is produced by the input below:
One should keep the following in mind when using \TeX
\begin{itemize}
\item \TeX\ is a typesetting language and not a word processor
\item \TeX\ is a program and and not an application
\item Theres is no meaning in comparing \TeX\ to a word processor, since the design
purposes are different
\item \TeX\ is the natural choice in one of these situations
\begin{itemize}
\item If we want to typeset a document containing lot of Mathematics
50 DISPLAYED TEXT
VI.


\item If we want our typed document to look beautiful
\end{itemize}
\end{itemize}
Being a program, \TeX\ offers a high degree of flexibility.

The itemize environment supports four levels of nesting. The full list of labels for the
items (˜bullets™ for the ¬rst level, ˜dashes™ for the second and so on) is as shown below

• The ¬rst item in the ¬rst level
• the second item in the ¬rst level
“ The ¬rst item in the second level
“ the second item in the second level
— The ¬rst item in the third level
— the second item in the third level
· The ¬rst item in the fourth level
· the second item in the fourth level


Not satis¬ed with these default labels? How about this one?

First item of a new list
Second item

It was produced by the following input:
{\renewcommand{\labelitemi}{$\triangleright$}
\begin{itemize}
\item First item of a new list
\item Second item
\end{itemize}}

Several things need explanation here. First note that the ¬rst level labels of the
itemize environment are produced by the (internal and so invisible to the user) command
\labelitemi and by default, this is set as \textbullet to produce the default ˜bullets™.
What we do here by issuing the \renewcommand is to override this by a choice of our own
namely $\triangleright$ which produces the little triangles in the above list. Why the
braces { and } (did you notice them?) enclosing the whole input? They make the effect
of the \renewcommand local in the sense that this change of labels is only for this speci¬c
list. Which means the next time we use an itemize environment, the labels revert back
to the original ˜bullets™. If we want the labels to be changed in the entire document, then
remove the braces.
What if we want to change the second level labels? No problem, just change the
\labelitemii command, using a symbol of our choice. The third and fourth level labels
are set by the commands (can you guess?) \labelitemiii and \labelitemiv. Look at the
following example.
51
WHEN
VI.4. ORDER MATTERS



 The ¬rst item in the ¬rst level
 the second item in the ¬rst level
 The ¬rst item in the second level
 the second item in the second level
 The ¬rst item in the third level
 the second item in the third level
 The ¬rst item in the fourth level
 the second item in the fourth level

Here the labels are chosen from the PostScript ZapfDingbats font. We will have to use
the package pifont, by including the line \usepackage{pifont} in our document preamble
to access them. The source of the above output is
\renewcommand{\labelitemi}{\ding{42}}
\renewcommand{\labelitemii}{\ding{43}}
\renewcommand{\labelitemiii}{\ding{44}}
\renewcommand{\labelitemiv}{\ding{45}}
\begin{itemize}
\item The first item in the first level
\item the second item in the first level
\begin{itemize}
\item The first item in the second level
\item the second item in the second level
\begin{itemize}
\item The first item in the third level
\item the second item in the third level
\begin{itemize}
\item The first item in the fourth level
\item the second item in the fourth level
\end{itemize}
\end{itemize}
\end{itemize}
\end{itemize}}




WHEN
VI.4. ORDER MATTERS

When the order of the items in a list is important, we need a list which speci¬es this order.
For example, consider this

The three basic steps in producing a printed document using LTEX are as follows
A


1. Prepare a source ¬le with the extension tex
2. Compile it with LTEX to produce a dvi ¬le
A

3. Print the document using a dvi driver

Such a numbered list is produced by the enumerate environment in LTEX. The above list
A

was produced by the following source.
\begin{enumerate}
\item prepare a source file with the extension "tex"
52 DISPLAYED TEXT
VI.


\item Compile it with \LaTeX to produce a "dvi" file
\item Print the document using a "dvi" driver
\end{enumerate}

As in the case of itemize environment, here also four levels of nesting are supports.
The example below shows the labels used for different levels.

1. The ¬rst item in the ¬rst level
2. the second item in the ¬rst level
(a) The ¬rst item in the second level
(b) the second item in the second level
i. The ¬rst item in the third level
ii. the second item in the third level
A. The ¬rst item in the fourth level
B. the second item in the fourth level

How about customizing the labels? Here there is an additional complication in that
the labels for items in the same level must follow a sequence (such as 1,2,3,. . . for the
¬rst level, (a), (b), (c),. . . for the second and so on, by default). There is a method for
doing it, but it will take us into somewhat deeper waters. Fortunately, there is a package
enumerate by David Carlisle, which makes it easy. So if we want

The three basic steps in producing a printed document using LTEX are as follows:
A


Step 1. Prepare a source ¬le with the extension tex
Step 2. Compile it with LTEX to produce a dvi ¬le
A

i. Use a previewer (such as xdvi on X Window System) to view the output
ii. Edit the source if needed
iii. Recompile
Step 3. Print the document using a dvi driver (such as dvips)

just type the input as follows
The three basic steps in producing a printed document
using \LaTeX\ are as follows:
\begin{enumerate}[\hspace{0.5cm}Step 1.]
\item Prepare a source file with the extension "tex"
\item Compile it with \LaTeX to produce a "dvi" file
\begin{enumerate}[i.]
\item Use a previewer (such as "xdvi" on
\textsf{X Window System}) to view the output
\item Edit the source if needed
\item Recompile
\end{enumerate}
\item Print the document using a "dvi" driver
(such as "dvips")
\end{enumerate}

As you can see, the labels Step 1, Step 2 and Step 3 are produced by the optional ar-
gument Step 1 within square brackets immediately following the ¬rst \begin{enumerate}
command and the labels i, ii, iii for the second level enumeration are produced by the
optional [i] following the second \begin{enumerate}. So, what is \hspace{0.5cm} doing
in the ¬rst optional argument? It is to provide an indentation at the left margin of the
¬rst level items, which the enumerate environment does not produce by default.
53
WHEN
VI.4. ORDER MATTERS


We can add further embellishments. For example, if we want the labels in the
¬rst level of the above example to be in boldface, just change the optional argument
[\hspace{0.5cm} Step 1] to [\hspace{0.5cm}\bfseries Step 1]. This produces:


The three basic steps in producing a printed document using LTEX are as follows:
A


Step 1 Prepare a source ¬le with the extension tex
Step 2 Compile it with LTEX to produce a dvi ¬le
A

(a) Use a previewer (such as xdvi on X Window System) to view the output
(b) Edit the source if needed
(c) Recompile
Step 3 Print the document using a dvi driver (such as dvips)


Some care must be taken when we give options like this. Suppose we want to pro-
duce something like this

Addition of numbers satis¬es the following conditions:
(A1) It is commutative
(A2) It is associative
(A3) There is an additive identity
(A4) Each number has an additive inverse

If we give the option [\hspace{1cm}(A1)] as in
Addition of numbers satisfies the following conditions:
\begin{enumerate}[\hspace{1cm}(A1)]
\item It is commutative
\item It is associative
\item There is an additive identity
\item Each number has an additive inverse
\end{enumerate}

Then we get the (somewhat surprising) output

(11) It is commutative
(22) It is associative
(33) There is an additive identity
(44) Each number has an additive inverse

What happened? In the enumerate package, the option [A] signi¬es that we want the
labels to be named in the sequence A, B, C,. . . ,Z (the upper case Roman alphabet) and
the option [1] signi¬es we want them as 1,2,3,. . . (the Arabic numerals). Other signi¬ers
are [a] for lowercase Roman letters, [I] for uppercase Roman numerals and [i] for
lowercase Roman numerals. So, if we use any one of these in the optional argument with
some other purpose in mind, then enclose it in braces. Thus the correct input to generate
the above example is
Addition of numbers satisfies the following conditions
\begin{enumerate}[\hspace{1cm}({A}1)]
\item It is commutative
\item It is associative
\item There is an additive identity
54 DISPLAYED TEXT
VI.


\item Each number has an additive inverse
\end{enumerate}

with braces surrounding the A. (The mystery is not over, is it? How come we got 11,
22,. . . in the above example and not A1, B2,. . . ? Work it out yourselves!)

DESCRIPTIONS
VI.5. AND DEFINITIONS

There is a third type of list available off-the-shelf in LTEX which is used in typesetting
A

lists like this

Let us take stock of what we have learnt
TEX A typesetting program
Emacs A text editor and also
a programming environment
a mailer
and a lot else besides
AbiWord A word processor

This is produced by the description environment as shown below:
Let us take stock of what we have learnt
\begin{description}
\item[\TeX] A typesetting program
\item[Emacs] A text editor and also
\begin{description}
\item a programming environment
\item a mailer
\item and a lot else besides
\end{description}
\item[AbiWord] A word processor
\end{description}

Note that this environment does not produce on its own any labels for the various
items, but only produces as labels, whatever we give inside square brackets immediately
after each \item. By default, the labels are typeset in boldface roman. Also, there is no
indentation for the ¬rst level. As with the other list environments, these can be changed
to suit your taste. For example, suppose we want labels to be typeset in sans-serif roman
and also want an indentation even for the ¬rst level. The code below will do the trick
(remember why we include the whole input within braces?):
\renewcommand{\descriptionlabel}[1]{\hspace{1cm}\textsf{#1}}
Let us take stock of what we have learnt
\begin{description}
\item[\TeX] A typesetting program
\item[Emacs] A text editor and also
\begin{description}
\item a programming environment
\item and a lot else besides
\end{description}
\item[AbiWord] A word processor
\end{description}
55
DESCRIPTIONS
VI.5. AND DEFINITIONS



and we get the output

Let us take stock of what we have learnt
TEX A typesetting program
Emacs A text editor and also
a programming environment
and a lot else besides
AbiWord A word processor


Now is perhaps the time to talk about a general feature of all the three list environ-
ments we have seen. In any of these, we can override the default labels (if any) produced
by the environment by something of our own by including it within square brackets
immediately after the \item. Thus the input
The real number $l$ is the least upper bound of the
set $A$ if it satisfies the following conditions
\begin{enumerate}
\item[(1)] $l$ is an upper bound of $A$
\item[(2)] if $u$ is an upper bound of $A$, then $l\le u$
\end{enumerate}
The second condition is equivalent to
\begin{enumerate}
\item[(2)$™$] If $a<l$, then $a$ is not an upper bound of $A$.
\end{enumerate}

produces

The real number l is the least upper bound of the set A if it satis¬es the following conditions
(1) l is an upper bound of A
(2) if u is an upper bound of A, then l ¤ u
The second condition is equivalent to
(2) If a < l, then a is not an upper bound of A.


This feature sometimes produces unexpected results. For example, if you type
Let™s review the notation
\begin{itemize}
\item (0,1) is an \emph{open} interval
\item [0,1] is a \emph{closed} interval
\end{itemize}

you will get

Let™s review the notation
• (0,1) is an open interval
0,1 is a closed interval

What happened? The 0,1 within square brackets in the second item is interpreted by
LTEX as the optional label for this item. The correct way to typeset this is
A
56 DISPLAYED TEXT
VI.


Let™s review the notation
\begin{itemize}
\item $(0,1)$ is an \emph{open} interval
\item $[0,1]$ is a \emph{closed} interval
\end{itemize}

which produces

<<

. 2
( 7)



>>