无法引用数字

无法引用数字

我已将下图插入到我的乳胶文档中

\begin{figure}
  \centering
  \includegraphics[width=0.5\textwidth]{Figures/magnetic-sandwich.jpg}\\
  \caption{A magnetic multilayer (a trilayer or ``sandwich'') that exhibits the GMR effect.  Magnetic iron (red) and chromium (grey).}\label{setup}
\end{figure}

稍后在文档中我想引用这些图,我正在尝试这样做:

 By constructing multilayers as depicted in Fig \ref{setup} devices....

但是,当我排版文档时,出现以下警告:

LaTeX 警告:第 2 页上的引用“setup”在输入行 64 上未定义。

即使我再次排版该文档后,该问题仍然存在。

包含参考的文本位于插入图片部分的子部分内。文档中的另一个图片也存在同样的问题,但其他图片都可以正常工作。我不确定这个问题的原因,任何帮助排除故障/修复它的帮助都将不胜感激。

编辑:

以下是一个可以重现该问题的示例文档:

\documentclass[10pt]{iopart}
\usepackage{graphicx}
%Uncomment next line if AMS fonts required
\usepackage{iopams}
\usepackage{placeins}
\usepackage{url}
\usepackage{multicol}
\usepackage{blindtext}

\begin{document}

\section{Giant Magnetoresistance}
\begin{multicols}{2}

%\blindtext

\begin{figure}
\centering
      \includegraphics[width=0.5\textwidth]{Figures/magnetic-sandwich.jpg}\\
      \caption{A magnetic multilayer (a trilayer or ``sandwich'') that exhibits the GMR     effect.  Magnetic iron (red) and chromium (grey).}\label{setup}
    \end{figure}

     %\blindtext

     \end{multicols}

     \begin{figure}
\centering
\includegraphics[width=\textwidth]{Figures/initial-results.png}
\caption{The initial results displaying GMR effect by Gr\"unberg (left) and Fert (right).\\
    Left: To the far right and left the iron layers are parallel to the external magnetic field.  In the middle the iron layers are antiparallel to the external magnetic field.\\
    Right:  To the far left and right the magnetisation of the iron layers are parallel to the external magnetic field.  In the middle every second iron layer is magnetised perpendicular to the external magnetic field.} \label{fig-initial-results}
\end{figure}

\begin{multicols}{2}

%\blindtext

\subsection{GMR cause and effect}
By constructing multilayers as depicted in Fig \ref{setup} devices such as spin-valves can be constructed which depend on being able to switch between different resistivity, this resistivity can be understood by analysing the following diagram.

\end{multicols}

\end{document}

iopart 类的源文件可以在这里找到:http://authors.iop.org/atom/usermgmt.nsf/AuthorServices

在左侧选择乳胶指南和类文件,然后开始下载。

答案1

我没有这iopart门课。当我在 下运行它时article,我注意到了几件事。

  1. 您在环境中使用数字multicols。也许在 中这是允许的iopart
  2. newline您在标题中嵌入了中断。您要么使用\protect它们(即\protect\\),要么添加一个minipage环境中添加要放置在断行符之后的额外文本更短标题。

以下是我对标题的建议示例:

\begin{figure}
    \centering
    \includegraphics[width=\textwidth]{example-image-b}
    \caption{The initial results displaying GMR effect by Gr\"unberg (left)
             and Fert (right).}
    \begin{minipage}{\linewidth}\vspace{1ex}
        %%
        Left: To the far right and left the iron layers are parallel to the
        external magnetic field.  In the middle the iron layers are
        antiparallel to the external magnetic field.\\ 
        %%
        Right:  To the far
        left and right the magnetisation of the iron layers are parallel to
        the external magnetic field.  In the middle every second iron layer
        is magnetised perpendicular to the external magnetic field.
    \end{minipage}
        \label{fig-initial-results}
\end{figure}

否则,我仍然没有收到任何标签错误,但我使用的是不同的类。不幸的是,我今天没有时间加载该类并对其进行足够的了解,以查看是否存在问题。

但是,我猜你应该纠正和标题内容的问题multicols,看看是否能解决问题。我强烈怀疑你的iopart类可能隐藏了multicols错误,因此没有写出必要的标签。只需将图形移动到调用之前或之后即可multicols。我怀疑标题格式与标签问题有关。

因此,请尝试删除multicols关于数字的内容。无论是否可行,请对此答案发表回复。如果不行,那么我将删除此答案,因为该问题超出了我现在有时间研究的范围。

我希望这有帮助。

下面是完整的 MWE,展示了我的建议:

\documentclass[10pt]{iopart}
\usepackage{graphicx}
%Uncomment next line if AMS fonts required
\usepackage{iopams}
\usepackage{placeins}
\usepackage{url}
\usepackage{multicol}
\usepackage{blindtext}
\begin{document}

\section{Giant Magnetoresistance}

\begin{figure}
    \centering
    \includegraphics[width=0.5\textwidth]{example-image-a}\\
    \caption{A magnetic multilayer (a trilayer or ``sandwich'') that
             exhibits the GMR effect.  }
    \begin{minipage}{\linewidth}
        \vspace{1ex}
        Magnetic iron (red) and chromium (grey).
    \end{minipage}
        \label{setup}
\end{figure}

\begin{multicols}{2}

\blindtext

\blindtext

\blindtext

\subsection{GMR cause and effect}

By constructing multilayers as depicted in Fig \ref{setup} devices such as
spin-valves can be constructed which depend on being able to switch between
different resistivity, this resistivity can be understood by analysing the
following diagram.

\end{multicols}

\begin{figure}
    \centering
    \includegraphics[width=\textwidth]{example-image-b}
    \caption{The initial results displaying GMR effect by Gr\"unberg (left)
             and Fert (right).}
    \begin{minipage}{\linewidth}\vspace{1ex}
        %%
        Left: To the far right and left the iron layers are parallel to the
        external magnetic field.  In the middle the iron layers are
        antiparallel to the external magnetic field.\\ 
        %%
        Right:  To the far
        left and right the magnetisation of the iron layers are parallel to
        the external magnetic field.  In the middle every second iron layer
        is magnetised perpendicular to the external magnetic field.
    \end{minipage}
        \label{fig-initial-results}
\end{figure}

\end{document}

相关内容