3

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?

lockstep
  • 250,273
Paramar
  • 625
  • 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
  • 3
    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? – abdulhaq-e 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
  • 1
  • 1
    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

2 Answers2

14

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.

hpesoj626
  • 17,282
1

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}
myrtille
  • 1,035