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.

Possible Duplicate:
How to use images in a table?

I'm looking for a solution for automatic alignment of figures within my tex-file. I would like to keep it as simple as possible. I have the following idea but don't know how to implement it. Has anyone a suggestion?

\begin{tabular}{ll}
%\hline
\begin{figure} \includegraphics{pic.eps} \end{figure} & \begin{figure} \includegraphics{pic.eps} \end{figure} \\
\begin{figure} \includegraphics{pic.eps} \end{figure} & \begin{figure} \includegraphics{pic.eps} \end{figure} \\
\begin{figure} \includegraphics{pic.eps} \end{figure} & \\
%\hline
\end{tabular}

Of course it would even be much more better, if I'd just type in the following and LaTeX will generate a two column table which will break automatically.

\begin{tabular}{ll}
\includegraphics{pic.eps}
\includegraphics{pic.eps}
\includegraphics{pic.eps}
\includegraphics{pic.eps}
\includegraphics{pic.eps}
\end{tabular}

Here is how I would like it to be in the end

enter image description here

share|improve this question
1  
Hint: You don't need to wrap \includegraphics in a figure environment. In this instance you don't want images to float. You'll probably have to do the table manually though. –  qubyte Feb 14 '12 at 12:41
    
Duplicate of tex.stackexchange.com/q/13240/9043 –  qubyte Feb 14 '12 at 12:48
    
You get more horizontal space out of your tabular environment if you change \begin{tabular}{ll} to \begin{tabular}{@{}ll@{}}. –  Marc van Dongen Feb 14 '12 at 13:10
add comment

marked as duplicate by qubyte, Seamus, egreg, Peter Grill, Stefan Kottwitz Feb 15 '12 at 13:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

If you have a specific width of your graphics (let's say about .48\textwidth or something like that, you might also use the subfigure package, http://ftp.twaren.net/Unix/TeX/CTAN/obsolete/macros/latex/contrib/subfigure/subfigure.pdf using the example 3.1 (page 15) using the package option raggedright. Advantage of this approach would be, that the other package options and vertical alignments, if you have 2 images of different height in one line. And of course - subfigure captions, which I really like.

share|improve this answer
5  
The subfigure package is obsolete (the link you posted might have been a clue) and has been replaced by the subfig package. Another modern alternative is the subcaption package. See subcaption vs. subfig for details. –  Alan Munn Feb 14 '12 at 13:50
    
Thanks for the advice. Of course my idea also works with ctan.tug.org/tex-archive/macros/latex/contrib/subfig/subfig.pdf (and yes i was a little lazy not looking at the URL), though i couldn't find the raggedright package option in there just now. –  Ronny Feb 14 '12 at 13:57
add comment

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