# Floating text around figure/table

Everyone knows the problem, in Latex a figure or table takes the whole width of a page. Even though you can have several figures/tables next to each other (see posts on minipage and subfigure), with none of these techniques it is possible to have floating text around a figure or table.

Here is how you can do it nicely and easily:

You need to include the floating – figure package in your document:
 \usepackage{floatflt} 
as well as the graphics package if you want to use figures:
 \usepackage{graphics} 

Code stub figure:

Similar to the usual figure environment, we first need to open a new floating-figure environment and can than include the image in the document.
 \begin{floatingfigure}[lrp]{width} \centering \includegraphics{image.jpg} \caption{fig:default} \label{fig:figlabel} \end{floatingfigure}

Captions and labels can be used in the same way as in the figure environment.

Either of the optional arguments is used:

l: left-hand sided figure

r: right-hand sided figure

p: left for even, right for odd page numbers.

The width-argument indicates the space to be taken by the figure.

Tip: Instead of an absolute width value, make it relative by using a fraction of the textwidth or columnwidth. E.g.

0.5\textwidth

Code stub table:

The main difference of the floating table to the floating figure environment is the second argument. Here we are not indicating the width, but passing the whole table as argument. This is probably necessary to determine the size of the table, which cannot be adjusted by the writer, but is determined by the table itself.
 \begin{floatingtable}[l]{ \begin{tabular}{|c|c|} \hline ...&...\\ ...&...\\ \hline \end{tabular}} \caption{default} \label{tab:tabref} \end{floatingtable} 
Hint: The only way to reduce the width taken by the table is to reduce the font size. E.g.
 \begin{footnotesize} \begin{floatingtable} ... \end{footnotsize} 
Check this post for an introduction to tables.