Question: Is it possible to automatically "add" `\left` and `\right` commands in front of all brackets? The source code should be left intact, but LaTeX should interpret every pair of brackets as if they were preceded by such commands. This is because adding `\left` and `\right` commands is time consuming and makes source code longer and less readable. I considered defining new commands such as `\lb` and `\rb` for `\left(` and `\right)`, but it doesn't seem very elegant to me: what if I also want to add square brackets for example?

Any ideas? Thanks.

Answer: 
The `\DeclarePairedDelimiter` command from [mathtools](http://www.ctan.org/pkg/mathtools) is useful. For example defining an absolute value macro;

```
\DeclarePairedDelimiter\abs{\lvert}{\rvert}

```

gives also a starred version with `\left` and `\right`

```
\abs*{\frac{a}{b}}

```

and the unstarred version takes an optional argument that can be `\big`, `\Big`, etc

```
\abs[\Bigg]{\frac{a}{b}}

```
To make auto-sized bracketing as painless and concise as possible, here's what I do:

```
\usepackage{mathtools} 

\DeclarePairedDelimiter\autobracket{(}{)}
\newcommand{\br}[1]{\autobracket*{#1}}

```

Example:

```
$$\br{\frac{1}{2}} + \br{1} - \br{\frac{\int_0^{2\pi} f(x)}{\sqrt[2]{\frac{1}{2}}}}$$

```

[![enter image description here](https://i.stack.imgur.com/z7LEa.png)](https://i.stack.imgur.com/z7LEa.png)