TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

From the answer to my other question " define something like \lim but for another name", I tried:

\def\ext{\qopname\relax m{ext}}


\newcommand{\ext}{\qopname\relax m{ext}}

In " What is the difference between \def and \newcommand?", it is said that they are basically the same and \newcommand is a bit more clever and does some extra checks. But it suggests that they should behave in just the same way.

But actually they do not. For the \def case, it seems to add extra spacing around \ext when I use it (just like \lim would). And \newcommand does not.

Why? What exactly is the different behavior for those more generally?

share|improve this question

closed as not a real question by Martin Scharrer Mar 16 '11 at 14:07

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

They should behave the same way. Note that \def is more like \newcommand*. For the same behavior of \newcommand you would need \long\def, but this does only matter if you define macros with arguments. Could you add a minimal example that shows the space you mention. – Martin Scharrer Mar 16 '11 at 10:18
Can you post a screenshot? I just tried it, and I thought I could see the difference on one test but when I zoomed in then it disappeared. – Loop Space Mar 16 '11 at 10:22
I think in general normal users should stay way from \def as it overwrites existing macros without question. Usually one should only overwrite a macro if on know what it does and one is certain it will be OK to overwrite it. The classical example is of course \span – daleif Mar 16 '11 at 10:27
@Martin: Hm, I just tried. But I don't seem to be able to reproduce this. Maybe it was something different and lead me to this wrong conclusion. – Albert Mar 16 '11 at 10:36
@Martin: I don't really want to delete it in the case that I stumble again upon it and when I am able to reproduce it. I would close it for now and reopen it later then. But I don't know how to do that. Maybe I lack enough reputation. – Albert Mar 16 '11 at 14:06

Browse other questions tagged or ask your own question.