Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latex floating and text wrapped image [closed]

I have a LaTeX document with an image in it. There is a section, four subsections, the latter 3 having just some text, and the first having a description environment with some stuff.

I want to have an image on the top right and have everything text wrap nicely around it.

The wrapfig package takes an entire column away (so text below the images gets wrapped to a fixed width even without the image there) and pushes the description environment past the left margin, and the floatflt package puts the image exactly where I want it, but no text gets wrapped.

I have the floatflt/wrapfig environment above the initial section (I get the best image placement this way) but moving it to various other places doesn't work either.

Are their any other ways to wrap the text around the image?

Some examples of fail can be seen here: http://drop.io/a3dbxte

like image 626
Daniel Huckstep Avatar asked Aug 14 '09 23:08

Daniel Huckstep


People also ask

How do I put text and pictures side by side in LaTeX?

you could use \parbox (or a minipage environment) for both the text and the picture. \parbox (minipage too) understands options for vertical alignment. Between the text box and the picture use \hfill to achieve right alignment.

How do you wrap text in LaTeX?

We can wrap text in a LaTeX table by using the p specification in the tabular environment. Then, we'll be able to break lines as per the specified width of the columns.

How do you wrap text around a figure?

Position a picture in the center of a document You can add a picture in the center of a document and have the text flow around it. Select a picture. Go to Picture Format or Format > Wrap Text > Square.


2 Answers

wrapfig is the best i've found, however, you need to put the wrapfig code above the paragraph you want it to wrap into:

\usepackage{wrapfig}

\begin{wrapfigure} \includegraphics... \end{wrapfigure}
This is the paragraph of text you want the figure to "wrap" into... etc etc.

If you put the wrapfig code under the paragraph you want to wrap into, it will obviously wrap into the next paragraph, producing an undesirable result.

you also mention a 'column' which makes me think you are using a multi-column layout, which probably isn't going to work that well with wrapfig.

When asking a specific question about latex, you should include a minimal working example, that is, enough of your preamble and body code/text so that people can recreate your problem.

EDIT: Ah. i see what you mean. wrapfig can take an optional line height argument:

\begin{wrapfigure}[line-height]{r}{width} 

where line-height is a positive integer.

your solution would probably look like this:

\begin{wrapfigure}[10]{r}{2.5in}
\centering
\includegraphics[width=2in]{governator.jpg}
\end{wrapfigure}

EDIT #2: wrapfig/floatflt + enumerate, itemize = not working. the packages are incompatible with one another. For a "wrapfigure" effect with an environment, i.e., enumerate, itemize, etc etc., You should put the environment in a minipage and the graphic in in a minipage, then set the two minipages next to each other. something to the effect of (i put them in a tabular environment as well):

\begin{tabular}{l l}
\begin{minipage}{0.5\textwidth}
\begin{enumerate}
\item
\end{enumerate}
\end{minipage}
&
\begin{minipage}{0.5\textwidth}
\includegraphics...
\end{minipage}
\end{tabular}
like image 76
Mica Avatar answered Sep 28 '22 17:09

Mica


I had the exact same problem. Wrapfig expects a paragraph below it, so give it an empty one!

\begin{wrapfigure}{I}{0.5\textwidth}
\includegraphics[...]{...}
\end{wrapfigure}
\paragraph{}
\vspace*{-\parskip}

This gives an empty paragraph to make wrapfig comfortable, and doesn't alter your content at all (I added a negative vspace* to account for the \parskip of the paragraph).

like image 32
Ryan Avatar answered Sep 28 '22 16:09

Ryan