5

I'm trying to switch from amsthm to ntheorem. (This is due to the incompatibility of amsthm with babel+Hebrew, see here and here; seems not to have been resolved.)

I would like to have both a starred and unstarred versions of certain environments, with the starred version being unnumbered. With amsthm I would do:

\newtheorem{theorem}{Theorem}
\newtheorem*{theorem*}{Theorem}

and this does what I want. With ntheorem, this results in an error - theorem* is already defined; removing the second command, both environments come out numbered, and the difference is that the theorem* doesn't get included in the list of theorems (which I don't use anyway). I tried this both with the [amsthm] option of ntheorem and without it.

Is there anything I can do other then give up theorem* in favor of something like

\newtheorem*{theoremstar}{Theorem}

?

  • 1
    If the switch is away from amsthm rather than to ntheorem, you could define your own (starred and unstarred) versions of theorem using primitives, rather defining them via ntheorem. Would that work? – Werner Jul 27 '11 at 20:51
3

Looking through the ntheorem documentation, I saw \renewtheorem mentioned; so:

\renewtheorem*{theorem*}{Theorem}

is a working hack. Now, if only I could macroize the choice between newtheorem and renewtheorem, so that I can use the same preamble code for both ntheorem and amsthm.

0

Re OP's answer: what about

\providecommand{\renewtheorem}{\newtheorem}

so that \renewtheorem is defined as \newtheorem when using amsthm and is not redefined when using ntheorem? This is a dirty hack, but should work irrespective of which of amsthm or ntheorem is used.

A cleaner version would be

\makeatletter
\@ifpackageloaded{amsthm}{what if loaded}{what if not}
\@ifpackageloaded{ntheorem}{what if loaded}{what if not}
\makeatother
  • Well, giving \renewtheorem the semantics of \newtheorem is a bit confusing, I feel. As for \@ifpackageloaded, that's something, but in itself it means some redundancy, or interspersing \@ifpackageloadeds with common code. I guess there's not much that can be done beyond that though. – einpoklum Sep 20 '11 at 6:13
  • Well, what you also could do is to write one's own "theorem" package. I do not know much about ntheorem, but amsthm is somewhat broken anyway, so this might actually be a good idea. – mbork Sep 20 '11 at 13:56
  • If I had spare time on my hands, I might... something like the algpseudocode which make algorithmicx behave like algorithm, right? – einpoklum Oct 7 '11 at 14:45
0

I can't think of any other possibility than the one you mention too, i.e., \newtheorem*{theoremstar}{Theorem}. It looks a bit unwieldy, but it works!

Addendum 2 Oct 2011: Please see my answer to this question for a more complete answer to your question about how to create a theorem style in which the "starred" version of a theorem is unnumbered.

  • It is because ntheorem has a feature where it can make a list of theorems. And theorem* will then not add an entry to this list. IMO when users are not using this feature, they should be allowed to use theorem* in the manner the OP wants. One may send this as a suggestion to Wolfgang May (the ntheorem author). – daleif Jul 21 '11 at 10:27
  • I just wrote him. One of the ways this could be done is making the list-of-theorems capability a package option, and if you choose not to have it, the theorem* environments don't get defined. Of course, all this wouldn't really help me since I can't have my thesis rely on yet-unreleased package versions... I'll have to make do I guess. – einpoklum Jul 21 '11 at 11:46

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.