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.
There are two primary modes in which LATEX is written: text mode, and math mode. Text mode is used for text; write as you would in any word processor. Anything mathematical should be written in math mode. A dollar sign ($) is used to transition between the two modes.
US Dollar : The symbol $ is reserved by LATEX for use in maths mode expres- sions. However, you can introduce this symbol in your text, by using < to unreserve the symbol. Thus, you do \$ 5432 to get $ 5432.
In the latter two TeX versions, a double dollar sign ($$) is used to indicate the beginning and end of display math mode. While the double dollar sign (still) works in LaTeX, it is not part of the "official" LaTeX command set (in fact, most books on LaTeX don't even mention it) and its use is discouraged.
In markdown editors such as GitHub , or Jupyter notebook , with MathJax available, you can use double backslash and a dollar sign together to show any amount or range of amount in the dollar. Note that, in StackExchange or any StackOverflow related site, a single backslash is enough.
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 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)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With