It would be great if you could format your code samples by highlighting the code and pressing the {} button.
–
JakeMay 2 '12 at 21:29

1

You're trying to fit three images, each with a width of 0.4\linewidth, on a single line (which has a width of 1\linewidth). Do you want them to extend into the margins?
–
JakeMay 2 '12 at 21:31

No I would not extend them into the margins but If it is possible I will change that
–
boutheinaMay 2 '12 at 21:35

1

\bf{\caption{..}} is not the correct way to make the caption bold. \bf doesn't accept and argument and is outdated for once, but {\bfseries\caption{..}} isn't really correct either. Have a look at the caption package which should allow you to change the font for the captions.
–
Martin Scharrer♦May 2 '12 at 21:43

This may require some adaptation to centre the contents of the figure environment. Like adding \centering outside the minipages. Otherwise you'll have a .01\linewidth gap on the RHS. Additionally, what will happen if the image is greater than 0.33\linewidth?
–
WernerMay 2 '12 at 22:13

Thank you very much for all this answers but when I try some solutions that you suggested I think it is better to leave the 3 figures one after the other because when I put them one beside the other it isn't very clear.
–
boutheinaMay 2 '12 at 22:17

@Werner, you're right. I changed with width of each of the image examples to 0.33\linewidth. I thought the 0.1 was negligible, but one can change to 0.3333… or center them all outside the minipage. And of course only use 3 images like that if you want them to be much smaller.
–
JosephMay 2 '12 at 22:23

3

@Joseph: Actually, the image widths should be \linewidth, not 0.33\linewidth, since \linewidth adapts to the width of the line inside the current environment. In this case its set by minipage to be 0.33\linewidth (equivalent to 0.33\textwidth at that point), implying that 0.33\linewidth image is actually 0.1089\linewidth wide... Try it, using \rule{0.33\linewidth}{50pt} for your images/\includegraphics instead. Unless, of course, that's what you meant in the first place.
–
WernerMay 2 '12 at 22:28

1

@boutheina: You should upvote all questions you find helpful (by clicking the upward-pointing triangle next to each answer), and accept the one that you found most helpful. This is true for all of your questions, by the way (you haven't upvoted or accepted any answers yet).
–
JakeMay 2 '12 at 22:31

You can achieve this in several ways. One way is to use the subfig package. Then you can add as many images as you want and LaTeX will try to arrange them on the same line. Here's a small example, edited as suggested.

To build an example with inamges without needing to have real images you can use the graphicx package with the option demo and \includegraphics[width=xx,height=yy]{someimg}will print a black rectangle. That’s preferred against building the images with Tikz which blows up the code unnecessarily. Otherwise you can just use \rule{width}{height} to print a black rectangle.
–
TobiMay 2 '12 at 21:47

Thanks for the hint @Tobi, sorry for not respecting the etiquette.
–
EdoMay 2 '12 at 21:52

1

In my eyes there’s no problem with you etiquette ;-) I just wanted to show an alternative way that’s better for minimal examples, in my opinion. In your example you may use real values for xx and yy or leave them out, so graphics uses the default (demo) values …
–
TobiMay 2 '12 at 21:58

1

Just a comment on the placement option, you've used [!ht] which is better (but equivalent) to the [!h] in the question but unless there is strong reason not to, including p as well is always a good idea. Disallowing p (and b) floats just increases the chance that no acceptable position for the floats will be available so they will all go to end of document.
–
David CarlisleMay 2 '12 at 22:03