Graphics
Image ↓
How to add images Image positioning How to add captions and a label to an image How to rotate and scale back an image
Charts ↓
Introduction & SmartDiagram TikZ: Simple Drawings TikZ: Advanced Commands PGFPlots
Tables ↓
Environment Cell spanning Positioning Coloring
Vector drawing ↓
Latexdraw Putting things together
Positioning

Position of the table in the page
In order to set the position of a table, it is necessary to insert [spec] after the table enviroment:\begin{table}[spec].
CODE
\lipsum[1]
\begin{table}
\begin{tabular}{ccc}
1 & table & example\\
2 & table & example\\
3 & table & example\\
4 & table & example\\
\end{tabular}
\end{table}

\lipsum[2]
\begin{table}[h]
\begin{tabular}{ccc}
12 & table & example\\
2 & table & example\\
3 & table & example\\
4 & table & example\\
\end{tabular}
\end{table}

\begin{table}[b]
\begin{tabular}{ccc}
12 & table & example\\
22 & table & example\\
3 & table & example\\
4 & table & example\\
\end{tabular}
\end{table}


The \lipsum{num} is used to generate Lorem ipsum text (the \usepackage{lipsum} is needed).
The first column must be placed after the second paragraph, but it is above. In order to avoid this effect, the spec h is needed. The latter will place the table in the correct place, as in the second example. The last table uses spec b, in fact it is situated at the bottom of the page.

There is an option to place the table and figures surrounded by a text. The \usepackage{wrapfig} is required.


CODE
\lipsum[1]
\begin{wraptable}{l}{3cm}
\begin{tabular}{|rr|}\hline
1example & table \\
example & table \\
example & table \\
example & table \\
example & table \\\hline
\end{tabular}
\end{wraptable}
\lipsum[1-2]


Instead of \begin{table}, \begin{wraptable}{alignment}{width} is used. The table can be placed in center, left or right respect to the text, by using attributes: c, l and r.
Alignment
This section speaks about the alignment of the table in the page.


CODE
\begin{tabular}{rr}
example & table \\
example & table \\
example & table \\
example & table \\
example & table \\
\end{tabular}

\begin{tabular}{rrl}
example & table & table\\
example & table & table \\
example & table & table\\
example & table & table \\
example & table & table\\
\end{tabular}
\end{center}
\lipsum [1]\medskip

\centering{
\begin{tabular}{rr}
4example & table \\
example & table \\
\end{tabular}}


First method, to put the content to the center: is to include the tabular enviroment inside the \begin{center} enviroment. Second method is to use command \centering{content}, where, in this case, the content is the table.
Position of the content in the cell
This subsection is a summary of commands and attributes seen in following sections: Environment: Building a simple table are presented basic attributes c, l, r, which determine the alignment of the content in the cell. Then, in section Environment: Special columns are introduced special columns, which also affect the rest of the row, e.g. p{width}, m{width}, b{width}. Meanwhile, entire subsection Cell spanning is dedicated to the position of the content in the table.
The new table type requries \usepackage{array} and \usepackage[thinlines]{easytable}. The general command of a new table is \begin{TAB}(orientation, stretch, stretch)[width]{horizontal alignment}{vertical alignment}. The orientation is the form of the table, the two stretch commands change their behaviour, because it depends on the orientation. The width increases the size of the table. Horizontal alignment and vertical alignment are used to determine the alignment of the columns and of the rows. The first one determine the number of column and its horizontal alignment by l r c attributes. The second command is used to decide the number of rows and their alignment by using t, c, b attributes.


CODE
\centering{
\begin{TAB}(c,2cm,1cm)[10pt]{|r|c|}{|c|c|c|}
hi, my name is what & Slim Shady\\
my name is how & Slim Shady \\
my name is "tiki-tiki" & Slim Shady \\
\end{TAB}}
\vspace{2cm}

\begin{TAB}(l,5cm,2.5cm)[5pt]{|r|c|}{|b|c|t|}
hi, my name is what & Slim Shady\\
my name is how & Slim Shady \\
my name is "tiki-tiki" & Slim Shady \\
\end{TAB}


The first table, has c as orientation, in fact the two stretch instructions have no effect. In order to enlarge the table, change the value of the width. Also, the first column is vertically aligned to the right and the second to the center. Meanwhile, all the rows has center alignment.
The second table has l as orientation, in fact the next two attributes controls the widht and the height of the table. Every row has a different attribute in order to show possible combinations.


CODE
\centering{
\begin{TAB}(l,3cm,1cm)[10pt]{|r|c}{|c|cc|}
hi, my name is what & Slim Shady\\
my name is how & Slim Shady \\
my name is "tiki-tiki" & Slim Shady \\
\end{TAB}}
\vspace{2cm}

\begin{TAB}(l,2cm,3cm)[10pt]{|c|c|}{|c|c|c|b|}
hi, my name is what & \multicolumn{1}{l}{Slim Shady}\\
my name is how & \multirow{2}{*}{Slim Shady} \\
my name is "tiki-tiki" & \\
example & table\\
\end{TAB}


The first table shows how to manage with the lines, because \hline and \cline inside the TAB enviroment are not supported.
The second table shows, that the \multicolumn and \multirow have no effect on the table.


Rotating
This subsection speaks about rotaing of a table. The first table in the example requires \usepackage{adjustbox} and the second one \usepackage[graphicx]{realboxes}.


CODE
\begin{adjustbox}{angle=250}
\begin{tabular}{cc}\hline
example & First Second\\ \hline
table & Second Second\\ \hline
\end{tabular}
\end{adjustbox}
\vspace{3cm}

\Rotatebox{90}{
\begin{tabular}{|rl|}\hline
First First &example\\ \hline
Second First & table\\ \hline
\end{tabular}}


The first table uses enviroment of adjustbox. In this case, the vertical lines cannot be added. While, the second table is rotated and there are no problem with lines.