왼쪽 오른쪽에 여러 이미지를 갖는 방법은 무엇입니까?

왼쪽 오른쪽에 여러 이미지를 갖는 방법은 무엇입니까?

기본적으로 아래와 같은 그림을 갖고 싶습니다.

여기에 이미지 설명을 입력하세요

그런데 왼쪽 오른쪽에 넣을 수 있는데 어떻게 위로 추가하나요?

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\usepackage{subcaption}

\begin{document}


\begin{figure}[ht]
\begin{subfigure}{.5\textwidth}
  \centering
  % include first image
  \includegraphics[width=.5\linewidth]{image_file_name}  
  \caption{Put your sub-caption here}
  \label{fig:sub-first}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
  \centering
  % include second image
  \includegraphics[width=.5\linewidth]{image_file_name}  
  \caption{Put your sub-caption here}
  \label{fig:sub-second}
\end{subfigure}
\caption{Put your caption here}
\label{fig:fig}
\end{figure}

\end{document}

내 현재 출력:

여기에 이미지 설명을 입력하세요

답변1

세 번째 이미지를 추가하세요... 아니면 제가 뭔가를 놓친 걸까요?

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\usepackage{subcaption}

\begin{document}


    \begin{figure}[ht]
        \begin{subfigure}{\textwidth}
            \centering
            % include first image
            \includegraphics[width=.25\linewidth]{example-image-a}  
            \caption{Put your sub-captionA here}
            \label{fig:sub-firstA}
        \end{subfigure}
        \begin{subfigure}{.5\textwidth}
            \centering
            % include first image
            \includegraphics[width=.5\linewidth]{example-image-b}  
            \caption{Put your sub-captionB here}
            \label{fig:sub-first}
        \end{subfigure}
        \begin{subfigure}{.5\textwidth}
            \centering
            % include second image
            \includegraphics[width=.5\linewidth]{example-image-c}  
            \caption{Put your sub-captionC here}
            \label{fig:sub-second}
        \end{subfigure}
        \caption{Put your caption here}
        \label{fig:fig}
    \end{figure}

\end{document}
\end{document}

여기에 이미지 설명을 입력하세요

업데이트 이미지 사이의 공간이 적습니다.

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\usepackage{subcaption}

\begin{document}


    \begin{figure}[ht]
        \begin{subfigure}{\textwidth}
            \centering
            % include first image
            \includegraphics[width=.45\linewidth]{example-image-a}   % this width should be half of the width of the other two images
            \caption{Put your sub-captionA here}
            \label{fig:sub-firstA}
        \end{subfigure}
        \begin{subfigure}{.5\textwidth} % this sets the figure to be max half the width of the page
            \centering
            % include first image
            \includegraphics[width=.9\linewidth]{example-image-b}  % this sets the image to fill 90% of the available space -> 45% of the line width in total. 
            \caption{Put your sub-captionB here}
            \label{fig:sub-first}
        \end{subfigure}
        \begin{subfigure}{.5\textwidth}
            \centering
            % include second image
            \includegraphics[width=.9\linewidth]{example-image-c}  
            \caption{Put your sub-captionC here}
            \label{fig:sub-second}
        \end{subfigure}
        \caption{Put your caption here}
        \label{fig:fig}
    \end{figure}

\end{document}

여기에 이미지 설명을 입력하세요

답변2

이 예에서는 하위 그림/캡션의 너비를 이미지 너비로 줄였습니다. 두 개의 아래쪽 하위 그림 사이에 배치하면 \hfil와 동일한 간격으로 확장되는 \centering반면 \hfill하위 그림은 가장자리까지 밀려납니다.

\documentclass{article}
\usepackage[margin=0.5in,showframe]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\usepackage{subcaption}

\begin{document}

\begin{figure}[ht]
\centering
\begin{subfigure}{.45\textwidth}
  \includegraphics[width=\linewidth]{example-image-a}  
  \caption{Put your sub-caption here}
  \label{fig:sub-first}
\end{subfigure}% ending a line with a brace adds a space
\vspace{\floatsep}% space added between consecutive floats

\begin{subfigure}{.45\textwidth}
  \includegraphics[width=\linewidth]{example-image-b}  
  \caption{Put your sub-caption here}
  \label{fig:sub-secon}
\end{subfigure}\hfil
\begin{subfigure}{.45\textwidth}
  \includegraphics[width=\linewidth]{example-image-c}  
  \caption{Put your sub-caption here}
  \label{fig:sub-third}
\end{subfigure}
\caption{Put your caption here}
\label{fig:fig}
\end{figure}

\end{document}

데모

관련 정보