# Equation: Using \left brackets inserts unwanted space [duplicate]

Possible Duplicate:
Spacing around \left and \right

I'm having some problems with writing down an equation in LaTeX. It's only a minor issue regarding appearance, but I'm kind of a perfectionist. And isn't that why we use LaTeX anyway?

Consider the following equation:

$$f(x)=\exp[-\frac{x}{2}]$$


The brackets following the exponential indicator \exp are closely placed next to "exp", clearly indicating that it's the variables for the exponential function. However, since the argument of the exponential function contains a fraction, it's appropriate to resize the brackets. So I let the brackets be resized automatically according to:

$$f(x)=\exp\left[-\frac{x}{2}\right]$$


Indeed, the brackets are now automatically appropriately sized. However, for some reason, extra white space appears between "exp" and the first "[" bracket. It now looks like the function "exp" and the term in brackets are two independent components.

I haven't found a way to solve this issue. I'm quite surprised that a system like LaTeX, known for its excellent equation capabilities, exhibits this behavior.

-

## marked as duplicate by Peter Grill, qubyte, Werner, Stefan Kottwitz♦Jan 12 '12 at 8:12

Possible duplicate: Spacing around \left and \right. Please see whether this modification (as a general solution) solves your problem and report back via adding a comment. There are other on-the-fly alternatives, like using \! on the outside which inserts a negative \thinspace to reduce the white space left by the \left and \right delimiter pair. –  Werner Jan 12 '12 at 0:11

Here are some of the possibilities, using the proposed solution of Spacing around \left and \right and adding \! (a negative \thinspace):

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align*}
f(x) &= \exp[-\tfrac{x}{2}] \\
f(x) &= \exp\left[-\frac{x}{2}\right] \\
f(x) &= \exp\!\left[-\frac{x}{2}\right]
\end{align*}

% http://tex.stackexchange.com/questions/2607/spacing-around-left-and-right
\let\originalleft\left
\let\originalright\right
\renewcommand{\left}{\mathopen{}\mathclose\bgroup\originalleft}
\renewcommand{\right}{\aftergroup\egroup\originalright}

\begin{align*}
f(x) &= \exp[-\tfrac{x}{2}] \\
f(x) &= \exp\left[-\frac{x}{2}\right] \\
f(x) &= \exp\!\left[-\frac{x}{2}\right]
\end{align*}
\end{document}


In both examples, the first equation represents the regular delimiters, second show the traditional \left and \right pair, while the third shows the addition of a negative \thinspace using \!.

-

if you want the same spacing use

$$f(x)=\exp\kern\nulldelimiterspace[-\dfrac{x}{2}]$$

-
The space between \exp and \left[ is not \nulldelimiterspace but a thin space because \exp is \mathop and \left is \mathinner. –  Philippe Goutet Jan 12 '12 at 8:24
I didn't said that! I said that that helps in this case .. –  Herbert Jan 12 '12 at 8:25
What you said is "if you want the same spacing", which is not what \nulldelimiterspace will give (with the standard value, it will be close, but as both \nulldelimiterspace and the thin space can be changed, there's no guarantee on that always being true). –  Philippe Goutet Jan 12 '12 at 11:17
everything can be changed ... ;-) –  Herbert Jan 12 '12 at 11:47
... but some things remain equal. Loading some math font packages (like fourier) will change the thin space. It's rarer, but some commands do set \nulldelimiterspace to 0pt in their argument (the only example I know is mathtool's \cramped). –  Philippe Goutet Jan 12 '12 at 13:54