4

I am getting some bizarre behavior using the gn-logic (gene-logic) package with some of the various cross-referencing packages. In particular varioref and cleveref. Here is a MWE illustrating the issue:

\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}

This is the image generated:

image

What on earth is going on here?

Dennis
  • 3,855
  • This seems relevant to the second set of issues: appendix referenced as section. – Dennis Mar 05 '14 at 00:16
  • Actually, I'm thinking that gene-logic might have nothing to do with the bug I'm experiencing. If that turns out to be the case I'll remove the tag and references to it in the title. – Dennis Mar 05 '14 at 00:25
  • 1
    I'm not certain but gene-logic seems to define Formula in terms of eqnarray which is not compatible with cleveref according to the latter's documentation. – cfr Mar 05 '14 at 00:28
  • 2
    gn-logic14 internally uses eqnarray; the cleverref package says that it will not work properly with eqnarray and there is 'no intention to fix this. The eqnarray environment is poorly implemented' – cmhughes Mar 05 '14 at 00:28
  • 2
    @cmhughes 4 seconds... ;) – cfr Mar 05 '14 at 00:28
  • 1
    It does add ' You’re far better off using the amsmath replace- ments, such as gather, align, multline and split, which do work properly with cleveref. (See http://www.tug.org/pracjourn/2006-4/madsen/).' Perhaps that can be of some use. – cfr Mar 05 '14 at 00:30
  • @cmhughes Ah! I've seen the "Avoid eqnarray!" warnings before. Didn't realize gn-logic14 would use it. – Dennis Mar 05 '14 at 00:33
  • @cmhughes If you'd like to turn your comment into an answer I'd be happy to accept it. – Dennis Mar 05 '14 at 00:41
  • @cfr beat me by 4 seconds, the glory is his/hers :) – cmhughes Mar 05 '14 at 00:47
  • @cmhughes Ah, good call, flipped the names vertically. cfr it's yours for the taking! – Dennis Mar 05 '14 at 00:50
  • 2
    For the sake of 4 seconds, then... – cfr Mar 05 '14 at 00:51

1 Answers1

4

This answer is based on the comments I made on the original question and which cmhughes posted just 4 seconds later.

The problem is that gene-logic defines the Formula environment using eqnarray (see here) but cleveref is incompatible with eqnarray. Moreover, this is featured in the 'not a bug' section on page 24-25 of the documentation:

14.1 Non-Bugs -- The following are not bugs. They are either intentional behaviour, unavoidable behaviour, or are caused by LATEX misunderstandings:

...

  • Cleveref will not work properly with the standard LATEX eqnarray environment. There is no intention to fix this. The eqnarray environment is poorly implemented, making it difficult to get it to work properly with cleveref, and it’s broken any way. You’re far better off using the amsmath replacements, such as gather, align, multline and split, which do work properly with cleveref. (See http://www.tug.org/pracjourn/2006-4/madsen/).

So I suspect your chances of getting these to agree are slim and you will need to either reference things differently or use a different environment in place of Formula.

As mentioned in Speravir's comment, there is an updated version of the article cleveref refers to above available here and some further discussion (or, at least, forceful expressions of opinion) in this answer. I am not sure any of this will help with the specific problem in this case but I'm not entirely sure what purpose Formula serves so it is a bit difficult to judge.

cfr
  • 198,882