每当我尝试用以下格式标记方程式时
\begin{equation}\label{eq:blah}
blah
\end{equation}
然后参考这个方程
By \eqref{eq:blah}
我得到了通常情况下 (??) 的不明确标签。不过,这种情况只发生在方程环境中。
我尝试删除序言中我能想到的几乎所有内容以使其发挥作用,但无济于事。
因此,我发布的 MWE 并不是很简洁——抱歉!
任何帮助是极大的赞赏!
\documentclass{book}
\usepackage{amsfonts,amssymb,latexsym,verbatim,url,color,mathrsfs,tikz,extarrows,enumerate,lipsum,mathtools}
\usepackage[nameinlink]{cleveref}
\usepackage{enumerate,fancyhdr,verbatim,comment}
\usepackage{dsfont}
\usetikzlibrary{matrix,arrows}
\usepackage[colorlinks = true,
linkcolor = blue,
urlcolor = blue,
citecolor = blue,
anchorcolor = blue]{hyperref}
\usepackage[amsmath,thmmarks]{ntheorem}
\newcounter{dummy}
\numberwithin{dummy}{chapter}
\theoremprework{\setlength
\theorempreskipamount{10 pt}\setlength\theorempostskipamount{10 pt}}
\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{example}[dummy]{Example}
\begin{document}
\begin{equation}\label{eq:example}
\int_a^b f(x)\, dx=F(b)-F(a)
\end{equation}
By Equation \eqref{eq:example}
\end{document}
新 MWE:
\documentclass{book}
\usepackage{amsfonts,amsmath,amssymb,latexsym,verbatim,url,color,mathrsfs,tikz,extarrows,enumerate,lipsum,mathtools}
\usepackage{enumerate,fancyhdr,verbatim,comment}
\usepackage{dsfont}
\usepackage[margin=1 in]{geometry}
\usetikzlibrary{matrix,arrows}
\usepackage[amsmath,thmmarks]{ntheorem}
\usepackage[colorlinks = true,
linkcolor = blue,
urlcolor = blue,
citecolor = blue,
anchorcolor = blue]{hyperref}
\usepackage[nameinlink]{cleveref}
\newcounter{dummy}
\numberwithin{dummy}{chapter}
\theoremprework{\setlength
\theorempreskipamount{10 pt}\setlength\theorempostskipamount{10 pt}}
\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{example}[dummy]{Example}
\begin{document}
\begin{equation}\label{eq:example}
\int_a^b f(x)\, dx=F(b)-F(a)
\end{equation}
By Equation \eqref{eq:example}
\end{document}
答案1
正如我在评论中提到的,问题在于软件包axtarrows
和。即使没有提供引用comment
,它们也会导致错误。这两个软件包还与其他一些软件包发生冲突,我没有进一步调查。你的文本中真的需要这些软件包吗?ntheorem
equation
我建议将您的包加载到具有类似用途(数学等)的组中。我根据自己的喜好/习惯这样做了。因此,在此之后,您的 MWE 代码为:
\documentclass{book}
\usepackage{mathtools,amssymb,latexsym,
color,mathrsfs}
% amsfont is load by amsmath and amsmath by maththools
% url is also part of hypperref package, no need to be loaded
% verbatim enumerate are loaded twice
% extarrows make troubles, I suggest to omit it, most its functionality is achievable by mathtools
% tikz and lipsum I moved in new group of packages
\usepackage{enumerate,fancyhdr,verbatim}
% comment make troubles, in all my needs is sufficient to use \begin{comment} ... \end{comment} from verbatim package
\usepackage{lipsum}% produce dummy text
\usepackage{dsfont}
\usepackage[margin=1 in]{geometry}
\usepackage{tikz}% for drawing pictures
\usetikzlibrary{matrix,arrows}
\usepackage[amsmath,thmmarks]{ntheorem}
\newcounter{dummy}
\numberwithin{dummy}{chapter}
\theoremprework{\setlength
\theorempreskipamount{10 pt}\setlength\theorempostskipamount{10 pt}}
\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{$\square$}% you not use a symbol for end of example
\theoremseparator{:}
\newtheorem{example}[dummy]{Example}
\usepackage[colorlinks = true,
linkcolor = blue,
urlcolor = blue,
citecolor = blue,
anchorcolor = blue]{hyperref}
\usepackage[nameinlink]{cleveref}
\begin{document}
\begin{equation}\label{eq:1}
\int_a^b f(x)\, dx=F(b)-F(a)
\end{equation}
By Equation \eqref{eq:1} \dots
\begin{example}
Let explain \eqref{eq:1} with \dots
\begin{equation}\label{eq:2}
\int_a^b f(x)\, \mathrm{d}x = F(b)-F(a)
\end{equation}
\end{example}
Regarding \eqref{eq:2} \dots
\end{document}
使用上述 MWE 我编译它时没有任何问题: