Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LaTeX: dollar sign vs \( \)

Tags:

syntax

latex

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.

like image 459
Olivier Verdier Avatar asked Feb 12 '10 11:02

Olivier Verdier


People also ask

What does the dollar sign do in LaTeX?

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.

How do you do a dollar sign in LaTeX?

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.

What is Double Dollar in LaTeX?

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.

How do I add a dollar sign in markdown?

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.


3 Answers

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 $$...$$.

like image 119
Will Robertson Avatar answered Sep 27 '22 20:09

Will Robertson


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)

like image 24
Mathias Soeken Avatar answered Sep 27 '22 21:09

Mathias Soeken


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.

like image 37
Andrew McGregor Avatar answered Sep 27 '22 20:09

Andrew McGregor