# Issue with resetting theorem counter

I am using LyX to typeset a document. I wanted to use another theorem-like construct not available in `amsthm`. So I included it using LaTeX code.

``````\newtheorem{discussion}{Discussion}[section]
``````

This works fine except the next theorem that appears using the built in theorem construct ends up having the same number as the one above. I tried using `\stepcounter` and `\addtocounter`, but this does not change the numbering.

Any idea how to fix this?

-
There is no built-in theorem construct, unless it's LyX that provides one. –  egreg Mar 20 '12 at 14:08
@egreg: By "built-in" I meant "available in amsthm". I might be using incorrect terminology, but I don't think what I mean is ambiguous. –  Zoey Mar 20 '12 at 14:12
@henrique: I had read about the MWE, but as I said I am using LyX to do this, so I am not sure how I can provide an MWE for that. If I export to latex and try to compile, I end up getting a bunch of errors which are not representative of my situation. –  Zoey Mar 20 '12 at 14:24

## 1 Answer

If you want this new structure to share the counter of a previously defined theorem-like environment, you can use the first optional argument of `\newtheorem` to indicate the counter dependance; for example:

``````\newtheorem{theorem}{Theorem}[section]
\newtheorem{discussion}[theorem]{Discussion}
``````
-
Thanks for the answer. This is exactly what I had initially. This did not work for me either. Perhaps it's the way LyX interacts with latex code. –  Zoey Mar 20 '12 at 14:19
@Zoey Then, we'll need to see a minimal, complete example of your actual code showing the settings relevant for this issue. Please add this minimal version to your question. –  Gonzalo Medina Mar 20 '12 at 14:22
I am using LyX to do this, so I am not sure how I can provide an MWE for that. If I export to latex and try to compile, I end up getting a bunch of errors which are not representative of my situation. –  Zoey Mar 20 '12 at 14:28
@Zoey: and I have no idea about LyX; anyway, build in LyX a document as short as possible illustrating the problem and then export it to LaTeX, and upload it somewhere. Add the link to your original question so someone can take a look at it and see if the problem can be found. –  Gonzalo Medina Mar 20 '12 at 18:16