# How to end wrapfigure environment

I used wrapfigure when I want insert a figure, but can's stop it after the figure. I used the code

\begin{wrapfigure}[8]{r}{20cm}

\documentclass[landscape,12pt,a3paper]{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage[left=2.00cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}

\setlength{\intextsep}{1cm}
\begin{wrapfigure}[35]{r}{20cm}
\centering
\includegraphics[width=20cm]{03-1.pdf}\\
\end{wrapfigure}

\subsubsection*{Shell sort}

Main article: Shell sort

Shell sort was invented by Donald Shell in 1959. It improves upon bubble sort and insertion sort by moving out of order elements more than one position at a time. One implementation can be described as arranging the data sequence in a two-dimensional array and then sorting the columns of the array using insertion sort.

\subsubsection*{Comb sort}
Main article: Comb sort

Comb sort is a relatively simple sorting algorithm originally designed by Wlodzimierz Dobosiewicz in 1980.[19] Later it was rediscovered and popularized by Stephen Lacey and Richard Box with a Byte Magazine article published in April 1991. Comb sort improves on bubble sort. The basic idea is to eliminate turtles, or small values near the end of the list, since in a bubble sort these slow the sorting down tremendously. (Rabbits, large values around the beginning of the list, do not pose a problem in bubble sort)

\subsection*{Distribution sort}

Distribution sort refers to any sorting algorithm where data are distributed from their input to multiple intermediate structures which are then gathered and placed on the output. For example, both bucket sort and flashsort are distribution based sorting algorithms. Distribution sorting algorithms can be used on a single processor, or they can be a distributed algorithm, where individual subsets are separately sorted on different processors, then combined. This allows external sorting of data too large to fit into a single computer's memory.    \end{document}

• Use \begin{wrapfigure}[8]{r}{20cm} where [8] is the number of lines after to wrap. You have 35 so wraping comes after 35 lines. – user11232 Nov 29 '14 at 4:51
• @HarishKumar: Do you want to provide your comment as an answer? – user31729 Nov 29 '14 at 4:58

The syntax for using wrapfigure (from manual):

You have used a number 35 so expect to get that much narrow lines. Looking at the picture in your question, a vlue of 15-17 is appropriate . Adjust this number properly. Also it would be better to give some more text in the paragraph so that wrapping looks good.

\documentclass[landscape,12pt,a3paper]{article}
\usepackage[demo]{graphicx}      %% remove demo
\usepackage{wrapfig}
\usepackage[left=2.00cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{lipsum}
\begin{document}

\setlength{\intextsep}{1cm}
\begin{wrapfigure}[8]{r}{20cm}  %% I used 8 here, change suitably
\centering
\includegraphics[width=20cm]{03-1.pdf}\\
\end{wrapfigure}
\lipsum[1-2]  %% just for putting more text, yes put more text here
text text  text text  text text  text text  text text ........

\end{document}

Regarding the edited question, put the wrapfigure after the section like

\subsubsection*{Shell sort}
\setlength{\intextsep}{1cm}
\begin{wrapfigure}[9]{r}{20cm}
\centering
\includegraphics[width=20cm]{03-1.pdf}\\
\end{wrapfigure}

Main article: Shell sort
.
.
.

However, you have too less text in the paragraph Main article: Shell sort...

• I provid the whole code after your anwser, I think that was because the \section or other problem cause it. Could you help me again. – zongxian Nov 29 '14 at 6:54
• @xinfaxian Please see the update. – user11232 Nov 29 '14 at 7:03