IEEEtran,subfig 冲突吗?

IEEEtran,subfig 冲突吗?

以下代码使用了该类IEEEtran,并subfig产生了编译错误,如“标题参数有多余的”或“超出 TeX 容量”等。但是,当我在标题中}注释掉所有错误时,所有错误都消失了。\subref

\documentclass[final]{IEEEtran}
\usepackage[caption=false]{subfig}
\usepackage{graphicx}
\begin{document}
\begin{figure*}
\centering
\subfloat[][\label{validation}Validating the model]{
\includegraphics{validationBlock.pdf}
}\\
\subfloat[][\label{a} my caption a]{
\includegraphics{validationMN.pdf}
}\\
\subfloat[][\label{b} my caption b]{
\includegraphics{piOutMN.pdf}
}\hfill
\subfloat[][\label{c}my caption c]{
\includegraphics{majorityVoterOutMN.pdf}
} 
\caption{\label{validationMN}
\subref{validation} % if i comment this line every thing is okay
my main caption
}
\end{figure*}
\end{document}

有什么建议么?

答案1

我觉得这种使用\label\subref内部的\caption方式有些奇怪;你确定需要使用这种构造吗?如果你真的需要保留这种构造,你将需要使用\protectfragrance\subref命令:

\documentclass[final]{IEEEtran}
\usepackage[caption=false]{subfig}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure*}
\centering
\subfloat[][\label{validation}Validating the model]{
\includegraphics{validationBlock.pdf}
}\\
\subfloat[][\label{a} my caption a]{
\includegraphics{validationMN.pdf}
}\\
\subfloat[][\label{b} my caption b]{
\includegraphics{piOutMN.pdf}
}\hfill
\subfloat[][\label{c}my caption c]{
\includegraphics{majorityVoterOutMN.pdf}
} 
\caption{\label{validationMN}
\protect\subref{validation} % if i comment this line every thing is okay
my main caption
}
\end{figure*}
\end{document}

或者使用可选参数\caption

\documentclass[final]{IEEEtran}
\usepackage[caption=false]{subfig}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure*}
\centering
\subfloat[][\label{validation}Validating the model]{
\includegraphics{validationBlock.pdf}
}\\
\subfloat[][\label{a} my caption a]{
\includegraphics{validationMN.pdf}
}\\
\subfloat[][\label{b} my caption b]{
\includegraphics{piOutMN.pdf}
}\hfill
\subfloat[][\label{c}my caption c]{
\includegraphics{majorityVoterOutMN.pdf}
} 
\caption[text for LoF]{\label{validationMN}
\subref{validation} % if i comment this line every thing is okay
my main caption
}
\end{figure*}
\end{document}

相关内容