Table in LATEX

Basic table :

\documentclass{article}
\begin{document}
  \begin{tabular}{<col 1><col 2>...<col N>}
    Data 1 & Data 2 &... Data N\\ %Row data 1
    Data 1 & Data 2 &... Data N\\ %Row data 2
  \end{tabular}
\end{document}

Table separator

NB: These separation line are not compulsory for the table but can be used for user convenience.

▶︎
all
running...

Table column allignment

l : left allignment

c : center allignment

r : right allignment

Our first LATEX tables :

▶︎
all
running...

▶︎
all
running...

▶︎
all
running...

▶︎
all
running...

▶︎
all
running...

Multirow and Multicolumn table

packages needed : multirow & multicolumn

multirow example

\documentclss{article}
\usepackage{multirow}
\begin{document}
  \begin{tabular}{lll}
    \hline
    \multirow{3}{*}{a}  & b  &  c \\
    \cline{2-3}
                        & d  &  c \\
    \cline{2-3}
                        & e  &  f \\
    \hline
  \end{tabular}
\end{document}
▶︎
all
running...

multicolumn example

\documentclass{article}
\usepackage{multicol}
\begin{document}
  \begin{tabular}{lll}
    \hline
    \multicolumn{2}{c}{a} &b\\\cline{1-2}
    c & d  &  e \\
     e  &  f & h \\
    \hline
  \end{tabular}
\end{document}
▶︎
all
running...

Combining multirow and multicol

▶︎
all
running...

Resizing table with scale box:

Two commands can be used for resizing tables:

\scalebox and \resizebox

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{tabular}{c c}
    a & b \\
    a & b \\
\end{tabular}

\scalebox{2}{
\begin{tabular}{c c}
    a & b \\
    a & b \\
\end{tabular}
}
\end{document}
▶︎
all
running...

Table environment

\documentclass{article}
\begin{document}
  \begin{table}
      <-- your tabular code goes here -->
  \end{table}
\end{document}

Captioning table

\documentclass{article}
\begin{document}
  \begin{table}
    \caption{The caption}
      <-- your tabular code goes here -->
  \end{table}
\end{document}
▶︎
all
running...

Side-wise table:

\documentclass[11pt]{article}
\usepackage{rotating}
\begin{document}
\begin{sidewaystable}[h]
\caption{Performance After Post Filtering} % title name of the table
\centering % centering table
\begin{tabular}{l c c rrrrrrr} % creating 10 columns
\hline\hline % inserting double-line
 Audio &Audibility & Decision &\multicolumn{7}{c}{Sum of Extracted Bits}
\\ [0.5ex]
\hline % inserts single-line
% Entering 1st row
 & &soft &1 & $-1$ & 1 & 1 & $-1$ & $-1$ & 1 \\[-1ex]
\raisebox{1.5ex}{Police} & \raisebox{1.5ex}{5}&hard
& 2 & $-4$ & 4 & 4 & $-2$ & $-4$ & 4 \\[1ex]
% Entering 2nd row
& &soft & 1 & $-1$ & 1 & 1 & $-1$ & $-1$ & 1 \\[-1ex]
\raisebox{1.5ex}{Beethoven} & \raisebox{1.5ex}{5}& hard
&8 & $-8$ & 2 & 8 & $-8$ & $-8$ & 6 \\[1ex]
% Entering 3rd row
& &soft & 1 & $-1$ & 1 & 1 & $-1$ & $-1$ & 1 \\[-1ex]
\raisebox{1.5ex}{Metallica} & \raisebox{1.5ex}{5}& hard
&4 & $-8$ & 8 & 4 & $-8$ & $-8$ & 8 \\[1ex]
% [1ex] adds vertical space
\hline % inserts single-line
\end{tabular}
\label{tab:LPer}
\end{sidewaystable}

\end{document}
▶︎
all
running...

Multi-page tables

\longtable is used to create a multipage table

\documentclass{article}
\usepackage{longtable}

\begin{document}
 \Large
 \begin{longtable}[c]{| c | c |}
 \caption{Long table caption.}\\

 \hline
 \multicolumn{2}{| c |}{Begin of Table}\\
 \hline
 Something & something else\\
 \hline
 \endfirsthead

 \hline
 \multicolumn{2}{|c|}{Continuation of Table}\\
 \hline
 Something & something else\\
 \hline
 \endhead

 \hline
 \endfoot

 \hline
 \multicolumn{2}{| c |}{End of Table}\\
 \hline\hline
 \endlastfoot

 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
  Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
  Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
  Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
  Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
  Lots of lines & like this\\
   Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
  Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
  Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\

 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 Lots of lines & like this\\
 \end{longtable}

 \end{document}
▶︎
all
running...