latex

Latex Online Course for Beginners

Create a Simple Table in Latex

The table is a very important structure for data representation and organization.  In Latex, the tabular environment is used to make a basic table.  To understand how to build a table it would be better to understand by an example. Below the whole code for  making a table in latex is given.

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage[width=5.00cm, height=1.00cm, left=5.00cm, right=3.00cm, top=4.00cm, bottom=3.00cm]{geometry}
\author{ Bindeshwar Singh Kushwaha}
\title{How to Make a Table in Latex}
\begin{document}
\begin{tabular}{|c|r|l|}
\hline
1 & 2 & 3 \\
\hline
4 & 5 & 6 \\
\hline
7 & 8 & 9 \\
\hline
\end{tabular}
\end{document}

In which the below code is for table

\begin{tabular}{|c|r|l|}
\hline
1 & 2 & 3 \\
\hline
4 & 5 & 6 \\
\hline
7 & 8 & 9 \\
\hline
\end{tabular}

I will explain the code one by one-

\begin{tabular}

\end{tabular}

The above code is scope of a table

 

The code {|c|r|l|} shows four verticles line in which the first column is center justified, the second one is right-justified, and the third one is left justified.

Further, \hline command is used of the horizontal line, & for column separator and  \\ is used for a new line.

The code execution is explained in the below video.

Leave a Comment