0% found this document useful (0 votes)
136 views22 pages

A Short Note On: Department of Mechanical Engineering, Tezpur University, Napaam, Tezpur - 784 028, India. Url

LaTeX

Uploaded by

Hugo Policarpo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views22 pages

A Short Note On: Department of Mechanical Engineering, Tezpur University, Napaam, Tezpur - 784 028, India. Url

LaTeX

Uploaded by

Hugo Policarpo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

A Short Note on

Dilip Datta
Department of Mechanical Engineering, Tezpur University, Napaam, Tezpur - 784 028, India.
ddatta@tezu.ernet.in, datta dilip@rediffmail.com
URL : http://www.tezu.ernet.in/dmech/people/ddatta.htm

Summary
LATEX is a programming-based simple and easy approach for producing a document directly in the dvi or pdf format. LATEX can be
used for preparing letters, applications, articles, reports, publications, theses, books, or anything of that kind.
One of the major advantages of using LATEX is that manual formatting of a document, as usually required in many word processors,
can be automated in LATEX. Therefore, the possibility of committing any mistake in formatting a document can be avoided, such as
in numbering and referring items (sections, tables, figures, equations, or references), in choosing size and type of fonts for different
sections and subsections, or in preparing bibliographic list. Further, LATEX has the provision for automatically generating various
lists of contents, index, and glossary.
The use of common word processors may be easier in preparing simple and small-size documents. But, the effort and time
required in LATEX for preparing complicated and big-size documents are quite less than those required in other word processors.
One can become expert in LATEX through a little practice. It can be realized that the preparation of only one academic dissertation
would pay off all additional efforts required in learning LATEX.
In spite of having such capabilities, a very limited number of books on LATEX are available in market. Of course, a lot of resources
on this subject can be obtained freely from the internet. However, most of the books emphasize on detailed documentation of LATEX,
while the internet-based resources are topic-specific. But people are either unable or not interested to spare time, during their busy
schedules of research works, to understand and learn the detailed genotype of LATEX covered in books, or to collect materials from
different websites. Instead, they prefer to get direct and concise applications of various LATEX syntax in a single window, which they
can modify easily to get their works done in the least time and with the least effort.
Accordingly, this note is designed to present LATEX in such a way that, even without having any prior working knowledge
with LATEX, one would understand easily, at least, how to prepare scientific research articles and reports, as well as academic
dissertations. The main topics covered in this note include introduction to LATEX, fonts selection, texts formatting, listing, tabbing,
table preparation, figure insertion, equation writing, preparation of bibliographic list, etc. The note is concluded with article, thesis,
and slide preparation in LATEX.
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 2

Contents 12 Slide Preparation 20


12.1 Frames in presentation . . . . . . . . . . . . . . . . . . . . . 20
Summary 1 12.2 Sectional units in presentation . . . . . . . . . . . . . . . . . 20
12.3 Presentation structure . . . . . . . . . . . . . . . . . . . . . . 20
1 Introduction to LATEX 2 12.4 Title page . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.1 How to prepare a LATEX input file? . . . . . . . . . . . . . . . 2 12.5 Appearance of a presentation (BEAMER themes) . . . . . . . 21
1.2 How to compile a LATEX input file? . . . . . . . . . . . . . . . 3
1.3 LATEX syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3.1 Commands . . . . . . . . . . . . . . . . . . . . . . . 3
1.3.2 Environments . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction to LATEX
1.3.3 Packages . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Keyboard characters in LATEX . . . . . . . . . . . . . . . . . . 4 LATEX is a macro-package used as a language-based approach
2 Fonts Selection 4 for typesetting documents. Various LATEX instructions are inter-
2.1 Text-mode fonts . . . . . . . . . . . . . . . . . . . . . . . . . 4 spersed with the input file of a document, say myfile.tex, for
2.2 Math-mode fonts . . . . . . . . . . . . . . . . . . . . . . . . 4 obtaining the output as myfile.dvi or directly as myfile.pdf.
2.3 Colored fonts . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3 Texts Formatting 5 1.1. How to prepare a LATEX input file?


3.1 Sectional units . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2 Labeling and referring numbered items . . . . . . . . . . . . . 5 The main structure
3.3 Quoted texts . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.4 New lines and paragraphs . . . . . . . . . . . . . . . . . . . . 5
of a LATEX input file \documentclass[]{}
. Preamble
3.5 Creating and filling blank space . . . . . . . . . . . . . . . . 6 is divided into two .
\ begin{document}
3.6 Producing dashes within texts . . . . . . . . . . . . . . . . . 6 parts (Fig. 1.1) – .
3.7 Foot notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 preamble and body. .
. Body
4 Listing Texts 6 The first part is .
\end{document}
4.1 Numbered listing through enumerate environment . . . . . . 6 the preamble that
4.2 Unnumbered listing through itemize environment . . . . . . . 7 contains the global Fig. 1.1: Structure of a LATEX input file.
4.3 Listing with user-defined labels through description environ-
ment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
processing parameters for the entire document to be produced,
4.4 Nesting different listing environments . . . . . . . . . . . . . 7 such as the type of the document, page formatting, header
and footer setting, inclusion of LATEX packages for supporting
5 Tabbing Texts 7
additional instructions, and definitions of new instructions.
6 Table Preparation 8 The simplest preamble is \documentclass{dtype}, where dtype
6.1 Table through tabular environment . . . . . . . . . . . . . . 8 in {} is a mandatory argument as the class (or type) of the
6.2 Table through tabularx environment . . . . . . . . . . . . . . 8 document, such as letter, article, report, or book. In the default
6.3 Vertical positioning of tables . . . . . . . . . . . . . . . . . . 9
6.4 Merging rows and columns of tables . . . . . . . . . . . . . . 9 setting, \documentclass{} prints a document on letter-size
6.5 Tables in multi-column documents . . . . . . . . . . . . . . . 10 paper in 10 point fonts (1 point ≈ 0.0138 inch ≈ 0.3515 mm).
6.6 Tables at the end of a document . . . . . . . . . . . . . . . . . 10 Different user-defined formats for a document can be obtained
7 Figure Insertion 10 through various options to \documentclass{}, in which case
7.1 Commands and environment for inserting figures . . . . . . . 10 it takes the form of \documentclass[fo1,fo2,...]{dtype} with
7.2 Inserting simple figures . . . . . . . . . . . . . . . . . . . . . 10 fo1, fo2, etc., in [] as the options (multiple options can be
7.3 Sub-numbering a group of figures . . . . . . . . . . . . . . . 11 inserted in any order separating two options by a comma), e.g.,
7.4 Figures in multi-column documents . . . . . . . . . . . . . . 11
7.5 Figures at the end of a document . . . . . . . . . . . . . . . . 11 \documentclass[a4paper,11pt]{article} for printing an article on
A4 paper in 11 point fonts.
8 Equation Writing 11 As shown in Fig. 1.1, the main body of a LATEX input file
8.1 Basic notations and delimiters . . . . . . . . . . . . . . . . . 11
8.2 Mathematical operators . . . . . . . . . . . . . . . . . . . . . 11 starts with \begin{document} and ends with \end{document}. The
8.3 Mathematical expressions in text-mode . . . . . . . . . . . . 11 entire contents to be printed in the output are inserted within
8.4 Simple equations . . . . . . . . . . . . . . . . . . . . . . . . 13 the body, mixed with various LATEX instructions (see §1.3 for
8.5 Array of equations . . . . . . . . . . . . . . . . . . . . . . . 13 detail). Any text entered after \end{document} is simply skipped.
9 Bibliography with BIBTEX 14 A LATEX input file is named with tex extension, say
9.1 Preparation of BIBTEX compatible reference database . . . . . 14 myfile.tex. It can be prepared in any operating system using
9.2 Standard bibliographic styles of LATEX . . . . . . . . . . . . . 15 any text editor that supports tex extension. There are also many
9.3 Compiling BIBTEX based LATEX input file . . . . . . . . . . . 16
open-source text editors developed specifically for preparing
10 Article Preparation 17 LATEX input files, e.g., Kile (kile.sourceforge.net), Tex-
10.1 List of authors . . . . . . . . . . . . . . . . . . . . . . . . . . 17 maker (xm1math.net/texmaker), WinEdt (winedt.com), etc.
10.2 Title and abstract on separate pages . . . . . . . . . . . . . . 17
10.3 Articles in multiple columns . . . . . . . . . . . . . . . . . . 18
A simple input file, say myarticle.tex, prepared under the
document-class of article is shown in the left column of Ta-
11 Thesis preparation 18 ble 1.1, along with its output in the right column. Surprisingly,
11.1 Template of a thesis . . . . . . . . . . . . . . . . . . . . . . . 19
11.2 Compilation of thesis . . . . . . . . . . . . . . . . . . . . . . 20
the output is not the one as expected. The differences are shown
underlined in the output file. This has happened due to the fact
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 3

Table 1.1: A simple LATEX input file and its output. ⊲ A command usually starts with a \ (backslash), followed
LATEX input Output by one or more alphabets without any gap, e.g., \LaTeX and
\documentclass{article} LaTeX is a macro c respectively.
\copyright for producing LATEX and
\begin{document} package for typeset-
LaTeX is a macro package for typesetting ting documents. It is a ⊲ Many commands require some mandatory arguments,
documents. It is a language-based language-based approach, each in a separate pair of {}, e.g., \textcolor{blue}{blue
approach, where LaTeX instructions are where LaTeX instructions
colored texts} (detail is in §2.3) for printing the second
interspersed with the text file of a are interspersed with the
document, say myfile.tex, for text file of a document, argument in blue color.
obtaining the desired output as say myfile.tex, for obtain-
myfile.dvi. The myfile.dvi file can ing the desired output as ⊲ Many commands have the provision for some optional
then be used to generate myfile.pdf myfile.dvi. The myfile.dvi instructions also, written in [] separating two options by
file. file can then be used to a comma, e.g., \documentclass[a4paper,11pt,twoside]{article}.
\end{document} generate myfile.pdf file.
A command with the provision for optional arguments
must have at least one mandatory argument.
1
⊲ A command without having any argument ignores trailing
blank spaces. Hence, if followed by a word or a num-
that many things in EX can be obtained through some special
LAT ber, such a command should be ended by \ (the sym-
instructions only as stated in §1.3. bol indicates a blank space). For example, \copyright 2007
will produce 2007
c , while \copyright\ 2007 will produce
c 2007. However, if such a command is followed by any
1.2. How to compile a LATEX input file? punctuation, it needs not to be ended by \ as a punctua-
A LATEX input file can be compiled in many LATEX edi- tion is not to be preceded by any blank space.
tors mentioned in §1.1. Besides, many open-source LATEX
compilers are also available, e.g., MiKTeX (miktex.org) or 1.3.2. Environments
TeXLive (tug.org/texlive). In a GUI-based compiler, like
MiKTex or Kile, a LATEX file can be compiled just by a mouse- A LATEX environment is a structure composed of two comple-
click. In other command-line compilers, a LATEX file is to be mentary commands, within which some particular job can be
compiled through the pdflatex or latex command, followed by performed, e.g., writing an equation or inserting a figure.
the name of the input file with or without its tex extension. For ⊲ The pair of complementary commands creating an envi-
example, myarticle.tex of Table 1.1 can be compiled as: ronment are \begin{ename} and \end{ename}, where ename
is the name of the environment, e.g., \begin{document} and
$ pdflatex myarticle.tex \end{document} as shown in Fig. 1.1 creates the document
Or, $ latex myarticle environment (or the body) in a LATEX input file.

The pdflatex command above will produce myarticle.pdf di- ⊲ It is possible to use a command inside an environment,
rectly, while the latex command will produce 3 files, namely or to nest two or more environments, e.g., within the
myarticle.aux, myarticle.log and myarticle.dvi. Out of document environment, the \LaTeX command for printing
these 3 files, myarticle.dvi can be viewed directly in a docu- LATEX or the figure environment for inserting a figure.
ment viewer. It can also be used for producing myarticle.pdf ⊲ Many environments require some mandatory arguments
as the output of myarticle.tex as follows: placed after \begin{}, e.g., \begin{tabularx}{10cm}{XXX} for
creating a table of three equal-width columns over 10 cm
$ dvipdf myarticle.dvi
length through the tabularx environment.

