latex

How to Wrap a Text Around Figures in LaTeX

Sometimes, it is essential to wrap text around a figure to maintain the flow of the information in the document. Usually, wrapping text stands for the figure caption and the context of the images.

Many document processors support the text wrapping feature to create clean research papers. LaTeX also has the same feature, but many users don’t know how to do it. So if you are also interested in learning, this tutorial is for you. In this tutorial, we’ll show you how to wrap text around figures in LaTeX.

How to Wrap a Text Around Figures in LaTeX?

Let’s start with a simple example of wrapping a text using the wrapfig \usepackage. Here is an example of the introduction related to the universe and its exploration over the years:

\documentclass{article}

\usepackage{wrapfig}

\usepackage{graphicx}

\begin{document}

\begin{wrapfigure}{r}{0.4\textwidth}

\centering

\includegraphics[width=0.35\textwidth]{Image/universe.jpg}

\caption{Image of the universe}

\label{fig:img1}

\end{wrapfigure}

Space is infinite and full of mysteries because we are still exploring to know more about the universe. Many space scientists around the globe are researching to get detailed information about plants and their living beings. In this research paper, you will briefly analyze the history behind \textbf{Human Efforts to Explore the Universe}.

\end{document}

Output:

In the above source code, we used graphicx \usepackage to include an image and \caption{} to add a caption below the image. Moreover, if you want to change the position of the image, please change the value of X in \begin{wrapfigure}{X} accordingly:

  • Right Side: r
  • Left Side: l
  • Inside Edge: i
  • Outside Edge: o

Conclusion

This was the brief information about the simple method to wrap a text in LaTeX. Wrapping a text with the image can give a clean look to the document. Furthermore, it provides a little information about the pictures.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.