# Caption of an image doesn't follow flushleft

Hello I want to place a photograph in a page so i write:

\begin{figure}[h]
\caption{H Feistel Function }
\begin{flushleft}
\includegraphics[scale=0.7]{func}
\end{flushleft}
\end{figure}


I face 2 problems: a) The caption is not flashed to the left. How is that possible? b) There is enough space for a second picture if it is flashed to the right but a mirror code like the above sends the next picture to the next page as it should. How can I fix that?

-
That should be \begin{flushleft} What you have would have generated an error about an undefined environment –  David Carlisle Feb 11 '13 at 23:02
Please post a MWE, to see what class you're using and if you have any packages that affects captions. Also, it's flushleft. Finally, maybe I'm missing something but what does the justification of the caption has to do with sending the next figure to the next page? Are you trying to put them side by side? –  pythonista Feb 11 '13 at 23:03
If you watch carefully I write that I face two problems. Problem one is that although picture func is sent to left side of the page its caption does not follow. Problem two is that I ask advice on how to put two pictures side by side as you said. It has nothing to do with the caption –  Paramar Feb 11 '13 at 23:08
Check this out Two figures side by side –  pythonista Feb 11 '13 at 23:11
With two unrelated problems, you should ask two separate questions (after checking that they haven't been asked before). –  lockstep Feb 11 '13 at 23:38

For putting figures side by side, check Two figures side by side.

For flushing the caption left, use the caption package as below. The graphicx package was only used here for the demo figure.

\documentclass{article}
\usepackage{caption}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}[h]
\captionsetup{justification=raggedright,
singlelinecheck=false
}
\caption{H Feistel Function }
\includegraphics[scale=0.7]{example-image}
\end{figure}
\end{document}


• justification=raggedright flushes your caption left.
• The default behavior is to center-align your caption if it fits in one line. singlelinecheck=false disables this behavior.

There is also no need for the flushleft environment here.

Please always provide a complete minimal working or non-working example (MWE) beginning with \documentclass and ending with \end{document}. Also, please limit your question to one problem at a time. I have answered the part on how to flush your caption left since there seems to be no question yet about it. If there already is, I would be willing to delete this answer to maintain order in this site.

-

To put two images next to each other, you can use minipages and the package suggested by hpesoj626 :

\documentclass{article}
\usepackage{caption}
\usepackage[demo]{graphicx}
\begin{document}
\begin{minipage}[t]{.5\textwidth}
\includegraphics[width=\textwidth]{example-image}
\captionsetup{justification=raggedright, singlelinecheck=false}
\captionof{figure}{H Feistel Function}
\end{minipage}%
\begin{minipage}[t]{.5\textwidth}
\includegraphics[width=\textwidth]{example-image}
\captionsetup{justification=raggedright, singlelinecheck=false}
\captionof{figure}{H Feistel Function}
\end{minipage}
\end{document}

-
If you added % after the first \end{minipage}, you would be able to make them .5\textwidth ;) –  tohecz Feb 12 '13 at 22:05
edited. :) I guess it also comes down on what you like more. Personally I actually prefer some white space between the two pics. –  myrtille Feb 14 '13 at 14:25
Then do it properly and use \hfill. –  tohecz Feb 14 '13 at 14:26
good to know :) –  myrtille Feb 14 '13 at 14:57