I was writing an article and try to insert an image with a caption. So first I used the following codes,
\flashright
\includegraphics[scale=0.25]{cantor.png}
which results in
Then I wanted to add a caption below the image, so I used the following codes
\begin{figure}
\flushright
\includegraphics[scale=0.25]{cantor.png}
\caption{cantor set}
\end{figure}
which gave me,
So my question is how can I fix this large gap and make the things look like the first image with the caption underneath the image?


\flushrightoutside thefigure? – Nasser Jun 29 '16 at 02:49figureis a float and it is floating to the bottom of the page. If you don't want a float, don't use a float environment i.e. don't usefigure. Use\captionoffrom thecaptionorcapt-ofpackages if you need a caption. – cfr Jun 29 '16 at 02:56