[Tex/LaTex] How to make a grid of images

graphicspositioning

Is it possible to place 4 images in an 2×2 grid? I don't want to float them, I don't want any captions. Each image should have the same width.

Edit:

Thanks for all the answers. After trying it out, I realized, that I forgot to ask one point:

Suppose I have a counter like this:

\newcounter{eqn}
\renewcommand*{\theeqn}{\alph{eqn})}
\newcommand{\num}{\refstepcounter{eqn}\text{\theeqn}\;}

Now I want to add \num before each picture, the enumeration should be displayed above to the left of each image.

Best Answer

This works for me:

\documentclass{article}

\usepackage{amsmath}

\newcounter{eqn}
\renewcommand*{\theeqn}{\alph{eqn})}
\newcommand{\num}{\refstepcounter{eqn}\text{\theeqn}\;}

\makeatletter
\newcommand{\putindeepbox}[2][0.7\baselineskip]{{%
    \setbox0=\hbox{#2}%
    \setbox0=\vbox{\noindent\hsize=\wd0\unhbox0}
    \@tempdima=\dp0
    \advance\@tempdima by \ht0
    \advance\@tempdima by -#1\relax
    \dp0=\@tempdima
    \ht0=#1\relax
    \box0
}}
\makeatother

\usepackage[demo]{graphicx}

% \setlength{\tabcolsep}{0pt}

\begin{document}

\begin{tabular}{cc}
  \num\putindeepbox[7pt]{\includegraphics{whatever.jpg}}
    & \num\putindeepbox[7pt]{\includegraphics{whatever.jpg}} \\
  \num\putindeepbox[7pt]{\includegraphics{whatever.jpg}}
    & \num\putindeepbox[7pt]{\includegraphics{whatever.jpg}} \\
\end{tabular}

\end{document}

Result

(Edited to include pseudo-captions; the macro \putindeepbox takes something and puts it into a box of height equal to 0.7\baselineskip by default (i.e., the height of a \strut) and deep enough to accomodate for the given material. Somehow in tabular \baselineskip gets reset to zero, so I've hardcoded the height manually. Not very elegant, but works - feel free to improve it;). Notice also some dirty tricks with boxes - hopefully someone will find a cleaner way to do it. I hope that this is what you wanted, and that it is not too late... See also comments below to make spacing better.)

The spacing is not perfect; you can manipulate the horizontal spacing with tabcolsep, AFAIK there is no such parameter for vertical spacing in tabular.