<< . . . 3( : 23) . . >>
A A

ifying the kind of document to be produced, using the command \documentclass{... }.
We™ve also noted that for a short article (which can actually turn out to be quite long!) we
write \documentclass{article} and for books, we write \documentclass{book}. There
are other document classes available in LTEX such as report and letter. All of them
A

share some common features and there are features speci¬c to each.
In addition to specifying the type of document (which we must do, since LTEX hasA

no default document class), we can also specify some options which modify the default
format.Thus the actual syntax of the \documentclass command is
\documentclass[options]{class}
Note that options are given in square brackets and not braces. (This is often the
case with LTEX commands”options are speci¬ed within square brackets, after which
A

mandatory arguments are given within braces.)

Font size
II.1.1.

We can select the size of the font for the normal text in the entire document with one of
the options
10pt 11pt 12pt
Thus we can say
\documentclass[11pt]{article}
to set the normal text in our document in 11 pt size. The default is 10pt and so this is the
size we get, if we do not specify any font-size option.

Paper size
II.1.2.

We know that LTEX has its own method of breaking lines to make paragraphs. It also has
A

methods to make vertical breaks to produce different pages of output. For these breaks
to work properly, it must know the width and height of the paper used. The various
options for selecting the paper size are given below:

11—8.5 in 20.7—21 in
letterpaper a4paper
14—8.5 in 21—14.8 in
legalpaper a5paper
10.5—7.25 in 25—17.6 in
executivepaper b5paper

Normally, the longer dimension is the vertical one”that is, the height of the page. The
default is letterpaper.

17
18 THE DOCUMENT
II.

Page formats
II.1.3.

There are options for setting the contents of each page in a single column (as is usual) or
in two columns (as in most dictionaries). This is set by the options
onecolumn twocolumn

and the default is onecolumn.
There is also an option to specify whether the document will be ¬nally printed on just
one side of each paper or on both sides. The names of the options are
oneside twoside

One of the differences is that with the twoside option, page numbers are printed on
the right on odd-numbered pages and on the left on even numbered pages, so that when
these printed back to back, the numbers are always on the outside, for better visibility.
(Note that LTEX has no control over the actual printing. It only makes the formats for
A

different types of printing.) The default is oneside for article, report and letter and
twoside for book.
In the report and book class there is a provision to specify the different chapters (we
will soon see how). Chapters always begin on a new page, leaving blank space in the
previous page, if necessary. With the book class there is the additional restriction that
chapters begin only on odd-numbered pages, leaving an entire page blank, if need be.
Such behavior is controlled by the options,
openany openright

The default is openany for reportclass (so that chapters begin on “any” new page)
and openright for the book class (so that chapters begin only on new right, that is, odd
numbered, page).
There is also a provision in LTEX for formatting the “title” (the name of the docu-
A

ment, author(s) and so on) of a document with special typographic consideration. In the
article class, this part of the document is printed along with the text following on the
¬rst page, while for report and book, a separate title page is printed. These are set by the
options
notitlepage titlepage

As noted above, the default is notitlepage for article and titlepage for report and
book. As with the other options, the default behavior can be overruled by explicitly
specifying an option with the documentclass command.
There are some other options to the documentclass which we will discuss in the rele-
vant context.

PAGE
II.2. STYLE

Having decided on the overall appearance of the document through the \documentclass
command with its various options, we next see how we can set the style for the individual
pages. In LTEX parlance, each page has a “head” and “foot” usually containing such
A

information as the current page number or the current chapter or section. Just what goes
where is set by the command
\pagestyle{...}

where the mandatory argument can be any one of the following styles

The behavior pertaining to each of these is given below:
19
PAGE
II.3. NUMBERING

plain The page head is empty and the foot contains just the page number, cen-
tered with respect to the width of the text. This is the default for the
article class if no \pagestyle is speci¬ed in the preamble.
empty Both the head and foot are empty. In particular, no page numbers are
printed.
headings This is the default for the book class. The foot is empty and the head
contains the page number and names of the chapter section or subsection,
depending on the document class and its options as given below:
CLASS OPTION LEFT PAGE RIGHT PAGE
one-sided ” chapter
book, report
two-sided chapter section
one-sided ” section
article
two-sided section subsection
are not predetermined, but to be given explicitly using the commands
\markright or \markboth as described below.

