because LaTeX matters

Placing figures/tables side-by-side (\minipage)

Including images in a report is very common in LaTeX. Structuring your work nicely is probably the most obvious reason why you want to put two figures/tables side-by-side. Another reason might be to save space, wherever a smaller size of an image is sufficient. The following code can be used to place two figures side-by-side by creating a minipage:

You can also have more than two column simply by adding another \minipage in between the table-command and reduce the width of each \minipage (0.33\linewidth in addition to the \hspace). LaTex will automaticaly place objects onto the next line, if space is not sufficient.

Remark: Using the subfigure-package is another way to place figures or tables side-by-side. You might want to have a look at this post on subfigures.

I use a macro called calc2latex (converts tables form OpenOffice into latex output), works great! There’s one for Excel called xls2latex. Google them, follow the instructions and let the macros make the tables for you!

PLLEEEEASE help me:
I would like to create a table in Latex and add it a note at the end of the table and the source where I got that table from. How can I add those lines of text at the end of the table?
Thanks,
Miguel

I don’t have problems with citing inside the table. That works fine. But my problem is how to add the note and the source at the end of the table. I’ve tried different options, nothing works (i.e., minipage) and it looks horrible. I wonder if there is an automatic option to do that. Double caption wouldn’t work because there would be two “Table #”, I gather.

If you’re comfortable with a program like OpenOffice.org Calc or Excel or whatever, you can use that program to make your tables.
If you Google for “Excel table macro Latex” or something like that, you can find a macro to convert the table to a LaTeX table.

Just remove the space between the two minipage-environments and the tables are placed side-by-side, as long as there is enough space vertically. If you want some space between, you can comment the empty line out

How to create a big table across a two-column latex document? I tried vertically put the big table in one column for the two-column latex document. But it looks ugly so I tried \minipage. However, it still does not help. Any suggestions?

What I suggest you to do is use the command \onecolumn, which will start a new page having only one column in your “two column environment” (see my previous post).
Then you insert your table, depending on the height/width ratio you can even change the page layout to landscape.
And finally, you switch back to a \twocolumn environment.

Is it possible to have the two figures/tables aligned at the top stead at the bottom? I’ve tried \minipage[t] but it ended up with the top of the left figure/table aligned to the bottom of the right one. It looked as if the two figures/tables occupied the top right and bottom left of a 2×2 invisible grid.

[…] width of a page. Even though you can have several figures/tables next to each other (see posts on minipage and subfigure), with none of these techniques it is possible to have floating text around a figure […]

There is indeed a problem in your code. Y only have one minipage for your tabular environment, but actually you need a minipage for the picture as well. So try this and let me know if you are still facing problems:

I cannot reproduce what you are referring to. Can you please provide a minimal example? Might it be that your tables together are wider than the document’s “textwidth” and hence one is pushed to the next “line”?

When i use the caption package, I got tons of errors after the place where I used the \captionof command… When I do not include the caption package, I only got 2 errors, there where I used the \captionof command…
anyone?

My bad, found the problem. I had this error: “to many unprocessed floats”. By using the caption package, the size of some captions may be changed, and suddenly LaTeX placed all my figures at the end of the document. This happened with so many figures that LaTeX couldn’t put them down nicely on a page any more. By using the float package, I forced some figures in position, and problem solved.

An other solution when you got the error is putting in a \clearpage or \cleardoublepage command to allow a page full of figures to be generated.

Hi!! I wanted to put two figures side by side, and the minipage stuff works fine. However, it doesn’t look good at all. The figures are not placed at the exact same height and I can’t place the captions exactly under each figure (probably cause of the page size, which i do not want to change) Also, I can’t put the figures at the center of the page, they either go too left or too right no matter what i do…

Amir, your code worked wonderfully for me. I had been struggling with the format till I tried your solution.

It turns out the issue was the [b] option after each \minipage command that made it look bad, ie, the table and the figure were placed side by side, but the figure was below the table. I removed that option and voilà, it worked.

Dear Bob , I have 40 subfigure which i want to display with caption F1,F2, …F40 under single banner. I do not want to display figure numbering like (a) F1 (b) F2 (c) F3… etc instead of it i want to display F1 F2 F3 F4…etc
please help me.
Thanks

I’m having a similar problem to Steven above. I’m using the code you provided to place mini pages horizontally, but they only stack vertically. Because of the cautionary note about the size of figures, I’ve attempted to remedy this by decreasing the image size and the buffer space between the images. Even though the figures are now only an inch across they still stack vertically. The code is as follows:

The problem is not so much with the size of the figures inside the minipage environment, but the size of the minipage “box” itselves. Including the small horizontal space in-between, they are taking up more than the complete linewidth. Try reducing their sizes slightly and it should work just fine.

Nice figures :-)! The space (line 23) ends the paragraph in LaTeX which is why the second figure is on the “next line” or below the first. Simply delete it and it should work. Also, \hspace is fine, however, LaTeX has standard space commands: \quad and \qquad. I recommend to use these. Finally, please provide a minimal working example including preamble next time, so I don’t have to figure out which packages and TikZ libraries you use.

I assume by align, you mean vertically align and . Btw. you are loading several packages multiple times, including textcomp, float and amsmath. Not that it was wrong, but remember that sometimes the order makes a difference.

Thanks again Tom ! They are definitely getting aligned ! But I wanted them left aligned..that way they look better ! So, I used \begin{flalign*},
but that doesnot work ! Is there any other way to left align the conditional
equations?

Hi, I am struggling with a captioning issue in minipage. The error I get states “Package floatrow Error: Caption(s) lost.” I have tried reading around this but cant find a solution to the issue. The code is one i have used previously and successfully so have no idea why it is now not working. Can anyone offer advice please?

Your code works perfectly, the only problem was a “}” in the short caption of the second figure. The conflict is due to the floatrow package (as the error suggests). Remove it in case you don’t need it. Otherwise, I would need to see a minimal example which produces the error to be able to help.

Here is a complete minimal working example just using minipage including captions:

Again, the code works perfectly (apart from the missing graphicx package). You would need to give me an example that includes the packages you load, so I can reproduce the error. I.e., are you loading floatrow? Another possibility would be to use either subfigure or subfig. You might want to give those packages a try to see if it solves your problem.

Hi Tom,
Iam using this code to display images side by side. However I want to reduce the space between the displayed images even further(ideally < 2mm seperating every image) , so that I can increase the size of every image and still display in one row. At present the seperation is around ~1cm between two images with the below code. can you suggest how to do this using minipage ?

Hi Tom, first of all you have a great and very helpful blog. All of this information helped me place 2 figures side by side and a table and a firgure side by side (using the minipage command). I have 2 questions: One- Is it possible to place two figures side by side and immediately below them another two figures, all of these as one “unit”?
Two- It’s a bit hard to explain (I’d send you a pic but don’t know how), but as I’m making a table I’d like to know how to control the lines, e.g. I have three columns and above them one cell which is not divided by the lines of thecolumns below… Do you have any suggestions?

Ideally, the code would illustrate your problem with as few lines as possible.

The problem is not related to eps-figures. You have two options:

Use your code without [H] and move the figure forward until you get it where you want. The figure will always end up at the top of the page.

If you need the figure to display in the middle of a page, you can use multicol. The figure, however, will break the page. In other words, the first column is filled to the figure before switching to column two and not to the bottom of the page. I added an example below