A Brief Note on LaTeX
By
Sanjay Dutta
Department of Mathematics, Assam Don Bosco University,
Assam, India
By
Department of Mathematics, Assam Don Bosco University,
Assam, India
Latex is a freeware software. Most of the components of the software such as various packages required are easily available on net. It is a software through which article, book, thesis, presentations can be prepared. Although, Microsoft had given Word, PowerPoint, etc for the above preparation with various tools available. But, its time taken to use those tools and apply for writing many pages with mathematical functions and symbols. Latex is easy to use and mainly for mathematical articles and books where in every single line mathematical objects are used. The advantage of using latex is that it is user editable, it depends on user where he/she wants the object to be put on the pages while writing. For example, if the user wants an image to be put in specific place on the page, it can be done using various syntax available. The size of the table can be varied according to the user choice and many more things can be done using Latex. The page style in the Latex can be changed or modified accordingly as per user needs. Different cover page, page layout, fonts, color, mathematical symbols etc can be made. The pages can be generated either in Tex, Postscripts, Pdf form whichever is required. The Tex file is portable and can be run on any Latex environment which is one of the great advantage over Microsoft Word which is operating system depended.
Writing mathematical functions and equations in Latex are quite easy as compared to Microsoft Word. The equation numbers are automatically generating and it can be label and refer as per user needs. One may be wonder If the user do not wants the equation numbers to be there then also it can be done. The equation numbers can be made section wise or continue in the article. The background of the page can be specified with watermark or pictures. The audio files can be link or video links can also be added in a page using Latex. Writing a bibliography is a very troublesome in Word, in Latex the references can be generated using JabRef software which is quite easy and does it automatically. It can save lot of time for the scholars while writing articles or thesis.
The various package required to write an article or book in Latex are as follows:
\documentclass[12pt,array,amsfonts]{article}- this syntax gives amsfont of size 12 and it is
for writing an article, the article can be replaced by book as per need.
\usepackage{hyperref}- this package give links to references.
\usepackage{natbib}- this package is used in generating bibliography.
\usepackage{geometry}- this package is for the geometry of the page.
\usepackage{pdflscape}- this package is optional as it is for landscape orientation.
\usepackage[dvips]{graphicx} - this package is for graphics.
\setlength\textheight{8.8in} \setlength\textwidth{6.25in}- this syntax is for setting the
textheight and textwidth.
\usepackage{amssymb,amsmath}- this package is for mathematical symbols and mathematical functions.
\usepackage[toc,page]{appendix}- this package is for table of content and appendix.
\usepackage{multirow,tabularx}- this package for the table and array generation.
These are the basic packages required to write an article and more package can be added using the syntax- \usepackage{} as required by the user.
The writing should be started after \begin{document} and at the end the document needs to be closed writing \end{document}.
Similarly, other things / components need to be written with \begin and \end. For examples,
For writing an abstract of a research paper, the user should write their abstract within
\begin{abstract} and \end{abstract}.
For writing mathematical equations with equation numbers, the user should write within
\begin{eqnarray} and \end{eqnarray}.
For writing mathematical equations without equation numbers, the user should write within
\begin{eqnarray*} and \end{eqnarray*}.
For writing mathematical equations with equation numbers, the user should write within
\begin{equation} and \end{equation}.
The mathematical equation can also be written inside the $ $, as $\tilde{X}= P(x)$.
To include the figure on the page, the user should use following syntax:
\begin{figure}
\begin{center}
\includegraphics[width=200mm,height=170mm]{picture.eps}
\caption{My picture}
\label{Fig1}
\end{center}
\end{figure}
The picture can be of the form eps, pnj, pdf, etc can be used. The width and height can also be modified as the user needs. Note that, this syntax generated by Latex leaves a gap or space between the figure and caption of the figure. The upper space of the page and the space between the figure and caption can be reduced using the following syntax:
\begin{figure}[!htp]
\vspace{-7cm}
\begin{center}
\includegraphics[width=200mm,height=170mm]{picture.eps}
\vspace{-2cm} \caption{My Picture}
\label{Fig1}
\end{center}
\end{figure}
Here, \vspace means vertical space, to reduce the space use '-' and to increase the space use'positive number'.
To include the table on the page, the user should use following syntax:
\begin{tabular}{|*|*|*|*|}
\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
* & * & * & * \\
* & * & * & * \\
\hline
\end{tabular}
When you give insert tabular with specified rows and columns the above syntax will appear on the page. One needs to remove the stars(*) and write their own values. The (*) in \begin tabular are needs to be replaced by c or l .
\begin{tabular}{|c|c|c|c|}
\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
1 & 2 & 3 & 4 \\
5 & 6 & 7 & 8 \\
\hline
\end{tabular}
The user can added few more syntax for better representation of the table.
\begin{table}[!htp]
\begin{center}
\caption{Table on Latex )} \tabcolsep 2.0pt
{\tiny
\begin{tabular}{|c|c|c|c|}
\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
1 & 2 & 3 & 4 \\
5 & 6 & 7 & 8 \\
\hline
\end{tabular}
\end{center}
\end{table}
Here [!htp] is the syntax for fixing the table or it may be moved to other space depending on the space available on that particular page. The syntax {\tiny is optional depending on user choice, whether the user want big table or small or tiny. The other syntax for size are \small,
\resizebox[width=x cm ][height= y cm]{%
\begin{table}[!htp]
\begin{center}
\caption{Table on Latex )} \tabcolsep 2.0pt
\resizebox[width=x cm ][height= y cm]{%
\begin{tabular}{|c|c|c|c|}
\hline
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
1 & 2 & 3 & 4 \\
5 & 6 & 7 & 8 \\
\hline
\end{tabular}%
\end{center}
\end{table}
Instead of [!htp] there are other option also available on net for fixing the table position. The column width can be changed or modified to
\begin{tabular}{|p|p{2cm}|p{3cm}|p{4cm}|}.
This will increase the width of columns as specified second column by 2 cm and so on.
There are lots to explore as the user keeps on doing will keep on learning new things.
To write the bibliography or references on an article the following syntax can be
used
\bibliographystyle{bibsytle file}
\bibliography{name of the reference file }
Here, bibstyle file needs to be downloaded from various journals and save it in the same folder where the user had save the Tex file. The name of the reference file is your Jabref file name which also should be saved on the same folder.
This is optional even one can write the references on Latex file as
\noindent{ \bf [1]} Dutta, S., "New Latex note", XYZ Journal}\\
%
\noindent{ \bf [2]} Dutta, S., "Latex", IJM }\\
Next, as an article can have various sections the user can give section by
\section{name of the section}.
The user can use maths symbols in between the sentences using $ $ as :
The function $ f(x)$ is given by, here f(x) is written in maths environment.
One can see the difference by writing it with $ symbols and without $ symbols. The power and subscripts are given by $ f_{1}$ will give f lower script 1 and $ f^{1}$ will give f superscript 1.
To write the fraction one can use the syntax \frac{x}{y}
To end the line in Latex use double backslash (\\).
To label and refer the following syntax is used
f(x)= x+y \label{eqn1} -this is way to label an equation. One can label equation,
section, etc. To refer this particular equation the following syntax is used \ref{eqn1}.
To give extra space in Latex the following syntax is used as in Latex one cannot give on giving blank space as in Word, \hspace{x cm}, \vspace{x cm}. The \hspace{x cm} is for horizontal space and \vspace{x cm} for vertical space.
To cite an article the following syntax is used \cite{article name} or \citet{article name} or \citep{article name}. \citep{article name} - is used to cite more than one in one round bracket.
To end the document the following syntax is used \end{document}.
To run the Latex file first save it and then go to LATEX symbol and then DVI. If the user wants pdf version of the document then dvi pdf symbol.
To directly create pdf document without dvi file click PDF Latex symbol and then just below, one more pdf symbol click there.
As learning goes on so keep using Latex and keep learning.