有关子图的帮助,适用于 {subcaption} 包,但不适用于 {subfigure},但它们不能在模板中一起出现

有关子图的帮助,适用于 {subcaption} 包,但不适用于 {subfigure},但它们不能在模板中一起出现
\documentclass{article}
\usepackage{tikz}
\usepackage[tight,footnotesize]{subfigure}
%\usepackage{subcaption}


\begin{document}
\begin{figure}[ht] 
\begin{subfigure}{0.5\linewidth}
\centering
\begin{tikzpicture} 
\node[anchor=south west,inner sep=0] (image) at (0,0)
    {\includegraphics[width=\textwidth]{Speed_torque_healthyandfaulty.eps}}; 
\node[anchor=south west,inner sep=0] (image) at (3.7,1.5)
    {\includegraphics[width=0.36\textwidth]{Speed_torque_healthyandfaulty_zoomed.eps}};
\end{tikzpicture} 
\caption{torque}
\end{subfigure}
%
\begin{subfigure}{0.5\linewidth}
\centering 
\begin{tikzpicture} 
\node[anchor=south west,inner sep=0] (image) at (0,0)
{\includegraphics[width=0.96\textwidth]{Speed_healthyandfaulty.eps}}; 
\node[anchor=south west,inner sep=0] (image) at (1.8,1.5)
{\includegraphics[width=0.4\textwidth]{Speed_healthyandfaulty_zoomed.eps}}; \end{tikzpicture} \caption{torque!}
\end{subfigure}
\caption{figures}
    \end{figure}
\end{document}

答案1

正如评论中已经提到的:

  • subfigure是过时的软件包。不要使用它!它已被替换为软件包\subfig
  • subfigure由包定义的环境subfigure与由包定义的同名环境没有任何共同之处subcaption
  • subfig包定义环境subloat,其语法如下:
\subfloat[<options>][< sub caption>]{sub figure file name}
  • subcaption包是更强大/灵活的包,例如更好地支持hyperef引用等。既然您已经使用它,我看不出有任何理由放弃一个好的解决方案。

无论如何,使用subfig包,你的 MWE 可以是:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{tikz}
\usepackage{subfig} % <---

\begin{document}
    \begin{figure}[ht]
\subfloat[torque]% <---
{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0)
    {\includegraphics[width=0.5\textwidth]{Speed_torque_healthyandfaulty.eps}};
\node[anchor=south west,inner sep=0] (image) at (3.7,1.5)
    {\includegraphics[width=0.18\textwidth]{Speed_torque_healthyandfaulty_zoomed.eps}};
\end{tikzpicture}
}
\hfill
\subfloat[torque!]% <---
{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0)
    {\includegraphics[width=0.48\textwidth]{Speed_healthyandfaulty.eps}};
\node[anchor=south west,inner sep=0] (image) at (1.8,1.5)
    {\includegraphics[width=0.2\textwidth]{Speed_healthyandfaulty_zoomed.eps}}; 
    \end{tikzpicture} 
}
\caption{figures}
    \end{figure}
\end{document}

  在此处输入图片描述

相关内容