0

I am trying to put three figures side-by-side. But they have different sizes. Here is the basic code

\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}

I am getting the following result:

enter image description here

When I use the optional [t] or [b] argument from subcaption I am getting this result:

enter image description here

How can I move the second subfigure EH in the center, but leave captions aligned at the bottom?

3
  • Please, add to your code the missing parts to make it compilable: document class and needed packages. Thanks!
    – Rmano
    Feb 2, 2022 at 21:44
  • I suggest to try with the subfloatrow environment, from the floatrow package.
    – Bernard
    Feb 2, 2022 at 22:37
  • You could use a tabular with the images and captions in different rows, but you need to use m columns (array package) or \parbox for the captions. Feb 2, 2022 at 22:59

1 Answer 1

2
  • As proposed @John Kormylo in his comment
  • reorganized your preamble (see added comment in code)
  • with use of tabularx table
\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}

enter image description here

(red lines indicate text borders)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .