Saturday, September 28, 2019

LaTeX Basics

LaTeX Tutorial 

Important Points

  • LATEX (pronounced as lay-tek ) is a document preparation system for producing high quality documents
  • It is different from Microsoft Word, LibreOffice Writer and Apple Pages
  • Microsoft Word, LibreOffice Writer and Apple Pages are  "What You See Is What You Get" (WYSIWYG) application
  • LaTeX was written in the early 1980s by Leslie Lamport
  • LATEX uses Tex Typesetting program developed by Donald Knuth in 1978
  • TeX and LATEX both are free 
  • Markup languages are used for processing, definition and presentation of text
  • A sequence of characters is inserted in a text processing file to specify how the file be supposed to look when it is printed.
  • A markup describes the document's logical structure.
  • The markup indicators are called "tags"
  • TeX commands start with a backslash and are grouped in curly braces
  • Latex is an extension of TeX
  • Latex is available for every platforms such as DOS, Windows, Unix, Linux etc.

Latex vs. Word Processors

  • Latex is used for scientific publishing
  • Typeset quality is high
  • Very few bugs
  • Very Good for large documents  
  • Can run smoothly on 386 PC
  • Difficult to learn

Latex File Structure

1. Document Class



Document Class: \documentclass command is the start of every LATEX document.

It ha redefined formats for article, report, book etc.

\documentclass[options]{class}

options = a4paper, 11pt, 12pt, 10pt, twocolumn, landscape etc.

class = article, report, book etc.

Ex.  \documentclass[]{article} 
\documentclass[a4paper,latin]{book}

2. Package inclusion:

For additional Functionality such as citation, graphics, reference style etc.
\usepackage{package name}
Ex.
\usepackage{color}
\usepackage{cite}

3. Main Body

For Text and Bibliography References.
\begin{document}
\end{document}
The \begin{document} and \end{document} commands is used to make up a LATEX document. Whatever typed before \begin {document} is identified as the preamble that change the whole document and after \end{document} everything is ignored by the system.

A simple Article Latex Code

 \documentclass[]{article}
\usepackage{color}
\usepackage{inputenc}

\usepackage{mathtools}

\title{Detection of DDOS Attack using Naive Bayes Classifier}
\author{\bf Md. Amir Khusru Akhtar}

\begin{document}

\maketitle

\begin{abstract}

Naive Bayes classifiers are a set of categorization techniques based on Bayes’ Theorem. .....
\end{abstract}
\it Keywords: Naïve Bayes Classifier, Denial-of-Service Attack, Bayes’ Theorem, Ddos, Dataset
\section{Introduction}

A denial-of-service attack is an attempt that makes a computer resource unavailable to the intended users by flooding of ....


\section{Mathematical Classifier Mode}

The proposed model uses a classifier function f that maps input feature vectors x $\in$ X to resultant class $y \in \{L1, L2,…, Ln\}$,......

\section{Numerical Simulation}


We have collected some IP packets from Scoreboard Dataset.....

\end{document}


OUTPUT


Note: for a blank date use \date{}

Basics of LATEX

Typesetting Text

Newline and New page 

NewLine: \\ or \newline 
Newpage: \newpage

Font Effects

Bold:  \textbf{……………} or \bf 
Italics: \emph{…………} or \textit{………} or \it
Underline: \underline{…………} or \ul

Color

for color write \usepackage{color}  before \begin{document}

\color{colour_name}

Ex.
\color{blue}

Font size

LATEX has a range of font sizes
\tiny 
\scriptsize  
\footnotesize 
\small  
\normalsize  
\large 
\Large 
\LARGE 
\huge

Ex.
\huge .....

Creating a Title 

The \maketitle command used to create a title. It is placed after the \begin{document}.
\title{}
\author{}
\date{}
\maketitle

Ex.
\title{DDoS Attack...}
\author{Dr. Md. Amir Khusru Akhtar}
\date{\today}
\maketitle

Sections

We can divide a document into chapters, sections and subsections. 
Commands of subsectioning article class:
\section{...}
\subsection{...}
\subsubsection{...}
\paragraph{...}
\subparagraph{...}

Ex.
\section{Mathematical Classifier Mode}
The proposed model uses a classifier function f that maps input feature vectors x $\in$ X to resultant class $y \in \{L1, L2,…, Ln\}$,......

\subsection{Simulation}


LIST

LATEX has two types of lists
1.      enumerate for  numbered lists
2.      itemize is for bulleted lists.

both list item can be defined by \item command and can be nested to produce sub lists.

Ex. enumerate

\begin{enumerate}
\item One
\item Two
\begin{enumerate}
\item Two one
\item Two two
\end{enumerate}
\item Three
\end{enumerate}

Ex. itemize

\begin{itemize}
\item One
\item Two
\begin{itemize}
\item Two one
\item Two two
\end{itemize} \item Three
\end{itemize}

OUTPUT

Example:

\documentclass{article}
\usepackage{enumerate}
\begin{document}
Enumerated List
\begin{enumerate}
\item one
\item two
\begin {enumerate} [{2.}1]
\item two one
\item two two
\end{enumerate}
\item three
\end{enumerate}
\end{document}

OUTPUT

Example
\documentclass{article}
\usepackage{amssymb}
\begin{document}
\renewcommand{\labelitemi}{$\blacksquare$}
\renewcommand\labelitemii{$\square$}
Itemize List
\begin{itemize}
\item one
\item two
\begin{itemize}
\item two one
\item two two
\end{itemize}
\item three
\end{itemize}
\end{document}

OUTPUT


Comments

Comments are defined using % character. When LATEX finds a % it ignores rest of the line.
Ex.
The proposed model uses a classifier function %Function definition
f that maps input feature vectors x $\in$ X to

OUTPUT



2 comments: