1

I want to align the sub-caption (c) as in the following figure.

\documentclass[a4paper,fleqn]{cas-dc}

%\usepackage[numbers]{natbib} %\usepackage[authoryear]{natbib} \usepackage[authoryear,longnamesfirst]{natbib}

\graphicspath{ {./figures/} } \usepackage{hyperref} \usepackage{verbatim} %comments \usepackage{apalike}

\usepackage{lipsum,capt-of,graphicx} \usepackage{geometry}% Just for this example

\usepackage{natbib} \let\printorcid\relax \usepackage[wby]{callouts} %\usepackage{cite} \usepackage{ragged2e} \usepackage{setspace} \usepackage[labelfont=bf,justification=raggedright,singlelinecheck=false, font={footnotesize}]{caption} \captionsetup[figure]{name=Fig. ,labelsep=period, justification=justified, singlelinecheck=off} \captionsetup[table]{labelsep=newline,font=footnotesize, justification=justified, singlelinecheck=off}%,skip=0pt,belowskip=0pt}

\usepackage{subcaption} \usepackage{setspace}

\usepackage{etoolbox} \AtBeginEnvironment{table}{\sffamily} \usepackage{booktabs,siunitx, multirow} \sisetup{table-format=1.4, tight-spacing=true, separate-uncertainty}

\sisetup{ output-exponent-marker = \text{e}, exponent-product={}, retain-explicit-plus, input-open-uncertainty = , input-close-uncertainty = , table-align-text-pre = false, table-align-text-post = false, round-mode=places, round-precision=2, table-space-text-pre = (, table-space-text-post = ), }

\usepackage{amsmath} \usepackage{floatrow} \floatsetup[table]{capposition=top} \floatsetup[table]{captionskip=0.1pt} \usepackage{tabularx} \usepackage[export, demo]{adjustbox}

\begin{document}

\begin{figure} \centering \setkeys{Gin}{clip, trim=1cm 1cm .8cm 0.8cm, width=\linewidth,height=4cm} \begin{tabularx}{\linewidth}{XX} \subfloat[\label{sfig:a}]{\includegraphics{C:/Users/foobar/Desktop/Doc1.pdf}} & \subfloat[\label{sfig:b}]{\includegraphics{C:/Users/foobar/Desktop/Doc1.pdf}} \ \subfloat[\label{sfig:c}]{\includegraphics[valign=m]{C:/Users/foobar/Desktop/Doc1.pdf}} & \caption{This caption} \label{fig2: Figs} \end{tabularx} \end{figure}

\end{document}

enter image description here

Ellie
  • 242
  • Your MWE doesn't reproduce showed image. Where you like to have sub-captions labels? – Zarko Oct 17 '21 at 16:56
  • @Zarko: These sub-captions are in the figures below. But, sub-caption (c) isn't! – Ellie Oct 17 '21 at 17:46
  • 1
    You are mixing 3 different caption packages which is the most likely reason why the output isn't as expected. The assumption is that you want a 2 x 2 layout, with images in the top row and lower-left block, but the caption for the entire figure in the lower-right block. Is this correct? – Werner Oct 17 '21 at 17:57
  • @Werner: Yes. I have also changed the code. – Ellie Oct 17 '21 at 18:15

1 Answers1

3

Based on guessing what you after. Also after OP's comments and editing of questions.

Edit: Like this?

enter image description here

or this:

enter image description here

Instead of \subfoat are now used \subcaption} defined in subcaption package. Subcaptions are places in separated table rows. By this is achieved better control over caption positioning.

\documentclass{article}
\usepackage{tabularx}
\usepackage[export, demo]{adjustbox}
\usepackage[skip=1ex, labelfont=bf]{caption}
\usepackage[skip=0.5ex, belowskip=1ex]{subcaption}
\usepackage{lipsum}

\begin{document} \begin{figure}[ht] \centering \setkeys{Gin}{clip, trim=1cm 1cm 1cm 0.8cm, width=\linewidth,height=4cm} \renewcommand\tabularxcolumn[1]{b{#1}} \begin{tabularx}{\linewidth}{XX} \includegraphics{C:/Users/foobar/Desktop/Doc1.pdf} & \includegraphics{C:/Users/foobar/Desktop/Doc1.pdf} \ \subcaption{}\label{sfig:a} & \subcaption{}\label{sfig:b} \ \includegraphics[valign=m] % for the second image delete "[valign=m]" {C:/Users/foobar/Desktop/Doc1.pdf} & \captionsetup{skip=-2.4ex} \caption{\lipsum[1][1]} \label{fig2: neighborhood} \ \subcaption{}\label{sfig:c}
& \ \end{tabularx} \end{figure} \end{document}

Similar result can be gottrn if first two images insert in table in subfloat environments. In this case the table body is:

    \begin{tabularx}{\linewidth}{XX}
\subfloat[]{\includegraphics{C:/Users/foobar/Desktop/Doc1.pdf}}
    &   \subfloat[]{\includegraphics{C:/Users/foobar/Desktop/Doc1.pdf}} \\
\includegraphics%[valign=m]  % for the second image delete "[valign=m]"
                {C:/Users/foobar/Desktop/Doc1.pdf}
    &   \captionsetup{skip=-2.4ex}
        \caption{\lipsum[1][1]}
        \label{fig2: neighborhood}      \\
\subcaption{}\label{sfig:c}
    &                                   \\
Zarko
  • 296,517
  • I have used your code in \documentclass[a4paper,fleqn]{cas-dc}. It is ok. But the caption isn't in its correct position. It is inserted below the sub-figures (not on the right side). – Ellie Oct 17 '21 at 21:13
  • I have edited my question. I have used your code in Overleaf and got the above image. But the caption isn't on the right side. – Ellie Oct 17 '21 at 21:31
  • Also, I have an error for \end{tabularx}, but the images are achieved. – Ellie Oct 17 '21 at 21:38
  • @Ellie, see edited answer. Not old MWE nor edited one hasn't any errors. If you not get the same result as are shown in answer, than you change something in MWE or eventually have outdated packages in your LaTeX installation. – Zarko Oct 18 '21 at 00:34
  • No. Unfortunately, I couldn't solve my problem! – Ellie Oct 18 '21 at 12:42