Graphics, Figures & Tableshow to remove gap between text in wrapfigure environment

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
wjfeeney
Posts: 9
Joined: Sun Aug 06, 2023 9:02 am

how to remove gap between text in wrapfigure environment

Post by wjfeeney »

In the image below, you can see a gap in the text which starts at the point where I begin the wrapfigure environmment. How do I remove that gap?

Preamble includes:
\usepackage{wrapfig}
\setlength\intextsep{10pt}


Body:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras risus nunc, tincidunt a euismod malesuada, placerat vitae massa. Proin feugiat nibh a neque vestibulum ultricies. In ex augue,
\begin{wrapfigure}{r}{0.3\textwidth}
\centering
\textcolor{Maroon4}{\rule{1pt}{108pt}}
\includegraphics[width=.85\linewidth]{~/Library/Mobile Documents/iCloud~md~obsidian/Documents/williamfeeney/Assets/Attachments/gold F copy.png}
\caption{Caption text Caption text may Caption text.}
\end{wrapfigure}
varius id vulputate aliquet, vehicula id dolor. Praesent ultrices lacinia suscipit. Quisque cursus iaculis risus eu pellentesque. Maecenas mattis pretium justo, nec accumsan ipsum. Nam purus purus, elementum sed lorem vitae, fermentum hendrerit ex. Vivamus velit neque, interdum non efficitur at, euismod id quam.
Attachments
Screenshot 2023-08-16 at 6.29.43 PM.png
Screenshot 2023-08-16 at 6.29.43 PM.png (298.34 KiB) Viewed 10064 times

Recommended reading 2024:

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

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

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

how to remove gap between text in wrapfigure environment

Post by kaiserkarl13 »

If you are speaking of the vertical gap, then inserting \vspace{1ex} or some other length will work. You could also try changing \intextsep, but that will change all the other figures, too.

If you mean the horizontal gap, try changing the value of \columnsep.
wjfeeney
Posts: 9
Joined: Sun Aug 06, 2023 9:02 am

how to remove gap between text in wrapfigure environment

Post by wjfeeney »

It's not the vertical gap above the figure, or the horizontal gap; it's the vertical gap between the lines of text I'd like to remove, so it looks like below. Note, there is no space between the lines of text, like in the above example.
Attachments
Screenshot 2023-08-16 at 10.39.14 PM.png
Screenshot 2023-08-16 at 10.39.14 PM.png (385.95 KiB) Viewed 10034 times
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

how to remove gap between text in wrapfigure environment

Post by kaiserkarl13 »

Ah, I see.

The wrapfigure package has trouble with this particular idea, because it requires predicting when a particular line will end before the paragraph is finished, and TeX doesn't work that way. I have had much better luck putting wrapfigures at the beginning or end of paragraphs.

If you're dead-set on putting a wrapped figure into the middle of a paragraph, then your best bet is trial-and-error: move words around and/or edit the text until you get a line to end in exactly the right place before the wrapped figure and mess with the spacing manually until the paragraph break that results doesn't look like an actual paragraph break.
wjfeeney
Posts: 9
Joined: Sun Aug 06, 2023 9:02 am

how to remove gap between text in wrapfigure environment

Post by wjfeeney »

Thanks for the advice; it's been my experience. I've tried wrapfigure inside a minipage and a tcolorbox, but no difference. I am resigning myself to putting the figures at the beginning of paragraphs that mention the figure. Putting them at the end of paragraphs leaves them isolated below the paragraph.
Post Reply