仅当使用 FrontiersinHarvard 样式时才使用 `! LaTeX 错误:不在外部 par 模式`

仅当使用 FrontiersinHarvard 样式时才使用 `! LaTeX 错误:不在外部 par 模式`

我想向提供模板的期刊投稿一份稿件:https://www.frontiersin.org/about/author-guideline但是它似乎很容易接受子图。如果我选​​择 elsarticle 格式(通过删除第一行的注释)并取消选择 FrontiersinHarvard 格式(通过注释掉第二行),错误就会消失。我该怎么办?

%\documentclass[review]{elsarticle}
\documentclass[utf8]{FrontiersinHarvard} % for articles in journals using the Harvard Referencing Style (Author-Date), for Frontiers Reference Styles by Journal: https://zendesk.frontiersin.org/hc/en-us/articles/360017860337-Frontiers-Reference-Styles-by-Journal
\usepackage{caption}
\usepackage{url,caption, graphicx}
\usepackage{geometry}
\usepackage{subcaption}
\usepackage{float}


\geometry{
    a4paper,
    total={170mm,257mm},
    left=20mm,
    top=20mm,
        bottom=20mm
}


\begin{document}

\begin{figure}[H]
     \centering
     \begin{subfigure}[b]{0.30\linewidth}
         \centering
         \includegraphics[width=0.25\textwidth]{example-image-a}
     \end{subfigure}
     \hfill
     \begin{subfigure}[b]{0.30\linewidth}
         \centering
         \includegraphics[width=0.25\textwidth]{example-image-b}
     \end{subfigure}
     \hfill
     \begin{subfigure}[b]{0.30\linewidth}
         \centering
         \includegraphics[width=0.25\textwidth]{example-image-c}
     \end{subfigure}
\end{figure}
\end{document}

答案1

以下是 Frontiers 模板中提供的代码:

\setcounter{figure}{2}
\setcounter{subfigure}{0}
\begin{subfigure}
\setcounter{figure}{2}
\setcounter{subfigure}{0}
    \centering
    \begin{minipage}[b]{0.5\textwidth}
        \includegraphics[width=\linewidth]{logo1.eps}
        \caption{This is Subfigure 1.}
        \label{fig:Subfigure 1}
    \end{minipage}  
   
\setcounter{figure}{2}
\setcounter{subfigure}{1}
    \begin{minipage}[b]{0.5\textwidth}
        \includegraphics[width=\linewidth]{logo2.eps}
        \caption{This is Subfigure 2.}
        \label{fig:Subfigure 2}
    \end{minipage}

\setcounter{figure}{2}
\setcounter{subfigure}{-1}
    \caption{Enter the caption for your subfigure here. \textbf{(A)} This is the caption for Subfigure 1. \textbf{(B)} This is the caption for Subfigure 2.}
    \label{fig: subfigures}
\end{subfigure}

相关内容