Assignment 1
\documentclass[preprint]{oscmjournal}
% \documentclass[final]{oscmjournal}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{csquotes}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{array}
% \hypersetup{
% colorlinks = false,
% hidelinks = true,
% linkbordercolor = {white},
%}
\addbibresource{[Link]}
\title{Template}
\authorinfo{
\textbf{Ankit Paul}\\
Department of Computer Science Engineering\\
Academy of Technology\\
Email: [Link].21@[Link]\\
\vspace{\baselineskip}
\today
\headrule
}
\begin{document}
\maketitle
\section{Text}
This is a template of text. You can add text anything like this which will show up in the pdf after
compile.
\vspace{1em}
\subsection{Subsection}
This area is for subsection of the previous text. You can add one or more subsection.
\vspace{2em}
\section{Coloured Text}
The color of text cam be \textcolor{red}{easily} set. To print in text in red color you can use
textcolor \{color\} \{text\}.
\vspace{2em}
\section{Itemized Text}
Here you need to add some text in bullet list
\begin{itemize}
\item Fist Item
\item Second Item
\end{itemize}
\vspace{1em}
\subsection{Ordered List}
Here you need to add some text in bullet list
\begin{enumerate}
\item First Item
\item Second Item
\end{enumerate}
\vspace{2em}
\section{Special Characters}
\begin{enumerate}
\item Command start with backslash
\item A percent sign \% starts a comment. Latex will ignore the rest of the line.
\item Superscript and Subscript
\begin{center}
\(a_1^2 + a_2^2 = a_3^2\) \\
\end{center}
to write this we need to write as n[ a\_1\^2 + a\_2\^2 = a\_3\^2]
\item The following characters play a role in LaTeX and are called "Special printing characters",
or "simply special charcaters". \\
\#
\$
\%
\&
\~
\_
f\^g \\
Whenever we need to put one of these special charcters into the doc we are doing something
special. If you simply want the character to be printed just as any other letter include a n in front of
the character. For example n\$ will produce \$ in the output
\end{enumerate}
\end{document}
Assignment – 2
\documentclass{article}
% \usepackage{graphicx} % Required for inserting images
\usepackage{array}
\usepackage{multirow}
\title{\huge\textbf{Different Forms of Tables \\ (Part - 1)}}
\author{\LARGE{Ankit Paul}}
\date{\today}
\begin{document}
\maketitle
\section{Introduction}
This article explains how to use LaTeX to create and customize tables: changing size/spacing,
combining rows and columns of cells.
\subsection{Sample 1}
Following is the code and result of a simple table created. The tabular environment is the default
LATEX method to create tables. You must specify a parameter to this environment; here we use \{c
c c\} which tells LaTeX there are three columns and the text inside each one of them must be
centred.
\begin{center}
\begin{tabular}{c c c}
cell1 & cell2 & cell3 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9
\end{tabular}
\end{center}
\subsection{Sample 2}
The tabular environment provides additional flexibility; for example, you can put separator lines in
between each column. The $\backslash$hline command is used to put a horizontal line on the top
and bottom of the table. Creating a table with boundaries is demonstrated below:
\begin{center}
\begin{tabular}{| c | c | c |}
\hline
cell1 & cell2 & cell3 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
\hline
\end{tabular}
\end{center}
\newpage
\subsection{Sample 3}
We have created a slightly more complex form of a table with more rows and columns with an
application of $\backslash$hline command as per requirement.
\begin{center}
\begin{tabular}{| c c c c |}
\hline
Col1 & Col2 & Col2 & Col3 \\
\hline
\hline
1 & 6 & 87837 & 737 \\
\hline
2 & 7 & 78 & 5415 \\
\hline
3 & 545 & 778 & 7507 \\
\hline
4 & 545 & 18744 & 7560 \\
\hline
5 & 88 & 788 & 6344 \\
\hline
\end{tabular}
\end{center}
\subsection{Sample 4}
\textbf{Combining Rows and Columns} \\
The command $\backslash$multicolumn and $\backslash$multirow are used to combine rows and
columns in a table in LaTeX.
\subsubsection{Example of multi column is demonstrated below}
The number of columns to be combined is displayed in $\backslash$multicolumn\{\}.
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
\multicolumn{3}{|c|}{Books} \\
\hline
Food name & Author & Publication \\
\hline
Book1 & Author1 & P1 \\
Book1 & Author2 & P2 \\
Book1 & Author3 & P3 \\
Book1 & Author4 & P4 \\
\hline
\end{tabular}
\end{center}
\subsubsection{Example of multi-row is demonstrated below:}
To combine rows you need to add the multirow package to your document preamble. The number
of rows to be combined is displayed in $\backslash$multirow\{\}. We can also specify the size of
multirow by writing $\backslash$multirow\{\}\{2cm\}.
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
col1 & col2 & col3 \\
\hline
\multirow{3}{2cm}{Multiple row} & cell2 & cell3 \\
& cell5 & cell6 \\
& cell8 & cell9 \\
\hline
\end{tabular}
\end{center}
\newpage
\section{Prepare a record in the form of a table showing the results of a student in 10th standard,
12th standard, and Graduation result serially (SL. no as one column) highlighting the Board/
University and Year of passing in each case in separate columns.}
\begin{center}
\begin{tabular}{|c|c|c|c|}
\hline
\multicolumn{4}{|c|}{Name of the student}\\
\hline
Sl. No& Standard& Board& Percentage\\
\hline
& & & \\
& & & \\
& & & \\
& & & \\
\hline
\end{tabular}
\end{center}
\end{document}
Assignment – 3
\documentclass{article}
\usepackage{array}
\usepackage{multirow}
\usepackage{adjustbox}
\title{\huge\textbf{Different Forms Of Tables (Part-2)}}
\author{\LARGE{Ankit Paul}}
\date{\today}
\begin{document}
\maketitle
\section{Introduction}
This article explains how to use LaTeX to create and customize tables: changing size/spacing,
showing caption of tables (below or above), use of positioning parameters, highlighting labels for
tables, and changing the direction of the table.
\subsection{Sample 5}
\textbf{Captions, labels:} \\
There are two important commands used as follows:
\begin{enumerate}
\item \textbackslash caption\{\}: This command is used to make a caption for the table which is
placed either above or below the table.
\item \textbackslash label\{\}: This command is used to refer to a table within a document.
\end{enumerate}
\subsubsection{Positioning parameters and use of $\backslash$ref\{\} command:}
The parameter h! passed to the table environment declaration establishes that this table must be
placed here, and override LATEX defaults as shown in Table~\ref{table:1}, \ref{table:2}, and \
ref{table:4}. The positioning parameters that can be passed in include:
\begin{itemize}
\item \textbf{h}: \\Will place the table here approximately.
\item \textbf{t}: \\Position the table at the top of the page.
\item \textbf{b}: \\Position the table at the bottom of the page.
\item \textbf{p}: \\Position the table at the top of the next page.
\end{itemize}
\newpage
\begin{table}[h!]
\centering
\begin{tabular}{||c c c c||}
\hline
Col1 & Col2 & Col3 & Col4 \\
\hline
\hline
1 & 2 & 3 & 4 \\
5 & 6 & 7 & 8 \\
9 & 10 & 11 & 12 \\
13 & 14 & 15 & 16 \\
17 & 18 & 19 & 20 \\
\hline
\end{tabular}
\caption{Table to test 1st positioning parameter (h!)}
\label{table:1}
\end{table}
\subsubsection{To Set Up the width of the table column}
Here we will see how we can set up the width of columns by specifying a particular width as shown
in Table \ref{table:2}.
\begin{table}[h!]
\centering
\begin{tabular}{ |p{3cm}||p{3cm}|p{3cm}|p{3cm}| }
\hline
\multicolumn{4}{|c|}{Country List} \\
\hline
Country Name or
Area Name & ISO ALPHA 2
Code & ISO ALPHA 3
Code & ISO numeric Code\\
\hline
Afghanistan & AF & AFG & 004\\ %Row1
Aland Islands & AX & ALA & 248 \\
Albania & AL & ALB & 008 \\
\hline
\end{tabular}
\caption{Table to set up the width of table columns}
\label{table:2}
\end{table}
\subsubsection{How to put a caption on top of the Latex table and use of $\backslash$vspace\{\}
command}
Here we will show how to put a caption on top of Latex table and adjust the height of the space
between the caption and tabular by using the $\backslash$vspace\{\} command. Here the table is
placed at the bottom of the page as shown in Table \ref{table:3}. The following symbols are
available to describe the table columns: l- left- justified column, c - centered column, r- right-
justified column. Here we have also shown that application.
\begin{table}[b]
\centering
\caption{Table to test 2nd positioning parameter (b) with the alignment of table columns and
caption on top of table}
\vspace{10pt}
\begin{tabular}{|c c c c|}
\hline
Col1 & Col2 & Col2 & Col3 \\
\hline
\hline
1 & 6 & 87837 & 787 \\
\hline
2 & 7 & 78 & 5415 \\
\hline
3 & 545 & 778 & 7507 \\
\hline
4 & 545 & 18744 & 7560 \\
\hline
5 & 88 & 788 & 6344 \\
\hline
\end{tabular}
\label{table:3}
\end{table}
\newpage
\subsection{Sample 6}
\textbf{Reducing the size of an entire Latex table:}\\
{Here we will see how we are reducing the size of an entire Latex table by using the $\
backslash$scalebox\{\} command as shown in Table \ref{table:4}. We also need to use the $\
backslash$usepackage\{tcolorbox\} for implementing the below table.}
\begin{table}[h]
\centering \scalebox{0.75}{
\begin{tabular}{| c c c c |}
\hline
Col1 & Col2 & Col2 & Col3 \\
\hline
\hline
1 & 2 & 3 & 4 \\
5 & 6 & 7 & 8 \\
9 & 10 & 11 & 12 \\
13 & 14 & 15 & 16 \\
17 & 18 & 19 & 20 \\
\hline
\end{tabular}}
\caption{Table to show a reduction of the size of an entire Latex table }
\label{table:4}
\end{table}
\subsection{Sample 7}
You can also change the mode to the landscape mode by using the $\backslash$usepackage\
{adjustbox\} command. The table here begins with the $\backslash$begin\{adjustbox\} and ends
with the $\backslash$end\{adjustbox\}.\\
The following Table \ref{table:5} and Table \ref{table:6} help us to understand this.
\begin{table}[h]
\centering
\begin{adjustbox}{angle=90}
\begin{tabular}{l|c|r}
\textbf{heading 1} & \textbf{heading 2} & \textbf{heading 3}\\
$\alpha$ & $\beta$ & $\gamma$ \\
\hline
1 & 11.34 & a \\
2 & 10.5 & b \\
3 & 765.5231 & c \\
\end{tabular}
\end{adjustbox}
\caption{Highlighting rotating of table, angle = 90 degree}
\label{table:5}
\end{table}
\newpage
For example, if we set the angle to 270 degrees in the same code as used for
the implementation of the previous table (Table \ref{table:5}), the output will look like the image
given below (Table \ref{table:6}):
\begin{table}[h]
\centering
\begin{adjustbox}{angle=270}
\begin{tabular}{l|c|r}
\textbf{heading 1} & \textbf{heading 2} & \textbf{heading 3}\\
$\alpha$ & $\beta$ & $\gamma$ \\
\hline
1 & 11.34 & a \\
2 & 10.5 & b \\
3 & 765.5231 & c \\
\end{tabular}
\end{adjustbox}
\caption{Highlighting rotating of table, angle = 270 degree}
\label{table:6}
\end{table}
\end{document}