1

I have two figures of slightly different sizes. So I'm unable to align them vertically, as shown in the figure. enter image description here

I'm using the following code.

\begin{figure}[h]
       \centering
       \includegraphics[width=2.8cm]{Fig1.pdf}
        \includegraphics[width=3.2cm]{Fig2.pdf}
       \caption{This is the caption.}
   \end{figure}

The problem is that Fig2 has an in-picture label, so to make them look of the same size, I have used width=3.2cm for Fig2 and width=2.8 for Fig1. So is there any way to align them at the top? For example, by moving only the left figure a little up or right fig a little down.

campa
  • 31,130
Epsilon
  • 516

1 Answers1

1

If you try with this it works?

\begin{figure}[h]
      \centering
      \begin{minipage}[b]{0.4\textwidth}
        \includegraphics[width=2.8cm]{Fig1.pdf}
      \end{minipage}
      \hfill
      \begin{minipage}[b]{0.4\textwidth}
        \includegraphics[width=3.2cm]{Fig2.pdf}
       \caption{This is the caption.}  
      \end{minipage}
    \caption{bla bla}
    \end{figure}

If not try to play with the command "width".

Gnoppi
  • 169
  • Are you sure? You could provide a minimal working example (i.e. a complete code that can be copied and typeset), using available images such as example-image-a, example-image-duck. – Ivan Jun 17 '21 at 16:03
  • no i'm not sure, I had the same problem not a long ago and in this way I solved it... if I'm wrong I'm sorry.. – Gnoppi Jun 17 '21 at 16:06
  • @Epsilon did you try if it works? – Gnoppi Jun 17 '21 at 16:17
  • How can this possibly solve the problem in the question? you are forcing the images into boxes of equal width (why?) but the vertical alignment will be dentical to their position without the minipage so all you are doing is making them further apart horizontally. – David Carlisle Jun 17 '21 at 20:38
  • I solved the same problem by doing what I said.. If it does not work, I'm sorry, and please feel free to reply :) – Gnoppi Jun 18 '21 at 09:06
  • 1
    @Gnoppi, it worked! Thanks, mate. – Epsilon Jun 18 '21 at 17:20
  • Happy it worked :-) – Gnoppi Jun 18 '21 at 17:41