如何使并排子图的标题靠底部对齐,但子图靠中心对齐?

如何使并排子图的标题靠底部对齐,但子图靠中心对齐?

我试图将三个数字并排放置。但它们的大小不同。这是基本代码

\documentclass[preprint]{elsarticle}
%\documentclass[<options>]{elsarticle}
\usepackage{lineno,hyperref}
\usepackage{nomencl}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage[cmex10]{amsmath}
\usepackage{amsfonts}
\usepackage{subcaption}
\usepackage{eurosym}
\modulolinenumbers[5]

\usepackage[english]{babel}

\usepackage[acronym, automake]{glossaries}
\makeglossaries
\input{glossary.tex}

\usepackage{tikz}
\usepackage{siunitx}

\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta, positioning, quotes}

\begin{document}

\begin{figure}[h]
\begin{subfigure}{0.325\textwidth}
\centering
\input{graphics_TikZ/sequential_frame_work.tikz}
\caption{\textbf{N=5}}
\end{subfigure}
\begin{subfigure}{0.325\textwidth}
\centering
\input{graphics_TikZ/integrated_framework.tikz}
\caption{\textbf{N=20}}
\end{subfigure}
\begin{subfigure}{0.325\textwidth}
\centering
\input{graphics_TikZ/proposed_framework.tikz}
\caption{\textbf{N=40}}
\end{subfigure}
\caption{Caption.}\label{fig:JOOS}
\end{figure}

\end{document}

我得到以下结果:

在此处输入图片描述

当我使用可选的[t][b]参数时subcaption,我得到了这个结果:

在此处输入图片描述

我怎样才能将第二个子图 EH 移动到中心,但让标题保持在底部对齐?

答案1

  • 正如@John Kormylo 在其评论中所建议的那样
  • 重新组织了你的序言(参见代码中添加的注释)
  • 使用tabularx表格
\documentclass[preprint]{elsarticle}
%\documentclass[<options>]{elsarticle}
\usepackage[english]{babel}

\usepackage[cmex10]{amsmath}
\usepackage{amssymb, amsbsy}
\usepackage{textcomp}
\usepackage{eurosym}

\usepackage{graphicx}
\usepackage{multirow,
            tabularx}   % <--- new
\newcolumntype{C}{>{\centering\arraybackslash}X}
%\usepackage{amsfonts}  it is loaded by amsmath
\usepackage[skip=-2ex]{subcaption} % <--- added option(s)

\usepackage{nomencl}
%\usepackage[acronym, automake]{glossaries}
%\makeglossaries
%\input{glossary.tex}   % it is not available

\usepackage{tikz}
\usepackage{siunitx}

\usepackage{tikz}
%\usetikzlibrary{positioning}   <--- duplicate
\usetikzlibrary{arrows.meta, 
                positioning, 
                quotes}

\usepackage{lineno}
\modulolinenumbers[5]
\usepackage{hyperref}    % <--- had to be loaded last

\begin{document}
    \begin{figure}[ht]
    \renewcommand\tabularxcolumn[1]{m{#1}}
\begin{tabularx}{\linewidth}{CCC}
%\input{graphics_TikZ/sequential_frame_work.tikz}   
\includegraphics[width=0.4\linewidth, height=5cm]{example-image-duck}
    &   %\input{graphics_TikZ/integrated_framework.tikz}
        \includegraphics[width=0.4\linewidth]{example-image-duck}
        &   %\input{graphics_TikZ/proposed_framework.tikz}
            \includegraphics[width=0.8\linewidth, height=4cm]{example-image-duck}   \\
\subcaption{\textbf{N=5}}  
    &   \subcaption{\textbf{N=20}}     
        &   \subcaption{\textbf{N=40}} 
\end{tabularx}
\caption{Caption.}
\label{fig:JOOS}
    \end{figure}
\end{document}

在此处输入图片描述

(红线表示文本边框)

相关内容