Are \( and \) preferable to dollar signs for math mode?

\( ... \) is LaTeX syntax. $ ... $ is TeX syntax.

plainTeX only allows $. In LaTeX you can use both, but \( ... \) will give less obscure error messages when there is a mistake inside it.

Both are shortcuts to start inline math environments.


Anyone who's ever tried writing a simple perl (or whatever) script to quickly parse a LaTeX document and do something in maths mode but not in text mode will agree that \( .. \) is the only way to go! Trying to get the pattern matching right against $a^2 + b^2$$c^2 + d^2$ is a nightmare.

(Before anyone asks, yes I have, and it's called mathgrep. The pain and agony of writing that convinced me more than anything else of the value of making everything a configurable macro so it can be easily changed later.)


Another reason: looking at the code, \( and \) actually checks that TeX is in the right mode before starting. So hello \(world \(can\) we\) have some tea? will produce an error, whereas hello $world $can$ we$ have some tea? will not.


Interestingly, nobody mentioned that the mathtools package has a very nice feature of adding italic correction in some places at the boundary between text and math mode (see its documentation for details, but aesthetically this really matters!), and this feature works only with \(...\).