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?
Asked
Active
Viewed 566 times
9
jak123
- 4,252
- 5
- 26
- 49
1 Answers
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
\intis 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\int{}. – jak123 May 11 '15 at 12:34fafter 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 pressspace. – Sigur May 11 '15 at 12:52