1

I am using krantz-single.sty in which the environments example and theorem are already defined with its own fonts, numbering (according to chapter) etc. I would like to number examples and theorems consecutively. So, I cannot use amsthm.sty to define Example as a newtheorem. I need only the counter for numbering to change. How to do it?

Arvind
  • 111
  • What you're after is making (say) the example counter be exactly (say) the theorem counter. For this, you can use any of the methods described in Slave duplicate counter (possible duplicate). – Werner Sep 24 '16 at 05:35
  • 3
    (1) welcome, (2) I've never heard of that package. Is ii readily available? In any case, please provide a minimal, but compilable document that shows how you use it and show the problem you have with the examples. That others will have something to start with, and it will be easier for them to help. – daleif Sep 24 '16 at 05:37
  • where can Krantz-single.sty be found? – barbara beeton Sep 24 '16 at 13:48
  • It is style file for typing a book by CRC Press. – Arvind Sep 25 '16 at 11:37
  • Slave duplicate counter: The slave counter there is a new environment that shares everything with the master environment. But what is needed is only the counter of slave will be following the counter of master; nothing else. – Arvind Sep 25 '16 at 11:44
  • 1
    krantz_single.sty is here: https://github.com/aperotte/sLDA_2011/blob/master/Krantz-v3/krantz_single.sty

    \documentclass[a4paper]{book} \usepackage{krantz_single}

    \begin{document}

    \begin{theorem} This is first theorem, Theorem~0.1. \end{theorem} \begin{example} This example should be numbered 0.2. \end{example} \begin{theorem} This is second theorem, to be numbered Theorem~0.3 \end{theorem} \end{document}

    – Arvind Sep 26 '16 at 09:22
  • Looks like the following in the preamble is working: \usepackage{ntheorem} \usepackage{thmtools} % \theoremstyle{break} \renewtheorem{theorem}[Example]{{\em Theorem}} But this may be resetting the theorem environment, and not just sharing the counter with Example. To conform to the style, I had to put % \theoremstyle{break}. Any idea how to reset only the counter so that theorems and examples are numbered consecutively, and nothing else? – Arvind Sep 26 '16 at 09:53

1 Answers1

3

Warning: the krantz_single package looks a little bit strange. It has counters named THEOREM or Example, so there's not really a consistent naming scheme.

However, the shared feature can be achieved with the concept of coupled counters from the xassoccnt package.

The advantage of the xassoccnt package is that it allows for an 'arbitrary' number of counter names as being coupled (well, nobody would do that really!)

Just define a group name, say krantz and fill the group with the name of the counters, THEOREM and Example here with \DeclareCoupledCounters.

The counters are consecutively stepped each time each member of the counter group is increased with \stepcounter or \refstepcounter.

\documentclass[a4paper]{book} 

\usepackage{krantz_single} 
\usepackage{xassoccnt}
\DeclareCoupledCountersGroup{krantz}

\DeclareCoupledCounters[name=krantz]{THEOREM,Example}
\begin{document} 
\begin{theorem} This is first theorem, Theorem~0.1.
\end{theorem} 
\begin{example} This example should be numbered 0.2.
\end{example} 
\begin{theorem} This is second theorem, to be numbered Theorem~0.3
\end{theorem} 
\end{document}

enter image description here