Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Incompatibility between cleveref and Springer journal classes

1,960 views
Skip to first unread message

Ted Pavlic

unread,
Jul 9, 2007, 4:15:05 PM7/9/07
to
It looks like cleverref

http://www.ctan.org/tex-archive/help/Catalogue/entries/cleveref.html

is incompatible with the document classes distributed with Springer
journals. Consider the following TeX example:

% ========
\documentclass{svjour3} % svjour2 also fails, but article works fine

\usepackage{hyperref}
\usepackage[hyperref]{cleveref}

\begin{document}

\begin{equation}
x = 5
\end{equation}

\end{document}
% ========

It produces the error:

% ========
! TeX capacity exceeded, sorry [input stack size=5000].
\cl@chapter ->\cl@chapter
\@elt {theorem}
l.9 \begin{equation}
% ========

It seems to be the equation environment that causes the problem.
Getting rid of it fixes things.

Does anyone know what might be causing this and how to fix it?

--Ted

P.S.

I'd like to use cleverref instead of \autoref because it gives me more
control over what part of the expanded reference gets hyperlinked
(e.g., just the "1" in "Equation (1)" rather than the whole thing).

Danie

unread,
Jul 10, 2007, 5:21:08 AM7/10/07
to

Be carefull when you use cleverref, it redefines latex internals such
as (if I remember correctly) \refstepcounter etc. this will cause a
lot of compatability problems, even simple commands, but often used
command,s such as \text from the AMSmath package can be broken.

Publisher styles such Springer's includes a lot of their owns stuff
and the best advice is to use as few as possible additional packages
with them, espcially if it is for a publication. Go with the with the
stock-standard \ref commands .
Danie


Ted Pavlic

unread,
Jul 11, 2007, 6:45:05 AM7/11/07
to
Keep in mind that cleveref has a "poorman" option that actually
produces a sed script that you can use to strip all of the cleveref
macros from your document so that the final document doesn't require
cleveref.

Therefore, that allows cleveref to be used locally to produce the
content even if you're worried about the journal frowning on its use.

> Publisher styles such Springer's includes a lot of their owns stuff
> and the best advice is to use as few as possible additional packages
> with them, espcially if it is for a publication. Go with the with the
> stock-standard \ref commands .

I think this is a little overly cautious. Many journals ask authors
specifically to use packages like natbib and hyperref (via \autoref)
to increase the readability and notational consistency in articles.

If a journal does not support an often-used package (like natbib or
hyperref), then I think pressure should be put on that journal to fix
that. After all, that will end up making things much easier for the
journal's internal typesetters. I recognize that cleveref is fairly
new, but certainly there shouldn't be a problem with autoref and/or
varioref.

For the moment, if you really don't want to use cleveref, I think a
similar and maybe more stable solution is to combine hyperref's
autoref with varioref's labelformat. \autoref expands references
automatically and varioref allows things like round brackets to be
added around reference numbers.

It just seems silly and backward to use the standard \ref and \cite
commands. It's only asking for trouble, and it makes adjacent journal
articles look completely different.

ts...@cantab.net

unread,
Jul 11, 2007, 7:49:20 AM7/11/07
to

As the author of cleveref, I can make a few comments on this.

On Jul 10, 10:21 am, Danie <dnj...@netscape.net> wrote:
> Be carefull when you use cleverref, it redefines latex internals such
> as (if I remember correctly) \refstepcounter etc. this will cause a
> lot of compatability problems, even simple commands, but often used
> command,s such as \text from the AMSmath package can be broken.

