1

I am using thmtools as a front end to amsthm and I have a definition environment as follows.

\declaretheorem[
    style=mydefinitionstyle,
    name=Definition,
    numberwithin=chapter
]{definition}

And what I want is another environment, say called definitionAlt, which would be used to give an alternative definition of the one just given, i.e., it uses the same number/counter as the definition just given but adds an "a" (or "b" or whatever), without incrementing the counter, and cross-referencing would still work.

\begin{definition}
\label{def:main_definition}
This is a definition which is numbered 1.1
\end{definition}

\begin{definitionAlt}
\label{def:alt_definition}
This is an alternative definition to the preceding one, which is automatically numbered 1.1a
\end{definitionAlt}

I have seen similar questions such as What’s the most straightforward way to typeset theorems etc. when the numbering is entirely manual?

which does some manual theorem numbering, but I cant find an answer that does exactly what I want.

Doe anyone have any suggestions?

  • This has come up several types. This is possible with counters. Just define a new counter, call it defntype, which is \alph and hook that counter to this environment. – kan May 09 '13 at 15:01
  • 1
    I think what I am trying to do is closer to this - http://tex.stackexchange.com/questions/101814/using-amsthm-to-number-examples-how-do-i-account-for-altered-examples-i-e-1?rq=1 – conorsomahony May 09 '13 at 15:24

1 Answers1

4
\documentclass{report}
\usepackage{thmtools} 
\declaretheorem[
    style=mydefinitionstyle,
    name=Definition,
    numberwithin=chapter
]{definition}

\declaretheorem[
    style=mydefinitionstyle,
    name=Definition,
    numberwithin=definition,
]{definitionAlt}
\renewcommand\thedefinitionAlt{\thedefinition\alph{definitionAlt}}

\begin{document}
\chapter{Testing Alternate Definitions Counter} 
\begin{definition}
\label{def:main_definition}
This is a definition which is numbered 1.1
\end{definition}

\begin{definitionAlt}
\label{def:alt_definitiona}
This is an alternative definition to the preceding one, which is automatically numbered 1.1a
\end{definitionAlt} 

\begin{definitionAlt}
\label{def:alt_definitionb}
This is an alternative definition to the preceding one, which is automatically numbered 1.1b.
\end{definitionAlt} 

\begin{definition}
\label{def:another_main_definition}
This is a definition which is numbered 1.2.
\end{definition}
And, of course, I can refer to my second alternate definition, the definition \ref{def:alt_definitionb} and my another definition, the definition \ref{def:another_main_definition} quite well!

\begin{definitionAlt}
\label{def:new_alt_definitiona}
This is an alternative definition to the preceding one, which is automatically numbered 1.2a.
\end{definitionAlt} 

begin{definition}
\label{def:yet_another_main_definition}
This is a definition which is numbered 1.3.
\end{definition}
\end{document} 

Thanks to Marco Daniel for his help on this one!.


The Output

Here it goes:

defntypeenviron.png

kan
  • 4,545
  • @conorsomahony Glad to have helped! If this answer is what you were looking for, could you please accept this by clicking on the tick mark besides this answer? :) – kan May 09 '13 at 15:31
  • I just noticed one small issue, the alph part of the counter doesn't get reset, so If I add another definitionAlt after Definition 1.2 - then this gets the number 1.2c, instead of 1.2a again... – conorsomahony May 09 '13 at 15:35
  • @conorsomahony Oh, good catch, I'll update my answer, just a few moments please... :) – kan May 09 '13 at 15:37
  • 1
    @conorsomahony See my update. :) – kan May 09 '13 at 16:14
  • @kan -- er, you want to repair the text for def. 1.2a -- it now purportedly refers to itself. (i don't want to make the change, since i would undoubtedly bollix up the output.) – barbara beeton May 09 '13 at 16:33
  • @kan thanks very much, exactly what i was looking for, very elegant answer! – conorsomahony May 09 '13 at 16:33
  • @barbarabeeton not sure I follow what I must fix... could you please edit it so that, I can compile the code and fix the picture. Thanks! – kan May 18 '13 at 16:42
  • @kan -- the "which" in definition 1.2a has "the preceding one" as its antecedent, and the preceding one is numbered 1.2. what i think you mean is "This definition, which is automatically numbered 1.2a, is an alternative to the preceding one." (i didn't want to make the change unless i was absolutely certain what you meant.) – barbara beeton May 18 '13 at 16:49
  • @barbarabeeton oooh! Will fix! :-) – kan May 18 '13 at 16:50