基因逻辑包和奇怪的交叉引用行为

基因逻辑包和奇怪的交叉引用行为

我在使用时遇到了一些奇怪的行为gn-logic(基因逻辑)包与一些不同的交叉引用包。特别是variorefcleveref。以下是说明该问题的 MWE:

\documentclass{article}
\usepackage{gn-logic14}
\usepackage{kantlipsum}
\usepackage{varioref}
\usepackage[colorlinks=true,hyperfootnotes=false]{hyperref}
\hypersetup{colorlinks, citecolor=violet, linkcolor=black, urlcolor=blue}
\usepackage{cleveref}
\begin{document}


Here is a formula in gene-logic's Formula environment:
\begin{Formula}\label{eq:SubIden}
\Forall x \Forall y [(x = y) \IMPL (Fx \IMPL Fy)]
\end{Formula}
Now let's try to refer to the formula, using straight \textbackslash ref works as expected: \ref{eq:SubIden}. Trying with \textbackslash cref doesn't work: \cref{eq:SubIden}. Trying with \textbackslash vref doesn't work: \vref{eq:SubIden}. Trying with \textbackslash autoref does work: \autoref{eq:SubIden}.

\section{Example section}

Here is some bizarre behavior:
\begin{Formula}\label{eq:SubIden1}
\Forall x \Forall y [(x = y) \IMPL (Fx \IMPL Fy)]
\end{Formula}
Now let's try to refer to the formula, using straight \textbackslash ref works as expected: \ref{eq:SubIden1}. Trying with \textbackslash cref doesn't work, but this time rather than returning ``??'' as it does for me above, it refers to the section number containing the formula: \cref{eq:SubIden1}. Trying with \textbackslash vref does the same thing, but with the extra text describing the location:  \vref{eq:SubIden1}. Trying with \textbackslash autoref does work: \autoref{eq:SubIden}.


\end{document}

这是生成的图像:

图像

这到底发生了什么事?

答案1

这个答案基于我对原始问题所发表的评论以及 cmhughes 在 4 秒后所发表的评论。

问题是使用gene-logic(参见Formulaeqnarray这里),但cleveref与 不兼容eqnarray。此外,这在 24-25 页的“不是错误”部分中有所提及文档

14.1 非 Bug —— 以下不是 Bug。它们要么是故意的行为,要么是不可避免的行为,要么是由 LATEX 误解引起的:

...

  • Cleveref 无法与标准 LATEX eqnarray 环境一起正常工作。目前没有打算修复这个问题。eqnarray 环境实现得很糟糕,很难让它与 cleveref 一起正常工作,而且它无论如何都是有问题的。你最好使用 amsmath 替代品,比如 gather、align、multline 和 split,它们与 cleveref 一起正常工作。(见http://www.tug.org/pracjourn/2006-4/madsen/)。

因此,我认为您让这些达成一致的机会很小,您需要要么以不同的方式引用事物,要么使用不同的环境来代替Formula

cleveref正如 Speravir 评论中提到的,上面提到的文章有一个更新版本这里以及一些进一步的讨论(或者至少是有力的意见表达)这个答案。我不确定这些是否有助于解决此案中的具体问题,但我不完全确定有什么用处,Formula所以有点难以判断。

相关内容