單列文字格式中帶有子圖的並排圖

單列文字格式中帶有子圖的並排圖

我想將兩個數字並排放置在一個單列文件中,該文件使用elsarticle每個數字都有一些與之關聯的子數字來編寫。

在此輸入影像描述

這是我的mwe

\documentclass[review]{elsarticle}
\usepackage{subfig}
\begin{document}
    \begin{figure}[]  % Figure 1
        \centering
        \subfloat[A]{\includegraphics[width=0.4\linewidth,height=0.15 \textheight]{example-image-a}} \\
        \subfloat[B]{\includegraphics[width=0.4\linewidth,height=0.15 \textheight]{example-image-b}} \\
        \caption[]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque }
    \end{figure}
    
    \begin{figure}[]  % Figure 2
        \centering
        \subfloat[C]{\includegraphics[width=0.4\linewidth,height=0.15 \textheight]{example-image-c}} \\
        \subfloat[X]{\includegraphics[width=0.4\linewidth,height=0.15 \textheight]{example-image}} \\
        \caption[]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque }
    \end{figure}
\end{document}

有人可以幫我按照附圖中的樣子放置它們嗎?

答案1

您需要將兩個圖像放入一個figure浮動中,每個 inminipage或 in tabularx

minipage

\documentclass[review]{elsarticle}
\usepackage{subfig}
\begin{document}
    \begin{figure}[ht]  
        \setkeys{Gin}{width=0.4\linewidth,height=0.15\textheight}
    % Figure 1
    \begin{minipage}[t]{0.45\linewidth}
        \centering
        \subfloat[A]{\includegraphics{example-image-a}} \\
        \subfloat[B]{\includegraphics{example-image-b}} 
        \caption[]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque }
    \end{minipage}
    \quad
    \begin{minipage}[t]{0.45\linewidth}
        \centering
        \subfloat[C]{\includegraphics{example-image-c}} \\
        \subfloat[X]{\includegraphics{example-image}} 
        \caption[]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque }
    \end{minipage}
    \end{figure}
\end{document}

在此輸入影像描述

tabularx

\documentclass[review]{elsarticle}
\usepackage{subfig}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}
    \begin{figure}[ht]  
        \setkeys{Gin}{width=0.4\linewidth,height=0.15\textheight}
    % Figure 1
    \begin{tabularx}{\linewidth}{CC}
        \subfloat[A]{\includegraphics{example-image-a}}
        
        \subfloat[B]{\includegraphics{example-image-b}} 
        \caption[]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque }
    &
        \subfloat[C]{\includegraphics{example-image-c}} 
        
        \subfloat[X]{\includegraphics{example-image}} 
        \caption[]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque }
    \end{tabularx}
    \end{figure}
\end{document}

結果與之前類似。

相關內容