我的主文档中浮点数和子浮点数的警告错误

我的主文档中浮点数和子浮点数的警告错误

我发现这段脚本可以将三幅图像叠放在一起

\documentclass[preprint,12pt,review]{elsarticle}
\usepackage{multicol, blindtext}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% \usepackage[english]{babel}     % Language
\usepackage[english]{babel}
\addto\captionsenglish{%
\def\tablename{Table}%
}
% \usepackage[latin1]{inputenc}   % Latin language
\usepackage{amsmath}            % For references to equations with \eqref
\usepackage{epstopdf}           % To be able to insert .eps figures when compiling with PDFLATEX
\usepackage{flushend}           % To match the columns of the last page
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{doi}
\usepackage{amsthm}
\usepackage{ulem}
\usepackage{mathtools}
\usepackage{multirow}
\usepackage{lscape}
\usepackage{color}
\usepackage{natbib}
\usepackage{tikz}
\usepackage{bm}
\usetikzlibrary{shapes}
\usepackage{subfig}

\begin{document}

\begin{figure}[htp]

\subfloat(a){%
  \includegraphics[clip,width=0.5\columnwidth]{example-image-duck}%
}

\subfloat(b){%
  \includegraphics[clip,width=0.5\columnwidth]{example-image-duck}%
}
\subfloat(c){%
  \includegraphics[clip,width=0.5\columnwidth]{example-image-duck}%
}

\label{fig:Nextel}

\caption[Grain size and strength development of  (a) Nextel 610, (b) Nextel 650, (c) Nextel 720 after heat-treatments between $1200^{o}$C and $1500^{o}$C (1 h)]{Grain size and strength development of  (a) Nextel 610, (b) Nextel 650, (c) Nextel 720 after heat-treatments between $1200^{o}$C and $1500^{o}$C (1 h) \citep{Schu:12}}

\end{figure}

\end{document}

但是,我收到了(a)和(c)的警告信息。

Undefined control sequence.

 
‪./reveiw.tex, 262‬
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}

我不明白为什么 (b) 没有错误消息,或者如何删除此示例中的两个错误消息。

答案1

完整的错误信息如下

! Undefined control sequence.
<argument> ...^{o}$C and $1500^{o}$C (1 h) \citep 
                                                  {Schu:12}
l.22 ...}$C and $1500^{o}$C (1 h) \citep{Schu:12}}
                                                  
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

正如错误消息所述,在您的情况下,顶行末尾的控制序列\citep未定义。

\citep不是默认的 latex 命令。您需要自己定义它,或者加载定义它的包,例如natbib

\documentclass{article}
\usepackage{natbib}

\begin{document}

\begin{figure}[htp]
\caption{\citep{Schu:12}}
\end{figure}

\end{document}

答案2

您的文档示例存在许多问题:

  • 错误是由引用格式化包缺失引起的(已在@samcarter_is_at_topanswers.xyz 答案中解决)
  • 不清楚你的子图像是否有子标题,如果有,应该在哪里安排。所以我猜,正确的子浮点插入应该是\subfloat[ ]{\includegraphics{Images/deu.png}}
  • 所有图像都将位于彼此上方,您需要在它们之间插入空行(现在前两个图像是平行放置的)
  • 对于数量我会考虑@Mico 的评论
  • 在标题中,您有两个标题版本(用于 FoC 和文档中)相同。如果您希望这样,请删除方括号中的部分

MWE 认为,上述内容是:

\documentclass[11pt,fleqn,a4paper]{article}
\usepackage[demo]{graphicx}
\usepackage[caption=false]{subfig}
\usepackage{siunitx}
\usepackage{natbib}

\begin{document}
    \begin{figure}[htp]
\setkeys{Gin}{width=0.5\columnwidth}
\sisetup{range-phrase = {\ \text{and}\ } }
    \centering
\subfloat[ ]{\includegraphics{Images/deu.png}}

\subfloat[ ]{\includegraphics{Images/ITA.png}}

\subfloat[ ]{\includegraphics{Images/USA.png}}

\caption{Grain size and strength development of  (a) Nextel 610, (b) Nextel 650, (c) Nextel 720 after heat-treatments between \qtyrange{1200}{1500}{\celsius} (\qty{1}{\hour}) \citep{Schu:12}.}
\label{fig:Nextel}
    \end{figure}
\end{document}

在此处输入图片描述

添加:
如果您喜欢在图像左侧有子阳离子(从您的问题中看不清楚,但文档示例可以通过这种方式理解),那么您的代码有点奇怪,例如考虑@Ignasi 的回答会更正确这个问题. 对你的情况的采纳是:

\documentclass{article}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage{floatrow}
\floatsetup[figure]{style=plain, 
                    subcapbesideposition=top}% center or bottom
\usepackage{caption}
\usepackage{siunitx}
\usepackage{natbib}

\begin{document}
    \begin{figure}
    \setkeys{Gin}{width=0.5\columnwidth}
    \sisetup{range-phrase = {\ \text{and}\ } }
    \captionsetup{labelfont={large, bf}}
\sidesubfloat[]{\includegraphics{example-image-a}} 

\medskip
\sidesubfloat[]{\includegraphics{example-image-b}} 

\medskip
\sidesubfloat[]{\includegraphics{example-image-c}}
\caption{Grain size and strength development of  (a) Nextel 610, (b) Nextel 650, (c) Nextel 720 after heat-treatments between \qtyrange{1200}{1500}{\celsius} (\qty{1}{\hour}) \citep{Schu:12}.}
    \end{figure}
\end{document}

在此处输入图片描述

相关内容