[Tex/LaTex] Put two graphics one above the other with no space in between


(The question does not concern figures, captions, …)

It's easy to put two graphics gra1 and gra2 side by side so that they touch each other along their right and left vertical sides of the bounding box, being


enough to accomplish the goal (the two graphics will be arranged as G1G2 with no space in between them).

What if one wants to put them one above the other so that they touch each other along the horizontal sides?
They should be arranged like this


with no space in between them. Is there any way I can do this which is as clear, simple (no package required) as the previous is?

I know that a new line is not the solution for two reasons:

  1. when the two graphics are small enough, a space will appear in between the two graphics, since they belong to different lines;
  2. I don't want the pair of graphics to be however related to the lines, since I just want to use the pair as it was a whole.

I'm not looking for the TikZ solution.

EDIT The reson for the point 2. is that I'm going to use this pack of two graphics as optional argument of \item in a itemize environment.
So I'd like to put something like

\newcommand{\vertcat}{<the solution I'm looking for>}

in the preamble, so that I can have a list like the following,

    \item[\horzcat] ...
    \item[\vertcat] ...

Best Answer

Example, where \vertcat is implemented by stacking the images in a \vbox with the base line at the bottom of the lower image (see OP's comment).

The images are left-aligned, the overall width is the width of the wider image. \offinterlineskip removes the space between the image, regardless whether \baselineskip or \lineskip would be used otherwise.

The solution for placing the images does not need any further packages. In contrary, it is implemented with commands and macros that are already available in plain TeX.



  \vbox{% baseline is at the bottom
    \offinterlineskip % disable line skip

  \item[\horzcat] side by side
  \item[\vertcat] one above the other


Related Question