2

I introduced these images into my latex work. I want to increase the size of the images but when I do this they do not align properly.

\begin{figure*}[h]
    \centering
    \begin{subfigure}[t]{0.25\textwidth}
        \centering
        \includegraphics[height=1.0in]{images/41025.jpg}
    \end{subfigure}%
    \begin{subfigure}[t]{0.25\textwidth}
        \centering
        \includegraphics[height=1.0in]{images/groundTruth41025.jpg}
    \end{subfigure}%
        \begin{subfigure}[t]{0.15\textwidth}
        \centering
        \includegraphics[height=1.0in]{images/imageBest41025.jpg}
    \end{subfigure}%
    \\
    \begin{subfigure}[t]{0.25\textwidth}
        \centering
        \includegraphics[height=1.0in]{images/43033.jpg}
    \end{subfigure}% 
        \begin{subfigure}[t]{0.25\textwidth}
        \centering
        \includegraphics[height=1.0in]{images/groundTruth43033.jpg}
    \end{subfigure}%
        \begin{subfigure}[t]{0.15\textwidth}
        \centering
        \includegraphics[height=1.0in]{images/imageBest43033.jpg}
    \end{subfigure}%
    \caption{Images.}
\end{figure*}

How can I increase the images size without moving? I want to have 3 images side by side

enter image description here

4
  • 1
    As long as you make them the same height, why wouldn't they line up (they do now). – Werner Jan 26 at 18:39
  • What does "do not align properly" mean? Do you refer to the slightly different horizontal white spaces between adjacent images? – leandriis Jan 26 at 18:45
  • How can I increase the images size without moving? I want to have 3 images side by side – AceDoong Jan 26 at 19:06
  • 2
    your three subfigure total 0.65 of the text width, why just that amount? you can make them all bigger and still fit three on a line? – David Carlisle Jan 26 at 20:04
1

I know two options to easily create a pleasant layout.

(1) using the subfigure environment, or

(2) relying on tabular, which frankly seems much simpler.

I added the length \figwidth which allows you to change the width of the figures and see how they fit on the page.

a

b

The prototype assumed that the leftmost figure is a square 2/3 the width of the other figures.

\documentclass[12pt,a4paper]{article}

\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{kantlipsum} % dummy text    
\usepackage[left=1.2in, right=1.2in, top=1in, bottom=1in]{geometry}

\newlength{\figwidth}
\setlength{\figwidth}{1.0in}

\begin{document}
            
1. \kant[1]
    
\begin{figure*}[h]
    \centering  
    \begin{subfigure}[t]{\figwidth}
        \centering
        \includegraphics[height=.66\figwidth,width=\figwidth]{example-image-a}
    \end{subfigure}%
    \hspace*{10pt}
    \begin{subfigure}[t]{\figwidth}
        \centering
        \includegraphics[height=.66\figwidth,width=\figwidth]{example-image-a}
    \end{subfigure}%
    \hspace*{10pt}
    \begin{subfigure}[t]{0.66\figwidth}
        \centering
        \includegraphics[height=.66\figwidth,width=.66\figwidth]{example-image-a}
    \end{subfigure}%

    \vspace*{10pt}
    \begin{subfigure}[t]{\figwidth}
        \centering
        \includegraphics[height=.66\figwidth,width=\figwidth]{example-image-b}
    \end{subfigure}% 
    \hspace*{10pt}
    \begin{subfigure}[t]{\figwidth}
        \centering
        \includegraphics[height=.66\figwidth,width=\figwidth]{example-image-b}
    \end{subfigure}%
    \hspace*{10pt}
    \begin{subfigure}[t]{0.66\figwidth}
        \centering
        \includegraphics[height=.66\figwidth,width=0.66\figwidth]{example-image-b}
    \end{subfigure}%
    \caption{Images with subfigure.}
\end{figure*}

    3. \kant[3]
\newpage
    
\begin{figure*}[h]
    \centering
    \begin{tabular}{ccc}
        \includegraphics[height=.66\figwidth,width=\figwidth]{example-image-a}&
        \includegraphics[height=.66\figwidth,width=\figwidth]{example-image-a}&
        \includegraphics[height=.66\figwidth,width=0.66\figwidth]{example-image-a}  \\[6pt] %vertical space between the rows
        \includegraphics[height=.66\figwidth,width=\figwidth]{example-image-b}&
        \includegraphics[height=.66\figwidth,width=\figwidth]{example-image-b}&
        \includegraphics[height=.66\figwidth,width=0.66\figwidth]{example-image-b}  \\
    \end{tabular}
        \caption{Images with tabular.}
\end{figure*}

2. \kant[2]
    
\end{document}

This is what you get changing \figwidth from 1.8in to 1in. See how with the tabular the vertical and horizontal separation does not need to be re-equalized.

c

0

You don't have to place each image inside a subfigure environment if you don't plan on indexing them. As such, just insert the images as-is with a \space (or some other width) between them:

enter image description here

\documentclass{article}

\usepackage{graphicx,lipsum}

\begin{document}

\lipsum[1]

\begin{figure}[ht]
  \centering
  \includegraphics[height=1in]{example-image-a}\space
    \includegraphics[height=1in]{example-image-b}\space
    \includegraphics[height=1in]{example-image-1x1}
  
  \includegraphics[height=1in]{example-image-c}\space
    \includegraphics[height=1in]{example-image}\space
    \includegraphics[height=1in]{example-image-1x1}
    
  \caption{A figure caption}
\end{figure}

\lipsum[2]

\end{document}

From here it should be straight-forward to adjust the height to something suitable for your needs.


If you want the images to span the maximum possible width, then set them using some comfortable measure between them, then \resizebox the entire row to fit \linewidth:

enter image description here

\documentclass{article}

\usepackage{graphicx,lipsum}

\begin{document}

\lipsum[1]

\begin{figure}[ht]
  \centering
  \resizebox{\linewidth}{!}{%
    \includegraphics[height=1in]{example-image-a}\space
      \includegraphics[height=1in]{example-image-b}\space
      \includegraphics[height=1in]{example-image-1x1}}
  
  \resizebox{\linewidth}{!}{%
    \includegraphics[height=1in]{example-image-c}\space
      \includegraphics[height=1in]{example-image}\space
      \includegraphics[height=1in]{example-image-1x1}}
    
  \caption{A figure caption}
\end{figure}

\lipsum[2]

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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