9

Is there an reason/advantage for writing the integration (and other argumentless commands) as: \int{xdx} instead of \int xdx? I can see the first one gives a more comprehensible code, but are there any other reasons?

jak123
  • 4,252
  • 5
  • 26
  • 49
  • 1
    \int is a macro without argument, so \int{xdx} is ... wrong, somehow. You might define a wrapper command which does typeset the differential together with the integral sign automatically –  May 11 '15 at 12:33
  • BTW, I'm asking because TeXneCenter autocompletes it as \int{}. – jak123 May 11 '15 at 12:34
  • 1
    I don't have this editor to test, but after it completes, where is the cursor? If the cursor is inside the braces, for sure it has a problem. But if the cursor is after the brace, then I guess that this is a different way to allow you to type in the sequel any other letter. For example, if you press f after it completes, you could have an error if the result is \intf. But no error if the result is \int{}f. So, after asking to auto-complete, you don't need to worry to press space. – Sigur May 11 '15 at 12:52
  • Inside the braces. – jak123 May 11 '15 at 12:53

1 Answers1

14

The braces are incorrect in general.

\int does not take an argument so the braces form a group,

{xdx} (or many would prefer {x\mathrm{d}x}) is therefore a single atom in the mathlist of type \mathord. In the case of xdx the spacing will not be affected but for example {x+1} differs from x+1 in that the spacing around the + is frozen at its natural size, and linebreaking is suppressed. Probably you don't have integrals in inline math so this probably doesn't matter, but if the editor is routinely adding unneeded {} into math mode, it isn't really helping.

David Carlisle
  • 757,742