2

Hello I have 7 figures in latex. I want to make all those figures to have the same width and height, Here is what I have tried till now. However as you can see in the result, the figures have not the same height and width. I appreciate if anyone can help me.

\begin{figure*}
        \centering
        %\vspace{-2\baselineskip}
        \begin{subfigure}[b]{0.3\textwidth}
        %\baselineskip
        %\includegraphics[height=8cm, width=18cm]{out_1.png}
                \includegraphics[height=8cm\hskip, width=18cm]{out_1.png}
        \end{subfigure}
        %\quad
        \begin{subfigure}[b]{0.3\textwidth}
                \includegraphics[height=8cm\hskip, width=18cm]{out_2.png}
        \end{subfigure}
        \vspace{-11\baselineskip}
        %\quad
        \begin{subfigure}[b]{0.3\textwidth}
                \includegraphics[height=8cm\hskip, width=18cm]{out_3.png}
        \end{subfigure}
        \begin{subfigure}[b]{0.3\textwidth}
                \includegraphics[height=8cm\hskip, width=18cm]{out_4.png}
        \end{subfigure}
        %\quad
        \vspace{-11\baselineskip}
         \begin{subfigure}[b]{0.3\textwidth}
                \includegraphics[height=8cm, width=18cm]{out_5.png}
        \end{subfigure}
        %\quad
         \begin{subfigure}[b]{0.3\textwidth}
                \includegraphics[height=8cm, width=18cm]{out_6.png}
        \end{subfigure}
      
        %\vspace{-11\baselineskip}
        \begin{subfigure}[b]{0.3\textwidth}
                \includegraphics[height=8cm, width=18cm]{out_7.png}
        \end{subfigure}
        
 \end{figure*}

enter image description here

MinaMRM
  • 343
  • 4
  • 16

1 Answers1

1

I usually prefer to define the size of figures, subfigures and tables not in absolute terms (i.e. with 'cm' or 'pt') but in terms relative to the size of the page geometry. This prevents tables from overshooting the page size and/or overlapping. So, if I want to render three figures on the same line, I define the size of the subfigure one third of the linewidth. In a similar way I set the width of the image to the full width of the 'column' generated by subfigure. Thus, I refactor your code as below:

\begin{figure*}
    \centering

    \begin{subfigure}[b]{0.3\textwidth}
            \includegraphics[width=\textwidth]{img.jpg}
    \end{subfigure}
    %\quad
    \begin{subfigure}[b]{0.3\textwidth}
            \includegraphics[width=\textwidth]{img.jpg}
    \end{subfigure}
    \vspace{1\baselineskip}
    %\quad
    \begin{subfigure}[b]{0.3\textwidth}
            \includegraphics[width=\textwidth]{img.jpg}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
            \includegraphics[width=\textwidth]{img.jpg}
    \end{subfigure}
    %\quad
    \vspace{1\baselineskip}
     \begin{subfigure}[b]{0.3\textwidth}
            \includegraphics[width=\textwidth]{img.jpg}
    \end{subfigure}
    %\quad
     \begin{subfigure}[b]{0.3\textwidth}
            \includegraphics[width=\textwidth]{img.jpg}
    \end{subfigure}
  
    \begin{subfigure}[b]{0.3\textwidth}
            \includegraphics[width=\textwidth]{img.jpg}
    \end{subfigure}
        
 \end{figure*}

result

  • Thank you for your answer. I did what you said but it makes the photos very small and blur and the space between photos arise. – MinaMRM Sep 20 '22 at 16:50
  • The differences between the pictures size and/or ratio is high? How much is it quantifiable? Maybe [this discussion](https://tex.stackexchange.com/questions/286737/sub-figures-of-different-sizes-grid-layout) can help you. – Federico Pellegatta Sep 21 '22 at 07:00