Moreover, we can customize the style for the current page only using the command
\thispagestyle{style}

where style is the name of one of the styles above. For example, the page number may
be suppressed for the current page alone by the command \thispagestyle{empty}. Note
that only the printing of the page number is suppressed. The next page will be numbered
with the next number and so on.

II.2.1.

As we mentioned above, in the page style myheadings, we have to specify the text to
appear on the head of every page. It is done with one of the commands

where left head is the text to appear in the head on left-hand pages and right head is the
text to appear on the right-hand pages.
The \markboth command is used with the twoside option with even numbered pages
considered to be on the left and odd numbered pages on the right. With oneside option,
all pages are considered to be right-handed and so in this case, the command \markright
can be used. These commands can also be used to override the default head set by the
Note that these give only a limited control over the head and foot. since the general
format, including the font used and the placement of the page number, is ¬xed by LTEX.
A

Better customization of the head and foot are offered by the package fancyhdr, which is
included in most LTEX distributions.
A

PAGE
II.3. NUMBERING

The style of page numbers can be speci¬ed by the command
\pagenumbering{...}

The possible arguments to this command and the resulting style of the numbers are given
below:
20 THE DOCUMENT
II.

Indo-Arabic numerals
arabic
lowercase Roman numerals
roman
upper case Roman numerals
Roman
lowercase English letters
alph
uppercase English letters
Alph

The default value is arabic. This command resets the page counter. Thus for example, to
number all the pages in the ˜Preface™ with lowercase Roman numerals and the rest of the
document with Indo-Arabic numerals, declare \pagenumbering{roman} at the beginning
of the Preface and issue the command \pagestyle{arabic} immediately after the ¬rst
\chapter command. (The \chapter{...} command starts a new chapter. We will come
to it soon.)
We can make the pages start with any number we want by the command
\setcounter{page}{number}
where number is the page number we wish the current page to have.

FORMATTING
II.4. LENGTHS

Each page that LTEX produces consists not only of a head and foot as discussed above
A

but also a body (surprise!) containing the actual text. In formatting a page, LTEX uses
A

the width and heights of these parts of the page and various other lengths such as the
left and right margins. The values of these lengths are set by the paper size options and
the page format and style commands. For example, the page layout with values of these
lengths for an odd page and even in this book are separately shown below.
These lengths can all be changed with the command \setlength. For example,
\setlength{\textwidth}{15cm}
makes the width of text 15 cm. The package geometry gives easier interfaces to customize
page format.

PARTS
II.5. OF A DOCUMENT

We now turn our attention to the contents of the document itself. Documents (especially
longer ones) are divided into chapters, sections and so on. There may be a title part
(sometimes even a separate title page) and an abstract. All these require special typo-
graphic considerations and LTEX has a number of features which automate this task.
A

Title
II.5.1.

The “title” part of a document usually consists of the name of the document, the name
of author(s) and sometimes a date. To produce a title, we make use of the commands
\title{document name}
\author{author names}
\date{date text}

\maketitle
Note that after specifying the arguments of \title, \author and \date, we must issue the
command \maketitle for this part to be typeset.
By default, all entries produced by these commands are centered on the lines in which
they appear. If a title text is too long to ¬t in one line, it will be broken automatically.
However, we can choose the break points with the \\ command.
If there are several authors and their names are separated by the \and command, then
the names appear side by side. Thus
21
DIVIDING
II.6. THE DOCUMENT

