0

I am trying to wrap text around a figure, but I would like this figure to be centered in the middle of the page. I have been using the wrapfig package. My code is below.

\begin{wrapfigure}{r}{0.5\textwidth}
  \centering
    \includegraphics[width=0.7\textwidth]{AvgReLease.png}
  \caption{AvgReLease} 
\end{wrapfigure}

My code aligns the image to the right. Is it possible to align the image in the centre of the page instead, such that it separates two bodies of text (say, in between paragraphs)? I have also tried to use the code below,

\begin{wrapfigure}{R}{0.5\textwidth}
\textbf{\begin{figure}[htp]
    \centering
    \includegraphics[width=10cm]{AvgReLease.png}
    \caption{Average Re-Lease (days) vs Storage Type}
    \label{fig: Average Re-Lease vs Storage Type}
\end{figure}}
\end{wrapfigure}

but the image appears on a different page.

7
  • So you want a paragraph to the left of the image, then the image, and then a paragraph to the right of the image? And they should be read in that order?
    – Teepeemm
    Jul 2, 2020 at 2:15
  • @Teepeemm I want a paragraph above and below the image. So text, only image, text. Does that make sense?
    – M B
    Jul 2, 2020 at 2:16
  • But the sole purpose of wrapfigure is to have text to the left or right of the figure. Is that not what you want?
    – Teepeemm
    Jul 2, 2020 at 2:29
  • Nope, sorry, I have misunderstood the use of wrapfigure. I have a page of text, and I would like to insert a graph in the centre of the page to divide the text.
    – M B
    Jul 2, 2020 at 2:31
  • And just ignore the examples that use the figure environment, since that lets your image go elsewhere.
    – Teepeemm
    Jul 2, 2020 at 2:41

1 Answer 1

0

The purpose of wrapfigure is to wrap text to the left or right of a figure, which isn't what you want. (The purpose of the figure environment is to allow the image to "float" to where LaTeX thinks is best, which also isn't what you want.) If you know where your image should go, then you can dispense with the figure environment. If you still need a caption, then you can use that package to fake a caption.

\documentclass{article}

\usepackage{graphicx}
\usepackage{caption}

\begin{document}

this comes before

\begin{center}
 \captionsetup{type=figure}
 \includegraphics[width=.7\textwidth]{example-image-a}
 \caption{My caption}
 \label{figurelabel}
\end{center}

this comes after

\end{document}

Not the answer you're looking for? Browse other questions tagged .