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.

Suppose I have a theorem that is defined a certain way, as follows.

\newtheorem*{mytheorem}{Foo}

And I want to redefine it another way further down in my document, as below.

\newtheorem*{mytheorem}{Bar}

What is the easiest way to go about this?

I would like something like this, but I get undefined control sequence on \renewtheorem.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}

\begin{document}
\theoremstyle{definition}
\newtheorem*{thmTemp}{Foo}
\begin{thmTemp} First one.  \end{thmTemp}

\renewtheorem*{thmTemp}{Bar}
\begin{thmTemp} Second one.  \end{thmTemp}
\end{document}

When I run pdflatex on this, I get the following:

! Undefined control sequence.
l.10     \renewtheorem
                  *{thmTemp}{Bar}

I am avoiding ntheorem because it does not preserve the theorem styles defined by amstheorem, even when the amsthm option is passed to it, and I would prefer not to redefine those styles.

share|improve this question
    
Have you tried \renewtheorem? It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. That way we would know which packages you are using as some solutions may be package specific. –  Peter Grill Mar 18 '13 at 6:13
    
Try replacing amsthm with ntheorem. –  Peter Grill Mar 18 '13 at 6:22
    
@PeterGrill, There's actually a specific reason I want to use amsthm and not ntheorem. I prefer not to redefine \theoremstyle{definition} among others. –  merlin2011 Mar 18 '13 at 6:23
    
And yes, I have tried the [amsthm] option to ntheorem, but it does not achieve the desired effect. –  merlin2011 Mar 18 '13 at 6:23
1  
Perhaps it would help if you specified more closely what you mean by 'redefine it another way'... How do you expect the redefined theorem environment to behave? Do you simply want to change the heading and continue numbering with the previous counter? Or do you also want to change the style of the theorem? –  benwilfut Mar 18 '13 at 8:12

1 Answer 1

up vote 5 down vote accepted

Rather than redefining the environment each time, I would define a wrapper:

\documentclass{article}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem*{inner}{\innerheader}
\newcommand{\innerheader}{}
\newenvironment{defi}[1]
 {\renewcommand\innerheader{#1}\begin{inner}}
 {\end{inner}}

\begin{document}
\begin{defi}{Foo}
First one.
\end{defi}

\begin{defi}{Bar}
Second one.
\end{defi}
\end{document}

enter image description here

share|improve this answer

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.