Search

Quick Guide To LaTeX (Part-3)

In previous parts:-

What is Latex, how to set your document and some basic functions of mathematics, Environments like: Equations, Equation Array; Mathematical functions like Limits, Differentiation, and Integration etc.


In this part:-

I will write about Document formatting, which I think is one of the most important aspect while writing any scientific document.


Font:-

  • Font Size:

We require different kind of fonts & font sizes while writing a document. For example generally we use about font size 24 for writing headings. In LaTeX software does not understand the number so we have to write a command in terms of ‘Tiny’ Or ‘Small’ Or ‘Large’ Or ‘Huge’. Commands for changing the font size are quite simple, they are as follows


\begin{tiny} <YOUR TEXT> \end{tiny} For Tiny text

\begin{small} <YOUR TEXT> \end{small} For Small text

\begin{large} <YOUR TEXT> \end{large} For Big text

\begin{huge} <YOUR TEXT> \end{huge} For Huge text


  • Font Type:

In LaTeX we can make a word Bold, Italic, Small Caps & Typewriter font. Commands for these various fonts are as follows,


\textbf <YOUR TEXT> For Bold font

\textit <YOUR TEXT> For Italic Font

\texttt <YOUR TEXT> For Typewriter Font

\textsc <YOUR TEXT> For Small Caps Font



Font & font size -1

Font & font size -2



Alignment:-

In any document Alignment is a necessary factor. In LaTeX Alignment can be defined left Justified, center justified & right justified.


\begin{center} <YOUR TEXT> \end{center} For center justified text

\begin{flushleft} <YOUR TEXT> \end{flushright} For left justified text

\begin{flushright} <YOUR TEXT> \end{flushright} For right justified text


Alignment -1

Alignment -2


Table:-

Some time in scientific writing we need to present data in tabular form. We can make a table in LaTeX very easily using some easy commands.

Just like in alignment we will use a command starting by \begin, only difference is we will use 2 sets of Curly brackets instead of one i.e. it will look like

\begin{…}{…}


1st curly bracket tells the computer what to begin, here we will write ‘tabular’. Second bracket will tell the computer about how many column we need.

Now we can make table in 2 formats. In 1st format we can write the data in rows & in 2nd format we can write the data in columns.

  • Format 1

In this format we will insert the data in columns. Let’s say we want a table with 5 columns. So the commands required for this type of table are as follows,


\begin{tabular}{|c|c|c|c|c|}


Here in 2nd set of curly bracket I have written “c” for 5 times & have inserted “|” this symbol. “c” denotes column whereas “|” denotes vertical lines before & after each column.

Now the next task will be to add row titles this table. Say we have 2 rows “X” & “f(X)”. So we will use Dollar sign and inside that we will write these 2 row titles. As these are 2 separate rows we will write them as follows

$X$

$f(X)$

Till now we have made table, we have added row titles. Now it’s time to complete the table by adding data. Assume that we have values of X as 1,2,3,4. For f(X) we have 10,11,12,13. The method to fill the data is as follows,


$X$ &1 &2 &3 &4

$f(X)$ &10 &11 &12 &13,


At the end we will write \end{tabular} to complete our code


  • Format 2

In 2nd format almost whole code is same. Almost because in this format we will have to define a new command. The command is \head for heading. We can use a command


\newcommand{Name of the command}[Num]{definition}


In the 1st curly bracket we write the name of new command. Square bracket containing Num is optional which defines how many arguments new command takes. The 2nd curly bracket is for the definition of the new command. So we can write our command as,


\newcommand{\head}[1]{\textnormal{\textbf{#1}}}


Now say we want 3 columns, 1st is “X”, 2nd is “Y” & 3rd is “f(X,Y}”. X takes values {1,2,3}; Y is {11,12,13} & f(X,Y) is {11,24,39}

Similar to 1st format we will start by


\begin{tabular}{|c|c|c|}

Next part is to gibe title to each column. For this sole purpose we have defined a new command \head, so let’s use it in our code.


\head{X} \head{Y} \head{f(X,Y)}


Now we can insert the data in this table. But for this we will use slightly different approach. Instead of using “Dollar sign” we will use “\verb”. Hence,


\verb|1| \verb|11| \verb|11|

\verb|2| \verb|12| \verb|24|

\verb|3| \verb|13| \verb|39|


We will end this function by using \end{tabular}.


Table -1

Table -2



These are most of the functions which you may require while writing a scientific document. Also I am adding a file named Latex Files.rar on Astro library.It has tex file & its pdf file. The tex file contains commands for all the functions from this series plus some additional functions. You can refer it while writing your tex document.


If you have any difficulty you may contact me on my Email Id: - prabhanjan1804@gmail.com


Please like & Share if you have liked this series of 3 blogs.


Happy texing....!!!!

0 views