This is simply not true. Firstly, cleveref doesn't break the \text
command in any way, or (as far as I'm aware) any other part of
AMSmath. I'd consider it a major bug if it did. It would be better not
to make comments like this in a public forum without testing them for
veracity first.

More generally, the internal changes that cleveref makes to
\refstepcounter are very minor, and *only* affect what's written to
the aux file, nothing else. And as if that weren't enough, the changes
it makes are essentially the same as the changes made by varioref,
hyperref, and many other packages that alter the referencing system.
Since hyperref is very widely used, and varioref is even a required
package, any packages that don't work with cleveref are almost certain
to break hyperref and varioref (though they will probably contain code
to patch them up so that they work again, simply because these
packages are so widely used). One of the reasons I implemented
cleveref internally in a very similar way to varioref was to make sure
it was as widely compatible as possible.

Cleveref works fine with American Physical Society journal style files
(REVTeX), and with AMSmath. I haven't had time to look into the
Springer style files yet, but I expect they alter the internals of the
equation environment in a far more radical way than cleveref's minor
changes to \refstepcounter. (Assuming this really is what's going on,
one could argue that this is a poor choice of design on the part of
Springer, as it will break many useful packages, and must make for a
lot of work supporting packages like hyperref and varioref. APS manage
just fine without breaking compatibility with standard LaTeX or
AMSmath.)


> Publisher styles such Springer's includes a lot of their owns stuff
> and the best advice is to use as few as possible additional packages
> with them, espcially if it is for a publication. Go with the with the
> stock-standard \ref commands .

I entirely agree with this...apart from the final comment. Journals
understandably only support a small subset of all the packages on
CTAN, and I would never advocate submitting LaTeX source to a journal
that uses an unsupported package. Apart from anything else, publishing
houses often don't use LaTeX internally, but instead have scripts to
translate it into their own typesetting language.

However, this is *precisely* the reason I implemented cleveref's
"poorman" option, which Ted also mentions in his reply. Once you're
ready to submit, you can supply this option to cleveref, LaTeX your
document, and it will spit out an automatically generated sed script.
Running your source files through this script then strips out all the
cleveref code, replacing it with stock-standard \ref commands. The
resulting version of your source files will produce identical output
when LaTeX'ed, but without requiring cleveref. The publisher never
even knows you're using cleveref! And since the version of the source
that they see doesn't use cleveref, there's absolutely no way it can
break anything.

Using the poorman option, you get all the benefits of cleveref without
having to worry about compatibility with journals' in-house styles.
Obviously, I'd be delighted if publishers started supporting cleveref.
But I'm not so naive as to think this will happen any time soon, and
until such time I'll be using cleveref with the "poorman" option for
all my papers.

I hope that clears things up a bit.

Toby

Dan

unread,
Jul 11, 2007, 3:46:38 PM7/11/07
to
On Jul 9, 3:15 pm, Ted Pavlic <ted.pav...@gmail.com> wrote:
> It looks like cleverref
>
> http://www.ctan.org/tex-archive/help/Catalogue/entries/cleveref.html
>
> is incompatible with the document classes distributed with Springer
> journals. Consider the following TeX example:

It is actually these documentclass that are incompatible with
standard LaTeX practices.

Every latex counter has something called a reset list. Whenever
that counter is stepped, the counters in that reset list are reset
to 0. The cleveref package examines the reset list for all the
sectioning units and makes decisions on the basis of what it
finds in them.

The svjour3 class is an article-like class, so it has no chapter
command. Therefore, it doesn't define the chapter counter.
However, inexplicably, it does set up a reset list for the
chapter counter by issuing \@addtoreset{theorem}{chapter}.
Without a chapter counter, this reset list is malformed and
cleveref cannot deal with it.

Two workarounds:

1. Put
\newcounter{chapter}
BEFORE \documentclass{svjour3}

OR

2. Put
\makeatletter \let\cl@chapter\relax \makeatother
anywhere in the preamble.


Dan

Ted Pavlic

unread,
Jul 14, 2007, 1:27:53 PM7/14/07
to
> It is actually these documentclass that are incompatible with
> standard LaTeX practices.

I figured this would actually be the case. :(

> The svjour3 class is an article-like class, so it has no chapter
> command. Therefore, it doesn't define the chapter counter.
> However, inexplicably, it does set up a reset list for the
> chapter counter by issuing \@addtoreset{theorem}{chapter}.
> Without a chapter counter, this reset list is malformed and
> cleveref cannot deal with it.

That's fascinating.

I'll have to send Springer something.

Now, I notice that I still get errors if I include \labelformat
commands along with cleveref; however, I don't need labelformat when I
have cleveref, so that shouldn't be that big of a deal.

Thanks! --
Ted

Dan

unread,
Jul 16, 2007, 2:23:23 PM7/16/07
to
On Jul 14, 12:27 pm, Ted Pavlic <ted.pav...@gmail.com> wrote:
> > It is actually these documentclass that are incompatible with
> > standard LaTeX practices.
>
> I figured this would actually be the case. :(
>
> > The svjour3 class is an article-like class, so it has no chapter
> > command. Therefore, it doesn't define the chapter counter.
> > However, inexplicably, it does set up a reset list for the
> > chapter counter by issuing \@addtoreset{theorem}{chapter}.
> > Without a chapter counter, this reset list is malformed and
> > cleveref cannot deal with it.
>
> That's fascinating.
>
> I'll have to send Springer something.

In case Toby is following this and wants to try to work
around this in cleveref, or if you want to send Springer
more detail. Or if the latex team want to put error checking into
\@addtoreset::

The \@addtoreset{chapter}{theorem} command does (ultimately)
the following:
\expandafter\xdef\csname cl@chapter\endcsname
{\csname cl@chapter\endcsname\@elt{theorem}}
When the chapter counter is defined with \newcounter, the
\cl@chapter command is initialized to \@empty. In that case,
\cl@chapter
has become defined as
\cl@chapter --> \@elt{theorem}
On the other hand, if the chapter counter is not defined, then
\cl@chapter
is undefined and so the \csname cl@chapter\endcsname is treated as
\relax
in the \xdef and left alone. Afterwards, when cl@chapter is executed
(by another \@addtoreset command or by cleveref) it _has_ been
defined, but expands to


\cl@chapter -> \cl@chapter\@elt{theorem}

generating an infinite loop.

>
> Now, I notice that I still get errors if I include \labelformat
> commands along with cleveref; however, I don't need labelformat when I
> have cleveref, so that shouldn't be that big of a deal.
>

Both varioref and cleveref redefine refstepcounter so it is perhaps
not surprising if they conflict. On the other hand, since svjour3
doesn't define any of the aspects of the chapter counter (except
the mistakenly defined \cl@chapter), it could be that svjour3 is
again at fault. A minimal example could help sort it out.


Dan

Ted Pavlic

unread,
Aug 7, 2007, 2:07:03 PM8/7/07
to
FYI --

> 2. Put
> \makeatletter \let\cl@chapter\relax \makeatother
> anywhere in the preamble.

This was the only workaround that was sure to work in every case I
tried. The other solution still caused the error in some cases.

Additionally, I notice that the elsart packages have a similar
problem. They require:

\makeatletter \let\cl@part\relax \makeatother

That's really frustrating.

--Ted

tabealh...@gmail.com

unread,
Mar 19, 2015, 4:27:54 AM3/19/15
to
thanks dan, it was very helpful.
0 new messages