Wrapfig doesn't put text beside figure

  • LaTeX
  • Thread starter brotherbobby
  • Start date
  • Tags
    Figure Text
In summary, Wrapfig is a LaTeX package that allows users to wrap text around figures, but it does not support placing text beside the figure in a traditional side-by-side layout. Instead, it arranges the text to flow around the figure, creating a more integrated appearance within the document.
  • #1
brotherbobby
702
163
TL;DR Summary
Using the ##\text{wrapfig}## package, the text appears below and above the figure, but not alongside it.
1710146759537.png
I am new to ##\rm{LaTeX}##.

Using the ##\texttt{wrapfig}## package, the figure loads correctly to the right.

However, the text, though I typed much of it below where I specified the image to be, comes above it, not alongside it.


I cope and paste my code below. You will see much the text that appear above the figure are actually written below it. I was hoping the text will appear alongside it, in the white empty space to the left.


1710146897411.png


I am using ##\texttt{TexMaker}##. The figure is defined above from lines 62-66. The text comes below from lines 69-75. This text is meant to wrap around the image, but it doesn't, as you saw in the previous picture.


Request : Where have I gone wrong?
 
Physics news on Phys.org
  • #2
Why is your wrapfigure 1.5\textwidth?

Also, please don’t post code as images. Use the code tags.
 
  • #3
Orodruin said:
Why is your wrapfigure 1.5\textwidth?
So that the figure goes to the very right of the page. [r] or [R} is not doing it. 0.5 textwidth takes it to the middle.

Orodruin said:
Also, please don’t post code as images. Use the code tags.

\LaTeX Code:
\textbf{Solution}
    \begin{enumerate}  [leftmargin=0pt] %
    \begin{small}
    {\fontfamily{ptm}\selectfont   
    \item (i) It's easy to do it using the method of distance-time. We note that the boy will only run for as long as his father walks. His father will walk home for a time of $t=\frac{x_H}{v_M}$, where $x_H, v_M$ are the distance to home and the man's walking speed, respectively. Hence, the boy covers a total distance of $s_B=\frac{v_B}{v_M}x_H= \frac{12}{4}\times 1.2 = 3.6$ km. \\

\begin{wrapfigure}{R}{1.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth]{2(a)}
\caption{\label{M&B}The man and boy problem situation}
\end{wrapfigure}

    
    (ii) Let us start by drawing the problem situation. \\
    The man has a speed of $v_M$ and the boy a speed of $v_B$.  All distances are measured from the home H which is also the origin O.
    The boy is shown with a red dot ({\color{red} {$\bullet$}}) and the man with a blue dot ({\color{blue}{$\bullet$}}).
    At the beginning, they are both at a distance $x_H$ from home. After the $i^{\text{th}}$ motion, the man is at a distance of $(x_M)_i$ from H. \\
    The stages are shown in green from $\mathbf{\color{OliveGreen}{0\rightarrow 5}}$. The situation starts in stage 0 when the man and the boy are both at a distance $x_H$ from home.
    
    In stage 1, the boy covers the distance in a time $t_1=\frac{x_H}{v_B}$.
    
}
    \end{small}
    \end{enumerate}
 
  • #4
brotherbobby said:
TL;DR Summary: Using the ##\text{wrapfig}## package, the text appears below and above the figure, but not alongside it.

Using the wrapfig package, the figure loads correctly to the right.

However, the text, though I typed much of it below where I specified the image to be, comes above it, not alongside it.

I read somewhere that ##\texttt{wrapfig}## doesn't work inside lists (Enumerate and itemize). If that's true, it's a big weakness. What is someone going to do if he wants to put an image and text around it againt a certain ##\texttt{\item}##?
 

FAQ: Wrapfig doesn't put text beside figure

Why is my text not wrapping around the figure when using Wrapfig?

One common reason is that the width of the figure or the text block might be too large, causing the text to be pushed below the figure. Ensure that the figure width is appropriately set and there is enough space for the text to wrap around.

How can I adjust the alignment of my figure using Wrapfig?

You can adjust the alignment by setting the optional argument in the Wrapfig environment. For example, \begin{wrapfigure}{r}{0.5\textwidth} will align the figure to the right and allow text to wrap around it.

Why is my figure overlapping with the text when using Wrapfig?

This issue can occur if the figure's width or placement is not set correctly. Double-check the width parameter and ensure it does not exceed the available text width. Additionally, make sure there is enough vertical space for the figure.

What should I do if the text wrapping is uneven or looks awkward?

Try adjusting the width of the figure or using the \setlength{\intextsep}{value} command to modify the spacing around the figure. Fine-tuning these settings can help achieve a more balanced and aesthetically pleasing layout.

Can I use Wrapfig with other floating environments like table or subfigure?

Yes, you can use Wrapfig with other floating environments, but you may need to experiment with the placement and width settings to ensure everything displays correctly. For complex layouts, consider using the wraptable package or combining subfigures within a wrapfigure environment.

Similar threads

Replies
5
Views
3K
Replies
11
Views
15K
Replies
14
Views
2K
Replies
5
Views
4K
Replies
2
Views
5K
Replies
4
Views
2K
Back
Top