TeXblog

 Typography with TeX and LaTeX

Inline math: $…$ vs. \(…\)

3 April 2009 by Stefan Kottwitz

l2tabu, a text informing about obsolete packages and commands, recommends to replace $$…$$ by \[…\], but it doesn’t say a word about the difference between $…$ and \(…\). “Mathmode” by H. Voss does tell something, but it says in v2.40: “In general $…$ is the best choice”. I doubt it, and when I mentioned here some thoughts about that, the author noticed it without much comment. Because of a question on Matheboard today I’ve listed some reasons why I’m preferring the \(…\) environment:

  • With \(…\) you can easily distinguish opening and closing of the math mode, in contrary to $…$, mistakes in code could be harder to find with $.
  • LaTeX does additional error checks in \(…\), whereas $…$ is plain TeX and is used internally by \(…\).
  • \(…\) is working inside alltt-environments, $…$ is causing errors.
  • Both \( and \) could be redefined or extended easily.
  • Though \( and \) are not robust, possibly causing problems in sectioning for instance, that could be fixed by just loading the fixltx2e package.

In general I recommend to use LaTeX macros instead of corresponding plain TeX commands.

This entry was posted on 3 April 2009 at 7:37 PM and is filed under LaTeX General, Mathematics. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply