3

Pursuant to the answer to my question at An error I get trying to number tables consecutively with theorems, I can number tables and theorems consecutively without anything breaking. I would like to also have a thm environment, functionally the same as theorem but easier to type, which is also numbered the same way tables are. Here is a MWE:

\documentclass{article}
\usepackage{amsthm,thmtools}
\newtheorem{thm}[table]{Theorem}
\begin{document}
\begin{thm}
\end{thm}
\end{document}

Running this code tells me that thm is already defined, but on the other hand, if I excise the \newtheorem line, I'm instead warned that thm is not defined. It seems like I just can't win. What to do?

P.S.: The code compiles and complies without complaint if I remove the thmtools package; however, I do need thmtools for my real document.

jdc
  • 1,245
  • why not just name your new theorem type something else: \newtheorem{tbthm}[table]{Theorem}? that's why differently named theorem environments are permitted, even encouraged. – barbara beeton Mar 08 '15 at 14:04
  • @barbarabeeton: I'm not sure I understand the question; I did it because I didn't want there to be any theorem type that wasn't enumerated sequentially with tables. It seems a bit clunky to make every theorem technically of the table type, if that's what's going on, but that was the suggestion I got, and I'm (obviously) not that good at TeX, so ... – jdc Mar 08 '15 at 22:50
  • since thm is already defined, and defining theorems isn't done with \newcommand or \newenvironment, you really do need to give it a different name. that is what @yo' has done. then \let lets you use the same name without technical conflict; just be sure that you never want to use the original meaning again, and also observe that, since thm is an environment, both the beginning and end must be taken care of. – barbara beeton Mar 09 '15 at 12:29

2 Answers2

4

I'm not sure what is the purpose of having Theorems use the table counter, but that's not my business. The work around this is to define another environment and then "map it":

\documentclass{article}

\usepackage{amsthm,thmtools}

\newtheorem{abcthm}[table]{Theorem}
\let\thm\abcthm
\let\endthm\endabcthm

\begin{document}

\begin{thm}
\end{thm}

\end{document}
yo'
  • 51,322
  • It's the way I was taught to make tables and theorems be numbered consecutively. Thanks for this workaround. I should apparently learn a bit more about \let. It seems very useful for fixing this kind of problem. – jdc Mar 08 '15 at 01:58
3

You need to conform to the usage/interface provided by thmtools. Instead of \newtheorem you need to use \declaretheorem[<opts>]{<theorem>}:

\documentclass{article}
\usepackage{amsthm,thmtools}
\declaretheorem[name=Theorem]{thm}
\begin{document}
\begin{thm}
\end{thm}
\end{document}

If you must, you can use the following interface:

\usepackage{amsthm}
\newtheorem{thm}{Theorem}
\usepackage{thmtools}
Werner
  • 603,163
  • Oh dear. I actually don't seem to have any \declaretheorems remaining. Maybe I'm not using thmtools for anything after all anymore. Hmm... – jdc Mar 08 '15 at 02:05