⊲ Like a command, many environments also have the provi-


1.3. LATEX syntax sion for some optional instructions written in a pair of [],
LATEX syntax consists of commands and environments, which e.g., \begin{table}[t] preferring through the option t in the
are kinds of instructions interspersed with the texts of a docu- table environment to place a table at the top of a page.
ment for performing some specific jobs. Such instructions are
defined in different packages. 1.3.3. Packages
The class (or type) of a document, incorporated through the
1.3.1. Commands \documentclass{} command, includes only basic features of
A LATEX command is an instruction used either for producing LATEX. Many additional commands and environments are de-
something new or to change the form of an existing item, e.g., fined in separate files, known as packages.
producing the symbol α or printing italic as italic.
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 4

⊲ A package is loaded in the preamble, in between given in Table 2.1, where atext is the piece of texts to be pro-
the \documentclass{} and \begin{document} commands, duced in the specified form.
through the \usepackage{pname} command, where pname is
the name of the package, e.g., \usepackage{amssymb} for Table 2.1: Different types of text-mode fonts used in LATEX.
producing AMS type mathematical symbols. Type Variety Command
Serif (default) \textrm{atext} or {\rm atext}
⊲ Like commands and environments, many packages also Family Sans serif \textsf{atext} or {\sf atext}
Typewriter \texttt{atext} or {\tt atext}
have the provision for some optional instructions in [], e.g., Medium (default) \textmd{atext}
Series
\usepackage[tight]{subfigure} preferring through the option Boldface \textbf{atext} or {\bf atext}
tight to reduce extra space between figures. Upright (default) \textup{atext}
Italic \textit{atext} or {\it atext}
⊲ Unlike an option to \documentclass[]{}, which is global to Shape Slanted \textsl{atext} or {\sl atext}
Caps & small caps \textsc{atext} or {\sc atext}
the entire document, an option to \usepackage[]{} is lo- Emphasized \emph{atext} or {\em atext}
cal only to the features defined in the package(s) loaded Tiny {\tiny atext}
through the \usepackage[]{} command. Script {\scriptsize atext}
Foot note {\footnotesize atext}
Small {\small atext}
1.4. Keyboard characters in LATEX Size
Normal (default) –
Large {\large atext}
Not all, but only the following characters of an English key- Larger {\Large atext}
board can be printed directly in a LATEX document: alphabets (a
b c d e f g h i j k l m n o p q r s t u v w x y z) both in uppercase Largest {\LARGE atext}

and lowercase, digits (0 1 2 3 4 5 6 7 8 9), parentheses ( ( ) ), Huge {\huge atext}


