\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{array} \usepackage{wrapfig} \usepackage{multirow} \usepackage{tabu} \title{Tables} \author{An example} \begin{document} \maketitle \listoftables \vspace{1cm} %--------------------------------------------------------------------- %Simplest working example \begin{center} \begin{tabular}{ c c c } cell1 & cell2 & cell3 \\ cell4 & cell5 & cell6 \\ cell7 & cell8 & cell9 \end{tabular} \end{center} %--------------------------------------------------------------------- \vspace{1cm} %--------------------------------------------------------------------- %Vertical lines as column separators \begin{center} \begin{tabular}{ | c | c | c | } \hline cell1 & cell2 & cell3 \\ cell4 & cell5 & cell6 \\ cell7 & cell8 & cell9 \\ \hline \end{tabular} \end{center} %--------------------------------------------------------------------- \vspace{1cm} %--------------------------------------------------------------------- %Horizontal lines as row separators \begin{center} \begin{tabular}{||c c c c||} \hline Col1 & Col2 & Col2 & Col3 \\ [0.5ex] \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 \\ [1ex] \hline \end{tabular} \end{center} %--------------------------------------------------------------------- \vspace{1cm} %--------------------------------------------------------------------- %Example of fixed column width and text long (array package required) \begin{center} \begin{tabular}{ | m{5em} | m{1cm}| m{1cm} | } \hline cell1 dummy text dummy text dummy text& cell2 & cell3 \\ \hline cell1 dummy text dummy text dummy text & cell5 & cell6 \\ \hline cell7 & cell8 & cell9 \\ \hline \end{tabular} \end{center} %--------------------------------------------------------------------- \newpage %--------------------------------------------------------------------- %Example of table with fixed length (tabu package required) \begin{tabu} to 0.8\textwidth { | X[l] | X[c] | X[r] | } \hline item 11 & item 12 & item 13 \\ \hline item 21 & item 22 & item 23 \\ \hline \end{tabu} \newpage %--------------------------------------------------------------------- %Example of the multicolumn command \begin{table}[h!] \caption{Multicolumn table} \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\\ Aland Islands& AX & ALA &248\\ Albania &AL & ALB& 008\\ Algeria &DZ & DZA& 012\\ American Samoa& AS & ASM&016\\ Andorra& AD & AND &020\\ Angola& AO & AGO&024\\ \hline \end{tabular} \end{table} %--------------------------------------------------------------------- \vspace{1cm} %--------------------------------------------------------------------- %Example of the multirow command (multirow package needed)} \begin{table}[h!] \caption{Multirow table} \begin{center} \begin{tabular}{ |c|c|c|c| } \hline col1 & col2 & col3 \\ \hline \multirow{3}{4em}{Multiple row} & cell2 & cell3 \\ & cell5 & cell6 \\ & cell8 & cell9 \\ \hline \end{tabular} \end{center} \end{table} %--------------------------------------------------------------------- \newpage %--------------------------------------------------------------------- %Referencing and captioning tables The table \ref{table:1} is an example of a referenced \LaTeX{} element. \begin{table}[h!] \centering \begin{tabular}{||c c c c||} \hline Col1 & Col2 & Col2 & Col3 \\ [0.5ex] \hline\hline 1 & 6 & 87837 & 787 \\ 2 & 7 & 78 & 5415 \\ 3 & 545 & 778 & 7507 \\ 4 & 545 & 18744 & 7560 \\ 5 & 88 & 788 & 6344 \\ [1ex] \hline \end{tabular} \caption{Table to test captions and labels} \label{table:1} \end{table} %--------------------------------------------------------------------- \end{document}