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?

  • 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 5 '14 at 0: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 5 '14 at 0:28
  • 2
    @cmhughes 4 seconds... ;) – cfr Mar 5 '14 at 0: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 tug.org/pracjourn/2006-4/madsen).' Perhaps that can be of some use. – cfr Mar 5 '14 at 0:30
  • 2
    For the sake of 4 seconds, then... – cfr Mar 5 '14 at 0:51
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.