Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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? –  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
1  
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

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

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}
share|improve this answer
    
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
1  
Then do it properly and use \hfill. –  tohecz Feb 14 '13 at 14:26
    
good to know :) –  myrtille Feb 14 '13 at 14:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.