# newtheorem report class with part' as reset counter

Sorry i have no MWE for this question.

I have a .dtx class and looking at the diff between a previous "good" version and the present i have, there is nowhere some recollection about what exactly is wrong, but here it is. So i ask in the direction of more details about part.

Ok, so the class issues a \renewtheorem{test}[part]{Name}, and users create environments, for instance:

\begin{test}\label{abc}
Ok.
\end{test}


But when typeset "as in test (\ref{abc})" instead of

as in test (1)

(before) the document shows

as in test (.1).

Not where, but why is that dot popping up there?

In a simplistic MWE, the part is not showing its presence w.r.t. dot in \ref. What can cause the dot there? If i set \renewcommand\thepart{100} then \ref{abc} is 100.1: still the dot!

Thank s.

-
Maybe it is how the numbering is defined and may be dependent on the section, chapter or part you are in. Check how the theorem style test is defined and whether you see a . there. –  azetina May 28 '12 at 19:25
no \theoremnumbering for test environment is invoked, only \theoremclass and \theoremstyle. –  sjbiaga May 28 '12 at 19:59
Isn't the result you are getting because you are using part to start with. Seemingly you don't want the dot but that is what the theorem numbering will look like dependent on the part number you are in. If you remove the part section then probably the numbering will result as 1 without a dot. I really can't get what is what you are asking. –  azetina May 28 '12 at 20:08
Yes, it seems it didn't do as above, but instead \renewtheorem{test}{Name}[part] (part at the end); i explicitly put them in order and it works. i know what is wrong: some \ifthenelse tests are missing. thank s a lot! –  sjbiaga May 28 '12 at 20:14
Why don't you post the answer to your question here? If you have resolved the issue that is the least you can do. –  azetina May 28 '12 at 20:20

When you state \newtheorem{thm}[part]{Theorem} you're telling LaTeX that the thm environment should use the part counter, rather than defining a new one just for the environment. Thus, assuming this is the first theorem and that no \part command has been issued, the code

\begin{thm}\label{abc}
Text
\end{thm}

This is the reference~(\ref{abc}).


would print

Theorem I Text

This is the reference (I).

\newtheorem{thm}{Theorem}[part]


which is completely different. In this case a thm counter is created and it resets whenever part is stepped. Moreover, \thethm is defined by

\newcommand\thethm{\thepart.\arabic{thm}}


and this explains your output. Indeed the report class defines

\newcommand\thepart{\Roman{part}}


and when you issue no \part command the counter's value is 0, so that \thepart prints nothing. That's why you get .1 both as the theorem's number and in the references to it. Redefining \renewcommand{\thepart}{100} doesn't change the definition of \thethm, which will give 100.1.

-

The .dtx has the list part,chapter,section,subsection,subsubsection (of \LaTex counters), and a list of ntheorem environments/counters a,b,c,d,e,...; b can only use a as shared counter or a \LaTeX reset counter; d only a,b,c, and so. In cases of "no shared counter" among a,b,c,..., the part counter is used as sentinel, when \renewtheorem{}{} must be issued without shared or reset counter specified. The search in the \LaTeX list did not single this case out, in order to distinguish part from the other chapter,section,subsubsection cases.

Removing the [part] section as suggested distinguishes from the erroneuos "[part] last" as it was (confused) at start, and directed me to detect the line of code for the missing \ifthenelse.

NB: part is not involved in typesetting the report document.

-