views:

163

answers:

1

I'm a LaTeX beginner. Up until now whenever I've created a table (using the tabular environment) LaTeX floats it in its own paragraph, between my lines of text.

However, I want a way to embed a small table within a paragraph (to the left or right), having the text flow around it. Is there a simple way to do this without having to exert too much manual control over the formatting?

+4  A: 
\begin{wraptable}{O}{0.5\columnwidth}
% 0.5\columnwidth is 50% of the width for text. It will wrap to the "outer"
% of the current page, and thus if you have double-sided print, it'll still look
% good.
\begin{centering}
% The centering will look nice (else it's left-aligned, which isn't nice)
\begin{tabular}{|c|c|}
% Having your own tabular here.
\hline
Hello & World\tabularnewline
\hline
\hline 
Stack & Overflow!\tabularnewline
\hline
% End of content.
\end{tabular}
\par % Add for spacing
\end{centering}
\caption{Test Table}
% Enter your caption (a float having a caption looks cool)
\end{wraptable}

This will let the tabular wrap & float. This looks similar to the floats in HTML, if you're familiar with them.

Pindatjuh
don't forget `\usepackage{wrapfig}` in your preamble!
Mica