The following is a piece of the code I am working on. It says that there is an error with \newtheorem{def} but I really don't understand why. Thank you very much for your help!

\usepackage[margin=1in]{geometry}  % set the margins to 1in on all sides
\usepackage{graphicx}              % to include figures
\usepackage{amsmath}               % great math stuff
\usepackage{amsfonts}              % for blackboard bold, etc
\usepackage{amsthm}                % better theorem environments



It throws an error even if I do not include "\begin{def}, \end{def}" in my code.

  • 3
    maybe this has to do with the fact that \def is a TeX primitive and \begin{def} implies the definition of corresponding \def and \enddef macros, with an obvious conflict
    – Bordaigorl
    Nov 30, 2014 at 20:44
  • 2
    the solution here is just to use a different shortcut such as defn or Def
    – Bordaigorl
    Nov 30, 2014 at 20:44
  • that works, thanks a lot for your help! :) what a noobish question I asked ahahah
    – Giovanni
    Nov 30, 2014 at 20:47
  • it's not noobish, it's never so obvious what happens with macro definitions without digging in the internals of LaTeX a bit...
    – Bordaigorl
    Nov 30, 2014 at 20:49

1 Answer 1


The error message you're getting should tell you all you need to know:

LaTeX Error: Command \def already defined.

What's going on? You're trying to set up a new (theorem-like) environment called def. In practice, this means that LaTeX tries to set up an instruction called \def to deal with the instruction \begin{def}. (LateX also sets up a macro \enddef.) Can you spot the problem?

  • I do! thank you too for the prompt reply, I really appreciate!
    – Giovanni
    Nov 30, 2014 at 20:48
  • @user01123581321345589144... - the fix is simple, as Bordaigorl has pointed out, is simple: call the environment defn, or definition, or even Def (though the latter is inviting lots of confusion, I suspect).
    – Mico
    Nov 30, 2014 at 20:51
  • 1
    @user01123581321345589144... I add a recommendation: when you see a message such as Command \foo already defined, take it seriously and don't try overriding the definition unless you know precisely what you're doing. Redefining \def, for instance, would be disastrous; if you want to have fun, add \let\def\relax just before \newtheorem{def}{Definition} and see what happens. ;-) That error message isn't issued, but… :-D
    – egreg
    Nov 30, 2014 at 21:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .