Research Methodology: LATEX Tutorial
NAME : KIRTIMAN MAHATA
ROLL : 24BT1106
Department : BIOTECHNOLOGY
December 4, 2024
Contents
1 Introduction 2
1.1 How we can benefit? . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Installing LATEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Understanding logical formatting 3
2.1 Exploring the document structure . . . . . . . . . . . . . . . . . 3
3 Environment, Floats and Mathematics 4
3.1 Inclusion of figure . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4 Bibliography 6
List of Tables
1 The interactions and their implications . . . . . . . . . . . . . . . 3
List of Figures
1 The source code . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Here is the example of subfigure. . . . . . . . . . . . . . . . . . . 6
List of Algorithms
1 swap(A,B) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1 INTRODUCTION 2
1 Introduction
LATEXis a software for typesetting documents. In other words, it’s a document
preparation system. LATEXis not a word processor, but is used as a document
markup language. LATEXis a free, open source software. It was originally written
by Leslie Lamport and is based on the TEXtypesetting engine by Donald Knuth.
People often refer to it as just TEX, meaning LATEX1 .
1.1 How we can benefit?
LATEX is especially well-suited for scientific and technical documents. Its supe-
rior typesetting of mathematical formulas is legendary. If you are a student or
a scientist, then LATEX is by far the best choice, and even if you don’t need its
scientific capabilities, there are other uses -
• It produces very high-quality output, is extremely stable, and handles
complex documents, no matter how large they are.
• Further remarkable strengths of LATEX are its cross-referencing capabil-
ities,its automatic numbering and generation of lists of contents, figures and
tables, indexes, glossaries, and bibliographies.
• It is multilingual with language-specific features, and it is able to use
PostScript and PDF features. (may not be available for native Indian lan-
guages).
• Apart from being perfect for scientists, LATEX is incredibly flexible - there
are templates for letters, presentations, bills, philosophy books, law texts, music
scores, and even for chess game notations. Hundreds of LATEX users have written
thousands of templates, styles, and tools useful for every possible purpose.
1.2 Installing LATEX
Lets start o with the installation of the LATEX distribution- TEX Live. This
distribution is available for Windows, Linux, Mac OS X, and other Unix- like
operating systems. TEX Live is well maintained and it is being actively devel-
oped.
Another very good and user-friendly LATEX distribution for Windows is MiK-
TeX. Its easy to install like any other Windows application, but its not avail-
able for other systems like Linux or Mac OS X. You can download it from
http://miktex.org.
Presently the most popular online platform for LATEX is www.overleaf.com.
1 It has a long history; you can read about it at http://www.tug.org/whatis.html
2 UNDERSTANDING LOGICAL FORMATTING 3
2 Understanding logical formatting
Lets work a bit to understand document structure. Type the following code in
your overleaf account.
\documentclass[a4paper,11pt]{article}
\title{Example 2}
\author{My name}
\date{2022, 18 April}
\begin{document}
\maketitle
\section{Whats this?}
This is our second document. It contains a title and a section with text.
\end{document}
View the output. What just happened?
1. We instruct the document to be an article.
2. We set the title, author, date.
3. We start the document.
4. We instruct to include the title information.
5. We de ne a section.
6. We include the text
2.1 Exploring the document structure
Lets look at the details. A LATEX document doesn’t stand alone. The document
is based on a versatile template. Such a fundamental template is called a class.
Instruction Implication
begin{document}, end{document} The body of the document
section{xxx} The beginning of a new section
subsection{xxx} The beginning of a sub-section
large{text} Enlarging the font size
small{text} Decrease the font size
ttfamily{text} change the font style to teletype
Table 1: The interactions and their implications
3 ENVIRONMENT, FLOATS AND MATHEMATICS 4
It provides customizable features, usually built for a certain purpose. There
classes are book, article, letters, report.
The commands are starting with a slash alphabet. The instruction docu-
mentclass followed by {article} states that the document is a type of article. It
has sections, subsections and subsubsections. In case of documentclass book
there would be chapter, sections and so on.
The useful instructions and their implications are shown in Table 1
Following is an example.
\documentclass{article}
\begin{document}
Text can be \bfph{emphasized}. Besides being \textit{italic} words
could be \textbf{bold}, \textsl{slanted} or typeset in
\textsc{Small Caps}. \\
Such commands can be \textit{\textbf{nested}}.
\bfph{See how \bfph{emphasizing} looks when nested.}
\end{document}
Some more example.
\documentclass{article}
\begin{document}
\section{The first step}
Yes I have made the first step in \LaTeX.
\subsection{It is easy}
This is quite easy and user friendly.
\subsubsection{WOW wonderful}
Great learning.
\end{document}
3 Environment, Floats and Mathematics
Document may contains other structures; like figures, tables, equations and
mathematics. It is easy to handle those components. There is a concept of
environment that encapsulates the details of the component- the body of the
component, caption and label.
Example of environment is as below.
\begin{equation} \label{equ1}
f(x) = a_0 +a_1x+a_2x^2 +\dots+a_nx^n
\end{equation}
The output of the above is as below
f (x) = a0 + a1 x + a2 x2 + · · · + an xn (1)
3 ENVIRONMENT, FLOATS AND MATHEMATICS 5
The Equation 1 is a polynomial of degree n. Here I have define an environment
of equation - the body of the equation, label to cross-referring. The numbering
and referencing are auto generated.
Similarly we can construct a matrix. Following is the construction of a
matrix.
a00 a01 a02
a10 a11 a12
.. .. ..
. . .
an0 an1 an2
The construction of table is already shown in Table 1. In the sequel we will
show the inclusion of algorithms and figure. To work with algorithm one should
include the package algorithm2e. The package enable to edit the algorithm
efficiently. 1 is an example of the swapping algorithm.
The source code can be included with the help of verbatim environment.
Following we include a source code in C.
Input: A an array of size n
Input: B an array of size n
Output: A and B
begin
Set t = 0
Let a = 0 and count = 1
for i = 0 to 10 do
if (i <= 0)||(j > −1) then
count = count + 1
end
end
// The order of sorting is O(n2 )
end
Algorithm 1: swap(A,B)
3.1 Inclusion of figure
We have already seen different environments- table, equation, algorithm, etc. In
this part we handle the figure. Figure is float that appears at the appropriate
position of the document. The package graphicx is required to handle the
figures.
Following is the simple example for inclusion of the figure.
In we find the picture of Diffie.
int main() {
printf("Hallo World");
4 BIBLIOGRAPHY 6
return 0;
}
The effect of the above is There are two commands - centering that makes
the figure centrally aligned and includegraphic that includes the figure in the
document.
There are different options to include the figure. Below we present some of
them.
#include <stdio.h>
int main(){
int i,j,k;
int A[10];
for(i=0;i<10;i++){
scanf("%d",&A[i]);
}
for(i=1;i<10;i++){
for(j=0;j<i;j++){
if(A[j]>A[j+1]){
k = A[j];
A[j] = A[j+1];
A[j+1] = k;
}
}
}
return 0;
}
Figure 1: The source code
(a) Diffie Original (b) Knuth
Figure 2: Here is the example of subfigure.
For example we can rotate the figure by 30 degree.
4 Bibliography
Reference management is one of the tedious task in document processing [2–
4]. There are, of course, some inconveniences with manually preparing the
4 BIBLIOGRAPHY 7
Option Description
scale = .5 Makes the figure half of size
width =\textwidth The image wide is set to the textwidth
height = .5\textheight The image height is set to half of the page height
angle = 45 Makes a rotation of 45 degree anti clockwise
bibliography (at the end of the document) and referencing [1]. Its up to the
author to accurately format each bibliography item based on the reference style.
Some times author has to manually perform - which bits should be in bold or
italic? Should the year come immediately after the authors, or at the end of
the entry? Given names first, or last names first? For different manuscripts or
documents that use different reference styles.
LATEX provides an easy mechanism to work with the bibliograph. This is
BibTEX and bibliography database files (.bib files) that you have to construct
once and can use the same le in multiple manuscripts. The citation is done by
the command citekeyword.
Instead of formatting cited reference entries, one should define the style in
the bibliographystyle. Following are some examples of BibTEX.
@book{texbook,
author = {Donald E. Knuth},
year = {1986},
title = {The {\TeX} Book},
publisher = {Addison-Wesley Professional}
}
@book{latex:companion,
author = {Frank Mittelbach and Michel Gossens
and Johannes Braams and David Carlisle
and Chris Rowley},
year = {2004},
title = {The {\LaTeX} Companion},
publisher = {Addison-Wesley Professional},
edition = {2}
}
@article{knuth:1984,
title={Literate Programming},
author={Donald E. Knuth},
journal={The Computer Journal},
volume={27},
number={2},
pages={97--111},
year={1984},
publisher={Oxford University Press}
REFERENCES 8
In this document, you must have an associated sample.bib file. The .bib
file contains the declarations of the bib-items (BibTEX) entries. To cite some
item we do the command \cite{...}. For example, we are citing two items as.
We find that the Bibliography contains two items.
References
[1] Damjan Fujs, Simon Vrhovec, and Damjan Vavpotič. Balancing software
and training requirements for information security. Computers & security,
134:103467, 2023.
[2] Donald Knuth. The TEXmanual, IEEE, 1997.
[3] Lampord. The LATEX manual., https://w3techs.com/technologies/
overview/content_language, 2000.
[4] Subhajit Roy, Jaydeep Howlader, and Goutam Sanyal. A novel approach of
data hiding in video using region selection and pca. Multimedia Tools and
Applications, 81(10):14553–14571, 2022.