问题
Is there any reason to prefer the syntax \(myformula\) to the usual $myformula$ in LaTeX?
Edit: The same question was asked, and answered, on tex.stackexchange.
回答1:
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 $$...$$.
回答2:
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)
回答3:
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
回答4:
Only 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.
回答5:
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.
来源:https://stackoverflow.com/questions/2251417/latex-dollar-sign-vs