当标题换行时,我收到错误。我的代码是:
\documentclass[12pt,MSc,twoside]{muthesis}
\usepackage{graphicx}
\usepackage{float}
\restylefloat{figure}
\usepackage{wrapfig}
\begin{document}
\begin{wrapfigure}{r}{0.5\textwidth}
\centering
\includegraphics[scale=0.7]{pictures/amazon_result.png}
\caption{Amazon categories after a search}
\label{fig:amazon_result}
\end{wrapfigure}
\end{document}
我收到的错误是:
Undefined control sequence \caption{Amazon categories after a search}
有什么建议吗?
答案1
来自wrapfig
文档:
要正确使用 float.sty,请在 wrapfig 之前加载 float 包,并声明任何新的 float 加载两者后的类型。
根据给定的示例,需要将\restylefloat
(未声明新的浮点数但具有类似的副作用)移动到\usepackage{wrapfig}
:
\documentclass[12pt,MSc,twoside]{muthesis}
\usepackage[demo]{graphicx}% since I don't have your pictures, I have added the "demo" option here
\usepackage{float}
\usepackage{wrapfig}
\restylefloat{figure}
\begin{document}
\begin{wrapfigure}{r}{0.5\textwidth}
\centering
\includegraphics[scale=0.7]{pictures/amazon_result.png}
\caption{Amazon categories after a search}
\label{fig:amazon_result}
\end{wrapfigure}
\end{document}