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: 
I use the following newcommands:

```
\newcommand{\of}[1]{\left(#1\right)}
\newcommand{\off}[1]{\left[#1\right]}
\newcommand{\offf}[1]{\left\{#1\right\}}

```

Hence, in the text, `f\of{x}` will appear as `f(x)`, `M\ast\offf{g\off{x}+h\off{x}}` will appear as `M*{g[x]+h[x]}`, etc. with the `\left` and `\right` commands automatically built-in.
There is another possibility to do it, if the automatic size should be the default ([as here](https://tex.stackexchange.com/questions/23178/swap-definition-of-starred-and-non-starred-command)) and explicit sizes should be easier to remember (numbers 0 till 4 instead of exotic names)

```
\documentclass{article}

\usepackage{amsmath}

% Enable the new LaTeX 3 commands.
\usepackage{xparse}

% Provide the \alias command substituting the \let command by working with optional arguments.
\usepackage{letltxmacro}
\LetLtxMacro{\alias}{\LetLtxMacro}

% Define a clear and useful programming interface. You should define \new, \renew and \provide similarly and use the correct one below.
\alias{\declare}{\DeclareDocumentCommand}

% Fix the spacing around \left and \right: https://tex.stackexchange.com/questions/2607/spacing-around-left-and-right
\alias{\leftOld}{\left}
\alias{\rightOld}{\right}
\declare{\left}{}{\mathopen{}\mathclose\bgroup\leftOld}
\declare{\right}{}{\aftergroup\egroup\rightOld}

% Usage: \newdelimited{functionName}{left delimiter}{right delimiter}
% Example: \newdelimited{parens}{(}{)}
%
% Usage of inner command: \functionName[explicit size]{delimited content}
% An auto sized delimiter is used, if no explicit size is given. Explicit sizes range from 0 (small) to 4 (huge)
% Examples: \parens{x}, \parens{\frac{x}{y}}, \parens[3]{x}, \parens[0]{\frac{x}{y}}
%
\declare{\newdelimited}{mmm}{%
    \declare{#1}{om}{%
        \IfNoValueTF{##1}{%
            \left#2 ##2 \right#3%
        }{%
            % Use the amsmath delimiter sizes to have proper scaling all the time.
            \ifcase##1\relax%
                #2 ##2 #3%
            \or \bigl#2 ##2 \bigr#3%
            \or \Bigl#2 ##2 \Bigr#3%
            \or \biggl#2 ##2 \biggr#3%
            \or \Biggl#2 ##2 \Biggr#3%
            \else \PackageError{newdelimited}{Only optional values 0, 1, 2, 3 and 4 are supported.}%
            \fi%
        }%
    }%
}

\begin{document}
    \newdelimited{\parens}{(}{)}
    $\parens{x}, \parens{\frac{M}{W}}, \parens[3]{x}, \parens[0]{\frac{M}{W}}$
\end{document}

```

The result looks like this:  

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