\title{Title}
\author{Author 1\\
\and
Author 2\\
\date{Month Date, Year}
produces

Title
Author 1 Author 2

Month Date, Year

If instead of \and, we use (plain old) \\, the names are printed one below another.
We may leave some of these arguments empty; for example, the command \date{ }
prints no date. Note, however, that if you simply omit the \date command itself, the
current date will be printed. The command
\thanks{footnote text}

can be given at any point within the \title, \author or \date. It puts a marker at this
point and places the footnote text as a footnote. (The general method of producing a
footnote is to type \footnote{footnote text} at the point we want to refer to.)
As mentioned earlier, the “title” is printed in a separate page for the document classes
book and report and in the ¬rst page of the document for the class article. (Also recall
that this behavior can be modi¬ed by the options titlepage or notitlepage.)

Abstract
II.5.2.

In the document classes article and report, an abstract of the document in special for-
mat can be produced by the commands
Abstract Text
\begin{abstract}
\end{abstract}
Note that we have to type the abstract ourselves. (There is a limit to what even LTEX can
A

do.) In the report class this appears on the separate title page and in the article class it
appears below the title information on the ¬rst page (unless overridden by the title page
option). This command is not available in the book class.

DIVIDING
II.6. THE DOCUMENT

A book is usually divided into chapters and (if it is technical one), chapters are divided
into sections, sections into subsections and so on. LTEX provides the following hierarchy
A
22 THE DOCUMENT
II.

of sectioning commands in the book and report class:
\chapter
\section
\subsection
\subsubsection
\paragraph
\subparagraph

Except for \chapter all these are available in article class also. For example, the
heading at the beginning of this chapter was produced by
\chapter{The Document}

and the heading of this section was produced by
\section{Dividing the document}

To see the other commands in action, suppose at this point of text I type
\subsection{Example}
In this example, we show how subsections and subsubsections
are produced (there are no subsubsubsections). Note how the
subsections are numbered.

\subsubsection{Subexample}
Did you note that subsubsections are not numbered? This is so in the
\texttt{book} and \texttt{report} classes. In the \texttt{article}
class they too have numbers. (Can you figure out why?)

\paragraph{Note}
Paragraphs and subparagraphs do not have numbers. And they have

Though named ˜˜paragraph™™ we can have several paragraphs of text
within this.

\subparagraph{Subnote}
Subparagraphs have an additional indentation too.

And they can also contain more than one paragraph of text.

We get

Example
II.6.1.

In this example, we show how subsections and subsubsections are produced (there are
no subsubsubsections). Note how the subsections are numbered.

Subexample
Did you note that subsubsections are not numbered? This is so in the book and report
classes. In the article class they too have numbers. (Can you ¬gure out why?)
Note Paragraphs and subparagraphs do not have numbers. And they have run-in head-
ings. Though named “paragraph” we can have several paragraphs of text within this.
Subnote Subparagraphs have an additional indentation too. And they can also con-
tain more than one paragraph of text.
23
WHAT
II.7. NEXT?

More on sectioning commands
II.6.2.

In the book and the report classes, the \chapter command shifts to the beginning of a
new page and prints the word “Chapter” and a number and beneath it, the name we have
given in the argument of the command. The \section command produces two numbers
(separated by a dot) indicating the chapter number and the section number followed
by the name we have given. It does not produce any text like “Section”. Subsections
have three numbers indicating the chapter, section and subsection. Subsubsections and
commands below it in the hierarchy do not have any numbers.
In the article class, \section is highest in the hierarchy and produces single number
like \chapter in book. (It does not produce any text like “Section”, though.) In this case,
subsubsections also have numbers, but none below have numbers.
Each sectioning command also has a “starred” version which does not produce num-
bers. Thus \section*{name} has the same effect as \section{name}, but produces no
number for this section.
Some books and longish documents are divided into parts also. LTEX also has a \part
A

command for such documents. In such cases, \part is the highest in the hierarchy, but it
does not affect the numbering of the lesser sectioning commands.
You may have noted that LTEX has a speci¬c format for typesetting the section head-
A

ings, such as the font used, the positioning, the vertical space before and after the heading
and so on. All these can be customized, but it requires some TEXpertise and cannot be
addressed at this point. However, the package sectsty provided some easy interfaces for
tweaking some of these settings.

WHAT
 << . . . 3( : 23) . . >>