LaTeX How to Wrap Text Around Figures in LaTeX?

  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Text
AI Thread Summary
The discussion revolves around using the wrapfig package in LaTeX to wrap text around figures in an article document class. The initial code provided by the user attempts to place an image with a caption, but the image appears too large for the specified width, causing improper text wrapping. Suggestions include ensuring the image size matches the wrapfigure width and using a minipage to improve layout. The user also encounters issues with MathJax interpreting LaTeX commands incorrectly in forum posts, which can be mitigated by altering the syntax slightly. Overall, the focus is on achieving a clean integration of figures within text using LaTeX's wrapfig capabilities.
member 428835
picture.png
Hi PF!

I am trying to wrap text around figures in the article document class. The code I type is

\usepackage{wrapfig}

\begin{wrapfigure}{R}{0.5\textwidth}
\centering
\includegraphics[width=5.7in]{Schematic}
\caption{Schematic of double-drained wetting capillary liquid in an interior corner. The draining locations are symmetric at z=L at volumetric sink flow rates Q.}
\label{fig:ddrain}

\end{wrapfigure}However, this produces the image attached. I would prefer to have the drawing in the text and on either left or right, with the text wrapping around it orderly. What mistake am I making?

Thanks for your help!

Edit: for some reason it will not display the text I've written. If you click reply I think you can see it though. Sorry, I don't know how to fix this.
 

Attachments

  • picture.png
    picture.png
    46.5 KB · Views: 1,592
Last edited by a moderator:
Physics news on Phys.org
When you write your begin statements the forum thinks you are trying to write math and MathJax takes over. You can add a small error to your begin statement and it won't.

\begin{wrapfigure }{R}{0.5\textwidth}
\centering
\includegraphics[width=5.7in]{Schematic}
\caption{Schematic of double-drained wetting capillary liquid in an interior corner. The draining locations are symmetric at z=L at volumetric sink flow rates Q.}
\label{fig:ddrain}
\end{wrapfigure}
 
That being said, the code itself looks fine. However, your image looks too big to fit in the allotted half textwidth and it seems as if the wrapping is done only in the section title. It is difficult to tell without seeing the rest of your code.
 
Orodruin said:
When you write your begin statements the forum thinks you are trying to write math and MathJax takes over. You can add a small error to your begin statement and it won't.
I have fixed the post. Note that you can also add BB codes, like making one letter black in "begin", that will make it such that MathJax won't recognize it as LaTeX.

As for the problem at hand, you can use the same designation of width, 0.5\textwidth, in \includegraphics, to ensure that the image is the same size.
 
Thank you both for your help!

DrClaude, I actually did do that but still did not place the picture in the correct spot. A working example is here.\documentclass[12pt]{article}
%
\usepackage{bm}%
\usepackage{mathtools}%
\usepackage{cases}%
\usepackage{amsmath}%
\usepackage{amsfonts}%
\usepackage{amssymb}%
\usepackage{amsthm}%
\usepackage{mathrsfs}%
\usepackage{graphicx}
\usepackage{float}
\usepackage{fancyhdr}% for header
\usepackage{changepage} % for the adjustwidth environment
\usepackage[numbers]{natbib}
\usepackage[margin=1.4in,tmargin=1in]{geometry}
\usepackage{caption}

\usepackage{calc}
\usepackage{enumitem}

\usepackage[english]{babel}% color
\usepackage{color}% color

\usepackage{booktabs}% fancy table
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}% fancy table

\usepackage{wrapfig}

\usepackage{blindtext}
%------------------------------------------------------------

% Theorem like environments

\newtheorem*{claim*}{Claim}
\newtheorem{exercise}{Exercise}

\renewcommand{\d}{\mathrm{d}} %differential d
\newcommand{\bx}{\bar{x}} % x overbar

\pagestyle{fancyplain}%
\rhead{\today}

%\pagestyle{fancy}

\setlength{\belowcaptionskip}{-15pt}
\renewcommand\refname{References and Citations}
%\pagestyle{empty}
%--------------------------------------------------------

\begin{document }
\section*{Response to Prior Review}
\subsection*{Data Submitted in the Project Description}
\blindtext[3]

\begin{wrapfigure }{r}{0.8\textwidth}
\centering
%\begin{figure }[H]
%\begin{center }
\includegraphics[width=0.78\textwidth]{Schematic}
\caption{Schematic of double-drained wetting capillary liquid in an interior corner. The draining locations are symmetric at z = \pm L at volumetric sink flow rates Q.}
\label{fig:ddrain}
%\end{center}
%\end{figure}
\end{wrapfigure}
\section*{Response to Prior Review}
\blindtext[3]
\end{document}
 

Attachments

I have never used the wrapfig package before, so I'm not sure how much I can help. It appears that wrapfig is not calculating the space of the caption. Putting the figure in a minipage makes things a bit better:

Code:
\begin{wrapfigure}{r}{0.8\textwidth}
\centering
\begin{minipage}{0.6\textwidth}
\includegraphics[width=0.78\textwidth]{Schematic}
\caption{Schematic of double-drained wetting capillary liquid in an interior corner. The draining locations are symmetric at $z = \pm L$ at volumetric sink flow rates Q.}
\label{fig:ddrain}
\end{minipage}
\end{wrap figure}
 

Similar threads

Replies
3
Views
3K
Replies
4
Views
3K
Replies
11
Views
16K
Replies
2
Views
5K
Replies
3
Views
2K
Replies
5
Views
5K
Replies
4
Views
3K
Replies
7
Views
4K
Back
Top