brackets ([ ]), quotations ( ` ’ ”), punctuations (, ; : ! . ?), math
operators (+ - * / =), rate (@). Hugest {\Huge atext}
All other characters of an English keyboard need to be pro-
duced in a LATEX document through some commands, which Different combinations of font family, series, shape and size
are (with their producing commands in parentheses) $ (\$), in a logical way are allowed for producing a wide variety
% (\%), { } (\{ \}), (\ ), ˆ (\ˆ\), & (\&), # (\#), \ ($\backslash$), of fonts, e.g., \emph{\textbf{emphasized boldface fonts}} for
∼ ($\sim$), | ($|$), < ($<$), and > ($>$). Note that the amssymb producing ‘emphasized boldface fonts’. Also note that, in order
package may be required for the commands in $ $. to maintain a proper posterior vertical spacing, the arguments of
the {\it }, {\em } and {\sl } commands may be followed by \/. For
example, ‘{\it red\/} line’ for producing ‘red line’.
2. Fonts Selection
There are three modes for processing texts in LATEX – para- 2.2. Math-mode fonts
graph-mode, LR-mode and math-mode. The paragraph-mode Like in text-mode, different types of fonts can be used in math-
is for producing normal texts with automatic word-splitting, mode also as shown in Table 2.2.
and line and page breaking to fit the texts within the specified
area. In contrast, the LR-mode processes texts from left-to-right Table 2.2: Different types of math-mode fonts used in LATEX.
without any word-splitting and line breaking, such as \mbox{} or Font type Command Package required Output
\fbox{} command whose arguments may span even beyond the Serif \mathrm{ABC abc} — ABCabc
Italic \mathit{ABC abc} — ABCabc
specified width of a page. On the other hand, the math-mode Sans serif \mathsf{ABC abc} — ABCabc
is for writing mathematical expressions, like equations. In this Typewriter \mathtt{ABC abc} — ABCabc
note, the paragraph-mode and LR-mode will occasionally be Boldface \mathbf{ABC abc} — ABCabc
addressed by a single name, known as the text-mode. \boldmath{ABC abc} amssymb ABCabc
Normal \mathnormal{ABC abc} — ABCabc
Calligraphic \mathcal{A B C} — ABC
2.1. Text-mode fonts Open \Bbb{A B C} amsfonts/ amssymb ABC
Open \mathbb{A B C} amsfonts/ amssymb ABC
The default font type of a LATEX document is medium series
serif family in upright shape and 10 pt size. The sizes of fonts
in different parts of a document, say in headings and in para- 1. If used in text-mode, the commands of Table 2.2 (except
graphs, are calculated proportionately. The default font set- \boldmath{}) are to be written within a pair of $ symbol,
ting can be altered globally through various options to the e.g., $\mathbf{abc}$ for printing abc. In the case of the
\documentclass[]{} command, e.g., \documentclass[12pt]{article} \boldmath{} command, the argument is to be enclosed in a
for producing an article in 12 pt fonts. The type of fonts in a pair of $ symbol, e.g., \boldmath{$abc$} for printing abc.
particular segment can also be set manually. 2. The \mathcal{}, \mathbb{} and \Bbb{} commands do not ac-
Types of fonts in LATEX are classified into four categories – cept lower-case letters.
family, series, shape and size. The detail of each category is
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 5

book / report
3. Any blank space in the arguments of the commands of Ta-
ble 2.2 is omitted. In such a case, most of the text-mode 1 1.1 1.1.1
commands having the forms of \text..{} (e.g., \textbf{} \chapter{} \section{} \subsection{} \subsubsection{}
or \textit{}) and \emph{}, as shown in Table 2.1, may be 1 1.1 1.1.1
used for writing normal texts in math-mode preserving the article
space provided between two letters or words. Fig. 3.1: Default three-tier numbering of sectional units.

2.3. Colored fonts Note that the numbering of a sectional unit can be omitted
by using the starred form of the sectional command, such as
Colored texts in LATEX are supported by the color package.
\chapter*{}, \section*{}, \subsection*{} and \subsubsection*{}.
There are basically three types of color combinations – black
and white (gray), additive primaries (rgb) and subtractive pri-
maries (cmyk), under which black, white, red, green, blue, cyan, 3.2. Labeling and referring numbered items
magenta and yellow are predefined colors. Apart from those,
Like to sectional units addressed in §3.1, LATEX assigns se-
various new colors can be defined, through the \definecolor{}{}{}
rial numbers to many environments or elements of an environ-
command, by setting different values to gray and each of the let-
ment (e.g., table, figure, equation, or \item, which are discussed
ters of rgb and cmyk as follows (where cname is the name of the
later). This default numbering system eliminates the possibility
user-defined new color):
of committing any mistake as may happen in manual number-
\definecolor{cname}{gray}{w} ; w ∈ [0, 1] ing. Moreover, LATEX allows to label a numbered item by a
\definecolor{cname}{rgb}{w, x, y} ; w, x, y ∈ [0, 1] unique reference key, which can be used to refer the item in
\definecolor{cname}{cmyk}{w, x, y, z} ; w, x, y, z ∈ [0, 1] any part within the same document (un-numbered items cannot
be referred in this way). As illustrated in Table 3.1, the label-
Once different colors are defined as above (if required), col- ing and referring of an item are performed through \label{rkey}
ored texts can be produced through the \textcolor{cname}{atext} and \ref{rkey} respectively, where rkey is the assigned unique
command, where atext is the piece of texts to be colored reference key of the item.
by cname color. For example, \textcolor{blue}{this is in
blue} will print ‘this is in blue’, while \textcolor{urgb}{this Table 3.1: Labeling and referring numbered items.
is in rgb = \{0,0.7,0.3\}} will print ‘this is in rgb = LATEX input Output
{0,0.7,0.3}’, where urgb is a new color defined as \section{Centre of 3.2 Centre of gravity
\definecolor{urgb}{rgb}{0,0.7,0.3}. gravity}\label{sec:cg} A point though which the resultant
A point though which the of the gravitational forces of all el-
resultant of the gravitational emental weights of a body acts.
forces of all elemental
3. Texts Formatting weights of a body acts.
%
3.3 Centre of mass
Many people format a document manually and hence commit \section{Centre of The definition of the centre of grav-
many mistakes, such as type and size of fonts for headings of mass}\label{sec-ex} ity is given in Section 3.2 . . .
sectional units, numbering and referring sectional units, line The definition of the centre
of gravity is given in
and paragraph breaking, horizontal and vertical spacing, etc. Section∼\ref{sec:cg} ...
LATEX has numerous predefined macros for automatic and uni-
form formatting of a document without any mistake.
3.3. Quoted texts
3.1. Sectional units
For quoting texts within quotation marks, ( `) may be used as
Various sectional units, like chapters and sections, are generated the left quote and (’) as the right quote (each twice for double
using the \chapter{}, \section{}, \subsection{}, \subsubsection{}, quotation), e.g., `single-quote’ will produce ‘single-quote’,
\paragraph{} and \subparagraph{} commands, whose argument while ``double-quote’’ will produce “double-quote”.
is the heading or title of a sectional unit, e.g., the current sec- For quoting an existing statement in a narrowed width with-
tion of this note is written as \section{Sectional units}. The out any change, the quote or quotation environment may be
sectional unit commands work in order and hence they should used (quote for a short display, while quotation for more than
be nested properly, i.e., a \subsection{} command should fol- one paragraph).
low a \section{} command or a \subparagraph{} command should
follow a \paragraph{} command. As shown in Fig. 3.1, LATEX
assigns three-tier serial numbers to chapters, sections, subsec-
3.4. New lines and paragraphs
tions and subsubsections (paragraphs and subparagraphs are not LATEX does not respond to a new line or paragraph set manually
numbered). by pressing the enter button of the keyboard. Unless specified
commands are used, LATEX considers everything in a single line
and single paragraph.
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 6

The command for creating a new line is \newline. A new line \textheight (height of texts on a page), \textwidth (width of texts
can also be created by using a line break command (\linebreak, in a page) or \linewidth (width of a column), e.g., 0.2\textheight
\\, \\\\, or one or more blank lines) at the end of the previous for a vertical space of 20% of \textheight or 0.3\linewidth for a
line. Some extra vertical space above the next new line can also horizontal space of 30% of \linewidth.
be specified in [] after the \\ command, e.g., \\[5mm] will create
an extra vertical space of 5 mm above the next line. 3.6. Producing dashes within texts
Though a new paragraph can be started manually by creat-
ing a new line as above, the direct command for the same is LATEX provides three types of dashes: -, – and —, which are
\par. The \paragraph{} and \subparagraph{} commands can also produced by -, -- and ---, respectively. Out of these dashes, the
be used for creating new paragraphs with the arguments of the shortest one is used between inter-related words, the medium
commands as the headings of the paragraphs. one to indicate a range, while the longest one to show the ex-
tension of an expression as illustrated in Table 3.4.
3.5. Creating and filling blank space Table 3.4: Dashes of different lengths.
LATEX input Output
Excess blank spaces, created by pressing the spacebar or tab
Inter-related Inter-related
button of the keyboard, are just ignored in LATEX, i.e., a se- May- -August May–August
quence of blank spaces is treated as a single one only. LATEX Weather - - - like clear sky Weather — like clear sky
provides its own commands for creating a blank space of a spec-
ified size, both in horizontal and vertical directions, which are
given in Tables 3.2 and 3.3. The need of a blank space after a
3.7. Foot notes
Table 3.2: Creating blank spaces. LATEX provides the \footnote{} command for printing its argu-
Command Package Application
ment as a foot note. As shown in Table 3.5, the command is
\quad — x\quad y x y
\qquad — x\qquad y x y to be inserted just after the word or phrase against which a foot
\, or \thinspace — x\,y xy note is to be generated. In the output, foot notes are numbered
\: or \medspace amsmath x\:y xy
\; or \thickspace amsmath x\;y xy Table 3.5: Foot notes generated through the \footnote{} com-
\! amsmath x\!y xy mand.
\!\! amsmath x\!\!y xy
LATEX input Output
\!\!\! amsmath x\!\!\!y xy
Both Rubi and Lila\footnote{They are Both Rubi and Lila1
sisters.} study in class I, while study in class I,
command, ended by an alphabet and followed by another alpha- Ravi and Joy\footnote{They are while Ravi and Joy2
bet, can be avoided by writing the following alphabet or word friends.\label{fn:friends}} study in study in class II.
class II.
in {}, e.g., ‘x\quad{y}’ to produce the same output as that by
‘x\quad y’. 1 They are sisters.
2 They are friends.
Table 3.3: Applications of some blank space creating com-
mands.
in Arabic numerals and hence they can be labeled and referred
LATEX input Output
using the \label{} and \ref{} commands as discussed in §3.2.
\begin{center} LATEX in 24 Hours
\LaTeX\ in 24 Hours\bigskip\\
A Practical Guide for Writing
\end{center}
A Practical Guide for Writing 4. Listing Texts
\begin{center} LATEX in 24 Hours
\LaTeX\ in 24 Hours Important matters are usually listed point-wise, either for con-
\vskip 5mm cise presentation or for making them prominent. There are three
A Practical Guide for Writing
A Practical Guide for Writing listing environments, namely enumerate, itemize and description,
\end{center} where an item is written through an \item command.
\begin{center} LATEX in 24 Hours
\LaTeX\ in 24 Hours
\vspace{5mm}\\
A Practical Guide for Writing 4.1. Numbered listing through the enumerate en-
A Practical Guide for Writing
\end{center} vironment
Language: \hspace{8mm} English Language: English The enumerate environment produces a numbered list of items,
Marks: 100 \hfill Time: 3 Hrs Marks: 100 Time: 3 Hrs where the items are numbered by Arabic numerals as shown in
Table 4.1.
Units of the lengths in the \vskip, \vspace{} and \hspace{} A maximum of four enumerate environments can be nested
commands can be any one of mm (millimeter), cm (centimeter), one inside another for producing a hierarchy of items, where an
in (inch), pt (point), em (width of M) and ex (width of x). Apart inner environment belongs to an \item of the previous environ-
from these units, a length can also be taken as a fraction of ment. Table 4.2 illustrates three nested enumerate environments,
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 7

Table 4.1: Numbered listing through the enumerate environ- 4.3. Listing with user-defined labels through the
ment.
LATEX input Output
description environment
Some states of India: Some states of India: The description environment facilities to prepare a list of items
\begin{enumerate}
\item Assam 1. Assam with user-defined labels. Like in the itemize environment, the
\item Punjab 2. Punjab items of the description environment also cannot be referred by
\item Rajasthan. 3. Rajasthan. any serial number. An item in the description environment is
\end{enumerate} labeled through an optional argument to the \item command,
which can be anything, like (a), (b), (i), (ii), or Rule,
Table 4.2: Nested listing through the enumerate environment.
Action, etc. which is printed in boldface fonts, e.g., \item[(a)]
LATEX input Output
\begin{enumerate} will label its item by (a). Such an example is given in Table 4.4.
1. India Like the enumerate and itemize environments, the description en-
\item India\label{item:Ind}
\begin{enumerate} (a) Assam
vironments can also be nested one inside another.
\item Assam\label{item:Ass} i. Nagaon
\begin{enumerate} ii. Kamrup Table 4.4: Listing with user-defined labels through the
\item Nagaon\label{item:Nag} iii. Cachar
description environment.
\item Kamrup (b) Bihar
LATEX input Output
\item Cachar (c) Punjab
\end{enumerate} \begin{description} (a) Assam
2. Sri Lanka
\item Bihar \item[(a)] Assam (b) Bihar
\item Punjab District 1(a)i belongs to \item[(b)] Bihar
\item[(c)] Punjab (c) Punjab
\end{enumerate} state 1a of country 1.
\item Sri Lanka \item[(d)] Rajasthan. (d) Rajasthan.
\end{enumerate} \end{description}
District∼\ref{item:Nag} belongs to
state∼\ref{item:Ass} of
country∼\ref{item:Ind}.
4.4. Nesting different listing environments
which also shows how their items can be labeled and referred Nesting of different listing environments is also possible for
through the \label{} and \ref{} commands respectively (blank producing a hierarchy of items as illustrated in Table 4.5.
spaces preceding inner lines in the LATEX input are kept only
Table 4.5: Nested different listing environments.
for easy understanding of a loop, otherwise they do not have
LATEX input Output
any sense in LATEX). Notice in Table 4.2 the numbering and \begin{enumerate}
referring styles of items in the nested enumerate environments. 1. SI System
\item SI System
\begin{enumerate} (a) Metre
\item Metre (b) Newton
4.2. Unnumbered listing through the itemize en- \item Newton (c) Second
\item Second 2. MKS System
vironment
\end{enumerate} • Metre
Unnumbered lists are produced through the itemize environ- \item MKS System
\begin{itemize} • Kilogram
ment. Like the enumerate environment, a maximum of four \item Metre • Second
itemize environments can be nested one inside another. Table 4.3 \item Kilogram
3. FPS System
\item Second
Table 4.3: Nested listing through the itemize environment. \end{itemize} (i) Foot
LATEX input Output \item FPS System (ii) Pound
\begin{itemize} • India \begin{description}
\item India \item [(i)] Foot (iii) Second
\begin{itemize} – Assam \item [(ii)] Pound
\item Assam ∗ Nagaon \item [(iii)] Second
\begin{itemize} ∗ Kamrup \end{description}
\item Nagaon ∗ Cachar
\end{enumerate}
\item Kamrup
\item Cachar – Bihar
\end{itemize} – Punjab
\item Bihar
\item Punjab • Sri Lanka 5. Tabbing Texts
\end{itemize}
\item Sri Lanka The tabbing environment is used for aligning texts in different
\end{itemize} columns. The \= command is used, usually in the first row, to
generate a new column by ending the current column. The \>
illustrates three nested itemize environments (items of the itemize command moves the control to the next column in the subse-
environment cannot be referred as they are not numbered). No- quent rows. Each row is terminated by a line brake command
tice in Table 4.3 the marking styles of items in the nested itemize
environments.
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 8

\\ to go to the next row (the last row is not required to be ter- row by a line break command \\. Further, the \hline command
minated by \\). Table 5.1 shows a simple two-column example is used either to mark a boundary or to separate two rows by a
of tabbing through the tabbing environment. horizontal line in the specified location, covering the full width
of the table. Finally, the tabular environment is ended by the
Table 5.1: Tabbing texts through the tabbing environment. \end{tabular} command.
LATEX input Output The table environment, inside which the tabular environment
\begin{tabbing} Potato 12.00 .
Potato \= 12.00\\ Rice 20.00 is put in Table 6.1, is started through the \begin{table}[!hbt]
Rice \> 20.00\\ Oil 60.00 command (the optional argument !hbt is for the preferred ver-
Oil \> 60.00\\ Sugar 23.00 tical positioning of the table, which is explained in §6.3).
Sugar \> 23.00
The next command is \centering, which instructs for width-
\end{tabbing}
wise center alignment of the table (other commands could be
\flushleft for left alignment or \flushright for right alignment).
In the tabbing environment, columns of required widths and
The \caption{attl} command used in the table environment (but
number can be generated using the \kill command. In that case,
outside the tabular environment) assigns a serial number to the
all the columns are generated in the first row itself, where the
table along with its argument attl as the title (caption) of the
entry of a column is the widest entry which appears later in that
table (since the title usually comes on the top of a table, the
column. Finally, the first row is ended by the \kill command,
\caption{} command is used before the tabular environment).
instead of the line breaking command \\, instructing not to print
Following the \caption{} command, the \label{} command is in-
the row but just to generate the columns. Such an example is
serted with a unique reference key, which as shown in Table 6.1
shown in Table 5.2.
can be used in the \ref{} command for referring the table any-
Table 5.2: Adjusting tabbing column width in the tabbing envi- where in the document. Note that \label{} is always used after
ronment using the \kill command. \caption{}. Moreover, \label{} does not have any effect without
LATEX input Output \caption{}, in which case the table is not numbered. Also note
\begin{tabbing} Breadth (b) = 3 that %, used in Table 6.1 after \end{tabular}, is a commented
Base area (A) \= = bdh \= = 24\kill Depth (d) =2
Breadth (b) \> = 3\\ Height (h) =4 line (any texts in a line preceded by % is ignored by LATEX com-
Depth (d) \> = 2\\ Volume (V) = bdh = 24 pilers).
Height (h) \> = 4\\ Base Area (A) = bd = 6
Volume (V) \> = bdh \> = 24\\
Base Area (A) \> = bd \> = 6\\ 6.2. Table through the tabularx environment
\end{tabbing}
The width of a column generated by one of the options of l, c
and r, as discussed in §6.1, is made equal to the length of the
longest entry in that column. This may extend a table even be-
yond the width of a page if the table has some very long entries.
6. Table Preparation The tabularx package provides the tabularx environment,
which can calculate automatically the width of a column so
A table is used for presenting data or items row and column-
as to restrict a table within a pre-specified horizontal width
wise in a concise form. In LATEX, tables are prepared through
irrespective of the lengths of the entries in the table. The
the tabular or tabularx environment. However, tables produced
tabularx environment takes two mandatory arguments, i.e.,
by these environments are not assigned any serial number or
\begin{tabularx}{awidth}{acols}, where awidth is the horizon-
title, which are generally required for identifying a table. For
tal width of the table and acols is its columns. The columns
this purpose, the tabular and tabularx environments are usually
in the tabularx environment are generated in the same way as
put inside the table environment.
in the tabular environment. A fixed-width column is generated
through l, c or r, while a flexible-width column (i.e., a col-
6.1. Table through the tabular environment umn whose width is to be calculated automatically) is gener-
In the tabular environment, the columns of a table are gener- ated through a X. All the flexible-width columns of a table are
ated through the mandatory argument of the environment, e.g., of equal width, which is calculated internally based on the val-
\begin{tabular}{|l|c|c|c|c|} in Table 6.1 generates a five-column ta-
ues of the total width (awidth) of the table and total width of
ble. A column is generated through one of the three letters of the fixed-width columns. Entries in a flexible-width column are
l, r and c, each of which represents a column as well as the
made full aligned. Other alignments can be obtained using ei-
alignment of the entries in that column (l for left alignment, ther >{\raggedright\arraybackslash}, >{\centering\arraybackslash}
r for right alignment and c for center alignment). The | sym-
or >{\raggedleft\arraybackslash} before X, which make the en-
bol in the argument of \begin{tabular}{} is used either to mark a tries left, center and right aligned respectively. Table 6.2 shows
boundary or to separate two columns by a vertical line in the an application of the tabularx environment for generating a
specified location, covering the full height of the table. Follow- three-column table of a total width of 80% of the page width,
ing the \begin{tabular}{} command, the column-wise entries of a i.e., 0.8\linewidth (a fixed value, say 10cm or 6in, can also be
row are inserted, separating two entries by an & and ending the used). Since the middle column is generated by the option c,
its width is fixed by the longest entry in that column. The ex-
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 9

Table 6.1: A simple table through the tabular environment.


LATEX input Output
\begin{table}[!hbt]
\centering
\caption{Obtained marks.} Table 1: Obtained marks.
\label{tab-marks}
\begin{tabular}{|l|c|c|c|c|} Name Math Phy Chem English
\hline Name & Math & Phy & Chem & English\\ Robin 80 68 60 57
\hline Robin & 80 & 68 & 60 & 57\\
Julie 72 62 66 63
\hline Julie & 72 & 62 & 66 & 63\\
\hline Robert & 75 & 70 & 71 & 69\\ Robert 75 70 71 69
\hline
\end{tabular} Table 1 shows the marks obtained by three students in the final
\end{table} examination.
%
Table∼\ref{tab-marks} shows the ...

Table 6.2: A simple table through the tabularx environment.


LATEX input Output
\begin{table}[!hbt]
\centering Table 2: Scored points.
\caption{Scored points.}
\begin{tabularx}{0.8\linewidth}{|X|c|>{\raggedleft\arraybackslash}X|} Name Sex Points
\hline {\bf Name} & {\bf Sex} & {\bf Points}\\
\hline Milan & M & 1,500\\ Milan M 1,500
Julie & F & 1,325\\ Julie F 1,325
Sekhar & M & 922\\
Sekhar M 922
Dipen & M & 598\\
Rubi & F & 99\\ Dipen M 598
\hline Rubi F 99
\end{tabularx}
\end{table}

treme two columns are generated by the option X, for which 6.4. Merging rows and columns of tables
their widths are equal and calculated internally to accommo-
When presenting different types of information in a table,
date all the three columns in the pre-specified width of the ta-
some cells are often required to be merged into a single
ble. Moreover, the last column is made right aligned by gen-
one. The multirow package provides the \multicolumn{}{}{} and
erating it through >{\raggedleft\arraybackslash}X, instead of just
\multirow{}{}{} commands for merging two or more columns and
through X. All other matters of Table 6.2 are same with those of
rows respectively, which are illustrated in Table 6.3.
Table 6.1.
In \multicolumn{nc }{calign}{centry}, nc is the number of
columns to be merged, calign is the alignment of the merged
6.3. Vertical positioning of tables column and centry is the entry of that merged cell. Since 4
As shown in Tables 6.1 and 6.2, the preferred vertical position columns in the first row in Table 6.3 are merged into a single
of a table on a page can be specified as an optional argument to cell, the number of entries in that row is reduced from 6 to 3.
the table environment, i.e., \begin{table}[avp], where avp is the The permitted calign in the tabular environment is l (for left
specifier for vertical positioning of the table. The commonly alignment), r (for right alignment) or c (for center alignment).
used specifiers are h, b and t, which stand for here, bottom of Similarly, in \multirow{nr }{cwidth}{centry}, nr is the number
the page, and top of the page, respectively. These specifiers can of rows to be merged, cwidth is the width of the merged cell
be used individually or in a combination of two or three in any and centry is the entry of that merged cell. The value of cwidth
order. Moreover, for placing the table in the specified position can be set manually (e.g., 25mm or 1.0in), or can be obtained an
even if enough space is not available on the current page, the auto-adjusted one using an * only. When some rows in a column
specifier or the combination of the specifiers may be preceded are merged, \multirow{}{}{} is used in the first row to be merged
by a ! symbol, like !h, !b or !hbt. and the column in each of the remaining merged rows is left
Besides h, b and t, the float package provides the specifier H, blank (i.e., the column is ended simply by a & or \\) as shown
which instructs to put a table here only. If the blank space on in the first and last columns in the second row of Table 6.3.
the current page is not sufficient to hold the table, it is taken Further, the \cline{m-n} command is used in Table 6.3 for
to the top of the next page along with the texts that follow the drawing a horizontal line covering columns m to n only.
table, by leaving the current page incomplete. The specifier H
is used alone, i.e., H is not combined with ! or any of h, b and t.
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 10

Table 6.3: Merging two or more cells of a table into a single one.
LATEX input Output
\begin{tabular}{|l|*{5}{c|}}
\hline \multirow{2}{*}{Name}& \multicolumn{4}{c|}{Subjects}& \multirow{2}{*}{Total}\\ Subjects
Name Total
\cline{2-5} & Math & Phy & Chem & English & \\ Math Phy Chem English
\hline Robin & 80 & 68 & 60 & 57 & 265\\
Robin 80 68 60 57 265
\hline Julie & 72 & 62 & 66 & 63 & 263\\
\hline Robert & 75 & 70 & 71 & 69 & 285\\ Julie 72 62 66 63 263
\hline Robert 75 70 71 69 285
\end{tabular}

6.5. Tables in multi-column documents 7.1. Commands and environment for inserting
In a multi-column document, where texts are printed column- figures
wise, a table is also placed in a single column. However, if An eps format figure can be inserted using the
the width of the column is not large enough to accommodate \epsfig{file=fname} command defined in the epsfig pack-
a table in it, the table* environment may be used for producing age, where fname is the name of the figure file with or without
the table over the entire width of the page. In that case, the the eps extension. Additionally, the size of a figure can also
\begin{table} and \end{table} commands are to be replaced by be specified in \epsfig{} through two optional fields, width and
the \begin{table*} and \end{table*} commands respectively. height, one separated from another by a comma. Without any
of the width and height, a figure is printed in its original size. If
6.6. Tables at the end of a document one of them is specified, the other one is automatically taken
in proportion. On the other hand, the presence of both width
Some publishers want the tables and figures of an article are and height prints a figure in the specified fixed size (in this
to be grouped at the end of the article. Just the inclusion of case, the figure may get distorted if their values are not set
the endfloat package in a normal document automatically per- properly). Further, a figure can also be rotated through the
forms this job, regardless of the actual positions of the tables option angle=theta, where a positive value of theta (in degree)
and figures in the LATEX input file (the endfloat package pro- will rotate the figure in counter-clockwise direction and a
duces two auxiliary files with fff and ttt extensions for writ- negative value in clockwise direction.
ing information about the figures and tables respectively). Not The more general command for inserting a figure is
only the tables and figures are grouped at the end of the doc- \includegraphics[aopt]{fname} defined in the graphicx package,
ument, notes are also produced in their actual positions, like where fname is the name of the figure file without its extension,
[Table 3 about here.] or [Figure 7 about here.]. More- and aopt is(are) the option(s) like width, height and angle. The
over, the tables and figures are preceded by two lists, namely advantage of using \includegraphics[]{} is that a figure in any for-
‘List of Tables’ and ‘List of Figures’ respectively, con- mat can be inserted without making any change in the input file.
taining their contents. The produced lists of tables and figures Similar to nesting the tabular or tabularx environment in
can be turned off by using the \notablist and \nofiglist commands the table environment as discussed in §6.1, the \epsfig{} and
in the preamble. Note that the use of the endfloat package may \includegraphics[]{} commands can be used in the figure envi-
require an additional latex run to move the tables and figures ronment, so that a figure can be assigned a serial number and
at the end of the document (§9.3 discuss about the latex run). a caption through the \caption{} command, as well as a refer-
ence key through the \label{} command for the purpose of re-
ferring it anywhere within a document. Further, similar to the
7. Figure Insertion table environment, the figure environment can also be created as
\begin{figure}[] with optional preferences in [] for vertical posi-
It is stated in §1.2 that a LATEX file can be compiled using either
tioning of a figure. The standard preferences for vertical posi-
the latex or pdflatex command. When a LATEX file involves fig-
tioning are H, and any or combination of h, b and t along with
ures from external files, either of the compilation commands
! (refer §6.3 for detail of [H] and [!hbt]).
is to be used based on the format of the figures. Note that
the file formats of all the inserted figures must be supported
by a single compilation command, either latex or pdflatex. Fig- 7.2. Inserting a simple figure
ure formats supported by the latex command are eps (encap-
Two examples of inserting a figure are shown in Table 7.1,
sulated postscript) and ps (postscript), while those supported
where the first command in the figure environment is \centering
by the pdflatex command are pdf (portable document format),
that instructs for width-wise center alignment of its figure (other
jpg (joint photographic expert group), tiff (tag index file for-
commands could be \flushleft for left alignment or \flushright for
mat) and png (portable network graphic).
right alignment). The \caption{} command is used for assigning
a serial number to the figure and for printing its argument as
the title of the figure (since the title usually comes at the bot-
tom of a figure, \caption{} is used after \epsfig{}). The \caption{}
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 11

Table 7.1: Figure insertion through the \epsfig{} command. 7.5. Figures at the end of a document
LATEX input Output
Refer §6.6 for detail.

\begin{figure}[!hbt]
\centering 8. Equation Writing
\epsfig{file=girl.eps, width=2.0cm}
\caption{A girl.}
\label{girl1} Mathematical expressions or equations in LATEX are written in
\end{figure} math-mode environments, such as equation or eqnarray. The
math-mode environments are defined in the amsmath package,
Figure 1: A girl.
while mathematical symbols are in the amssymb package.

8.1. Basic mathematical notations and delimiters


\begin{figure}[!hbt]
\centering Since various mathematical notations are basic tools for writ-
\epsfig{file=girl, width=2cm, angle=30} ing mathematical expressions, LATEX commands for some fre-
\caption{A girl.} quently used notations are listed in Table 8.1 as a quick refer-
\label{girl2} ence. Also, Greek letters used as symbols are given in Table 8.2.
\end{figure}

Some basic delimiters, a pair of which acts like parentheses


Figure 2: A girl. to enclose an expression, are also given in Table 8.3. To fit au-
tomatically around the height of a mathematical expression, the
\left and \right commands may be used before the opening and
command is followed by the \label{} command for assigning a closing delimiters (\left and \right are used as a complementary
unique reference key, which can be used for referring the figure pair). The two delimiters enclosing an expression need not to
through the \ref{} command. be similar. For example, \left( and \right] can be used to enclose
an expression in ( ]. If no delimiter is required in one side of an
7.3. Sub-numbering a group of figures expression, the \left. or \right. command, as applicable, may be
used. On the other hand, for fixed big-size delimiters, the \big,
A group of figures can be sub-numbered under a main num- \Big, \bigg and \Bigg commands may be used by appending l
ber, e.g., 3(a) or 5(e). Within the figure environment, the and r for producing opening and closing delimiters respectively,
\subfigure[atitle]{afig} command defined in the subfigure e.g., \biggl\{ and \biggr\} will produce a pair of big-sized curly
package (or the new \subfloat[atitle]{afig} command defined braces. Note that none of the commands of the forms of \big,
in the subfig package) may be used for inserting a figure with \Big, \bigg and \Bigg is required to appear in a complementary
a sub-numbering, where optional atitle is the title of the fig- pair, i.e., either the opening or closing delimiter can also be
ure, and mandatory afig is the insertion of the figure either used alone as shown in the right column of Table 8.3.
through the \epsfig{} or \includegraphics[]{} command. For the
purpose of referring, a sub-figure can be assigned a reference
key through the \label{} command inside the mandatory argu- 8.2. Mathematical operators
ment of \subfigure[]{}. Moreover, the group of sub-figures can A mathematical expression is formed by connecting various
be captioned and labeled as a whole using respectively the terms through some operators, which are classified as binary
\caption{} and \label{} commands inside the figure environment. operators and relation operators. Such operators along with
Table 7.2 shows such an example, which also shows that the their LATEX commands are given in Tables 8.4 and 8.5.
sub-figures can be inserted in a single row or even in mul-
tiple rows (for inserting a sub-figure in the next row, a line
break command \\ is to be used at the end of the previous
8.3. Mathematical expressions in text-mode
\subfigure[]{} command). A mathematical expression, say amath, can be inserted
in running texts of a paragraph as $amath$, \(amath\) or
7.4. Figures in multi-column documents \begin{math}amath\end{math}, where ‘$ $’, ‘\( \)’ or the math en-
vironment create math-modes in running texts. A single nota-
In a multi-column document, where texts are printed column- tion is usually inserted in $ $, while an expression is inserted in
wise, a figure is also placed in a single column. However, if \( \) or in the math environment (however, all three are applica-
the width of the column is not large enough to accommodate ble in either case). Consider the following example:
a figure in it, the figure* environment may be used for inserting
the figure on the entire width of the page. In that case, the The equation of an origin-centered circle is x2 + y2 =
\begin{figure} and \end{figure} commands are to be replaced by r2 , where x and y are the coordinates of a point on the
the \begin{figure*} and \end{figure*} commands respectively. circumference of the circle, and r is its radius.
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 12

Table 7.2: Sub-numbering a group of figures using the \subfigure[]{} command.


LATEX input Output

\begin{figure}[!htb]
\centering
\subfigure[A girl.]
{ \includegraphics[width=2.0cm]{girl}
\label{girl}
}\hfill
\subfigure[A flower.]
{ \includegraphics[width=2.0cm]{flower} (a) A girl. (b) A flower.
\label{flower}
}\\
\subfigure[A finger work.]
{ \includegraphics[width=4.0cm]{finger}
\label{finger-work}
}
\caption{Girl, flower and finger work.}
\label{girl flower finger}
\end{figure}
%
In Figure∼\ref{girl flower finger}, \ref{girl} and \ref{flower} (c) A finger work
display a girl and a flower, while \ref{finger} displays a
beautiful finger work. Figure 3: Girl, flower and finger work.
In Figure 3, 3(a) and 3(b) display a girl and a flower, while 3(c) displays a
beautiful finger work.

Table 8.1: Frequently used mathematical notations (math- Table 8.2: Greek letters (math-mode).
mode). Sym. command Sym. command Sym. command Sym. command
Function Command with application Output Lowercase κ \kappa υ \upsilon Ξ \Xi
α \alpha λ \lambda φ \phi Π \Pi
Prime p’ p′ β \beta µ \mu ϕ \varphi Σ \Sigma
Dots \dot{x}, \ddot{x} ẋ, ẍ γ \gamma ν \nu χ \chi Υ \Upsilon
... ....
\dddot{x}, \ddddot{x} x, x δ \delta ξ \xi ψ \psi Φ \Phi
Single sub-/super-script x i, xˆ2 xi , x2 ǫ \epsilon π \pi ω \omega Ψ \Psi
ε \varepsilon ̟ \varpi Uppercase Ω \Omega
Multiple sub-/super- x {ij}, xˆ{2k} xi j , x2k
ζ \zeta ρ \rho Γ \Gamma AMS Greek
scripts
η \eta ̺ \varrho ∆ \Delta ̥ \digamma
Subscript and super- xˆ{2k} {ij} or x {ij}ˆ{2k} xi2kj θ \theta σ \sigma Θ \Theta κ \varkappa
script ϑ \vartheta ς \varsigma Λ \Lambda
20
Summation \sum, \sum {i=1}ˆ{20}
P P
, ι \iota τ \tau
i=1
20
\prod, \prod {i=1}ˆ{i=20}
Q Q
Product , Table 8.3: Basic delimiters (math-mode).
i=1 Rb
Del. Command Del. Command
R
Integration \int xˆ2\,dx, \int aˆb xy\,dx x2 dx, a xy dx
RR RRR  
Multiple integration \iint\limits s, \iiint\limits v , x x
\left( \frac{x}{y} \right) \bigl( \frac{x}{y} \bigr)
y y
RsR R R v x
\left( \frac{x}{y} \right. x
\iiiint y y \Bigl( \frac{x}{y}
x
Set of integrations \idotsint
R
···
R
\left. \frac{x}{y} \right) x

ny o y \frac{x}{y} \biggr)
x
\left\{ \frac{x}{y} \right\}
H
Cyclic integration \oint ny
x x
Fraction \frac{x}{y} \left\{ \frac{x}{y} \right.  
x
y yo
y \biggl\{ \frac{x}{y} \biggr\}
dx x
Derivative \nabla{f}, \frac{dx}{dy} ∇f, \left. \frac{x}{y} \right\}
dy hy i
∂y x
!
Partial derivative \frac{\partial{y}}{\partial{x}} \left[ \frac{x}{y} \right] x
∂x
√ √5 hy y \Biggl( \frac{x}{y} \Biggr)
\sqrt{x}, \sqrt[5]{xyz} x
Root x, xyz yi \left[ \frac{x}{y} \right.
Limit \lim {x\to 0} lim x→0 x
)
\left. \frac{x}{y} \right] x
y y \frac{x}{y} \Biggr\}
\underset{x\to 0}{\lim} lim x \left| \frac{x}{y} \right|
x→0 y
∃, ∄

Exists/not exists \exists, \nexists x \left| \frac{x}{y} \right. x
y \frac{x}{y} \Biggr|
Modes \mod{nˆ2}, \bmod{nˆ2} mod n2 , modn2 x
\left. \frac{x}{y} \right|
y
y
\pmod{nˆ2}, \pod{nˆ2} (mod n2 ), (n2 )
n
Binomial expression \binom{n}{k} k

and r as $x$, $y$ and $r$ respectively.


where the equation can be inserted as \(xˆ2 + yˆ2 = rˆ2\) or
\begin{math}xˆ2 + yˆ2 = rˆ2\end{math}, while the variables x, y
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 13

Table 8.4: Basic binary operators. numbered, either the \nonumber command may be inserted af-
Symbol Command Symbol Command Symbol Command ter the equation, or the equation may be produced through the
± \pm ⋄ \diamond ≀ \wr
∓ \mp ♦ \Diamond \ \setminus equation* environment instead of the equation environment, as
÷ \div △ \triangle ∐ \amalg illustrated in the second and third examples of Table 8.6.
× \times △ \bigtriangleup † \dagger
∗ \ast ▽ \bigtriangledown ‡ \ddagger
⋆ \star ⊳ \triangleleft \bigcirc 8.5. Array of equations
\cdot \triangleright \bigcap
T
· ⊲
◦ \circ ⊳ \lhd
S
\bigcup LATEX provides a number of environments for producing an ar-
\bullet ⊲ \rhd \bigsqcup
F
• ray of equations together, instead of producing each equation
\cap E \unlhd \biguplus
U
∩ by a separate equation environment. Such environments along
\cup D \unrhd \bigvee
W

⊓ \sqcap ⊙ \odot
V
\bigwedge with their alignment structures are listed in Table 8.7 and their
J
⊔ \sqcup ⊕ \oplus L \bigodot
⊎ \uplus ⊖ \ominus N \bigoplus Table 8.7: Environments used for producing arrays of equations.
∨ \vee ⊗ \otimes \bigotimes Environment Alignment structure
∧ \wedge ⊘ \oslash
gather and gather* Gather equations without alignment.
Table 8.5: Basic relation operators. eqnarray and eqnarray* Allow alignment about a single place only.
Symbol Command Symbol Command Symbol Command align and align* Allow alignment about a single place only.
≤ \leq ∈ \in , \not= alignat and alignat* Allow alignment about multiple places.
.
≪ \ll < \not\in = \doteq xalignat and xxalignat Allow alignment about multiple places.
≥ \geq ∋ \ni ∝ \propto Columns and margins are equally spaced in
≫ \gg ⊢ \vdash | |
xalignat, while margin spacing is ignored in
T \gtreqqless ⊣ \dashv |= \models xxalignat.
≺ \prec ≡ \equiv ⊥ \perp
array Allows alignment at multiple places. It is to
 \preceq . \not\equiv | \mid
be nested in the equation environment.
≻ \succ ∼ \sim k \parallel
 \succeq ≁ \not\sim ∦ \not\parallel
⊂ \subset ≃ \simeq ⊲⊳ \bowtie applications are shown in Table 8.8. In these environments,
⊆ \subseteq ≍ \asymp ⋊
⋉ \Join each equation of an array, except the last one, is terminated
⊑ \sqsubseteq ≈ \approx ⌣ \smile
⊃ \supset 0 \not\approx ⌢ \frown by \\. The \\[vsize] command can also be used for provid-
⊇ \supseteq  \cong ≮ \not< ing extra vsize vertical space between two equations. The
⊒ \sqsupseteq , \neq ≯ \not> \intertext{atext} command can be used after \\ for inserting a
few lines of texts (i.e., atext) in between two equations main-
taining their alignments.
8.4. Simple equations The patterns of aligning the equations of an array differ from
The very basic math-mode environment for producing an equa- environment to environment. The eqnarray and eqnarray* envi-
tion is equation, which is used for inserting a single equation. ronments enclose the aligning place by a pair of & sign (e.g.,
Table 8.1 shows three examples of the equation environment, &=&) or simply && for aligning about an empty space. The
align and align* environments use a single & on the left side
Table 8.6: A simple equation through equation environment. of the aligning place (e.g., &=). Similarly, the alignat, alignat*,
LATEX input Output xalignat and xxalignat environments (which allow alignment at
\begin{equation} multiple places) also use a single & on the left side of an align-
xˆ2 + yˆ2 = rˆ2
x2 + y2 = r2 (8.1) ing place, but with a provision for ending the current aligning
\label{eq:circ}
\end{equation} place by another & before starting the alignment at the next
\begin{equation*}
place. The alignat, alignat*, xalignat and xxalignat environments
xˆ2 + yˆ2 = rˆ2 x2 + y2 = r2 take the number of aligning places as a mandatory argument,
\end{equation*} e.g., \begin{alignat}{m} with m> n2 +1 if n is even and m> n+1
2
if n
\begin{equation} is odd, where n is the number of & used in an equation. On the
xˆ2 + yˆ2 = rˆ2 \nonumber x2 + y2 = r2 other hand, the aligning process in the array environment is quite
\end{equation} different. Similar to the tabular environment used for preparing a
table (refer §6.1), the array environment creates aligning places
where each equation is printed in a separate center-aligned line. through mandatory options of l for left alignment, c for centered
As seen in the first example, by default the equation is assigned and r for right alignment.
a serial number in ( ) on its right side. It is also shown that The starred forms of the environments (including xxalignat
the equation can be labeled by the \label{} command for the which acts like the starred form of xalignat) ignore the number-
purpose of referring it through the \ref{} command (similar to ing to any equation, while their non-starred forms (including
\ref{}, the \eqref{} command may also be used for referring an xalignat) assign an individual serial number to each equation. If
equation, which put the serial number of the equation in a pair required, numbering to any equation of an array can be elim-
of parentheses). On the other hand, if an equation is not to be inated using the \nonumber or \notag command. On the other
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 14

Table 8.8: Array of equations in different forms.


LATEX input Output
\begin{gather}
5x+ 2y = x+ 2z+ 3\\ 5x + 2y = x + 2z + 3 (8.2)
130x+ 4z = y+ 2\\
130x + 4z = y + 2 (8.3)
43y+ 57z = 20x+ 99
\end{gather} 43y + 57z = 20x + 99 (8.4)

\begin{eqnarray}
5x+2y &=& x+2z+3 \label{eqn1}\\
5x + 2y = x + 2z + 3 (8.5)
130x+4z &=& y+2 \nonumber \\
43y+57z &=& 20x+99 \label{eqn3} 130x + 4z = y+2
\end{eqnarray} 43y + 57z = 20x + 99 (8.6)

\begin{align}
5x+2y &= x+2z+3 \tag{See \eqref{eqn1}}\\ 5x + 2y = x + 2z + 3 (See (8.5))
130x+4z &= y+2 \label{align2}\\[3mm] 130x + 4z = y + 2 (8.7)
43y+57z &= 20x+99 \notag
\end{align} 43y + 57z = 20x + 99

\begin{alignat*}{7} 5x+ 2y = x+ 2z+ 3


5x&+& 2y&& &=& x&+& && 2z&+& 3\\
Please notice the alignment made about each
\intertext{Please notice the alignment ...}
‘+’ and ‘=’ signs of these equations.
130x&+& && 4z &=& && y&+& && 2\\
&& 43y&+& 57z &=& 20x&+& && && 99
130x+ 4z= y+ 2
\end{alignat*} 43y+57z=20x 99
\begin{xxalignat}{7}
5x&+& 2y&& &=& x&+& && 2z&+& 3\\ 5x+ 2y = x+ 2z+ 3
130x&+& && 4z &=& && y&+& && 2\\ 130x+ 4z= y+ 2
&& 43y&+& 57z &=& 20x&+& && && 99 43y+ 57z= 20x 99
\end{xxalignat}
\begin{equation}
\left.\begin{array}{rrrrrrrrrrrrr} 
5x&+& 2y&& &=& x&+& && 2z&+& 3\\ 5x+ 2y = x+ 2z+ 3


130x+ 4z= y+ 2 (8.8)

130x&+& && 4z &=& && y&+& && 2\\ 
43y+57z=20x 99

&& 43y&+& 57z &=& 20x&+& && && 99
\end{array}\right}
\end{equation}

hand, since the array environment is nested in the equation en- magazines), book (books), booklet (booklet type references),
vironment, it is treated as a single equation and hence the en- inbook (chapters or parts of books), incollection (parts of a
tire array of equations is assigned a single serial number as a book with separate titles), inproceedings (articles in confer-
whole. ence proceedings), conference (articles in conference proceed-
ings), manual (technical documentations), mastersthesis (Master
theses), phdthesis (Ph.D theses), misc (uncommon references),
9. Bibliography with BIBTEX proceedings (proceedings of an event), techreport (technical re-
ports or working papers), and unpublished (unpublished refer-
An elegant bibliographic list can be produced in a document ences).
by incorporating the BibTEX program with LATEX. It prints a A reference-type command is preceded by @ and it takes
reference only if it is cited somewhere in the document. More- a mandatory argument, e.g., @article{ckey, rf1, rf2, ...},
over, the BibTEX program follows certain structures for differ- where ckey is the mandatory citation key, and rf1, rf2, etc.,
ent types of references according to the chosen bibliography are other mandatory and optional fields detailing the reference.
style as discussed in §9.2. As shown in Table 9.1, a reference-type command takes
some out of around 21 reference fields, which are address,
9.1. Preparation of BIBTEX compatible reference author, booktitle, chapter, edition, editor, howpublished, institution,
database journal, month, note, number, organization, pages, publisher,
school, series, title, type, volume, and year. These fields can be
The entry of a reference in the BibTEX program consists of entered in any order, which will be arranged automatically ac-
three mandatory parts – (1) type of the reference, (2) a user- cording to the chosen bibliography style. There is no harm if
defined citation key which can be used for citing the reference, an extra field is inserted or an acceptable field is left blank. A
and (3) detail of the reference. redundant field or a field with no data is automatically skipped
As shown in Table 9.1, there are around 14 types of de- by BibTEX.
fined references, which are article (articles in journals or
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 15

Table 9.1: Types and fields of references under BibTEX program. 4. In the case of a multi-author reference, the names of

inproceedings,

mastersthesis,
every two authors are to be separated by the word

unpublished
proceedings
incollection

conference
‘and’ (not by a comma as generally done).

techreport
phdthesis
5. If a list is to be truncated with the name(s) of the first
booklet

manual
inbook
article

book

misc
or few author(s), ‘and others,’ may be added after
that(those) name(s), which is converted to ‘et al.’.
address × O O O O O O O × O O ×
author M M1 O M1 M M O M O × M M
booktitle × × × × M M × × × × × ×
⊲ booktitle: Title of the book or proceedings.
chapter × × × M2 O × × × × × × × ⊲ chapter: Serial number of the referred unit/chapter.
edition × O × O O × O × × × × ×
editor × M1 × M1 O O × × × O × × ⊲ edition: Edition number, e.g., ‘Second’ or ‘2nd’.
howpublished O O
× × × × × × × × × ×
⊲ editor: Names of the editors (in the same way as author).
institution × × × × × × × × × × M ×
journal M × × × × × × × × × × × ⊲ howpublished: Type of publication.
month O O O O O O O O O O O O
note O O O O O O O O O O O M ⊲ institution: Name of the publishing Institute.
number O O1 × O1 O1 O1 × × × O1 O ×
⊲ journal: Name of the journal.
organization × × × × × O O × × O × ×
pages O × × M2 O O × × × × × × ⊲ month: Month of publication, e.g., ‘Jan.’ or ‘January’.
publisher M M M O O
⊲ note: A short note on the document, e.g., the abstract.
× × × × × × ×
school × × × × × × × M × × × ×
series × O O O O ×
× × × O × × ⊲ number: Issue or serial number of the publication.
title M M
M M M M M M O M M M
type × × × O O × × O × × O × ⊲ organization: Name of the organizing or sponsoring body.
volume O O1 × O1 O1 O1 × × × O1 × ×
⊲ pages: Serial number of the referred pages, e.g., ‘24- -35’.
year M M O M M M O M O M M O
M → mandatory field M1 → one of them is mandatory ⊲ publisher: Name of the publisher.
M2 → either one or both are mandatory
O → optional field O1 → one of them (optional) ×→ not required
⊲ school: Name of the thesis submitting Institute.
⊲ series: Name of the publishing series.
⊲ title: Title of the reference.
Data of all the fields of a reference-type command are pro-
cessed in text-mode. Hence, accented and special charac- ⊲ type: Type of the reference, e.g., ‘Ph.D thesis’.
ters are to be put in proper way, e.g., ‘Jos\’e’ for produc- ⊲ volume: Volume number of the publication.
ing ‘José’ or ‘Hungerl$\ddot{\mathrm{a}}$nder’ for producing
⊲ year: Year of publication, e.g., 2018.
‘Hungerländer’. Data of a field can be inserted either in a
pair of quotes or curly braces, e.g., title=”A Practical Guide According to above, an illustrative bibliographic reference
to \LaTeX” or title={A Practical Guide to \LaTeX}. Further database file is shown in Table 9.2, where two fields of a refer-
processes for entering data in the argument of a reference-type ence (including the citation key) are separated by a comma.
command are explained below:

⊲ Citation key: It is a combination of any number of alpha- 9.2. Standard bibliographic styles of LATEX
bets, numerals and/or signs without any gap between two
The formatting of bibliographic references in the BibTEX pro-
characters, e.g., Even-etal-1976 or Even+:1976.
gram is controlled by an associated bibliographic style, which
⊲ address: It could be the city or country of a publisher, is defined through the \bibliographystyle{astyle} command
venue of a conference, address of an institution or school, with astyle as a bibliography style as listed in Table 9.3.
or URL of a webpage. A URL may be inserted through The \bibliographystyle{astyle} command is followed by the
the \url{} command defined in the url package. \bibliography{dbib} command, where dbib is the name of the
⊲ author: The name of an author is processed in two parts bibliography database file without its bib extension. For exam-
only, the first name and the surname. ple, the following are the commands to load the bibliography
database file ‘mybib2.bib’ of Table 9.2 in plain style:
1. In the case of all words capitalized, the last word is
treated as the surname and rest as the first name. \bibliographystyle{plain}
2. In the presence of any non-capitalized word, all \bibliography{mybib2}
the remaining words starting from the first non-
capitalized one are treated as the surname and rest Under all the bibliography styles given in Table 9.3, a ref-
as the first name. erence is cited through the \cite{ckey} command, where ckey is
3. If a surname contains multiple words, those may be the citation key of the reference. Multiple references can also be
inserted either in curly braces or at the starting with cited through a single \cite{} command separating two citation
a comma after the last word. keys by a comma, e.g., \cite{Datta-1998, Even-etal-1976}.
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 16

Table 9.2: BibTEX compatible bibliographic reference database. Table 9.3: Some standard bibliographic styles of LATEX.
% mybib2.bib LATEX style Function
@article{Datta-Figueira-2013, plain References are listed in alphabetic order of the surnames (last
author = {Dilip Datta and Jos\’e Rui Figueira}, or family names) of authors, and labeled by Arabic numerals in
title = {{A real-integer-discrete-coded differential [], e.g., the first two references of Table 9.2 will be produced as
evolution}}, follows:
journal = {Applied Soft Computing}, [1] Dilip Datta and José Rui Figueira. A real-integer-discrete-coded dif-
volume = {13}, ferential evolution. Applied Soft Computing, 13(9):3884–3893, 2013.
number = {9}, [2] Kalyanmoy Deb. Multi-Objective Optimization using Evolutionary
Algorithms. John Wiley & Sons Ltd., Chichester, England, 2001.
pages = {3884--3893},
unsrt Same with plain, except that the references are listed in order of
year = {2013}
their citations in the document.
}
alpha A reference is labeled by an identifier generated from the sur-
names of the authors and the year of publication, and the refer-
@book{Deb-2001,
ences are listed in alphabetic order of their identifiers, e.g., the
author = {Kalyanmoy Deb},
first two references of Table 9.2 will be produced as follows:
title = {{Multi-Objective Optimization using Evolutionary
Algorithms}}, [Deb01] Kalyanmoy Deb. Multi-Objective Optimization using Evolu-
tionary Algorithms. John Wiley & Sons Ltd., Chichester, Eng-
publisher = {John Wiley \& Sons Ltd.}, land, 2001.
address = {Chichester, England}, [DF13] Dilip Datta and José Rui Figueira. A real-integer-discrete-
year = {2001} coded differential evolution. Applied Soft Computing,
} 13(9):3884–3893, 2013.
abbrv Same with plain, except that a reference is made compact by
@inproceedings{Burke-etal-1996, abbreviating the given (or first and middle) names of authors,
author = {Edmund Burke and Dave Elliman and Peter Ford e.g., the first two references of Table 9.2 will be produced as
Rupert Weare}, follows:
title = {{Examination Timetabling in British Universities - [1] D. Datta and J. R. Figueira. A real-integer-discrete-coded differential
A Survey}}, evolution. Applied Soft Computing, 13(9):3884–3893, 2013.
booktitle = {Proceedings of Practice and Theory of [2] K. Deb. Multi-Objective Optimization using Evolutionary Algo-
Automated Timetabling}, rithms. John Wiley & Sons Ltd., Chichester, England, 2001.
publisher = {Springer}, acm Same with plain, but the surname of an author is printed first
series = {Lecture Notes in Computer Science (LNCS)}, in small capital letters, followed by the abbreviated given name,
editor = {Edmund K. Burke and Peter Ross}, e.g., the first two references of Table 9.2 will be produced as
year = {1996}, follows:
volume = {1153}, [1] Datta, D., and Figueira, J. R. A real-integer-discrete-coded differen-
tial evolution. Applied Soft Computing 13, 9 (2013), 3884–3893.
pages = {76--90}
[2] Deb, K. Multi-Objective Optimization using Evolutionary Algo-
} rithms. John Wiley & Sons Ltd., Chichester, England, 2001.
apalike The surname of an author is printed first, followed by the ab-
@mastersthesis{Datta-1998, breviated given name, and a reference is labeled by an identifier
author = {Dilip Datta}, generated from the surnames of authors and the year of publica-
title = {{Optimal Shape Design System for Plates under tion, e.g., the first two references of Table 9.2 will be produced
Dynamic Loads}}, as follows:
school = {Indian Institute of Technology, Delhi},
[Datta and Figueira, 2013] Datta, D. and Figueira, J. R. (2013). A real-
month = {December}, integer-discrete-coded differential evolution. Applied Soft Computing,
year = {1998}, 13(9):3884–3893.
note = {Master thesis} [Deb, 2001] Deb, K. (2001). Multi-Objective Optimization using Evolu-
} tionary Algorithms. John Wiley & Sons Ltd., Chichester, England.

@techreport{Colorni-etal-1992,
author = {Alberto Colorni and Marco Dorigo and Vittorio
citing it in the document. On the other hand, the \nocite{*} com-
Maniezzo},
title = {{A Genetic Algorithm to Solve the Timetable mand may be used for listing all the references of a database
Problem}}, file without citing even a single one.
number = {90-060 revised},
institution = {Politecnico di Milano, Italy},
year = {1992} 9.3. Compiling BIBTEX based LATEX input file
}
If bibliography is generated through the BibTEX program, a
LATEX file is to be compiled through the following 4 lines of
Citations are marked in the contents of a document by the iden- commands:
tifiers of the cited references, e.g., [1], [2], . . . , or [Deb01],
$ latex myarticle
[DF13], . . . , or [Datta and Figueira, 2013], [Deb, 2001],
$ bibtex myarticle
. . . , as shown in Table 9.3.
$ latex myarticle
Only those references, cited in the document, are printed in
$ latex myarticle
the bibliographic reference list under the heading ‘References’.
If a reference is to be printed in the bibliography list without where myarticle is the name of the LATEX input file with-
citing it in the document, the \nocite{} command may be used out its tex extension. The bibtex command compiles the bib-
somewhere in the document, e.g., \nocite{Datta-1998} for print- liography file included in myarticle.tex. The last two la-
ing the reference under the citation key ‘Datta-1998’ without tex commands link the BibTEX generated bibliographic ref-
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 17

erences with LATEX. The above commands will produce five Table 10.1: Article in the document-class article.
files, namely myarticle.aux, myarticle.log, myarticle.dvi, LATEX input Output
% myarticle.tex (in
myarticle.bbl and myarticle.blg. As mentioned in §1.2, the
myarticle.dvi file can be viewed in a document viewer or can
‘article’)
\documentclass[12pt]{article}
My First Article in
be used to produce a pdf file. \date{} LATEX
\title{My First Article in
\LaTeX} Author’s Name and Address
\author{Author’s Name and
10. Article Preparation Address} Abstract
\begin{document} The article explains . . .
Templates of articles for publishing in journals, proceedings, \maketitle
magazines, etc., vary from publisher to publisher. Many pub- %
1 First Section
lishers provide their own templates for maintaining uniformity \begin{abstract}
The article explains ... First level of numbered section.
in a volume, and an author needs just to insert the contents of an \end{abstract}
article in the given template. If not given, authors can prepare % 1.1 First subsection
articles in their own templates. A number of such LATEX based \section{First Section} Second level of numbered section.
First level of numbered
standard templates are discussed here.
section.
An article can be prepared in the document-class of article or 1.1.1 First sub-subsection
\subsection{First subsection}
amsart. Generally an article starts with a title and the list of au- Second level of numbered Third and last level of numbered
section. section.
thor(s), which are inserted as the arguments of the \title{} and
\subsubsection{First
\author{} commands respectively. These commands are acti- 2 Second Section
sub-subsection}
vated using the \maketitle command in the document environ- Third and last level of Texts of the second section . . .
ment before inserting any content of the article. The \title{} numbered section.
and \author{} commands can be used either in the preamble \section{Second Section}
Texts of the second section
or even in the document environment, but must be before the ... 1
\maketitle command. Following the \maketitle command, the %
abstract of the article is inserted in the abstract environment. \end{document}
Then the actual contents of the article are inserted through a
series of standard formatting, such as \section{}, \subsection{}, Table 10.2: Article in the document-class amsart.
\subsubsection{}, \paragraph{}, \subparagraph{} commands, as LATEX input Output
well as other applicable commands and environments discussed % myarticle.tex (in ‘amsart’)
\documentclass[12pt]{amsart} MY FIRST ARTICLE IN
up to the previous Section. \title{My First Article in LATEX
The general format of an article, in both the document- \LaTeX}
classes of article and amsart, are shown in Tables 10.1 and \author{Author’s Name and AUTHOR’S NAME AND
Address} ADDRESS
10.2 respectively, where the differences in the outputs of the
\begin{document}
two document-classes are clearly visible. The document-class \maketitle Abstract. The article explains
article by default prints the compilation date of the article (which % ...
is prevented in Table 10.1 through the \date{} command with \begin{abstract}
empty argument). The article explains ... 1. First Section
\end{abstract}
% First level of numbered section.

10.1. List of authors \section{First Section}


First level of numbered 1.1. First subsection. Second
section. level of numbered section.
Tables 10.1 and 10.2 show only one author in the article, which
\subsection{First subsection} 1.1.1. First sub-subsection. Third
is printed center-alignment. When the number of authors is Second level of numbered
and last level of numbered section.
more than one, these may be printed one below another, side- section.
by-side, or in any other user-defined format. A format for two \subsubsection{First
sub-subsection} 2. Second Section
authors, printed one below another, is shown Table 10.3. An-
Third and last level of Texts of the second section . . .
other format is shown in Table 10.4, where two authors are numbered section.
printed side-by-side through the tabular environment with two \section{Second Section}
columns. Also, the contents of each column are center-aligned Texts of the second section
...
and two columns are separated by extra 30 mm space through %
1
the @{\extracolsep{30mm}} command. A third format is shown \end{document}
in Table 10.5, where the detail of an author is printed at the bot-
tom of the page through the \thanks{} command after the name
of each author. The same effect can be obtained through the 10.2. Title and abstract on separate pages
\footnote{} command also, instead of the \thanks{} command.
The \and command is used between the names of the two au- Some publishers may ask to produce title, list of authors and
thors to separate them by a big gap in the output. abstract of an article on separate pages, particularly for the re-
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 18

Table 10.3: Authors in articles one below another. 10.3. Articles in multiple columns
LATEX input Output
\author Many publishers want articles to be produced in multiple
{ columns. The twocolumn option in the \documentclass[]{} com-
{\bf 1st author’s name}\\ 1st author’s name
Affiliation mand produces an article in two columns. In the document-
Affiliation\\
Address\\[2mm] Address class article, as shown in Table 10.6, the title and list of authors
% 2nd author’s name
{\bf 2nd author’s name}\\ Table 10.6: Article in two columns through the twocolumn op-
Affiliation
Affiliation\\ Address tion.
Address \documentclass[a4paper,12pt,twocolumn]{article}
} \date{}
\title{My First Article in \LaTeX}
Table 10.4: Authors side-by-side through the tabular environ- \author{Author’s Name and Address}
ment. \begin{document}
\maketitle
\author LATEX %
{ input \begin{abstract}
\begin{tabular}[t]{c@{\extracolsep{30mm}}c} Abstract of the article ...
{\it Author-1} & {\it Author-2}\\ \end{abstract}
LATEX
Affiliation & Affiliation\\ %
input
Address & Address\\ \section{Introduction}
e-mail & e-mail\\ Introduction to the work ...
\end{tabular} \end{document}
}
Author-1 Author-2 My First Article in LATEX
Affiliation Affiliation
Output Address Address Author’s Name and Address
e-mail email
Abstract
Table 10.5: Author details at the bottom of a page through Abstract of the article . . . Ab- Introduction to the work . . .
stract of the article . . . Ab- Introduction to the work . . .
\thanks{} command. Introduction to the work . . .
LATEX input Output Output stract of the article . . . Ab- Introduction to the work . . .
stract of the article . . .
\documentclass[12pt]{article} My First Article 1 Introduction
Introduction to the work . . .
Introduction to the work . . .
\date{} in LATEX Introduction to the work . . .
\title{My First Article in \LaTeX} Introduction to the work ... Introduction to the work . . .
\author Mr. X∗ Mr. Y† Introduction to the work ... Introduction to the work . . .
{ Introduction to the work ... Introduction to the work . . .
Mr.\,X\thanks{X’s Address} Abstract Introduction to the work ... Introduction to the work . . .
\and The article explains . . .
Mr.\,Y\thanks{Y’s Address}
}
\begin{document} 1 Introduction are printed in single-column, and the abstract and other con-
\maketitle tents of the article are printed in two columns. In the case of the
Introduction to the problem . . .
% document-class amsart, however, the title and list of authors are
\begin{abstract} also printed in two columns.
The article explains ...
\end{abstract} Sometime the title, author and abstract are to be printed in a
% single column, while the rest of the article in two columns. In
\section{Introduction} that case, instead of the twocolumn option in \documentclass[]{},
Introduction to the problem ... ∗ X’s Address
% † Y’s Address
the \twocolumn[] command may be used. As shown in Ta-
\end{document} ble 10.7, \twocolumn[] is used after \begin{document}, putting
1 the \maketitle command and the abstract environment in [] of
\twocolumn[]. After \end{abstract}, the \vspace{1.0cm} com-
mand is used in Table 10.7 to leave 1.0 cm vertical blank space
view purpose. These can be achieved by using the titlepage before starting the two-column mode.
and abstract options in the \documentclass[]{} command, i.e., as
\documentclass[titlepage,abstract]{article}. The titlepage option in-
structs \maketitle to produce the title and list of authors on a 11. Thesis preparation
separate page, while the abstract option instructs to produce the
abstract on another separate page. Preparation of an academic thesis (also a book or a report) is
similar with that of an article discussed in §10. The only differ-
ence is that a thesis contains a number of chapters, where each
chapter is like an independent article.
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 19

Table 10.7: Article in two columns through the \twocolumn[] mand with the name of an input file (without its extension)
command. as the argument of the command. The bibliography file is
\documentclass[a4paper,12pt]{article} included through the \bibliography{} command following the
\date{}
\title{My First Article in \LaTeX} \bibliographystyle{} command. Such a sample root file of a thesis
\author{Author’s Name and Address} is shown in Table 11.1, whose different segments are as follows:
\begin{document}
\twocolumn Table 11.1: Root file linking individual input files of a thesis.
[
% File name: mythesis.tex
LATEX \maketitle \input{preamble}
input \begin{abstract} \begin{document}
Abstract of the article ...
% Cover page, title, abstract, certificate, acknowledge, and dedication
\end{abstract} \thispagestyle{empty}
\vspace{1.0cm} \include{coverpage} \clearpage
]
\pagenumbering{roman} % Page numbering in Roman numerals
\section{Introduction} \addcontentsline{toc}{chapter}{Title}
Introduction to the work ...
\thispagestyle{empty} \include{title} \clearpage
\end{document} \addcontentsline{toc}{chapter}{Abstract}
\thispagestyle{empty} \include{abstract} \clearpage
My First Article in LATEX \addcontentsline{toc}{chapter}{Certificate}
\thispagestyle{empty} \include{certif} \clearpage
Author’s Name and Address
\addcontentsline{toc}{chapter}{Acknowledgement}
\thispagestyle{empty} \include{acknowl} \clearpage
Abstract \addcontentsline{toc}{chapter}{Dedication}
Abstract of the article . . . Abstract of the article . . . Abstract of \thispagestyle{empty} \include{dedicate} \clearpage
the article . . . Abstract of the article . . . Abstract of the article . . . % Contents, List of Tables and List of Figures
Output Abstract of the article . . . \addcontentsline{toc}{chapter}{Contents}
\thispagestyle{empty} \tableofcontents \clearpage
1 Introduction Introduction to the work . . . \addcontentsline{toc}{chapter}{List of Tables}
Introduction to the work . . . \thispagestyle{empty} \listoftables \clearpage
Introduction to the work ... Introduction to the work . . . \addcontentsline{toc}{chapter}{List of Figures}
Introduction to the work ... Introduction to the work . . . \thispagestyle{empty} \listoffigures \clearpage
Introduction to the work ... Introduction to the work . . . % Main matters
Introduction to the work ... Introduction to the work . . . \pagenumbering{arabic} % Page numbering in Arabic numerals
% Chapters
\include{chap introduction}
\include{chap literature}
\include{chap problem}
11.1. Template of a thesis \include{chap formulation}
\include{chap result}
A thesis can be prepared through the document-class of book or \include{chap conclusion}
report. Since a thesis usually contains a large number of pages, % Appendix
practically it will be difficult to work with a single file accom- \appendix
modating all the contents of the entire thesis. Hence, as a con- \include{app derivation}
\include{app proof}
venient way, a thesis is generally prepared in a number of input % Bibliography
files of smaller sizes. Usually each part of a thesis (such as the \addcontentsline{toc}{chapter}{Bibliography}
cover page, title page, abstract, certificate, acknowledge, ded- \bibliographystyle{plain}
ication, chapters, appendix, and bibliography) is prepared in a \bibliography{mybib}
\end{document}
separate input file and then all the individual files are compiled
together to produce a single output file as the final thesis. More-
over, the preamble (i.e., the required packages and other global ⊲ At the very beginning, the preamble file (preamble.tex) is
settings) may also be prepared in a separate input file. The in- included through the \input{preamble} command, and then
put file containing the list of bibliographic references is named all other ‘.tex’ files (without extension) are included in the
with bib extension, say mybib.bib. All other input files are document environment through the \include{} command.
named with tex extension, such as, preamble.tex, title.tex,
abstract.tex, chapter1.tex, chapter2.tex, etc. Finally, all ⊲ The BibTEXformatted bibliography file (mybib.bib)
the individual input files are linked to a single root file, say is inserted through the \bibliography{mybib} com-
mythesis.tex, compilation of which produces the final the- mand, preceded by a bibliography style through the
sis. Note that neither the \documentclass[]{} command nor the \bibliographystyle{} command, say \bibliographystyle{plain}.
document environment is required in the individual input files.
⊲ The \thispagestyle{empty} command is used in some places
The \documentclass[]{} command is included in the preamble
for not assigning any page number to those pages.
file, and the document environment is created in the root file in
which these individual files are linked. ⊲ The \clearpage command is used in many places for start-
The input files (other than the bibliography file) can be linked ing the following unit on the next odd numbered page.
to the root file either through the \input{} or \include{} com-
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 20

⊲ The inclusions of the unnumbered units are preceded by (1) Headline and footline: These are generated automatically
the \addcontentsline{}{}{} command for including them in for displaying presentation related various information.
the Contents list. The arguments of \addcontentsline{}{}{} (2) Sidebars: Sidebars are generated automatically for dis-
are respectively the location where the unit is to be en- playing mainly the table of contents of the presentation.
tered (toc for Contents list), the type how the unit is to be (3) Navigation bars: Navigation bars are produced for dis-
treated (chapter) and the name of the unit to be printed in playing the status of presentation, as well as to jump to a
the Contents list. particular frame by clicking on the corresponding link.
⊲ The \tableofcontents, \listoftables and \listoffigures com- (4) Navigation symbols: Eight number of default navigation
mands are used for automatically generating three lists – symbols are provided in the bottom right corner of every
Contents list of sectional units, List of Tables and List slide in order to jump other frames or slides.
of Figures, respectively. (5) Logo: A logo can be printed globally in all the frames
through the \logo{} command in the preamble.
⊲ The \appendix command is used for printing the included
(6) Frame title: A title and a subtitle can be assigned to a
following chapters as appendices.
frame using \frametitle{} and \framesubtitle{} in the manda-
⊲ The \pagenumbering{roman} command is used for number- tory argument of \frame[]{} or inside the frame environment.
ing the following pages in Roman numerals, while the (7) Background: Each frame has a background, which con-
\pagenumbering{arabic} command is used for numbering its sists of a background canvas and the main background.
following pages in Arabic numerals. (8) Frame contents: The main contents of a frame could be
LATEX supported any text, including the frame title and sub-
11.2. Compilation of thesis title. The contents of a frame are inserted in the mandatory
argument of \frame[]{} or inside the frame environment. By
Since a thesis is generally composed of a number of chap- default the contents of a frame are vertically center aligned,
ters, one or more appendices, and bibliography, it (the root file which can be changed by the option t (top alignment) or
mythesis.tex as given in Table 11.1) is to be compiled using b (bottom alignment), e.g., \frame[t]{} or \begin{frame}[t] for
the following commands: top alignment.
$ latex mythesis
$ bibtex mythesis 12.2. Sectional units in presentation
$ latex mythesis
$ latex mythesis
The frames of a presentation can be put under different sec-
tions and subsections produced through the \section[]{} and
The latex command in the first line compiles mythesis.tex as \subsection[]{} commands. Unlike in standard LATEX, \section[]{}
well as all other ‘.tex’ files included in mythesis.tex. It also and \subsection[]{} here do not create any heading at their posi-
generates the output in the form of mythesis.dvi. However, tions, rather they add entries in the table of contents and nav-
the bibliography remains uncompiled. It is required to be com- igation bars. Generally the full headings under the mandatory
piled separately, which is done through the bibtex command in arguments of \section[]{} and \subsection[]{} are added in the ta-
the second third line. Then the latex command is repeated in the ble of contents, while the short headings under their optional
third line for linking all the compilation. As the last step, the arguments are added in navigation bars.
same command is repeated once again in the fourth line for pro-
ducing ‘mythesis.dvi’ as the complete and final output file. 12.3. Presentation structure
A simple presentation input file consisting of six frames under
12. Slide Preparation the JuanLesPins presentation theme (§12.5 discusses themes) is
shown in Table 12.1 and its output column-wise in Table 12.2.
The LATEX platform is applicable for preparing slides also, Just to show their applications, frames are created through
which can be presented like those prepared in popularly known both the \frame[]{} command and frame environment. The in-
Microsoft PowerPoint package. In LATEX, slides are widely pre- put file is started with \documentclass{beamer}, followed by
pared through the document classe of beamer. the JuanLesPins presentation theme loaded through \usetheme{}.
The other major component in the preamble is the title page
12.1. Frames in presentation related commands (refer §12.4 for detail). Then the frames,
containing different components of a presentation under vari-
In the document-class beamer, a presentation consists of ous sectional units, are prepared in the document environment.
a number of frames (or slides). A frame is created ei- The title page is generated in the very first frame. The next
ther by the \frame[]{} command or the frame environment as frame, producing the table of contents through \tableofcontents,
\begin{frame}[]. . . \end{frame}. A frame generally consists of is put under \section*{} for excluding its entry in the table of con-
some or all of the following eight components: tents. Then the main contents of a presentation are inserted in
intermediate frames, as shown in Table 12.1 producing frames 3
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 21

Table 12.1: A simple presentation input file. Table 12.2: Slides under the JuanLesPins presentation theme for
\documentclass{beamer} input file of Table 12.1.
LATEX in 24H

\usetheme{JuanLesPins} Introduction
Resources

LATEX in Twenty Four Hours Introduction to LATEX


% Components of the title page A Practical Guide for Scientific Writing
A
Some popular books on LT XE

\title[\LaTeX\ in 24H]{\LaTeX\ in Twenty Four Hours} 1 The LATEX Companion by Goossens et al.
(1994)
Dilip Datta
\subtitle{A Practical Guide for Scientific Writing} LATEX Learners Team
2

3
A Guide to LATEX2ε by Kopka and Daly (1995)
LATEX: Users Guide and Reference Manual by
\author[D. Datta]{Dilip Datta} June 21, 2016 Lamport (1994)

\institute[\LaTeX-LT]{\LaTeX\ Learners Team} LATEX

E AM
LE R
\date[L24H :: 21-06-2016]{June 21, 2016}

A
N

T
E RS

\titlegraphic{\includegraphics[width=20mm]{logo LA}}
%
LATEX in 24H LATEX in 24H
Outline

Presentation outline References


\begin{document}
% Frame 1 Goossens, M., Mittelbach, F., and Samarin, A.
(1994). The LATEX Companion. Addison-Wesley
\frame[plain]{\titlepage} 1 Introduction to LATEX Publishing company, Reading, Massachusetts.
Kopka, H. and Daly, P. W. (1995). A Guide to
Definition of LATEX
% Frame 2 Resources on LATEX LATEX2ε. Addison-Wesley, Harlow, England.
Lamport, L. (1994). LATEX: User’s Guide and
\section*{Outline} Reference Manual. Pearson Education, NJ, USA.

\frame[t]{ \frametitle{Presentation outline} \tableofcontents }


% Frames 3 and 4
\section[Introduction]{Introduction to \LaTeX} LATEX in 24H
Introduction
Definition
LATEX in 24H

\subsection[Definition]{Definition of \LaTeX} Introduction to LATEX


What is LATEX?

\frame[t] Thanks a lot


{ \frametitle{Introduction to \LaTeX} LATEX is a macro-package for typesetting
documents. for your patience
\framesubtitle{What is \LaTeX?} LATEX instructions are interspersed with the
input file of a document. in listening
\begin{itemize} LATEX input files have .tex extension.
LATEX output can be obtained in .dvi or .pdf The Boring Presentation!!
\item \LaTeX\ is a macro-package for ... format.

\item \LaTeX\ instructions are interspersed ...


\item \LaTeX\ input files have .tex extension.
\item \LaTeX\ output can be obtained in ...
\end{itemize}
} in the frame. The title page generally contains sequentially
\subsection[Resources]{Resources on \LaTeX} a title, a subtitle, list of authors, affiliations of the authors,
\begin{frame}[t] presentation date, and a symbolic affiliation, which are gener-
\frametitle{Introduction to \LaTeX}
\framesubtitle{Some popular books on \LaTeX} ated in the preamble through the \title[]{}, \subtitle{}, \author[]{},
\begin{enumerate} \institute[]{}, \date[]{} and \titlegraphic{} commands respectively.
\item The \LaTeX\ Companion by \citet{Goossens-etal-1994}
\item A Guide to \LaTeX2$ \varepsilon$ by \citet{KopDal-97}
\item \LaTeX: User’s Guide and Reference Manual by ... 12.5. Appearance of a presentation (BEAMER
\end{enumerate} themes)
\end{frame}
% Frame 5 It is always desirable to make a presentation attractive as much
\section*{}
\begin{frame}[t] as possible. The appearance of a presentation in the beamer
\frametitle{References} document-class can be controlled by five types of themes,
\bibliographystyle{apalike} \bibliography{lswbib} which are presentation theme, color theme, font theme, inner
\end{frame} theme, and outer theme. A presentation theme generally con-
% Frame 6
\section*{} trols every single detail of the appearance of a presentation.
\begin{frame} Since every presentation theme uses a default set of other four
\begin{center} themes, normally no other theme is required to be specified if a
\Large{\bf\textcolor{blue}{Thanks a lot}}\\[5mm] ... presentation theme is chosen. In order to alter the default set-
\end{center}
\end{frame} ting of a presentation theme, still separate color, font, inner, or
\end{document} outer theme may be used as per requirement or choice.
The above five themes are loaded in the pream-
ble as \usetheme{tname}, \usecolortheme{tname},
and 4 under one section and two subsections. Finally, the bibli- \usefonttheme{tname}, \useinnertheme{tname}, and
ographic reference list and thanks giving may be inserted in the \useoutertheme{tname}, where tname is the name of the
ending frames. These two frames are prepared under \section*{} chosen presentation/color/font/inner/outer theme.
without any argument so as to skip their entry in the table of The following are the available various themes:
contents as well as in headline/footline and sidebars.
1. Presentation themes: default, boxes, Bergen, Boadilla,
Madrid, AnnArbor, CambridgeUS, EastLansing, Pittsburgh,
12.4. Title page
Rochester, Antibes, JuanLesPins, Montpellier, Berkeley,
The title page of a presentation is produced through the PaloAlto, Goettingen, Marburg, Hannover, Berlin, Ilmenau,
\titlepage command, which in Table 12.1 is put in \frame[]{} Dresden, Darmstadt, Frankfurt, Singapore, Szeged,
for printing the title page in a frame (Frame 1). The plain op- Copenhagen, Luebeck, Malmoe, Warsaw, etc.
tion is used here for omitting headline/footline and sidebars
Dilip Datta :: A Short Note on LATEX in 24 Hours – A Practical Guide for Scientific Writing 22

2. Color themes: default, sidebartab, structure, albatross, beetle,


crane, dove, fly, monarca, seagull, wolverine, beaver, spruce,
lily, orchid, rose, whale, seahorse, dolphin, etc.
3. Font theme: default, serif, structurebold, structureitalicserif,
structuresmallcapsserif, etc.
4. Inner themes: default, circles, rectangles, rounded, inmargin,
etc.
5. Outer themes: default, infolines, miniframes, smoothbars,
sidebar, split, shadow, tree, smoothtree, etc.

You might also like