Is there any reason to prefer the syntax \(myformula\)
to the usual $myformula$
in LaTeX?
views:
434answers:
5Only that some editors can't balance $ signs, where they can balance the brackets in the \(\)
form. If you have a good editor (and with emacs and auctex mode out there, who doesn't?), then it's not an issue.
I use $formula$
and $$formula$$
. But sometimes you need to catch the end of the math mode. The thing is that you can catch the begin of the math mode using \everymath
or \everydisplay
:
\everymath{\color{red}}
Unfortunately you can not catch end of the math mode. But if you use \(
and \)
you can redefine \)
:
\let\endmath\)% Save \)
\def\){\preendmath \endmath \postendmath}% Override
\def\preendmath{\,(*)}% For example
\def\postendmath{}% Any stuff
I read in [1] (German text), that the use of $$ ... $$
leads to inconsistencies in vertical spaces before and after the formula, which shouldn't happen with [ ... ]
.
[1] ftp://ftp.dante.de/tex-archive/info/l2tabu/german/l2tabu.pdf (Section 1.6)
LaTeX can catch nesting errors with \(
...\)
but in practise there's no real advantage to using them over $
...$
. If you do use \(
...\)
, then make sure to load the fixltx2e
package to make them robust (i.e., e.g., usable in captions and section headings).
As others have said, on the other hand, \[
...\]
should be used instead of $$
...$$
.
I believe that $...$
is not technically standard LaTeX, but that \(
is. Since all latex compilers make use of the underlying TeX engine, this is never an issue, but from a pendant's perspective, there is that difference.