如何在 Latex 中在每个图形下方添加子标题?

如何在 Latex 中在每个图形下方添加子标题?

我想在每个图(每页五个图)下面放置一个子标题,例如下面的图。我借助这个关联,但 有问题\floatbox。如何解决?

在此处输入图片描述

\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}
\subfloat[]{\label{main:a}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}\quad
\subfloat[]{\label{main:b}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}

\medskip

\subfloat[]{\label{main:c}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}\quad
\subfloat[]{\label{main:d}\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}}
\subfloat[]{\label{main:e}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}
\end{figure}


\end{document} 

错误在这里:

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


! Argument of \subcaption@subfloat@ has an extra }.
<inserted text> 
                \par 
l.75 \subfloat
              []{\label{main:e}\includegraphics[width=.48\textwidth,height=5...

? 

答案1

如果这是用于出版,您需要与 elsearticle核实有关更改标题格式的事宜。

这是一个不使用 floatrow 的解决方案。我显示了最后一个基线,以便更轻松地调整标题的垂直位置。

\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}
\subfloat[]{\label{main:a}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}\quad
\subfloat[]{\label{main:b}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}

\medskip

\subfloat[]{\label{main:c}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}\quad
\subfloat[]{\label{main:d}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}

\medskip

\subfloat[]{\label{main:e}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}\quad
\begin{minipage}[t]{.48\textwidth}
  \caption[singlelinecheck=false]{Caption text}\label{fig:test}
\end{minipage}
\hfill\llap{\rule{\textwidth}{0.5pt}}% show baseline (remove)
\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}
\subfloat[]{\label{main:a}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}\quad
\subfloat[]{\label{main:b}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}

\medskip

\subfloat[]{\label{main:c}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}\quad
\subfloat[]{\label{main:d}\includegraphics[width=.48\textwidth,height=5cm]{example-image-a}}

\medskip

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


\end{document} 

相关内容