Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using MikTeX 2.9. When processing the following:

\documentclass{article}
\usepackage{hyperref}
\usepackage[hyperref]{ntheorem}
\usepackage{aliascnt}

\newtheorem{lemma}{Lemma}
\newaliascnt{definition}{lemma}
\newtheorem{definition}[definition]{Definition}
\aliascntresetthe{definition}

\begin{document}

\begin{definition}
\label{def:first}
This is my definition.
\end{definition}

\begin{definition}[Alternative to \autoref{def:first}]
This is my second definition.
\end{definition}

\end{document}

I get:

! TeX capacity exceeded, sorry [grouping levels=255].
\HyRef@autoref #1#2->\begingroup 
                                 \Hy@safe@activestrue \expandafter \HyRef@au...
l.31 ...ition}[Alternative to \autoref{def:first}]

If I remove the autoref, all is well. This doesn't happen to me with amsthm instead of ntheorem. Am I doing something wrong? Is it an ntheorem bug? an aliascnt bug?

share|improve this question
add comment

2 Answers

This seems to work; the problem seems to be in the counter's name

\documentclass{article}
\usepackage[hyperref]{ntheorem}
\usepackage{aliascnt}
\usepackage{hyperref}
\newcommand\definautorefname{Definition}

\newtheorem{lemma}{Lemma}
\newaliascnt{defin}{lemma}
\newtheorem{definition}[defin]{Definition}

\begin{document}

\begin{definition}
\label{def:first}
This is my definition.
\end{definition}

\begin{definition}[Alternative to \autoref{def:first}]
This is my second definition.
\end{definition}

\end{document}
share|improve this answer
2  
also, hyperref should be loaded last (as you've done). –  barbara beeton Jul 21 '11 at 15:40
    
But why shouldn't it just work the way it is, without me having to use a different counter name? :-( –  einpoklum Jul 21 '11 at 18:59
    
Sorry, ask Heiko Oberdiek; he is always very keen on receiving comments and bug reports. –  egreg Jul 21 '11 at 22:44
    
@egreg: Just though I'd report I wrote Heiko Oberdiek (heiko.oberdiek at googlemail dot com) on 2011-07-23, and he hasn't answered yet. –  einpoklum Oct 30 '11 at 19:26
add comment
up vote 0 down vote accepted

Well, at least I can have nice macro for this:

\makeatletter
\def\newaliasedtheorem#1[#2]#3{%
  \newaliascnt{#1@alt}{#2}
  \newtheorem{#1}[#1@alt]{#3}
  \expandafter\newcommand\csname #1@altname\endcsname{#3}
}
\makeatother

Use it instead of \newtheorem, i.e. rather than:

\newtheorem{mynewenv}[existingcounter]{MyNewEnvName}

do

\newaliasedtheorem{mynewenv}[existingcounter]{MyNewEnvName}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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