如何在图形侧面设置标题?

如何在图形侧面设置标题?

我尝试在图形的侧面插入标题(例如下图),但无法设置。如何设置?我也见过:关联关联

在此处输入图片描述

\documentclass[review]{elsarticle}
\graphicspath{ {./figures/} }
\usepackage{hyperref}
\usepackage{float}
\usepackage{verbatim} %comments
\usepackage{apalike}
\restylefloat{figure}
\usepackage{float}
\floatstyle{plaintop}
\restylefloat{table}


\usepackage{lipsum,capt-of,graphicx}
\usepackage{geometry}% Just for this example
%\usepackage[authoryear,longnamesfirst]{natbib}
%\usepackage[authoryear]{natbib}
%\usepackage[numbers]{natbib}
\usepackage{natbib}
\let\printorcid\relax
\usepackage[wby]{callouts}
%\usepackage{cite}
\usepackage{ragged2e}
\usepackage{setspace}
%\usepackage{caption}
%\usepackage[font={footnotesize},labelfont=bf]{caption}
\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}
%\setlength\abovecaptionskip{-5pt}
%\setlength{\heavyrulewidth}{3\lightrulewidth}
\usepackage{subcaption}
\usepackage{setspace}
%\renewcommand{\baselinestretch}{1.8}

%%%Author definitions

%%%

%\usepackage[flushleft]{threeparttable}
%\renewcommand\TPTtagStyle{\textit}
\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{adjustbox}
%\usepackage{floatrow}
%\floatsetup[table]{style=Plaintop}

%\setlength{\mathindent}{0pt}

%\makeatletter
%\@dblfpsep=20pt
%\makeatother

\usepackage{array, cellspace}
\setlength\cellspacetoplimit{3pt}
\setlength\cellspacebottomlimit{3pt}

\begin{document}
\begin{figure}[htb]
\centering
\begin{tabular}{cc}
  \includegraphics[width=.4\textwidth]{example-image-a}
  &
  \includegraphics[width=.4\textwidth]{example-image-a}\\
  \includegraphics[width=.4\textwidth]{example-image-a}
  &
  \includegraphics[width=.4\textwidth]{example-image-a}\\
  \includegraphics[width=.4\textwidth]{example-image-a}
  &\multicolumn{1}{b{.4\linewidth}}{\caption{Caption text coming here at the last position}}
\end{tabular}
\end{figure}

\end{document} 

另外,我检查了以下代码,但出现了错误:

\begin{figure}
{\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}
{\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}\\
{\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}
{\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}\\
\floatbox[{\capbeside\thisfloatsetup{capbesideposition={right,bottom},capbesidewidth=5.57cm}}]{figure}
{\caption{Caption text}\label{fig:test}}
{\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}
\end{figure}

错误:

   ! Package floatrow Error: Do not use float package with floatrow.
    (floatrow)                The latter will be skipped.

问题是由于\usepackage{float}\usepackage{floatrow}。虽然我需要它们两个:\usepackage{float}用于表格标题和\usepackage{floatrow}用于图形标题。但是,它们不兼容。如何解决?

答案1

通过使用adjustboxtabularx包,您可以获得以下结果:

在此处输入图片描述

\documentclass[review]{elsarticle}
\usepackage[labelfont=bf,
            justification=raggedright,
            singlelinecheck=false, 
            font={footnotesize, stretch=0.84}]{caption}
\usepackage[export]{adjustbox}
\usepackage{tabularx}

\begin{document}
    \begin{figure}[htb]
\centering
\setlength\tabcolsep{3pt}
\adjustboxset{width=\linewidth, valign=m, margin=0pt 3pt 0pt 3pt}
\begin{tabularx}{\linewidth}{@{} XX @{}}
\adjustimage{}{example-image-a}
    &   \adjustimage{}{example-image-a}   \\
\adjustimage{}{example-image-a}
    &   \adjustimage{}{example-image-a}   \\
\adjustimage{}{example-image-a}
    &   \parbox{\linewidth}{\caption{Caption text coming here at the last position}}
\end{tabularx}
    \end{figure}
\end{document} 

答案2

另一个解决方案:

在此处输入图片描述

\documentclass[review]{elsarticle}
\graphicspath{ {./figures/} }
\usepackage{hyperref}
%\usepackage{float}
\usepackage{verbatim} %comments
\usepackage{apalike}
%\restylefloat{figure}
%\floatstyle{plaintop}
%\restylefloat{table}


\usepackage{lipsum,capt-of,graphicx}
\usepackage{geometry}

\usepackage{natbib}
\let\printorcid\relax
\usepackage[wby]{callouts}
\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{adjustbox}
\usepackage{floatrow}
\floatsetup[table]{capposition=top}
\floatsetup[table]{captionskip=0.1pt}
\floatsetup[subfigure]{objectset=centering}

\usepackage{array, cellspace}
\setlength\cellspacetoplimit{3pt}
\setlength\cellspacebottomlimit{3pt}

\usepackage{placeins}

\begin{document}
    
\begin{figure}
{\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}\quad
{\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}

\medskip

{\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}\quad
{\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}

\medskip

\floatbox[{\capbeside\thisfloatsetup{capbesideposition={right,bottom},capbesidewidth=7.3cm}}]{figure}
{\caption{Caption text}\label{fig:test}}
{\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}
\end{figure}


\end{document} 

相关内容