GeneralWrapping style of tables

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
avp3000
Posts: 49
Joined: Thu Nov 15, 2007 4:22 pm

Wrapping style of tables

Post by avp3000 »

Hello,

I have a question about tables. I am writing a paper and I want to occasionally use simply tables. However, since the content of the cells is relatively small I don't want the tables to stretch from the one side of the page to the other, but be wrapped along the text (for example, if the page is 20cm wide, I want the table to be just 10 cm. wide and have text on the other 10 cm. next to it). Which package should I use for that?

Thank you very much
Alexander

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Wrapping style of tables

Post by Stefan Kottwitz »

Hi Alexander,

you could use the wrapfig-package.

Stefan
LaTeX.org admin
avp3000
Posts: 49
Joined: Thu Nov 15, 2007 4:22 pm

Re: Wrapping style of tables

Post by avp3000 »

Hello Stefan,

Thanks for the advice. Unfortunately I have problems obtaining the package documentation. There's a note that "most of the package documentation is contained in wrapfig.sty itself (after the \endinput command at the end of the package proper)". What is a "package proper". I also tried to use the floatflt package. The problem with it is that, although putting the figure on the right side, it doesn't just put text nexto to the figure, but also overrides it.
avp3000
Posts: 49
Joined: Thu Nov 15, 2007 4:22 pm

Wrapping style of tables

Post by avp3000 »

Here's an example. In this example, no figure is produced (I have attached figure2.pdf, all this packages are not necessary here, but I am using them in main main paper, so I decided to use them in the example, too):

Code: Select all

\documentclass{article}

\usepackage[a4paper,pagesize]{typearea}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{color}
\usepackage{graphicx}
\usepackage{eurosym}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{colortbl}
\usepackage{blindtext}
\usepackage{url}
\usepackage[authoryear,longnamesfirst,comma,square]{natbib}
\usepackage{mathrsfs}
\usepackage{tikz}
\usepackage[rflt]{floatflt}
\usepackage{blindtext}

\begin{document}

\blindtext
\begin{floatingfigure}[r]{5cm}
  \includegraphics[width=5cm]{figure2}\\
  \caption{Comparison}
\end{floatingfigure}

\end{document}

Attachments
figure2.pdf
(235.42 KiB) Downloaded 277 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Wrapping style of tables

Post by Stefan Kottwitz »

Hi Alexander,

here is the file: wrapfig.sty
Open it and look at the beginning (lines 1-159) and the end (lines 333-595), there it's documented.

Stefan
LaTeX.org admin
avp3000
Posts: 49
Joined: Thu Nov 15, 2007 4:22 pm

Re: Wrapping style of tables

Post by avp3000 »

O.K., so I got some decent results with both of the packages. My mistake was that I put the figures that I want wrap after the last paragraph I had written with only empty space after them and (logically) there was nothing to wrap after them. At the beginning I thought that they would automatically fit in the last paragraph, but they obviously only consider the space after them). When I put the wrapfigure before the paragraph it produced really decent results and with a couple of settings it looked fairly well. I used a manual from wikipedia (for anyone interested in the subject):

http://en.wikibooks.org/wiki/LaTeX/Floa ... hite_space
avp3000
Posts: 49
Joined: Thu Nov 15, 2007 4:22 pm

Re: Wrapping style of tables

Post by avp3000 »

One last question (for tonight ;-)). How do I put a figure in a box, so that there is a thin black borderline around it to separate it from the text. I mean, now it's ok, but I want to see how it'll look with a box around it. How do I do this?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Wrapping style of tables

Post by Stefan Kottwitz »

Try \fbox{...}. Some adjustments are possible, like changing \fboxsep, \fboxrule. The framed package provides alternative possibilities.

Stefan
LaTeX.org admin
avp3000
Posts: 49
Joined: Thu Nov 15, 2007 4:22 pm

Re: Wrapping style of tables

Post by avp3000 »

Thank you :-)
Post Reply